From 026df47b324c94e98f094003590d5c6985020614 Mon Sep 17 00:00:00 2001 From: Wim Henderickx Date: Sat, 18 May 2024 18:35:22 +0200 Subject: [PATCH] added interface to infra objects --- .../infra/v1alpha1/endpoint_interface.go | 242 +++++++++++++++++ apis/backend/infra/v1alpha1/generated.pb.go | 257 +++++++++--------- apis/backend/infra/v1alpha1/id.go | 2 +- apis/backend/infra/v1alpha1/link_interface.go | 223 +++++++++++++++ apis/backend/infra/v1alpha1/node_interface.go | 233 ++++++++++++++++ .../infra/v1alpha1/region_interface.go | 209 ++++++++++++++ apis/backend/infra/v1alpha1/site_interface.go | 215 +++++++++++++++ .../infra/v1alpha1/zz_generated.deepcopy.go | 31 +-- .../generated/openapi/zz_generated.openapi.go | 33 ++- go.mod | 10 +- go.sum | 12 +- tools/apiserver-runtime-gen/main.go | 20 +- 12 files changed, 1305 insertions(+), 182 deletions(-) create mode 100644 apis/backend/infra/v1alpha1/endpoint_interface.go create mode 100644 apis/backend/infra/v1alpha1/link_interface.go create mode 100644 apis/backend/infra/v1alpha1/node_interface.go create mode 100644 apis/backend/infra/v1alpha1/region_interface.go create mode 100644 apis/backend/infra/v1alpha1/site_interface.go diff --git a/apis/backend/infra/v1alpha1/endpoint_interface.go b/apis/backend/infra/v1alpha1/endpoint_interface.go new file mode 100644 index 0000000..65e4bc9 --- /dev/null +++ b/apis/backend/infra/v1alpha1/endpoint_interface.go @@ -0,0 +1,242 @@ +/* +Copyright 2024 Nokia. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + "crypto/sha1" + "encoding/json" + "fmt" + + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-store/pkg/generic/registry" + "github.com/henderiw/store" + "github.com/kuidio/kuid/apis/backend" + commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" + conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/validation/field" +) + +const EndpointPlural = "endpoints" +const EndpointSingular = "endpoint" + +// +k8s:deepcopy-gen=false +var _ resource.Object = &Endpoint{} +var _ resource.ObjectList = &EndpointList{} + +// GetListMeta returns the ListMeta +func (r *EndpointList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +func (r *Endpoint) GetSingularName() string { + return EndpointSingular +} + +func (Endpoint) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: EndpointPlural, + } +} + +// IsStorageVersion returns true -- v1alpha1.Config is used as the internal version. +// IsStorageVersion implements resource.Object. +func (Endpoint) IsStorageVersion() bool { + return true +} + +// GetObjectMeta implements resource.Object +func (r *Endpoint) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object. +func (Endpoint) NamespaceScoped() bool { + return true +} + +// New implements resource.Object +func (Endpoint) New() runtime.Object { + return &Endpoint{} +} + +// NewList implements resource.Object +func (Endpoint) NewList() runtime.Object { + return &EndpointList{} +} + +// GetCondition returns the condition based on the condition kind +func (r *Endpoint) GetCondition(t conditionv1alpha1.ConditionType) conditionv1alpha1.Condition { + return r.Status.GetCondition(t) +} + +// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions +// to be set at once +func (r *Endpoint) SetConditions(c ...conditionv1alpha1.Condition) { + r.Status.SetConditions(c...) +} + +// EndpointConvertFieldSelector is the schema conversion function for normalizing the FieldSelector for Endpoint +func EndpointConvertFieldSelector(label, value string) (internalLabel, internalValue string, err error) { + switch label { + case "metadata.name": + return label, value, nil + case "metadata.namespace": + return label, value, nil + default: + return "", "", fmt.Errorf("%q is not a known field selector", label) + } +} + +func (r *EndpointList) GetItems() []backend.Object { + objs := []backend.Object{} + for _, r := range r.Items { + r := r + objs = append(objs, &r) + } + return objs +} + +func (r *Endpoint) CalculateHash() ([sha1.Size]byte, error) { + // Convert the struct to JSON + jsonData, err := json.Marshal(r) + if err != nil { + return [sha1.Size]byte{}, err + } + + // Calculate SHA-1 hash + return sha1.Sum(jsonData), nil +} + +func (r *Endpoint) GetNamespacedName() types.NamespacedName { + return types.NamespacedName{ + Namespace: r.GetNamespace(), + Name: r.GetName(), + } +} + +func (r *Endpoint) GetKey() store.Key { + return store.KeyFromNSN(r.GetNamespacedName()) +} + +func (r *Endpoint) GetRegion() string { + return r.Spec.Region +} + +func (r *Endpoint) GetSite() string { + return r.Spec.Site +} + +func (r *Endpoint) GetNodeGroupID() NodeGroupID { + return NodeGroupID{ + SiteID: r.Spec.SiteID, + NodeGroup: r.Spec.NodeGroup, + } +} + +func (r *Endpoint) GetNodeID() NodeID { + return NodeID{ + Node: r.Spec.Node, + NodeGroupID: r.GetNodeGroupID(), + } +} + +func (r *Endpoint) GetEndpointID() EndpointID { + return EndpointID{ + NodeID: r.GetNodeID(), + Endpoint: r.Name, + } +} + +func (r *Endpoint) GetOwnerReference() *commonv1alpha1.OwnerReference { + return &commonv1alpha1.OwnerReference{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Kind: EndpointKind, + Namespace: r.Namespace, + Name: r.Name, + } +} + +func (r *Endpoint) ValidateSyntax() field.ErrorList { + var allErrs field.ErrorList + + /* + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.type"), + r, + fmt.Errorf("invalid GENID Type %s", r.Spec.Type).Error(), + )) + } + */ + return allErrs +} + +// BuildEndpoint returns a reource from a client Object a Spec/Status +func BuildEndpoint(meta metav1.ObjectMeta, spec *EndpointSpec, status *EndpointStatus) *Endpoint { + aspec := EndpointSpec{} + if spec != nil { + aspec = *spec + } + astatus := EndpointStatus{} + if status != nil { + astatus = *status + } + return &Endpoint{ + TypeMeta: metav1.TypeMeta{ + APIVersion: SchemeGroupVersion.Identifier(), + Kind: EndpointKind, + }, + ObjectMeta: meta, + Spec: aspec, + Status: astatus, + } +} + +func EndpointTableConvertor(gr schema.GroupResource) registry.TableConvertor { + return registry.TableConvertor{ + Resource: gr, + Cells: func(obj runtime.Object) []interface{} { + r, ok := obj.(*Endpoint) + if !ok { + return nil + } + return []interface{}{ + r.GetName(), + r.GetCondition(conditionv1alpha1.ConditionTypeReady).Status, + r.Spec.Region, + r.Spec.Site, + r.Spec.NodeGroup, + r.Spec.Node, + } + }, + Columns: []metav1.TableColumnDefinition{ + {Name: "Name", Type: "string"}, + {Name: "Ready", Type: "string"}, + {Name: "Region", Type: "string"}, + {Name: "Site", Type: "string"}, + {Name: "Topology", Type: "string"}, + {Name: "Node", Type: "string"}, + }, + } +} diff --git a/apis/backend/infra/v1alpha1/generated.pb.go b/apis/backend/infra/v1alpha1/generated.pb.go index 4b14f3c..a5e1ee6 100644 --- a/apis/backend/infra/v1alpha1/generated.pb.go +++ b/apis/backend/infra/v1alpha1/generated.pb.go @@ -1818,123 +1818,123 @@ func init() { } var fileDescriptor_4799f6fc4127511d = []byte{ - // 1856 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x5b, 0xcd, 0x6b, 0x1b, 0x47, - 0x1b, 0xf7, 0xac, 0x64, 0x45, 0x7a, 0x6c, 0x27, 0xaf, 0xf7, 0xbd, 0x38, 0x21, 0xc8, 0x46, 0x2f, - 0x04, 0xc3, 0xdb, 0xae, 0x1a, 0x53, 0x4a, 0x48, 0xd2, 0x7c, 0xac, 0x1d, 0x5a, 0x83,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0x10, 0x1e, 0x14, 0x5b, 0xfa, 0x5e, 0x82, 0xfc, 0x05, 0x53, 0x6f, 0x5b, 0x86, 0xe9, 0xc4, - 0x80, 0x01, 0x95, 0x10, 0x06, 0x9c, 0x1b, 0x67, 0xee, 0x5d, 0x6d, 0x23, 0x41, 0xe0, 0x4a, 0x1f, - 0x08, 0xa8, 0x13, 0x49, 0x19, 0x8e, 0x02, 0x37, 0x11, 0x80, 0x4b, 0xba, 0xb9, 0x21, 0x57, 0x20, - 0x67, 0x5a, 0x3a, 0xd9, 0xdc, 0x58, 0xca, 0x31, 0xd1, 0x27, 0xc7, 0x11, 0x7d, 0x89, 0x71, 0xf0, - 0x45, 0xf2, 0x36, 0x16, 0x9c, 0xe9, 0x82, 0x23, 0x42, 0xe2, 0xd2, 0x6c, 0x78, 0xc1, 0xb9, 0x9a, - 0x60, 0x8f, 0xa2, 0x74, 0x1f, 0xc1, 0xbc, 0xdb, 0x1d, 0x03, 0x4e, 0x69, 0x61, 0x9c, 0x3a, 0x3d, - 0x89, 0xeb, 0x23, 0x80, 0xea, 0x27, 0x09, 0xe6, 0xbc, 0xd9, 0x21, 0x71, 0x04, 0x2d, 0x09, 0x05, - 0xed, 0xfa, 0x44, 0xe1, 0x44, 0xa2, 0xe3, 0xb6, 0xd5, 0x17, 0xb7, 0x17, 0x26, 0x15, 0x34, 0x3c, - 0x74, 0x1f, 0x22, 0x38, 0x14, 0xa0, 0x8e, 0x21, 0x38, 0xf4, 0x70, 0x70, 0x9c, 0x9d, 0xd0, 0xbe, - 0x88, 0xf8, 0xf8, 0x4a, 0x0a, 0xd9, 0xc5, 0x92, 0x59, 0x03, 0x0a, 0xee, 0x8a, 0xa0, 0x48, 0x9b, - 0x19, 0x99, 0x05, 0x46, 0x48, 0xdf, 0xdc, 0x50, 0x17, 0x7a, 0x7b, 0xcb, 0x05, 0xb7, 0x6d, 0x63, - 0x9f, 0xbf, 0x7c, 0x14, 0xb2, 0x4d, 0xad, 0xda, 0x66, 0x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 0x9d, 0x54, 0x46, 0x98, 0x92, 0xeb, 0x09, 0xae, 0x6c, 0x04, - 0xa4, 0x7c, 0xee, 0x59, 0x93, 0xb0, 0x0a, 0xd7, 0x75, 0x04, 0xf3, 0xc1, 0xf9, 0x48, 0x5e, 0x1a, - 0xa6, 0x58, 0x99, 0x8e, 0x34, 0x4c, 0x35, 0x9d, 0x6e, 0x1a, 0x66, 0x12, 0x86, 0xaf, 0x9b, 0x4b, - 0x20, 0xb2, 0x8b, 0x5c, 0x82, 0x5c, 0x87, 0xcd, 0xac, 0x78, 0x53, 0xc1, 0xde, 0x96, 0xf2, 0xb9, - 0xc6, 0x62, 0x44, 0x5e, 0x81, 0x2c, 0xcd, 0x41, 0x62, 0xaf, 0xeb, 0xeb, 0x6d, 0x38, 0x04, 0xb3, - 0x11, 0x96, 0xd6, 0x69, 0x33, 0x25, 0x69, 0x9d, 0xaa, 0x1a, 0xb1, 0x06, 0xbf, 0x94, 0xb8, 0x25, - 0xee, 0x0f, 0x96, 0x42, 0xce, 0xf1, 0xdc, 0xd9, 0xe7, 0xa0, 0xb8, 0x52, 0x73, 0x72, 0xee, 0x06, - 0x69, 0x36, 0xf5, 0xe3, 0x2c, 0x51, 0x78, 0xa0, 0xbe, 0x71, 0xf7, 0x71, 0x71, 0xe6, 0xc1, 0xe3, - 0xe2, 0xcc, 0xa3, 0xc7, 0xc5, 0x99, 0x0f, 0x7a, 0x45, 0x74, 0xb7, 0x57, 0x44, 0x0f, 0x7a, 0x45, - 0xf4, 0xa8, 0x57, 0x44, 0xbf, 0xf5, 0x8a, 0xe8, 0xb3, 0xdf, 0x8b, 0x33, 0x6f, 0xae, 0x3d, 0xfd, - 0x4f, 0x47, 0xff, 0x0a, 0x00, 0x00, 0xff, 0xff, 0x7a, 0x36, 0x8c, 0xaf, 0x6f, 0x3a, 0x00, 0x00, + // 1847 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 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 0x60, 0x0a, 0x0f, 0xca, + 0x2c, 0x7d, 0x89, 0x60, 0x21, 0x94, 0x51, 0xf2, 0x67, 0x08, 0x16, 0x3d, 0x28, 0x20, 0x3a, 0x1f, + 0x15, 0x39, 0x73, 0x7e, 0x84, 0x6e, 0xe2, 0xad, 0x40, 0x50, 0xfb, 0x19, 0xf9, 0xea, 0x0d, 0x4c, + 0xe1, 0x41, 0xb1, 0xa5, 0x1f, 0x24, 0xc8, 0x5f, 0x30, 0xf5, 0xb6, 0x65, 0x98, 0x4e, 0x0c, 0x18, + 0x50, 0x09, 0x61, 0xc0, 0xb9, 0x71, 0x62, 0xef, 0x6a, 0x1b, 0x09, 0x02, 0x97, 0xfb, 0x40, 0x40, + 0x9d, 0x48, 0xca, 0x70, 0x14, 0xb8, 0x81, 0x00, 0x5c, 0xd2, 0xcd, 0x0d, 0xb9, 0x02, 0x39, 0xd3, + 0xd2, 0xc9, 0xe6, 0xc6, 0x52, 0x8e, 0x89, 0x3e, 0x39, 0x8e, 0xe8, 0x57, 0x18, 0x07, 0x5f, 0x24, + 0x7f, 0xc6, 0x82, 0x33, 0x5d, 0x70, 0x44, 0x48, 0x5c, 0x9a, 0x0d, 0x2f, 0x38, 0x57, 0x13, 0xec, + 0x51, 0x94, 0xee, 0x21, 0x98, 0x77, 0x87, 0x63, 0xc0, 0x29, 0x2d, 0x8c, 0x53, 0xa7, 0x27, 0x71, + 0x7d, 0x04, 0x50, 0xfd, 0x2c, 0xc1, 0x9c, 0x17, 0x1d, 0x12, 0x47, 0xd2, 0x92, 0x50, 0xd2, 0xae, + 0x4f, 0x94, 0x4e, 0x24, 0x3a, 0x6f, 0x5b, 0x7d, 0x79, 0x7b, 0x61, 0x52, 0x41, 0xc3, 0x53, 0xf7, + 0x01, 0x82, 0x43, 0x01, 0xea, 0x18, 0x92, 0x43, 0x0f, 0x27, 0xc7, 0xd9, 0x09, 0xed, 0x8b, 0xc8, + 0x8f, 0xaf, 0xa5, 0x90, 0x5d, 0x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xd9, 0x7d, 0x02, 0x12, 0x3f, 0x41, 0x93, 0x05, 0x24, 0xb7, + 0x24, 0xc8, 0x61, 0x52, 0xa3, 0xde, 0x4f, 0xc5, 0x1d, 0x24, 0xd7, 0x75, 0xba, 0x77, 0x90, 0x42, + 0xc6, 0x70, 0x38, 0xb9, 0x4b, 0x83, 0xca, 0x08, 0x53, 0x72, 0x3d, 0xc1, 0x95, 0x8d, 0x80, 0x94, + 0x2f, 0x3c, 0x6b, 0x12, 0xd6, 0xe1, 0xba, 0x86, 0x60, 0x3e, 0x18, 0x8f, 0xe4, 0x95, 0x61, 0x8a, + 0x95, 0xe9, 0x28, 0xc3, 0x54, 0xd3, 0xe9, 0x96, 0x61, 0x26, 0x61, 0xf8, 0xba, 0xc1, 0x20, 0xaa, + 0x0b, 0x45, 0xfb, 0x0e, 0x8b, 0x6c, 0xff, 0x6f, 0x72, 0x78, 0xbc, 0xb1, 0x98, 0x95, 0x57, 0x20, + 0x4b, 0xeb, 0x90, 0xd8, 0xef, 0xfa, 0xba, 0x1b, 0x0e, 0xc1, 0x6c, 0x86, 0x95, 0x76, 0xfa, 0x98, + 0x92, 0xd2, 0x4e, 0x55, 0x8d, 0x58, 0x87, 0x5f, 0x49, 0xdc, 0x12, 0xf7, 0x47, 0x4b, 0x4f, 0xe4, + 0xa0, 0xb8, 0xca, 0x73, 0x72, 0xee, 0x07, 0x69, 0x45, 0xf5, 0x73, 0x2d, 0x51, 0x98, 0xa0, 0xbe, + 0x79, 0xe7, 0x51, 0x71, 0xe6, 0xfe, 0xa3, 0xe2, 0xcc, 0xc3, 0x47, 0xc5, 0x99, 0x0f, 0x7b, 0x45, + 0x74, 0xa7, 0x57, 0x44, 0xf7, 0x7b, 0x45, 0xf4, 0xb0, 0x57, 0x44, 0xbf, 0xf7, 0x8a, 0xe8, 0xf3, + 0x3f, 0x8a, 0x33, 0x6f, 0xad, 0x3d, 0xfd, 0xcf, 0x47, 0xff, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x6f, + 0x5d, 0x2d, 0x06, 0x73, 0x3a, 0x00, 0x00, } func (m *Cluster) Marshal() (dAtA []byte, err error) { @@ -4565,13 +4565,11 @@ func (m *SiteID) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenerated(dAtA, i, uint64(len(m.Site))) i-- dAtA[i] = 0x12 - if m.Region != nil { - i -= len(*m.Region) - copy(dAtA[i:], *m.Region) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Region))) - i-- - dAtA[i] = 0xa - } + i -= len(m.Region) + copy(dAtA[i:], m.Region) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Region))) + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -5584,10 +5582,8 @@ func (m *SiteID) Size() (n int) { } var l int _ = l - if m.Region != nil { - l = len(*m.Region) - n += 1 + l + sovGenerated(uint64(l)) - } + l = len(m.Region) + n += 1 + l + sovGenerated(uint64(l)) l = len(m.Site) n += 1 + l + sovGenerated(uint64(l)) return n @@ -6373,7 +6369,7 @@ func (this *SiteID) String() string { return "nil" } s := strings.Join([]string{`&SiteID{`, - `Region:` + valueToStringGenerated(this.Region) + `,`, + `Region:` + fmt.Sprintf("%v", this.Region) + `,`, `Site:` + fmt.Sprintf("%v", this.Site) + `,`, `}`, }, "") @@ -13608,8 +13604,7 @@ func (m *SiteID) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - s := string(dAtA[iNdEx:postIndex]) - m.Region = &s + m.Region = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { diff --git a/apis/backend/infra/v1alpha1/id.go b/apis/backend/infra/v1alpha1/id.go index 2c45f82..c503999 100644 --- a/apis/backend/infra/v1alpha1/id.go +++ b/apis/backend/infra/v1alpha1/id.go @@ -18,7 +18,7 @@ package v1alpha1 type SiteID struct { // Region defines the region this sites belongs to - Region *string `json:"region,omitempty" yaml:"region,omitempty" protobuf:"bytes,1,opt,name=region"` + Region string `json:"region" yaml:"region" protobuf:"bytes,1,opt,name=region"` // Site defines the site in which the node is deployed Site string `json:"site" yaml:"site" protobuf:"bytes,2,opt,name=site"` } diff --git a/apis/backend/infra/v1alpha1/link_interface.go b/apis/backend/infra/v1alpha1/link_interface.go new file mode 100644 index 0000000..36f96de --- /dev/null +++ b/apis/backend/infra/v1alpha1/link_interface.go @@ -0,0 +1,223 @@ +/* +Copyright 2024 Nokia. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + "crypto/sha1" + "encoding/json" + "fmt" + + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-store/pkg/generic/registry" + "github.com/henderiw/store" + "github.com/kuidio/kuid/apis/backend" + commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" + conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/validation/field" +) + +const LinkPlural = "links" +const LinkSingular = "link" + +// +k8s:deepcopy-gen=false +var _ resource.Object = &Link{} +var _ resource.ObjectList = &LinkList{} + +// GetListMeta returns the ListMeta +func (r *LinkList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +func (r *Link) GetSingularName() string { + return LinkSingular +} + +func (Link) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: LinkPlural, + } +} + +// IsStorageVersion returns true -- v1alpha1.Config is used as the internal version. +// IsStorageVersion implements resource.Object. +func (Link) IsStorageVersion() bool { + return true +} + +// GetObjectMeta implements resource.Object +func (r *Link) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object. +func (Link) NamespaceScoped() bool { + return true +} + +// New implements resource.Object +func (Link) New() runtime.Object { + return &Link{} +} + +// NewList implements resource.Object +func (Link) NewList() runtime.Object { + return &LinkList{} +} + +// GetCondition returns the condition based on the condition kind +func (r *Link) GetCondition(t conditionv1alpha1.ConditionType) conditionv1alpha1.Condition { + return r.Status.GetCondition(t) +} + +// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions +// to be set at once +func (r *Link) SetConditions(c ...conditionv1alpha1.Condition) { + r.Status.SetConditions(c...) +} + +// LinkConvertFieldSelector is the schema conversion function for normalizing the FieldSelector for Link +func LinkConvertFieldSelector(label, value string) (internalLabel, internalValue string, err error) { + switch label { + case "metadata.name": + return label, value, nil + case "metadata.namespace": + return label, value, nil + default: + return "", "", fmt.Errorf("%q is not a known field selector", label) + } +} + +func (r *LinkList) GetItems() []backend.Object { + objs := []backend.Object{} + for _, r := range r.Items { + r := r + objs = append(objs, &r) + } + return objs +} + +func (r *Link) CalculateHash() ([sha1.Size]byte, error) { + // Convert the struct to JSON + jsonData, err := json.Marshal(r) + if err != nil { + return [sha1.Size]byte{}, err + } + + // Calculate SHA-1 hash + return sha1.Sum(jsonData), nil +} + +func (r *Link) GetNamespacedName() types.NamespacedName { + return types.NamespacedName{ + Namespace: r.GetNamespace(), + Name: r.GetName(), + } +} + +func (r *Link) GetKey() store.Key { + return store.KeyFromNSN(r.GetNamespacedName()) +} + +func (r *Link) GetEndPointIDA() *EndpointID { + if len(r.Spec.Endpoints) != 2 { + return nil + } + return r.Spec.Endpoints[0] +} + +func (r *Link) GetEndPointIDB() *EndpointID { + if len(r.Spec.Endpoints) != 2 { + return nil + } + return r.Spec.Endpoints[1] +} + +func (r *Link) GetOwnerReference() *commonv1alpha1.OwnerReference { + return &commonv1alpha1.OwnerReference{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Kind: LinkKind, + Namespace: r.Namespace, + Name: r.Name, + } +} + +func (r *Link) ValidateSyntax() field.ErrorList { + var allErrs field.ErrorList + + if len(r.Spec.Endpoints) != 2 { + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.endpoints"), + r, + fmt.Errorf("a link always need 2 endpoints got %d", len(r.Spec.Endpoints)).Error(), + )) + } + + return allErrs +} + +// BuildLink returns a reource from a client Object a Spec/Status +func BuildLink(meta metav1.ObjectMeta, spec *LinkSpec, status *LinkStatus) *Link { + aspec := LinkSpec{} + if spec != nil { + aspec = *spec + } + astatus := LinkStatus{} + if status != nil { + astatus = *status + } + return &Link{ + TypeMeta: metav1.TypeMeta{ + APIVersion: SchemeGroupVersion.Identifier(), + Kind: LinkKind, + }, + ObjectMeta: meta, + Spec: aspec, + Status: astatus, + } +} + +func LinkTableConvertor(gr schema.GroupResource) registry.TableConvertor { + return registry.TableConvertor{ + Resource: gr, + Cells: func(obj runtime.Object) []interface{} { + r, ok := obj.(*Link) + if !ok { + return nil + } + return []interface{}{ + r.GetName(), + r.GetCondition(conditionv1alpha1.ConditionTypeReady).Status, + r.GetEndPointIDA().String(), + r.GetEndPointIDB().String(), + } + }, + Columns: []metav1.TableColumnDefinition{ + {Name: "Name", Type: "string"}, + {Name: "Ready", Type: "string"}, + {Name: "EPA", Type: "string"}, + {Name: "EPB", Type: "string"}, + }, + } +} diff --git a/apis/backend/infra/v1alpha1/node_interface.go b/apis/backend/infra/v1alpha1/node_interface.go new file mode 100644 index 0000000..16b7e98 --- /dev/null +++ b/apis/backend/infra/v1alpha1/node_interface.go @@ -0,0 +1,233 @@ +/* +Copyright 2024 Nokia. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + "crypto/sha1" + "encoding/json" + "fmt" + + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-store/pkg/generic/registry" + "github.com/henderiw/store" + "github.com/kuidio/kuid/apis/backend" + commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" + conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/validation/field" +) + +const NodePlural = "nodes" +const NodeSingular = "node" + +// +k8s:deepcopy-gen=false +var _ resource.Object = &Node{} +var _ resource.ObjectList = &NodeList{} + +// GetListMeta returns the ListMeta +func (r *NodeList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +func (r *Node) GetSingularName() string { + return NodeSingular +} + +func (Node) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: NodePlural, + } +} + +// IsStorageVersion returns true -- v1alpha1.Config is used as the internal version. +// IsStorageVersion implements resource.Object. +func (Node) IsStorageVersion() bool { + return true +} + +// GetObjectMeta implements resource.Object +func (r *Node) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object. +func (Node) NamespaceScoped() bool { + return true +} + +// New implements resource.Object +func (Node) New() runtime.Object { + return &Node{} +} + +// NewList implements resource.Object +func (Node) NewList() runtime.Object { + return &NodeList{} +} + +// GetCondition returns the condition based on the condition kind +func (r *Node) GetCondition(t conditionv1alpha1.ConditionType) conditionv1alpha1.Condition { + return r.Status.GetCondition(t) +} + +// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions +// to be set at once +func (r *Node) SetConditions(c ...conditionv1alpha1.Condition) { + r.Status.SetConditions(c...) +} + +// NodeConvertFieldSelector is the schema conversion function for normalizing the FieldSelector for Node +func NodeConvertFieldSelector(label, value string) (internalLabel, internalValue string, err error) { + switch label { + case "metadata.name": + return label, value, nil + case "metadata.namespace": + return label, value, nil + default: + return "", "", fmt.Errorf("%q is not a known field selector", label) + } +} + +func (r *NodeList) GetItems() []backend.Object { + objs := []backend.Object{} + for _, r := range r.Items { + r := r + objs = append(objs, &r) + } + return objs +} + +func (r *Node) CalculateHash() ([sha1.Size]byte, error) { + // Convert the struct to JSON + jsonData, err := json.Marshal(r) + if err != nil { + return [sha1.Size]byte{}, err + } + + // Calculate SHA-1 hash + return sha1.Sum(jsonData), nil +} + +func (r *Node) GetNamespacedName() types.NamespacedName { + return types.NamespacedName{ + Namespace: r.GetNamespace(), + Name: r.GetName(), + } +} + +func (r *Node) GetKey() store.Key { + return store.KeyFromNSN(r.GetNamespacedName()) +} + +func (r *Node) GetRegion() string { + return r.Spec.Region +} + +func (r *Node) GetSite() string { + return r.Spec.Site +} + +func (r *Node) GetNodeGroupID() NodeGroupID { + return NodeGroupID{ + SiteID: r.Spec.SiteID, + NodeGroup: r.Spec.NodeGroup, + } +} + +func (r *Node) GetNodeID() NodeID { + return NodeID{ + NodeGroupID: r.GetNodeGroupID(), + Node: r.Name, + } +} + +func (r *Node) GetOwnerReference() *commonv1alpha1.OwnerReference { + return &commonv1alpha1.OwnerReference{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Kind: NodeKind, + Namespace: r.Namespace, + Name: r.Name, + } +} + +func (r *Node) ValidateSyntax() field.ErrorList { + var allErrs field.ErrorList + + /* + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.type"), + r, + fmt.Errorf("invalid GENID Type %s", r.Spec.Type).Error(), + )) + } + */ + return allErrs +} + +// BuildNode returns a reource from a client Object a Spec/Status +func BuildNode(meta metav1.ObjectMeta, spec *NodeSpec, status *NodeStatus) *Node { + aspec := NodeSpec{} + if spec != nil { + aspec = *spec + } + astatus := NodeStatus{} + if status != nil { + astatus = *status + } + return &Node{ + TypeMeta: metav1.TypeMeta{ + APIVersion: SchemeGroupVersion.Identifier(), + Kind: NodeKind, + }, + ObjectMeta: meta, + Spec: aspec, + Status: astatus, + } +} + +func NodeTableConvertor(gr schema.GroupResource) registry.TableConvertor { + return registry.TableConvertor{ + Resource: gr, + Cells: func(obj runtime.Object) []interface{} { + r, ok := obj.(*Node) + if !ok { + return nil + } + return []interface{}{ + r.GetName(), + r.GetCondition(conditionv1alpha1.ConditionTypeReady).Status, + r.Spec.SiteID.Region, + r.Spec.SiteID.Site, + r.Spec.NodeGroup, + } + }, + Columns: []metav1.TableColumnDefinition{ + {Name: "Name", Type: "string"}, + {Name: "Ready", Type: "string"}, + {Name: "Region", Type: "string"}, + {Name: "Site", Type: "string"}, + {Name: "Topology", Type: "string"}, + }, + } +} diff --git a/apis/backend/infra/v1alpha1/region_interface.go b/apis/backend/infra/v1alpha1/region_interface.go new file mode 100644 index 0000000..0f1f43b --- /dev/null +++ b/apis/backend/infra/v1alpha1/region_interface.go @@ -0,0 +1,209 @@ +/* +Copyright 2024 Nokia. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + "crypto/sha1" + "encoding/json" + "fmt" + + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-store/pkg/generic/registry" + "github.com/henderiw/store" + "github.com/kuidio/kuid/apis/backend" + commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" + conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/validation/field" +) + +const RegionPlural = "regions" +const RegionSingular = "region" + +// +k8s:deepcopy-gen=false +var _ resource.Object = &Region{} +var _ resource.ObjectList = &RegionList{} + +// GetListMeta returns the ListMeta +func (r *RegionList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +func (r *Region) GetSingularName() string { + return RegionSingular +} + +func (Region) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: RegionPlural, + } +} + +// IsStorageVersion returns true -- v1alpha1.Config is used as the internal version. +// IsStorageVersion implements resource.Object. +func (Region) IsStorageVersion() bool { + return true +} + +// GetObjectMeta implements resource.Object +func (r *Region) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object. +func (Region) NamespaceScoped() bool { + return true +} + +// New implements resource.Object +func (Region) New() runtime.Object { + return &Region{} +} + +// NewList implements resource.Object +func (Region) NewList() runtime.Object { + return &RegionList{} +} + +// GetCondition returns the condition based on the condition kind +func (r *Region) GetCondition(t conditionv1alpha1.ConditionType) conditionv1alpha1.Condition { + return r.Status.GetCondition(t) +} + +// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions +// to be set at once +func (r *Region) SetConditions(c ...conditionv1alpha1.Condition) { + r.Status.SetConditions(c...) +} + +// RegionConvertFieldSelector is the schema conversion function for normalizing the FieldSelector for Region +func RegionConvertFieldSelector(label, value string) (internalLabel, internalValue string, err error) { + switch label { + case "metadata.name": + return label, value, nil + case "metadata.namespace": + return label, value, nil + default: + return "", "", fmt.Errorf("%q is not a known field selector", label) + } +} + +func (r *RegionList) GetItems() []backend.Object { + objs := []backend.Object{} + for _, r := range r.Items { + r := r + objs = append(objs, &r) + } + return objs +} + +func (r *Region) CalculateHash() ([sha1.Size]byte, error) { + // Convert the struct to JSON + jsonData, err := json.Marshal(r) + if err != nil { + return [sha1.Size]byte{}, err + } + + // Calculate SHA-1 hash + return sha1.Sum(jsonData), nil +} + +func (r *Region) GetNamespacedName() types.NamespacedName { + return types.NamespacedName{ + Namespace: r.GetNamespace(), + Name: r.GetName(), + } +} + +func (r *Region) GetKey() store.Key { + return store.KeyFromNSN(r.GetNamespacedName()) +} + +func (r *Region) GetRegion() string { + return r.Name +} + +func (r *Region) GetOwnerReference() *commonv1alpha1.OwnerReference { + return &commonv1alpha1.OwnerReference{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Kind: RegionKind, + Namespace: r.Namespace, + Name: r.Name, + } +} + +func (r *Region) ValidateSyntax() field.ErrorList { + var allErrs field.ErrorList + + /* + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.type"), + r, + fmt.Errorf("invalid GENID Type %s", r.Spec.Type).Error(), + )) + } + */ + return allErrs +} + +// BuildRegion returns a reource from a client Object a Spec/Status +func BuildRegion(meta metav1.ObjectMeta, spec *RegionSpec, status *RegionStatus) *Region { + aspec := RegionSpec{} + if spec != nil { + aspec = *spec + } + astatus := RegionStatus{} + if status != nil { + astatus = *status + } + return &Region{ + TypeMeta: metav1.TypeMeta{ + APIVersion: SchemeGroupVersion.Identifier(), + Kind: RegionKind, + }, + ObjectMeta: meta, + Spec: aspec, + Status: astatus, + } +} + +func RegionTableConvertor(gr schema.GroupResource) registry.TableConvertor { + return registry.TableConvertor{ + Resource: gr, + Cells: func(obj runtime.Object) []interface{} { + r, ok := obj.(*Region) + if !ok { + return nil + } + return []interface{}{ + r.GetName(), + r.GetCondition(conditionv1alpha1.ConditionTypeReady).Status, + } + }, + Columns: []metav1.TableColumnDefinition{ + {Name: "Name", Type: "string"}, + {Name: "Ready", Type: "string"}, + }, + } +} diff --git a/apis/backend/infra/v1alpha1/site_interface.go b/apis/backend/infra/v1alpha1/site_interface.go new file mode 100644 index 0000000..e20caa0 --- /dev/null +++ b/apis/backend/infra/v1alpha1/site_interface.go @@ -0,0 +1,215 @@ +/* +Copyright 2024 Nokia. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + "crypto/sha1" + "encoding/json" + "fmt" + + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-store/pkg/generic/registry" + "github.com/henderiw/store" + "github.com/kuidio/kuid/apis/backend" + commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" + conditionv1alpha1 "github.com/kuidio/kuid/apis/condition/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/validation/field" +) + +const SitePlural = "sites" +const SiteSingular = "site" + +// +k8s:deepcopy-gen=false +var _ resource.Object = &Site{} +var _ resource.ObjectList = &SiteList{} + +// GetListMeta returns the ListMeta +func (r *SiteList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +func (r *Site) GetSingularName() string { + return SiteSingular +} + +func (Site) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: SitePlural, + } +} + +// IsStorageVersion returns true -- v1alpha1.Config is used as the internal version. +// IsStorageVersion implements resource.Object. +func (Site) IsStorageVersion() bool { + return true +} + +// GetObjectMeta implements resource.Object +func (r *Site) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object. +func (Site) NamespaceScoped() bool { + return true +} + +// New implements resource.Object +func (Site) New() runtime.Object { + return &Site{} +} + +// NewList implements resource.Object +func (Site) NewList() runtime.Object { + return &SiteList{} +} + +// GetCondition returns the condition based on the condition kind +func (r *Site) GetCondition(t conditionv1alpha1.ConditionType) conditionv1alpha1.Condition { + return r.Status.GetCondition(t) +} + +// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions +// to be set at once +func (r *Site) SetConditions(c ...conditionv1alpha1.Condition) { + r.Status.SetConditions(c...) +} + +// SiteConvertFieldSelector is the schema conversion function for normalizing the FieldSelector for Site +func SiteConvertFieldSelector(label, value string) (internalLabel, internalValue string, err error) { + switch label { + case "metadata.name": + return label, value, nil + case "metadata.namespace": + return label, value, nil + default: + return "", "", fmt.Errorf("%q is not a known field selector", label) + } +} + +func (r *SiteList) GetItems() []backend.Object { + objs := []backend.Object{} + for _, r := range r.Items { + r := r + objs = append(objs, &r) + } + return objs +} + +func (r *Site) CalculateHash() ([sha1.Size]byte, error) { + // Convert the struct to JSON + jsonData, err := json.Marshal(r) + if err != nil { + return [sha1.Size]byte{}, err + } + + // Calculate SHA-1 hash + return sha1.Sum(jsonData), nil +} + +func (r *Site) GetNamespacedName() types.NamespacedName { + return types.NamespacedName{ + Namespace: r.GetNamespace(), + Name: r.GetName(), + } +} + +func (r *Site) GetKey() store.Key { + return store.KeyFromNSN(r.GetNamespacedName()) +} + +func (r *Site) GetRegion() string { + return r.Spec.Region +} + +func (r *Site) GetSite() string { + return r.Name +} + +func (r *Site) GetOwnerReference() *commonv1alpha1.OwnerReference { + return &commonv1alpha1.OwnerReference{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Kind: SiteKind, + Namespace: r.Namespace, + Name: r.Name, + } +} + +func (r *Site) ValidateSyntax() field.ErrorList { + var allErrs field.ErrorList + + /* + allErrs = append(allErrs, field.Invalid( + field.NewPath("spec.type"), + r, + fmt.Errorf("invalid GENID Type %s", r.Spec.Type).Error(), + )) + } + */ + return allErrs +} + +// BuildSite returns a reource from a client Object a Spec/Status +func BuildSite(meta metav1.ObjectMeta, spec *SiteSpec, status *SiteStatus) *Site { + aspec := SiteSpec{} + if spec != nil { + aspec = *spec + } + astatus := SiteStatus{} + if status != nil { + astatus = *status + } + return &Site{ + TypeMeta: metav1.TypeMeta{ + APIVersion: SchemeGroupVersion.Identifier(), + Kind: SiteKind, + }, + ObjectMeta: meta, + Spec: aspec, + Status: astatus, + } +} + +func SiteTableConvertor(gr schema.GroupResource) registry.TableConvertor { + return registry.TableConvertor{ + Resource: gr, + Cells: func(obj runtime.Object) []interface{} { + r, ok := obj.(*Site) + if !ok { + return nil + } + return []interface{}{ + r.GetName(), + r.GetCondition(conditionv1alpha1.ConditionTypeReady).Status, + r.Spec.Region, + } + }, + Columns: []metav1.TableColumnDefinition{ + {Name: "Name", Type: "string"}, + {Name: "Ready", Type: "string"}, + {Name: "Region", Type: "string"}, + }, + } +} diff --git a/apis/backend/infra/v1alpha1/zz_generated.deepcopy.go b/apis/backend/infra/v1alpha1/zz_generated.deepcopy.go index 12dc245..5bf0a6c 100644 --- a/apis/backend/infra/v1alpha1/zz_generated.deepcopy.go +++ b/apis/backend/infra/v1alpha1/zz_generated.deepcopy.go @@ -155,7 +155,7 @@ func (in *Endpoint) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *EndpointID) DeepCopyInto(out *EndpointID) { *out = *in - in.NodeID.DeepCopyInto(&out.NodeID) + out.NodeID = in.NodeID return } @@ -273,7 +273,7 @@ func (in *EndpointSetSpec) DeepCopyInto(out *EndpointSetSpec) { if (*in)[i] != nil { in, out := &(*in)[i], &(*out)[i] *out = new(EndpointID) - (*in).DeepCopyInto(*out) + **out = **in } } } @@ -326,7 +326,7 @@ func (in *EndpointSetStatus) DeepCopy() *EndpointSetStatus { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *EndpointSpec) DeepCopyInto(out *EndpointSpec) { *out = *in - in.EndpointID.DeepCopyInto(&out.EndpointID) + out.EndpointID = in.EndpointID if in.Module != nil { in, out := &in.Module, &out.Module *out = new(string) @@ -500,7 +500,7 @@ func (in *LinkSetSpec) DeepCopyInto(out *LinkSetSpec) { if (*in)[i] != nil { in, out := &(*in)[i], &(*out)[i] *out = new(EndpointID) - (*in).DeepCopyInto(*out) + **out = **in } } } @@ -555,7 +555,7 @@ func (in *LinkSpec) DeepCopyInto(out *LinkSpec) { if (*in)[i] != nil { in, out := &(*in)[i], &(*out)[i] *out = new(EndpointID) - (*in).DeepCopyInto(*out) + **out = **in } } } @@ -708,7 +708,7 @@ func (in *ModuleBayList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ModuleBaySpec) DeepCopyInto(out *ModuleBaySpec) { *out = *in - in.NodeID.DeepCopyInto(&out.NodeID) + out.NodeID = in.NodeID in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) return } @@ -776,7 +776,7 @@ func (in *ModuleList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ModuleSpec) DeepCopyInto(out *ModuleSpec) { *out = *in - in.NodeID.DeepCopyInto(&out.NodeID) + out.NodeID = in.NodeID in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) return } @@ -867,7 +867,7 @@ func (in *NodeGroup) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NodeGroupID) DeepCopyInto(out *NodeGroupID) { *out = *in - in.SiteID.DeepCopyInto(&out.SiteID) + out.SiteID = in.SiteID return } @@ -951,7 +951,7 @@ func (in *NodeGroupStatus) DeepCopy() *NodeGroupStatus { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NodeID) DeepCopyInto(out *NodeID) { *out = *in - in.NodeGroupID.DeepCopyInto(&out.NodeGroupID) + out.NodeGroupID = in.NodeGroupID return } @@ -1029,7 +1029,7 @@ func (in *NodeItemList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NodeItemSpec) DeepCopyInto(out *NodeItemSpec) { *out = *in - in.NodeID.DeepCopyInto(&out.NodeID) + out.NodeID = in.NodeID in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) return } @@ -1158,7 +1158,7 @@ func (in *NodeSetList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NodeSetSpec) DeepCopyInto(out *NodeSetSpec) { *out = *in - in.NodeGroupID.DeepCopyInto(&out.NodeGroupID) + out.NodeGroupID = in.NodeGroupID in.ClaimLabels.DeepCopyInto(&out.ClaimLabels) return } @@ -1193,7 +1193,7 @@ func (in *NodeSetStatus) DeepCopy() *NodeSetStatus { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NodeSpec) DeepCopyInto(out *NodeSpec) { *out = *in - in.NodeGroupID.DeepCopyInto(&out.NodeGroupID) + out.NodeGroupID = in.NodeGroupID if in.Rack != nil { in, out := &in.Rack, &out.Rack *out = new(string) @@ -1304,7 +1304,7 @@ func (in *RackList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *RackSpec) DeepCopyInto(out *RackSpec) { *out = *in - in.SiteID.DeepCopyInto(&out.SiteID) + out.SiteID = in.SiteID if in.Location != nil { in, out := &in.Location, &out.Location *out = new(Location) @@ -1467,11 +1467,6 @@ func (in *Site) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SiteID) DeepCopyInto(out *SiteID) { *out = *in - if in.Region != nil { - in, out := &in.Region, &out.Region - *out = new(string) - **out = **in - } return } diff --git a/apis/generated/openapi/zz_generated.openapi.go b/apis/generated/openapi/zz_generated.openapi.go index 4993a06..554df8e 100644 --- a/apis/generated/openapi/zz_generated.openapi.go +++ b/apis/generated/openapi/zz_generated.openapi.go @@ -3147,6 +3147,7 @@ func schema_apis_backend_infra_v1alpha1_EndpointID(ref common.ReferenceCallback) "region": { SchemaProps: spec.SchemaProps{ Description: "Region defines the region this sites belongs to", + Default: "", Type: []string{"string"}, Format: "", }, @@ -3184,7 +3185,7 @@ func schema_apis_backend_infra_v1alpha1_EndpointID(ref common.ReferenceCallback) }, }, }, - Required: []string{"site", "nodeGroup", "node", "endpoint"}, + Required: []string{"region", "site", "nodeGroup", "node", "endpoint"}, }, }, } @@ -3440,6 +3441,7 @@ func schema_apis_backend_infra_v1alpha1_EndpointSpec(ref common.ReferenceCallbac "region": { SchemaProps: spec.SchemaProps{ Description: "Region defines the region this sites belongs to", + Default: "", Type: []string{"string"}, Format: "", }, @@ -3507,7 +3509,7 @@ func schema_apis_backend_infra_v1alpha1_EndpointSpec(ref common.ReferenceCallbac }, }, }, - Required: []string{"site", "nodeGroup", "node", "endpoint"}, + Required: []string{"region", "site", "nodeGroup", "node", "endpoint"}, }, }, } @@ -4073,6 +4075,7 @@ func schema_apis_backend_infra_v1alpha1_ModuleBaySpec(ref common.ReferenceCallba "region": { SchemaProps: spec.SchemaProps{ Description: "Region defines the region this sites belongs to", + Default: "", Type: []string{"string"}, Format: "", }, @@ -4126,7 +4129,7 @@ func schema_apis_backend_infra_v1alpha1_ModuleBaySpec(ref common.ReferenceCallba }, }, }, - Required: []string{"site", "nodeGroup", "node", "psoition"}, + Required: []string{"region", "site", "nodeGroup", "node", "psoition"}, }, }, } @@ -4220,6 +4223,7 @@ func schema_apis_backend_infra_v1alpha1_ModuleSpec(ref common.ReferenceCallback) "region": { SchemaProps: spec.SchemaProps{ Description: "Region defines the region this sites belongs to", + Default: "", Type: []string{"string"}, Format: "", }, @@ -4273,7 +4277,7 @@ func schema_apis_backend_infra_v1alpha1_ModuleSpec(ref common.ReferenceCallback) }, }, }, - Required: []string{"site", "nodeGroup", "node", "moduleBay"}, + Required: []string{"region", "site", "nodeGroup", "node", "moduleBay"}, }, }, } @@ -4411,6 +4415,7 @@ func schema_apis_backend_infra_v1alpha1_NodeGroupID(ref common.ReferenceCallback "region": { SchemaProps: spec.SchemaProps{ Description: "Region defines the region this sites belongs to", + Default: "", Type: []string{"string"}, Format: "", }, @@ -4432,7 +4437,7 @@ func schema_apis_backend_infra_v1alpha1_NodeGroupID(ref common.ReferenceCallback }, }, }, - Required: []string{"site", "nodeGroup"}, + Required: []string{"region", "site", "nodeGroup"}, }, }, } @@ -4554,6 +4559,7 @@ func schema_apis_backend_infra_v1alpha1_NodeID(ref common.ReferenceCallback) com "region": { SchemaProps: spec.SchemaProps{ Description: "Region defines the region this sites belongs to", + Default: "", Type: []string{"string"}, Format: "", }, @@ -4583,7 +4589,7 @@ func schema_apis_backend_infra_v1alpha1_NodeID(ref common.ReferenceCallback) com }, }, }, - Required: []string{"site", "nodeGroup", "node"}, + Required: []string{"region", "site", "nodeGroup", "node"}, }, }, } @@ -4695,6 +4701,7 @@ func schema_apis_backend_infra_v1alpha1_NodeItemSpec(ref common.ReferenceCallbac "region": { SchemaProps: spec.SchemaProps{ Description: "Region defines the region this sites belongs to", + Default: "", Type: []string{"string"}, Format: "", }, @@ -4740,7 +4747,7 @@ func schema_apis_backend_infra_v1alpha1_NodeItemSpec(ref common.ReferenceCallbac }, }, }, - Required: []string{"site", "nodeGroup", "node"}, + Required: []string{"region", "site", "nodeGroup", "node"}, }, }, } @@ -4930,6 +4937,7 @@ func schema_apis_backend_infra_v1alpha1_NodeSetSpec(ref common.ReferenceCallback "region": { SchemaProps: spec.SchemaProps{ Description: "Region defines the region this sites belongs to", + Default: "", Type: []string{"string"}, Format: "", }, @@ -4973,7 +4981,7 @@ func schema_apis_backend_infra_v1alpha1_NodeSetSpec(ref common.ReferenceCallback }, }, }, - Required: []string{"site", "nodeGroup"}, + Required: []string{"region", "site", "nodeGroup"}, }, }, Dependencies: []string{ @@ -5020,6 +5028,7 @@ func schema_apis_backend_infra_v1alpha1_NodeSpec(ref common.ReferenceCallback) c "region": { SchemaProps: spec.SchemaProps{ Description: "Region defines the region this sites belongs to", + Default: "", Type: []string{"string"}, Format: "", }, @@ -5085,7 +5094,7 @@ func schema_apis_backend_infra_v1alpha1_NodeSpec(ref common.ReferenceCallback) c }, }, }, - Required: []string{"site", "nodeGroup", "provider"}, + Required: []string{"region", "site", "nodeGroup", "provider"}, }, }, Dependencies: []string{ @@ -5228,6 +5237,7 @@ func schema_apis_backend_infra_v1alpha1_RackSpec(ref common.ReferenceCallback) c "region": { SchemaProps: spec.SchemaProps{ Description: "Region defines the region this sites belongs to", + Default: "", Type: []string{"string"}, Format: "", }, @@ -5277,7 +5287,7 @@ func schema_apis_backend_infra_v1alpha1_RackSpec(ref common.ReferenceCallback) c }, }, }, - Required: []string{"site"}, + Required: []string{"region", "site"}, }, }, Dependencies: []string{ @@ -5524,6 +5534,7 @@ func schema_apis_backend_infra_v1alpha1_SiteID(ref common.ReferenceCallback) com "region": { SchemaProps: spec.SchemaProps{ Description: "Region defines the region this sites belongs to", + Default: "", Type: []string{"string"}, Format: "", }, @@ -5537,7 +5548,7 @@ func schema_apis_backend_infra_v1alpha1_SiteID(ref common.ReferenceCallback) com }, }, }, - Required: []string{"site"}, + Required: []string{"region", "site"}, }, }, } diff --git a/go.mod b/go.mod index e3bfcb8..d77c582 100644 --- a/go.mod +++ b/go.mod @@ -44,15 +44,15 @@ require ( go.opentelemetry.io/otel v1.20.0 go.uber.org/zap v1.27.0 go4.org/netipx v0.0.0-20231129151722-fdeea329fbba - golang.org/x/mod v0.14.0 - golang.org/x/sync v0.6.0 + golang.org/x/mod v0.17.0 + golang.org/x/sync v0.7.0 k8s.io/api v0.29.3 - k8s.io/apimachinery v0.30.0 + k8s.io/apimachinery v0.30.1 k8s.io/apiserver v0.29.3 k8s.io/client-go v0.29.3 k8s.io/code-generator v0.29.3 k8s.io/component-base v0.29.3 - k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 + k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 k8s.io/utils v0.0.0-20230726121419-3b25d923346b sigs.k8s.io/controller-runtime v0.17.2 sigs.k8s.io/yaml v1.4.0 @@ -131,7 +131,7 @@ require ( golang.org/x/term v0.18.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.5.0 // indirect - golang.org/x/tools v0.16.1 // indirect + golang.org/x/tools v0.18.0 // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect google.golang.org/appengine v1.6.8 // indirect google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect diff --git a/go.sum b/go.sum index 67e85a5..81b5153 100644 --- a/go.sum +++ b/go.sum @@ -281,8 +281,8 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= -golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -305,8 +305,8 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= -golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -340,8 +340,8 @@ golang.org/x/tools v0.0.0-20200505023115-26f46d2f7ef8/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.16.1 h1:TLyB3WofjdOEepBHAU20JdNC1Zbg87elYofWYAY5oZA= -golang.org/x/tools v0.16.1/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0= +golang.org/x/tools v0.18.0 h1:k8NLag8AGHnn+PHbl7g43CtqZAwG60vZkLqgyZgIHgQ= +golang.org/x/tools v0.18.0/go.mod h1:GL7B4CwcLLeo59yx/9UWWuNOW1n3VZ4f5axWfML7Lcg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/tools/apiserver-runtime-gen/main.go b/tools/apiserver-runtime-gen/main.go index 00d033e..bb5676d 100644 --- a/tools/apiserver-runtime-gen/main.go +++ b/tools/apiserver-runtime-gen/main.go @@ -67,16 +67,16 @@ func runE(cmd *cobra.Command, args []string) error { return err } if gen == "go-to-protobuf" { - /* - err := run(exec.Command("go", "mod", "vendor")) - if err != nil { - return err - } - err = run(exec.Command("go", "mod", "tidy")) - if err != nil { - return err - } - */ + + err := run(exec.Command("go", "mod", "vendor")) + if err != nil { + return err + } + err = run(exec.Command("go", "mod", "tidy")) + if err != nil { + return err + } + } } }