From f57a256a29f99bf374743b03c219c0fea036cafe Mon Sep 17 00:00:00 2001 From: Wim Henderickx Date: Sun, 3 Nov 2024 20:35:07 +0100 Subject: [PATCH] updated infra --- .gitignore | 3 +- apis/id/id.go | 14 +- apis/id/v1alpha1/id.go | 16 +- apis/id/v1alpha1/zz_generated.deepcopy.go | 54 +- apis/id/zz_generated.deepcopy.go | 54 +- apis/infra/adaptor_helper.go | 32 + apis/infra/adaptor_resource.go | 312 +++++++++ apis/infra/adaptor_types.go | 72 +++ apis/infra/cluster_types.go | 2 + apis/infra/doc.go | 1 + apis/infra/endpoint_types.go | 3 +- apis/infra/endpointset_types.go | 5 +- apis/infra/link_types.go | 7 +- apis/infra/linkset_types.go | 5 +- apis/infra/module_types.go | 3 + apis/infra/modulebay_types.go | 3 + apis/infra/node_types.go | 3 +- apis/infra/nodeitem_types.go | 2 +- apis/infra/nodeset_types.go | 3 +- apis/infra/partition_types.go | 2 + apis/infra/port_helper.go | 32 + apis/infra/port_resource.go | 312 +++++++++ apis/infra/port_types.go | 72 +++ apis/infra/rack_types.go | 3 +- apis/infra/region_types.go | 3 +- apis/infra/site_types.go | 3 +- apis/infra/v1alpha1/adaptor_resource.go | 80 +++ apis/infra/v1alpha1/adaptor_types.go | 74 +++ apis/infra/v1alpha1/conversion.go | 58 +- apis/infra/v1alpha1/link_types.go | 6 +- apis/infra/v1alpha1/port_resource.go | 80 +++ apis/infra/v1alpha1/port_types.go | 74 +++ .../infra/v1alpha1/zz_generated.conversion.go | 364 ++++++++++- apis/infra/v1alpha1/zz_generated.deepcopy.go | 197 ++++++ apis/infra/zz_generated.deepcopy.go | 224 +++++++ crds/infra.kuid.dev_adaptors.yaml | 157 +++++ crds/infra.kuid.dev_clusters.yaml | 137 ---- crds/infra.kuid.dev_endpoints.yaml | 150 ----- crds/infra.kuid.dev_endpointsets.yaml | 173 ----- crds/infra.kuid.dev_links.yaml | 155 +---- crds/infra.kuid.dev_linksets.yaml | 165 ----- crds/infra.kuid.dev_modulebays.yaml | 127 ---- crds/infra.kuid.dev_modules.yaml | 126 ---- crds/infra.kuid.dev_nodeitems.yaml | 123 ---- crds/infra.kuid.dev_nodes.jinja2 | 22 - crds/infra.kuid.dev_nodes.star | 59 -- crds/infra.kuid.dev_nodes.yaml | 157 ----- crds/infra.kuid.dev_nodesets.yaml | 172 ----- crds/infra.kuid.dev_partitions.yaml | 100 --- crds/infra.kuid.dev_ports.yaml | 153 +++++ crds/infra.kuid.dev_racks.yaml | 132 ---- crds/infra.kuid.dev_regions.yaml | 103 --- crds/infra.kuid.dev_sites.yaml | 126 ---- .../versioned/typed/infra/v1alpha1/adaptor.go | 68 ++ .../typed/infra/v1alpha1/fake/fake_adaptor.go | 146 +++++ .../infra/v1alpha1/fake/fake_infra_client.go | 8 + .../typed/infra/v1alpha1/fake/fake_port.go | 146 +++++ .../infra/v1alpha1/generated_expansion.go | 4 + .../typed/infra/v1alpha1/infra_client.go | 10 + .../versioned/typed/infra/v1alpha1/port.go | 68 ++ .../informers/externalversions/generic.go | 4 + .../infra/v1alpha1/adaptor.go | 89 +++ .../infra/v1alpha1/interface.go | 14 + .../externalversions/infra/v1alpha1/port.go | 89 +++ .../listers/infra/v1alpha1/adaptor.go | 69 ++ .../infra/v1alpha1/expansion_generated.go | 16 + pkg/generated/listers/infra/v1alpha1/port.go | 69 ++ pkg/generated/openapi/zz_generated.openapi.go | 603 +++++++++++++++--- 68 files changed, 3691 insertions(+), 2227 deletions(-) create mode 100644 apis/infra/adaptor_helper.go create mode 100644 apis/infra/adaptor_resource.go create mode 100644 apis/infra/adaptor_types.go create mode 100644 apis/infra/port_helper.go create mode 100644 apis/infra/port_resource.go create mode 100644 apis/infra/port_types.go create mode 100644 apis/infra/v1alpha1/adaptor_resource.go create mode 100644 apis/infra/v1alpha1/adaptor_types.go create mode 100644 apis/infra/v1alpha1/port_resource.go create mode 100644 apis/infra/v1alpha1/port_types.go create mode 100644 crds/infra.kuid.dev_adaptors.yaml delete mode 100644 crds/infra.kuid.dev_nodes.jinja2 delete mode 100644 crds/infra.kuid.dev_nodes.star create mode 100644 crds/infra.kuid.dev_ports.yaml create mode 100644 pkg/generated/clientset/versioned/typed/infra/v1alpha1/adaptor.go create mode 100644 pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_adaptor.go create mode 100644 pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_port.go create mode 100644 pkg/generated/clientset/versioned/typed/infra/v1alpha1/port.go create mode 100644 pkg/generated/informers/externalversions/infra/v1alpha1/adaptor.go create mode 100644 pkg/generated/informers/externalversions/infra/v1alpha1/port.go create mode 100644 pkg/generated/listers/infra/v1alpha1/adaptor.go create mode 100644 pkg/generated/listers/infra/v1alpha1/port.go diff --git a/.gitignore b/.gitignore index 8915da6..ec34054 100644 --- a/.gitignore +++ b/.gitignore @@ -21,4 +21,5 @@ dist # Go workspace file go.work -vendor \ No newline at end of file +vendor +db \ No newline at end of file diff --git a/apis/id/id.go b/apis/id/id.go index 3f0a628..7d7f5df 100644 --- a/apis/id/id.go +++ b/apis/id/id.go @@ -38,8 +38,8 @@ type PartitionNodeID struct { Node string `json:"node" yaml:"node" protobuf:"bytes,3,opt,name=node"` } -type PortID struct { - NodeID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=nodeID"` +type PartitionPortID struct { + PartitionNodeID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=nodeID"` // ModuleBay defines the moduleBay reference id ModuleBay *int `json:"moduleBay,omitempty" yaml:"moduleBay,omitempty" protobuf:"bytes,2,opt,name=moduleBay"` // Module defines the module reference id @@ -48,14 +48,8 @@ type PortID struct { Port int `json:"port" yaml:"port" protobuf:"bytes,4,opt,name=port"` } -type AdaptorID struct { - NodeID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=nodeID"` - // ModuleBay defines the moduleBay reference id - ModuleBay *int `json:"moduleBay,omitempty" yaml:"moduleBay,omitempty" protobuf:"bytes,2,opt,name=moduleBay"` - // Module defines the module reference id - Module *int `json:"module,omitempty" yaml:"module,omitempty" protobuf:"bytes,3,opt,name=module"` - // Port defines the id of the port - Port int `json:"port" yaml:"port" protobuf:"bytes,4,opt,name=port"` +type PartitionAdaptorID struct { + PartitionPortID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=nodeID"` // Adaptor defines the name of the adaptor Adaptor string `json:"adaptor" yaml:"adaptor" protobuf:"bytes,5,opt,name=adaptor"` } diff --git a/apis/id/v1alpha1/id.go b/apis/id/v1alpha1/id.go index c785185..45cb921 100644 --- a/apis/id/v1alpha1/id.go +++ b/apis/id/v1alpha1/id.go @@ -38,8 +38,8 @@ type PartitionNodeID struct { Node string `json:"node" yaml:"node" protobuf:"bytes,3,opt,name=node"` } -type PortID struct { - NodeID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=nodeID"` +type PartitionPortID struct { + PartitionNodeID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=nodeID"` // ModuleBay defines the moduleBay reference id ModuleBay *int `json:"moduleBay,omitempty" yaml:"moduleBay,omitempty" protobuf:"bytes,2,opt,name=moduleBay"` // Module defines the module reference id @@ -48,15 +48,9 @@ type PortID struct { Port int `json:"port" yaml:"port" protobuf:"bytes,4,opt,name=port"` } -type AdaptorID struct { - NodeID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=nodeID"` - // ModuleBay defines the moduleBay reference id - ModuleBay *int `json:"moduleBay,omitempty" yaml:"moduleBay,omitempty" protobuf:"bytes,2,opt,name=moduleBay"` - // Module defines the module reference id - Module *int `json:"module,omitempty" yaml:"module,omitempty" protobuf:"bytes,3,opt,name=module"` - // Port defines the id of the port - Port int `json:"port" yaml:"port" protobuf:"bytes,4,opt,name=port"` - //Adaptor defines the adaptor used in the port, like an sfp, qsfp +type PartitionAdaptorID struct { + PartitionPortID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=nodeID"` + // Adaptor defines the name of the adaptor Adaptor string `json:"adaptor" yaml:"adaptor" protobuf:"bytes,5,opt,name=adaptor"` } diff --git a/apis/id/v1alpha1/zz_generated.deepcopy.go b/apis/id/v1alpha1/zz_generated.deepcopy.go index 42a5b4a..8c76c2e 100644 --- a/apis/id/v1alpha1/zz_generated.deepcopy.go +++ b/apis/id/v1alpha1/zz_generated.deepcopy.go @@ -20,33 +20,6 @@ limitations under the License. package v1alpha1 -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AdaptorID) DeepCopyInto(out *AdaptorID) { - *out = *in - out.NodeID = in.NodeID - if in.ModuleBay != nil { - in, out := &in.ModuleBay, &out.ModuleBay - *out = new(int) - **out = **in - } - if in.Module != nil { - in, out := &in.Module, &out.Module - *out = new(int) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AdaptorID. -func (in *AdaptorID) DeepCopy() *AdaptorID { - if in == nil { - return nil - } - out := new(AdaptorID) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClusterID) DeepCopyInto(out *ClusterID) { *out = *in @@ -108,6 +81,23 @@ func (in *NodeID) DeepCopy() *NodeID { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PartitionAdaptorID) DeepCopyInto(out *PartitionAdaptorID) { + *out = *in + in.PartitionPortID.DeepCopyInto(&out.PartitionPortID) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PartitionAdaptorID. +func (in *PartitionAdaptorID) DeepCopy() *PartitionAdaptorID { + if in == nil { + return nil + } + out := new(PartitionAdaptorID) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PartitionAttachmentID) DeepCopyInto(out *PartitionAttachmentID) { *out = *in @@ -212,9 +202,9 @@ func (in *PartitionNodeID) DeepCopy() *PartitionNodeID { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PortID) DeepCopyInto(out *PortID) { +func (in *PartitionPortID) DeepCopyInto(out *PartitionPortID) { *out = *in - out.NodeID = in.NodeID + out.PartitionNodeID = in.PartitionNodeID if in.ModuleBay != nil { in, out := &in.ModuleBay, &out.ModuleBay *out = new(int) @@ -228,12 +218,12 @@ func (in *PortID) DeepCopyInto(out *PortID) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PortID. -func (in *PortID) DeepCopy() *PortID { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PartitionPortID. +func (in *PartitionPortID) DeepCopy() *PartitionPortID { if in == nil { return nil } - out := new(PortID) + out := new(PartitionPortID) in.DeepCopyInto(out) return out } diff --git a/apis/id/zz_generated.deepcopy.go b/apis/id/zz_generated.deepcopy.go index ad07374..6dbd370 100644 --- a/apis/id/zz_generated.deepcopy.go +++ b/apis/id/zz_generated.deepcopy.go @@ -20,33 +20,6 @@ limitations under the License. package id -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AdaptorID) DeepCopyInto(out *AdaptorID) { - *out = *in - out.NodeID = in.NodeID - if in.ModuleBay != nil { - in, out := &in.ModuleBay, &out.ModuleBay - *out = new(int) - **out = **in - } - if in.Module != nil { - in, out := &in.Module, &out.Module - *out = new(int) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AdaptorID. -func (in *AdaptorID) DeepCopy() *AdaptorID { - if in == nil { - return nil - } - out := new(AdaptorID) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClusterID) DeepCopyInto(out *ClusterID) { *out = *in @@ -108,6 +81,23 @@ func (in *NodeID) DeepCopy() *NodeID { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PartitionAdaptorID) DeepCopyInto(out *PartitionAdaptorID) { + *out = *in + in.PartitionPortID.DeepCopyInto(&out.PartitionPortID) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PartitionAdaptorID. +func (in *PartitionAdaptorID) DeepCopy() *PartitionAdaptorID { + if in == nil { + return nil + } + out := new(PartitionAdaptorID) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PartitionAttachmentID) DeepCopyInto(out *PartitionAttachmentID) { *out = *in @@ -212,9 +202,9 @@ func (in *PartitionNodeID) DeepCopy() *PartitionNodeID { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PortID) DeepCopyInto(out *PortID) { +func (in *PartitionPortID) DeepCopyInto(out *PartitionPortID) { *out = *in - out.NodeID = in.NodeID + out.PartitionNodeID = in.PartitionNodeID if in.ModuleBay != nil { in, out := &in.ModuleBay, &out.ModuleBay *out = new(int) @@ -228,12 +218,12 @@ func (in *PortID) DeepCopyInto(out *PortID) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PortID. -func (in *PortID) DeepCopy() *PortID { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PartitionPortID. +func (in *PartitionPortID) DeepCopy() *PartitionPortID { if in == nil { return nil } - out := new(PortID) + out := new(PartitionPortID) in.DeepCopyInto(out) return out } diff --git a/apis/infra/adaptor_helper.go b/apis/infra/adaptor_helper.go new file mode 100644 index 0000000..2e96209 --- /dev/null +++ b/apis/infra/adaptor_helper.go @@ -0,0 +1,32 @@ +/* +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 infra + +import ( + "github.com/kform-dev/choreo/apis/condition" +) + +// GetCondition returns the condition based on the condition kind +func (r *Adaptor) GetCondition(t condition.ConditionType) condition.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 *Adaptor) SetConditions(c ...condition.Condition) { + r.Status.SetConditions(c...) +} diff --git a/apis/infra/adaptor_resource.go b/apis/infra/adaptor_resource.go new file mode 100644 index 0000000..e499056 --- /dev/null +++ b/apis/infra/adaptor_resource.go @@ -0,0 +1,312 @@ +/* +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 infra + +import ( + "context" + "fmt" + + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-store/pkg/generic/registry" + "github.com/kform-dev/choreo/apis/condition" + apiequality "k8s.io/apimachinery/pkg/api/equality" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/selection" + "k8s.io/apimachinery/pkg/util/validation/field" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/apiserver/pkg/registry/rest" +) + +const ( + AdaptorPlural = "adaptors" + AdaptorSingular = "adaptor" +) + +var ( + AdaptorShortNames = []string{} + AdaptorCategories = []string{"kuid", "knet"} +) + +// +k8s:deepcopy-gen=false +var _ resource.InternalObject = &Adaptor{} +var _ resource.ObjectList = &AdaptorList{} +var _ resource.ObjectWithStatusSubResource = &Adaptor{} +var _ resource.StatusSubResource = &AdaptorStatus{} + +func (Adaptor) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: AdaptorPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (Adaptor) IsStorageVersion() bool { + return true +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (Adaptor) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *Adaptor) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// GetSingularName returns the singular name of the resource +// GetSingularName implements resource.Object +func (Adaptor) GetSingularName() string { + return AdaptorSingular +} + +// GetShortNames returns the shortnames for the resource +// GetShortNames implements resource.Object +func (Adaptor) GetShortNames() []string { + return AdaptorShortNames +} + +// GetCategories return the categories of the resource +// GetCategories implements resource.Object +func (Adaptor) GetCategories() []string { + return AdaptorCategories +} + +// New return an empty resource +// New implements resource.Object +func (Adaptor) New() runtime.Object { + return &Adaptor{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (Adaptor) NewList() runtime.Object { + return &AdaptorList{} +} + +// IsEqual returns a bool indicating if the desired state of both resources is equal or not +func (r *Adaptor) IsEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*Adaptor) + oldobj := old.(*Adaptor) + + if !apiequality.Semantic.DeepEqual(oldobj.ObjectMeta, newobj.ObjectMeta) { + return false + } + // if equal we also test the spec + return apiequality.Semantic.DeepEqual(oldobj.Spec, newobj.Spec) +} + +// GetStatus return the resource.StatusSubResource interface +func (r *Adaptor) GetStatus() resource.StatusSubResource { + return r.Status +} + +// IsStatusEqual returns a bool indicating if the status of both resources is equal or not +func (r *Adaptor) IsStatusEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*Adaptor) + oldobj := old.(*Adaptor) + return apiequality.Semantic.DeepEqual(oldobj.Status, newobj.Status) +} + +// PrepareForStatusUpdate prepares the status update +func (r *Adaptor) PrepareForStatusUpdate(ctx context.Context, obj, old runtime.Object) { + newObj := obj.(*Adaptor) + oldObj := old.(*Adaptor) + newObj.Spec = oldObj.Spec + + // Status updates are for only for updating status, not objectmeta. + metav1.ResetObjectMetaForStatus(&newObj.ObjectMeta, &newObj.ObjectMeta) +} + +// ValidateStatusUpdate validates status updates +func (r *Adaptor) ValidateStatusUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +// SubResourceName resturns the name of the subresource +// SubResourceName implements the resource.StatusSubResource +func (AdaptorStatus) SubResourceName() string { + return fmt.Sprintf("%s/%s", AdaptorPlural, "status") +} + +// CopyTo copies the content of the status subresource to a parent resource. +// CopyTo implements the resource.StatusSubResource +func (r AdaptorStatus) CopyTo(obj resource.ObjectWithStatusSubResource) { + parent, ok := obj.(*Adaptor) + if ok { + parent.Status = r + } +} + +// GetListMeta returns the ListMeta +// GetListMeta implements the resource.ObjectList +func (r *AdaptorList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// TableConvertor return the table format of the resource +func (r *Adaptor) TableConvertor() func(gr schema.GroupResource) rest.TableConvertor { + return func(gr schema.GroupResource) rest.TableConvertor { + return registry.NewTableConverter( + gr, + func(obj runtime.Object) []interface{} { + claim, ok := obj.(*Adaptor) + if !ok { + return nil + } + return []interface{}{ + claim.GetName(), + claim.GetCondition(condition.ConditionTypeReady).Status, + } + }, + []metav1.TableColumnDefinition{ + {Name: "Name", Type: "string"}, + {Name: "Ready", Type: "string"}, + }, + ) + } +} + +// FieldLabelConversion is the schema conversion function for normalizing the FieldSelector for the resource +func (r *Adaptor) FieldLabelConversion() runtime.FieldLabelConversionFunc { + return func(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 *Adaptor) FieldSelector() func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + return func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + var filter *AdaptorFilter + + // add the namespace to the list + namespace, ok := genericapirequest.NamespaceFrom(ctx) + if fieldSelector == nil { + if ok { + return &AdaptorFilter{Namespace: namespace}, nil + } + return filter, nil + } + requirements := fieldSelector.Requirements() + for _, requirement := range requirements { + filter = &AdaptorFilter{} + switch requirement.Operator { + case selection.Equals, selection.DoesNotExist: + if requirement.Value == "" { + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupAdaptored fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) + } + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupAdaptored fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) + } + + switch requirement.Field { + case "metadata.name": + filter.Name = requirement.Value + case "metadata.namespace": + filter.Namespace = requirement.Value + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) + } + } + // add namespace to the filter selector if specified + if ok { + if filter != nil { + filter.Namespace = namespace + } else { + filter = &AdaptorFilter{Namespace: namespace} + } + return filter, nil + } + + return &AdaptorFilter{}, nil + } + +} + +type AdaptorFilter struct { + // Name filters by the name of the objects + Name string `protobuf:"bytes,1,opt,name=name"` + + // Namespace filters by the namespace of the objects + Namespace string `protobuf:"bytes,2,opt,name=namespace"` +} + +func (r *AdaptorFilter) Filter(ctx context.Context, obj runtime.Object) bool { + f := false // result of the previous filter + o, ok := obj.(*Adaptor) + if !ok { + return f + } + if r == nil { + return false + } + if r.Name != "" { + if o.GetName() == r.Name { + f = false + } else { + f = true + } + } + if r.Namespace != "" { + if o.GetNamespace() == r.Namespace { + f = false + } else { + f = true + } + } + return f +} + +func (r *Adaptor) PrepareForCreate(ctx context.Context, obj runtime.Object) { + // status cannot be set upon create -> reset it + newobj := obj.(*Adaptor) + newobj.Status = AdaptorStatus{} +} + +// ValidateCreate statically validates +func (r *Adaptor) ValidateCreate(ctx context.Context, obj runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +func (r *Adaptor) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) { + // ensure the status dont get updated + newobj := obj.(*Adaptor) + oldObj := old.(*Adaptor) + newobj.Status = oldObj.Status +} + +func (r *Adaptor) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} diff --git a/apis/infra/adaptor_types.go b/apis/infra/adaptor_types.go new file mode 100644 index 0000000..7d33dd8 --- /dev/null +++ b/apis/infra/adaptor_types.go @@ -0,0 +1,72 @@ +/* +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 infra + +import ( + "reflect" + + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/id" + "github.com/kuidio/kuid/apis/common" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// AdaptorSpec defines the desired state of Adaptor +type AdaptorSpec struct { + // PartitionAdaptorID the Adaptor identity this resource belongs to + id.PartitionAdaptorID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=partitionAdaptorID"` + // UserDefinedLabels define metadata to the resource. + // defined in the spec to distingiush metadata labels from user defined labels + common.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=userDefinedLabels"` +} + +// AdaptorStatus defines the observed state of Adaptor +type AdaptorStatus struct { + // ConditionedStatus provides the status of the IPClain using conditions + // - a ready condition indicates the overall status of the resource + condition.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:skipversion +// An Adaptor represents a communication interface or connection point within a Node, +// facilitating network communication and data transfer between different components +// or systems within the environment. `Adaptors` serve as gateways for transmitting and +// receiving data, enabling seamless communication between Nodes. +type Adaptor struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec AdaptorSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status AdaptorStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:skipversion +// AdaptorList contains a list of Adaptors +type AdaptorList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []Adaptor `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + AdaptorKind = reflect.TypeOf(Adaptor{}).Name() + AdaptorKindList = reflect.TypeOf(AdaptorList{}).Name() +) diff --git a/apis/infra/cluster_types.go b/apis/infra/cluster_types.go index 9dbf0b0..a084a06 100644 --- a/apis/infra/cluster_types.go +++ b/apis/infra/cluster_types.go @@ -51,6 +51,7 @@ type ClusterStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:skipversion // A Cluster represents a kubernetes cluster and is typically used as a nodeGroup identifier. type Cluster struct { metav1.TypeMeta `json:",inline" yaml:",inline"` @@ -62,6 +63,7 @@ type Cluster struct { // ClusterList contains a list of Clusters // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:skipversion type ClusterList struct { metav1.TypeMeta `json:",inline" yaml:",inline"` metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/apis/infra/doc.go b/apis/infra/doc.go index 3cf0322..a199eec 100644 --- a/apis/infra/doc.go +++ b/apis/infra/doc.go @@ -16,6 +16,7 @@ limitations under the License. // +k8s:deepcopy-gen=package,register // +groupName=infra.kuid.dev +// +kubebuilder:skipversion // Package infra is the internal version of the API. package infra // import "github.com/kuidio/kuid/apis/infra" \ No newline at end of file diff --git a/apis/infra/endpoint_types.go b/apis/infra/endpoint_types.go index 489c1f7..fd0f701 100644 --- a/apis/infra/endpoint_types.go +++ b/apis/infra/endpoint_types.go @@ -50,7 +50,7 @@ type EndpointStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:skipversion // An Endpoint represents a communication interface or connection point within a Node, // facilitating network communication and data transfer between different components // or systems within the environment. `Endpoints` serve as gateways for transmitting and @@ -65,6 +65,7 @@ type Endpoint struct { // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:skipversion // EndpointList contains a list of Endpoints type EndpointList struct { metav1.TypeMeta `json:",inline" yaml:",inline"` diff --git a/apis/infra/endpointset_types.go b/apis/infra/endpointset_types.go index 35bf4cc..1a2bbfa 100644 --- a/apis/infra/endpointset_types.go +++ b/apis/infra/endpointset_types.go @@ -58,7 +58,7 @@ type EndpointSetStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:skipversion // A EndpointSet represents a set of endpoints that belong together within a nodeGroup. // E.g. it can be used to model a logical Link Aggregation group within // a node or it can be used to represent a logical multi-homing construction @@ -71,8 +71,9 @@ type EndpointSet struct { Status EndpointSetStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` } -// EndpointSetList contains a list of EndpointSets // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:skipversion +// EndpointSetList contains a list of EndpointSets type EndpointSetList struct { metav1.TypeMeta `json:",inline" yaml:",inline"` metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/apis/infra/link_types.go b/apis/infra/link_types.go index 3bc224e..6975565 100644 --- a/apis/infra/link_types.go +++ b/apis/infra/link_types.go @@ -27,6 +27,8 @@ import ( // LinkSpec defines the desired state of Link type LinkSpec struct { + // +kubebuilder:storageversion + // Endpoints define the 2 endpoint identifiers of the link // Can only have 2 endpoints Endpoints []*id.PartitionEndpointID `json:"endpoints" yaml:"endpoints" protobuf:"bytes,1,opt,name=endpoints"` @@ -56,7 +58,7 @@ type LinkStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:skipversion // A link represents a physical/logical connection that enables communication and data transfer // between 2 endpoints of a node. type Link struct { @@ -67,8 +69,9 @@ type Link struct { Status LinkStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` } -// LinkList contains a list of Links // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:skipversion +// LinkList contains a list of Links type LinkList struct { metav1.TypeMeta `json:",inline" yaml:",inline"` metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/apis/infra/linkset_types.go b/apis/infra/linkset_types.go index 147d473..6673754 100644 --- a/apis/infra/linkset_types.go +++ b/apis/infra/linkset_types.go @@ -50,7 +50,7 @@ type LinkSetStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:skipversion // A linkSet represents a set of links that belong together within a node group or accross nodeGroups. // E.g. it can be used to model a logical Link Aggregation group between 2 nodes or // it can be used to represent a logical multi-homing construction between a set of nodes @@ -63,8 +63,9 @@ type LinkSet struct { Status LinkSetStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` } -// LinkSetList contains a list of LinkSets // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:skipversion +// LinkSetList contains a list of LinkSets type LinkSetList struct { metav1.TypeMeta `json:",inline" yaml:",inline"` metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/apis/infra/module_types.go b/apis/infra/module_types.go index cc083ed..f5091f4 100644 --- a/apis/infra/module_types.go +++ b/apis/infra/module_types.go @@ -45,6 +45,7 @@ type ModuleStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:skipversion // A module refers to a hardware component or expansion module that can be installed within a ModuleBay of a Node. // Modules provide additional functionality and capabilities to the infrastructure environment, @@ -59,6 +60,8 @@ type Module struct { // ModuleList contains a list of Modules // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:skipversion + type ModuleList struct { metav1.TypeMeta `json:",inline" yaml:",inline"` metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/apis/infra/modulebay_types.go b/apis/infra/modulebay_types.go index 6db48bd..e215f28 100644 --- a/apis/infra/modulebay_types.go +++ b/apis/infra/modulebay_types.go @@ -45,6 +45,7 @@ type ModuleBayStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:skipversion // A ModuleBay serves as a modular slot or enclosure within a Node, designed to accommodate additional modules. // ModuleBays provide a flexible and scalable approach to extending the capabilities of Nodes, @@ -59,6 +60,8 @@ type ModuleBay struct { // ModuleBayList contains a list of ModuleBays // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:skipversion + type ModuleBayList struct { metav1.TypeMeta `json:",inline" yaml:",inline"` metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/apis/infra/node_types.go b/apis/infra/node_types.go index f216c99..93d654e 100644 --- a/apis/infra/node_types.go +++ b/apis/infra/node_types.go @@ -67,7 +67,7 @@ type NodeStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:skipversion // A Node represents a fundamental unit that implements compute, storage, and/or networking within your environment. // Nodes can embody physical, virtual, or containerized entities, offering versatility in deployment options to suit // diverse infrastructure requirements. @@ -85,6 +85,7 @@ type Node struct { // NodeList contains a list of Nodes // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:skipversion type NodeList struct { metav1.TypeMeta `json:",inline" yaml:",inline"` metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/apis/infra/nodeitem_types.go b/apis/infra/nodeitem_types.go index f517e8d..e6e5363 100644 --- a/apis/infra/nodeitem_types.go +++ b/apis/infra/nodeitem_types.go @@ -43,7 +43,7 @@ type NodeItemStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:skipversion // A NodeItem represents a specific hardware component or accessory associated with a Node. // NodeItems represent a wide range of hardware elements, e.g Fan(s), PowerUnit(s), CPU(s), // and other peripheral devices essential for the operation of the Node. diff --git a/apis/infra/nodeset_types.go b/apis/infra/nodeset_types.go index c5a79fa..7dc8c41 100644 --- a/apis/infra/nodeset_types.go +++ b/apis/infra/nodeset_types.go @@ -44,7 +44,7 @@ type NodeSetStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:skipversion // A NodeSet represents a set of nodes. // E.g. it can be used to model a set of nodes in a NodeSet that share the same // charecteristics wrt, Numa, interfaces, etc. @@ -59,6 +59,7 @@ type NodeSet struct { // NodeSetList contains a list of NodeSets // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:skipversion type NodeSetList struct { metav1.TypeMeta `json:",inline" yaml:",inline"` metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/apis/infra/partition_types.go b/apis/infra/partition_types.go index 7afabe9..be95d5f 100644 --- a/apis/infra/partition_types.go +++ b/apis/infra/partition_types.go @@ -40,6 +40,7 @@ type PartitionStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:skipversion type Partition struct { metav1.TypeMeta `json:",inline" yaml:",inline"` metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -50,6 +51,7 @@ type Partition struct { // PartitionList contains a list of Partitions // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:skipversion type PartitionList struct { metav1.TypeMeta `json:",inline" yaml:",inline"` metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/apis/infra/port_helper.go b/apis/infra/port_helper.go new file mode 100644 index 0000000..dc657e6 --- /dev/null +++ b/apis/infra/port_helper.go @@ -0,0 +1,32 @@ +/* +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 infra + +import ( + "github.com/kform-dev/choreo/apis/condition" +) + +// GetCondition returns the condition based on the condition kind +func (r *Port) GetCondition(t condition.ConditionType) condition.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 *Port) SetConditions(c ...condition.Condition) { + r.Status.SetConditions(c...) +} diff --git a/apis/infra/port_resource.go b/apis/infra/port_resource.go new file mode 100644 index 0000000..688b3ca --- /dev/null +++ b/apis/infra/port_resource.go @@ -0,0 +1,312 @@ +/* +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 infra + +import ( + "context" + "fmt" + + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/henderiw/apiserver-store/pkg/generic/registry" + "github.com/kform-dev/choreo/apis/condition" + apiequality "k8s.io/apimachinery/pkg/api/equality" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/selection" + "k8s.io/apimachinery/pkg/util/validation/field" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/apiserver/pkg/registry/rest" +) + +const ( + PortPlural = "ports" + PortSingular = "port" +) + +var ( + PortShortNames = []string{} + PortCategories = []string{"kuid", "knet"} +) + +// +k8s:deepcopy-gen=false +var _ resource.InternalObject = &Port{} +var _ resource.ObjectList = &PortList{} +var _ resource.ObjectWithStatusSubResource = &Port{} +var _ resource.StatusSubResource = &PortStatus{} + +func (Port) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: PortPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (Port) IsStorageVersion() bool { + return true +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (Port) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *Port) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// GetSingularName returns the singular name of the resource +// GetSingularName implements resource.Object +func (Port) GetSingularName() string { + return PortSingular +} + +// GetShortNames returns the shortnames for the resource +// GetShortNames implements resource.Object +func (Port) GetShortNames() []string { + return PortShortNames +} + +// GetCategories return the categories of the resource +// GetCategories implements resource.Object +func (Port) GetCategories() []string { + return PortCategories +} + +// New return an empty resource +// New implements resource.Object +func (Port) New() runtime.Object { + return &Port{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (Port) NewList() runtime.Object { + return &PortList{} +} + +// IsEqual returns a bool indicating if the desired state of both resources is equal or not +func (r *Port) IsEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*Port) + oldobj := old.(*Port) + + if !apiequality.Semantic.DeepEqual(oldobj.ObjectMeta, newobj.ObjectMeta) { + return false + } + // if equal we also test the spec + return apiequality.Semantic.DeepEqual(oldobj.Spec, newobj.Spec) +} + +// GetStatus return the resource.StatusSubResource interface +func (r *Port) GetStatus() resource.StatusSubResource { + return r.Status +} + +// IsStatusEqual returns a bool indicating if the status of both resources is equal or not +func (r *Port) IsStatusEqual(ctx context.Context, obj, old runtime.Object) bool { + newobj := obj.(*Port) + oldobj := old.(*Port) + return apiequality.Semantic.DeepEqual(oldobj.Status, newobj.Status) +} + +// PrepareForStatusUpdate prepares the status update +func (r *Port) PrepareForStatusUpdate(ctx context.Context, obj, old runtime.Object) { + newObj := obj.(*Port) + oldObj := old.(*Port) + newObj.Spec = oldObj.Spec + + // Status updates are for only for updating status, not objectmeta. + metav1.ResetObjectMetaForStatus(&newObj.ObjectMeta, &newObj.ObjectMeta) +} + +// ValidateStatusUpdate validates status updates +func (r *Port) ValidateStatusUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +// SubResourceName resturns the name of the subresource +// SubResourceName implements the resource.StatusSubResource +func (PortStatus) SubResourceName() string { + return fmt.Sprintf("%s/%s", PortPlural, "status") +} + +// CopyTo copies the content of the status subresource to a parent resource. +// CopyTo implements the resource.StatusSubResource +func (r PortStatus) CopyTo(obj resource.ObjectWithStatusSubResource) { + parent, ok := obj.(*Port) + if ok { + parent.Status = r + } +} + +// GetListMeta returns the ListMeta +// GetListMeta implements the resource.ObjectList +func (r *PortList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// TableConvertor return the table format of the resource +func (r *Port) TableConvertor() func(gr schema.GroupResource) rest.TableConvertor { + return func(gr schema.GroupResource) rest.TableConvertor { + return registry.NewTableConverter( + gr, + func(obj runtime.Object) []interface{} { + claim, ok := obj.(*Port) + if !ok { + return nil + } + return []interface{}{ + claim.GetName(), + claim.GetCondition(condition.ConditionTypeReady).Status, + } + }, + []metav1.TableColumnDefinition{ + {Name: "Name", Type: "string"}, + {Name: "Ready", Type: "string"}, + }, + ) + } +} + +// FieldLabelConversion is the schema conversion function for normalizing the FieldSelector for the resource +func (r *Port) FieldLabelConversion() runtime.FieldLabelConversionFunc { + return func(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 *Port) FieldSelector() func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + return func(ctx context.Context, fieldSelector fields.Selector) (resource.Filter, error) { + var filter *PortFilter + + // add the namespace to the list + namespace, ok := genericapirequest.NamespaceFrom(ctx) + if fieldSelector == nil { + if ok { + return &PortFilter{Namespace: namespace}, nil + } + return filter, nil + } + requirements := fieldSelector.Requirements() + for _, requirement := range requirements { + filter = &PortFilter{} + switch requirement.Operator { + case selection.Equals, selection.DoesNotExist: + if requirement.Value == "" { + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector value %q for field %q with operator %q", requirement.Value, requirement.Field, requirement.Operator)) + } + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unsupported fieldSelector operator %q for field %q", requirement.Operator, requirement.Field)) + } + + switch requirement.Field { + case "metadata.name": + filter.Name = requirement.Value + case "metadata.namespace": + filter.Namespace = requirement.Value + default: + return filter, apierrors.NewBadRequest(fmt.Sprintf("unknown fieldSelector field %q", requirement.Field)) + } + } + // add namespace to the filter selector if specified + if ok { + if filter != nil { + filter.Namespace = namespace + } else { + filter = &PortFilter{Namespace: namespace} + } + return filter, nil + } + + return &PortFilter{}, nil + } + +} + +type PortFilter struct { + // Name filters by the name of the objects + Name string `protobuf:"bytes,1,opt,name=name"` + + // Namespace filters by the namespace of the objects + Namespace string `protobuf:"bytes,2,opt,name=namespace"` +} + +func (r *PortFilter) Filter(ctx context.Context, obj runtime.Object) bool { + f := false // result of the previous filter + o, ok := obj.(*Port) + if !ok { + return f + } + if r == nil { + return false + } + if r.Name != "" { + if o.GetName() == r.Name { + f = false + } else { + f = true + } + } + if r.Namespace != "" { + if o.GetNamespace() == r.Namespace { + f = false + } else { + f = true + } + } + return f +} + +func (r *Port) PrepareForCreate(ctx context.Context, obj runtime.Object) { + // status cannot be set upon create -> reset it + newobj := obj.(*Port) + newobj.Status = PortStatus{} +} + +// ValidateCreate statically validates +func (r *Port) ValidateCreate(ctx context.Context, obj runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} + +func (r *Port) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) { + // ensure the status dont get updated + newobj := obj.(*Port) + oldObj := old.(*Port) + newobj.Status = oldObj.Status +} + +func (r *Port) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + var allErrs field.ErrorList + return allErrs +} diff --git a/apis/infra/port_types.go b/apis/infra/port_types.go new file mode 100644 index 0000000..c3fc3be --- /dev/null +++ b/apis/infra/port_types.go @@ -0,0 +1,72 @@ +/* +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 infra + +import ( + "reflect" + + "github.com/kform-dev/choreo/apis/condition" + "github.com/kuidio/kuid/apis/id" + "github.com/kuidio/kuid/apis/common" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// PortSpec defines the desired state of Port +type PortSpec struct { + // PartitionPortID the Port identity this resource belongs to + id.PartitionPortID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=partitionPortID"` + // UserDefinedLabels define metadata to the resource. + // defined in the spec to distingiush metadata labels from user defined labels + common.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=userDefinedLabels"` +} + +// PortStatus defines the observed state of Port +type PortStatus struct { + // ConditionedStatus provides the status of the IPClain using conditions + // - a ready condition indicates the overall status of the resource + condition.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:skipversion +// An Port represents a communication interface or connection point within a Node, +// facilitating network communication and data transfer between different components +// or systems within the environment. `Ports` serve as gateways for transmitting and +// receiving data, enabling seamless communication between Nodes. +type Port struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec PortSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status PortStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:skipversion +// PortList contains a list of Ports +type PortList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []Port `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + PortKind = reflect.TypeOf(Port{}).Name() + PortKindList = reflect.TypeOf(PortList{}).Name() +) diff --git a/apis/infra/rack_types.go b/apis/infra/rack_types.go index f61544e..5ddf026 100644 --- a/apis/infra/rack_types.go +++ b/apis/infra/rack_types.go @@ -50,7 +50,7 @@ type RackStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:skipversion // A rack represents a physical equipment rack within your environment. Each rack is designed to accommodate // the installation of devices and equipment. type Rack struct { @@ -63,6 +63,7 @@ type Rack struct { // RackList contains a list of Racks // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:skipversion type RackList struct { metav1.TypeMeta `json:",inline" yaml:",inline"` metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/apis/infra/region_types.go b/apis/infra/region_types.go index 1ad5b84..9179ac9 100644 --- a/apis/infra/region_types.go +++ b/apis/infra/region_types.go @@ -40,7 +40,7 @@ type RegionStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:skipversion // A Region represent a geography in which multiple infrastructure resources are grouped // A Region might represent a continent, country, city, campus, or other area depending on your environment. type Region struct { @@ -53,6 +53,7 @@ type Region struct { // RegionList contains a list of Regions // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:skipversion type RegionList struct { metav1.TypeMeta `json:",inline" yaml:",inline"` metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/apis/infra/site_types.go b/apis/infra/site_types.go index b8ec265..aef19cc 100644 --- a/apis/infra/site_types.go +++ b/apis/infra/site_types.go @@ -46,7 +46,7 @@ type SiteStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:skipversion // A site serves as a fundamental organizational unit for managing infrastructure resources within your environment. // The utilization of sites may vary based on the organizational structure and requirements, // but in essence, each site typically corresponds to a distinct building or campus. @@ -61,6 +61,7 @@ type Site struct { // SiteList contains a list of Sites // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:skipversion type SiteList struct { metav1.TypeMeta `json:",inline" yaml:",inline"` metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/apis/infra/v1alpha1/adaptor_resource.go b/apis/infra/v1alpha1/adaptor_resource.go new file mode 100644 index 0000000..ad3a9c8 --- /dev/null +++ b/apis/infra/v1alpha1/adaptor_resource.go @@ -0,0 +1,80 @@ +/* +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 ( + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/kuidio/kuid/apis/infra" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// +k8s:deepcopy-gen=false +var _ resource.Object = &Adaptor{} +var _ resource.ObjectList = &AdaptorList{} +var _ resource.MultiVersionObject = &Adaptor{} + +func (Adaptor) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: infra.AdaptorPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (Adaptor) IsStorageVersion() bool { + return false +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (Adaptor) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *Adaptor) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// New return an empty resource +// New implements resource.Object +func (Adaptor) New() runtime.Object { + return &Adaptor{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (Adaptor) NewList() runtime.Object { + return &AdaptorList{} +} + +// GetListMeta returns the ListMeta +// GetListMeta implements resource.ObjectList +func (r *AdaptorList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// RegisterConversions registers the conversions. +// RegisterConversions implements resource.MultiVersionObject +func (Adaptor) RegisterConversions() func(s *runtime.Scheme) error { + return RegisterConversions +} diff --git a/apis/infra/v1alpha1/adaptor_types.go b/apis/infra/v1alpha1/adaptor_types.go new file mode 100644 index 0000000..08c080d --- /dev/null +++ b/apis/infra/v1alpha1/adaptor_types.go @@ -0,0 +1,74 @@ +/* +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 ( + "reflect" + + condv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" + commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" + idv1alpha1 "github.com/kuidio/kuid/apis/id/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// AdaptorSpec defines the desired state of Adaptor +type AdaptorSpec struct { + // NodeGroupAdaptorID identifies the Adaptor identity this resource belongs to + idv1alpha1.PartitionAdaptorID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=nodeGroupAdaptorID"` + // UserDefinedLabels define metadata to the resource. + // defined in the spec to distingiush metadata labels from user defined labels + commonv1alpha1.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=userDefinedLabels"` +} + +// AdaptorStatus defines the observed state of Adaptor +type AdaptorStatus struct { + // ConditionedStatus provides the status of the IPClain using conditions + // - a ready condition indicates the overall status of the resource + condv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} +// An Adaptor represents a communication interface or connection point within a Node, +// facilitating network communication and data transfer between different components +// or systems within the environment. `Adaptors` serve as gateways for transmitting and +// receiving data, enabling seamless communication between Nodes. +// +k8s:openapi-gen=true +type Adaptor struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec AdaptorSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status AdaptorStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// AdaptorList contains a list of Adaptors +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type AdaptorList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []Adaptor `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + AdaptorKind = reflect.TypeOf(Adaptor{}).Name() + AdaptorKindList = reflect.TypeOf(AdaptorList{}).Name() +) diff --git a/apis/infra/v1alpha1/conversion.go b/apis/infra/v1alpha1/conversion.go index a86aa0c..6e2e988 100644 --- a/apis/infra/v1alpha1/conversion.go +++ b/apis/infra/v1alpha1/conversion.go @@ -27,12 +27,12 @@ import ( ) // Convert_v1alpha1_AdaptorID_To_id_AdaptorID is an autogenerated conversion function. -func Convert_v1alpha1_AdaptorID_To_id_AdaptorID(in *idv1alpha1.AdaptorID, out *id.AdaptorID, s conversion.Scope) error { +func Convert_v1alpha1_AdaptorID_To_id_AdaptorID(in *idv1alpha1.PartitionAdaptorID, out *id.PartitionAdaptorID, s conversion.Scope) error { return autoConvert_v1alpha1_AdaptorID_To_id_AdaptorID(in, out, s) } -func autoConvert_v1alpha1_AdaptorID_To_id_AdaptorID(in *idv1alpha1.AdaptorID, out *id.AdaptorID, s conversion.Scope) error { - if err := Convert_v1alpha1_NodeID_To_id_NodeID(&in.NodeID, &out.NodeID, s); err != nil { +func autoConvert_v1alpha1_AdaptorID_To_id_AdaptorID(in *idv1alpha1.PartitionAdaptorID, out *id.PartitionAdaptorID, s conversion.Scope) error { + if err := Convert_v1alpha1_PartitionNodeID_To_id_PartitionNodeID(&in.PartitionNodeID, &out.PartitionNodeID, s); err != nil { return err } out.ModuleBay = (*int)(unsafe.Pointer(in.ModuleBay)) @@ -43,12 +43,12 @@ func autoConvert_v1alpha1_AdaptorID_To_id_AdaptorID(in *idv1alpha1.AdaptorID, ou } // Convert_id_AdaptorID_To_v1alpha1_AdaptorID is an autogenerated conversion function. -func Convert_id_AdaptorID_To_v1alpha1_AdaptorID(in *id.AdaptorID, out *idv1alpha1.AdaptorID, s conversion.Scope) error { +func Convert_id_AdaptorID_To_v1alpha1_AdaptorID(in *id.PartitionAdaptorID, out *idv1alpha1.PartitionAdaptorID, s conversion.Scope) error { return autoConvert_id_AdaptorID_To_v1alpha1_AdaptorID(in, out, s) } -func autoConvert_id_AdaptorID_To_v1alpha1_AdaptorID(in *id.AdaptorID, out *idv1alpha1.AdaptorID, s conversion.Scope) error { - if err := Convert_id_NodeID_To_v1alpha1_NodeID(&in.NodeID, &out.NodeID, s); err != nil { +func autoConvert_id_AdaptorID_To_v1alpha1_AdaptorID(in *id.PartitionAdaptorID, out *idv1alpha1.PartitionAdaptorID, s conversion.Scope) error { + if err := Convert_id_PartitionNodeID_To_v1alpha1_PartitionNodeID(&in.PartitionNodeID, &out.PartitionNodeID, s); err != nil { return err } out.ModuleBay = (*int)(unsafe.Pointer(in.ModuleBay)) @@ -273,12 +273,12 @@ func autoConvert_id_PartitionNodeID_To_v1alpha1_PartitionNodeID(in *id.Partition } // Convert_v1alpha1_PortID_To_id_PortID is an autogenerated conversion function. -func Convert_v1alpha1_PortID_To_id_PortID(in *idv1alpha1.PortID, out *id.PortID, s conversion.Scope) error { - return autoConvert_v1alpha1_PortID_To_id_PortID(in, out, s) +func Convert_v1alpha1_PartitionPortID_To_id_PartitionPortID(in *idv1alpha1.PartitionPortID, out *id.PartitionPortID, s conversion.Scope) error { + return autoConvert_v1alpha1_PartitionPortID_To_id_PartitionPortID(in, out, s) } -func autoConvert_v1alpha1_PortID_To_id_PortID(in *idv1alpha1.PortID, out *id.PortID, s conversion.Scope) error { - if err := Convert_v1alpha1_NodeID_To_id_NodeID(&in.NodeID, &out.NodeID, s); err != nil { +func autoConvert_v1alpha1_PartitionPortID_To_id_PartitionPortID(in *idv1alpha1.PartitionPortID, out *id.PartitionPortID, s conversion.Scope) error { + if err := Convert_v1alpha1_PartitionNodeID_To_id_PartitionNodeID(&in.PartitionNodeID, &out.PartitionNodeID, s); err != nil { return err } out.ModuleBay = (*int)(unsafe.Pointer(in.ModuleBay)) @@ -288,12 +288,12 @@ func autoConvert_v1alpha1_PortID_To_id_PortID(in *idv1alpha1.PortID, out *id.Por } // Convert_id_PortID_To_v1alpha1_PortID is an autogenerated conversion function. -func Convert_id_PortID_To_v1alpha1_PortID(in *id.PortID, out *idv1alpha1.PortID, s conversion.Scope) error { - return autoConvert_id_PortID_To_v1alpha1_PortID(in, out, s) +func Convert_id_PartitionPortID_To_v1alpha1_PartitionPortID(in *id.PartitionPortID, out *idv1alpha1.PartitionPortID, s conversion.Scope) error { + return autoConvert_id_PartitionPortID_To_v1alpha1_PortID(in, out, s) } -func autoConvert_id_PortID_To_v1alpha1_PortID(in *id.PortID, out *idv1alpha1.PortID, s conversion.Scope) error { - if err := Convert_id_NodeID_To_v1alpha1_NodeID(&in.NodeID, &out.NodeID, s); err != nil { +func autoConvert_id_PartitionPortID_To_v1alpha1_PortID(in *id.PartitionPortID, out *idv1alpha1.PartitionPortID, s conversion.Scope) error { + if err := Convert_id_PartitionNodeID_To_v1alpha1_PartitionNodeID(&in.PartitionNodeID, &out.PartitionNodeID, s); err != nil { return err } out.ModuleBay = (*int)(unsafe.Pointer(in.ModuleBay)) @@ -302,6 +302,33 @@ func autoConvert_id_PortID_To_v1alpha1_PortID(in *id.PortID, out *idv1alpha1.Por return nil } +// Convert_v1alpha1_PartitionAdaptorID_To_id_PartitionAdaptorID is an autogenerated conversion function. +func Convert_v1alpha1_PartitionAdaptorID_To_id_PartitionAdaptorID(in *idv1alpha1.PartitionAdaptorID, out *id.PartitionAdaptorID, s conversion.Scope) error { + return autoConvert_v1alpha1_PartitionAdaptorID_To_id_AdaptorPortID(in, out, s) +} + +func autoConvert_v1alpha1_PartitionAdaptorID_To_id_AdaptorPortID(in *idv1alpha1.PartitionAdaptorID, out *id.PartitionAdaptorID, s conversion.Scope) error { + if err := Convert_v1alpha1_PartitionPortID_To_id_PartitionPortID(&in.PartitionPortID, &out.PartitionPortID, s); err != nil { + return err + } + out.Adaptor = in.Adaptor + return nil +} + +// Convert_id_PartitionAdaptorID_To_v1alpha1_PartitionAdaptorID is an autogenerated conversion function. +func Convert_id_PartitionAdaptorID_To_v1alpha1_PartitionAdaptorID(in *id.PartitionAdaptorID, out *idv1alpha1.PartitionAdaptorID, s conversion.Scope) error { + return autoConvert_id_PartitionAdaptorID_To_v1alpha1_AdaptorID(in, out, s) +} + +func autoConvert_id_PartitionAdaptorID_To_v1alpha1_AdaptorID(in *id.PartitionAdaptorID, out *idv1alpha1.PartitionAdaptorID, s conversion.Scope) error { + if err := Convert_id_PartitionPortID_To_v1alpha1_PartitionPortID(&in.PartitionPortID, &out.PartitionPortID, s); err != nil { + return err + } + out.Adaptor = in.Adaptor + return nil +} + + // Convert_v1alpha1_SiteID_To_id_SiteID is an autogenerated conversion function. func Convert_v1alpha1_SiteID_To_id_SiteID(in *idv1alpha1.SiteID, out *id.SiteID, s conversion.Scope) error { return autoConvert_v1alpha1_SiteID_To_id_SiteID(in, out, s) @@ -450,4 +477,5 @@ func autoConvert_v1alpha1_LinkSpec_To_infra_LinkSpec(in *LinkSpec, out *infra.Li // Convert_v1alpha1_LinkSpec_To_infra_LinkSpec is an autogenerated conversion function. func Convert_v1alpha1_LinkSpec_To_infra_LinkSpec(in *LinkSpec, out *infra.LinkSpec, s conversion.Scope) error { return autoConvert_v1alpha1_LinkSpec_To_infra_LinkSpec(in, out, s) -} \ No newline at end of file +} + diff --git a/apis/infra/v1alpha1/link_types.go b/apis/infra/v1alpha1/link_types.go index 59e02c9..c6773fd 100644 --- a/apis/infra/v1alpha1/link_types.go +++ b/apis/infra/v1alpha1/link_types.go @@ -27,12 +27,14 @@ import ( // LinkSpec defines the desired state of Link type LinkSpec struct { + // Internal indicated if the link is internal to the topology + Internal *bool `json:"internal,omitempty" protobuf:"bytes,1,opt,name=internal"` // Endpoints define the 2 endpoint identifiers of the link // Can only have 2 endpoints - Endpoints []*idv1alpha1.PartitionEndpointID `json:"endpoints" yaml:"endpoints" protobuf:"bytes,1,opt,name=endpoints"` + Endpoints []*idv1alpha1.PartitionEndpointID `json:"endpoints" yaml:"endpoints" protobuf:"bytes,2,opt,name=endpoints"` // UserDefinedLabels define metadata to the resource. // defined in the spec to distingiush metadata labels from user defined labels - commonv1alpha1.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,2,opt,name=userDefinedLabels"` + commonv1alpha1.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=userDefinedLabels"` // BFD defines the BFD specific parameters on the link // +optional //BFD *BFDLinkParameters `json:"bfd,omitempty" yaml:"bfd,omitempty" protobuf:"bytes,3,opt,name=bfd"` diff --git a/apis/infra/v1alpha1/port_resource.go b/apis/infra/v1alpha1/port_resource.go new file mode 100644 index 0000000..6b19bd3 --- /dev/null +++ b/apis/infra/v1alpha1/port_resource.go @@ -0,0 +1,80 @@ +/* +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 ( + "github.com/henderiw/apiserver-builder/pkg/builder/resource" + "github.com/kuidio/kuid/apis/infra" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// +k8s:deepcopy-gen=false +var _ resource.Object = &Port{} +var _ resource.ObjectList = &PortList{} +var _ resource.MultiVersionObject = &Port{} + +func (Port) GetGroupVersionResource() schema.GroupVersionResource { + return schema.GroupVersionResource{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Resource: infra.PortPlural, + } +} + +// IsStorageVersion returns true -- Config is used as the internal version. +// IsStorageVersion implements resource.Object +func (Port) IsStorageVersion() bool { + return false +} + +// NamespaceScoped returns true to indicate Fortune is a namespaced resource. +// NamespaceScoped implements resource.Object +func (Port) NamespaceScoped() bool { + return true +} + +// GetObjectMeta implements resource.Object +// GetObjectMeta implements resource.Object +func (r *Port) GetObjectMeta() *metav1.ObjectMeta { + return &r.ObjectMeta +} + +// New return an empty resource +// New implements resource.Object +func (Port) New() runtime.Object { + return &Port{} +} + +// NewList return an empty resourceList +// NewList implements resource.Object +func (Port) NewList() runtime.Object { + return &PortList{} +} + +// GetListMeta returns the ListMeta +// GetListMeta implements resource.ObjectList +func (r *PortList) GetListMeta() *metav1.ListMeta { + return &r.ListMeta +} + +// RegisterConversions registers the conversions. +// RegisterConversions implements resource.MultiVersionObject +func (Port) RegisterConversions() func(s *runtime.Scheme) error { + return RegisterConversions +} diff --git a/apis/infra/v1alpha1/port_types.go b/apis/infra/v1alpha1/port_types.go new file mode 100644 index 0000000..701846d --- /dev/null +++ b/apis/infra/v1alpha1/port_types.go @@ -0,0 +1,74 @@ +/* +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 ( + "reflect" + + condv1alpha1 "github.com/kform-dev/choreo/apis/condition/v1alpha1" + commonv1alpha1 "github.com/kuidio/kuid/apis/common/v1alpha1" + idv1alpha1 "github.com/kuidio/kuid/apis/id/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// PortSpec defines the desired state of Port +type PortSpec struct { + // PartitionPortID the Port identity this resource belongs to + idv1alpha1.PartitionPortID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=partitionPortID"` + // UserDefinedLabels define metadata to the resource. + // defined in the spec to distingiush metadata labels from user defined labels + commonv1alpha1.UserDefinedLabels `json:",inline" yaml:",inline" protobuf:"bytes,3,opt,name=userDefinedLabels"` +} + +// PortStatus defines the observed state of Port +type PortStatus struct { + // ConditionedStatus provides the status of the IPClain using conditions + // - a ready condition indicates the overall status of the resource + condv1alpha1.ConditionedStatus `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=conditionedStatus"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status +// +kubebuilder:resource:categories={kuid} +// An Port represents a communication interface or connection point within a Node, +// facilitating network communication and data transfer between different components +// or systems within the environment. `Ports` serve as gateways for transmitting and +// receiving data, enabling seamless communication between Nodes. +// +k8s:openapi-gen=true +type Port struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec PortSpec `json:"spec,omitempty" yaml:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status PortStatus `json:"status,omitempty" yaml:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// PortList contains a list of Ports +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type PortList struct { + metav1.TypeMeta `json:",inline" yaml:",inline"` + metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + Items []Port `json:"items" yaml:"items" protobuf:"bytes,2,rep,name=items"` +} + +var ( + PortKind = reflect.TypeOf(Port{}).Name() + PortKindList = reflect.TypeOf(PortList{}).Name() +) diff --git a/apis/infra/v1alpha1/zz_generated.conversion.go b/apis/infra/v1alpha1/zz_generated.conversion.go index df6734c..ff0c49c 100644 --- a/apis/infra/v1alpha1/zz_generated.conversion.go +++ b/apis/infra/v1alpha1/zz_generated.conversion.go @@ -38,6 +38,46 @@ func init() { // RegisterConversions adds conversion functions to the given scheme. // Public to allow building arbitrary schemes. func RegisterConversions(s *runtime.Scheme) error { + if err := s.AddGeneratedConversionFunc((*Adaptor)(nil), (*infra.Adaptor)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_Adaptor_To_infra_Adaptor(a.(*Adaptor), b.(*infra.Adaptor), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.Adaptor)(nil), (*Adaptor)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_Adaptor_To_v1alpha1_Adaptor(a.(*infra.Adaptor), b.(*Adaptor), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*AdaptorList)(nil), (*infra.AdaptorList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_AdaptorList_To_infra_AdaptorList(a.(*AdaptorList), b.(*infra.AdaptorList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.AdaptorList)(nil), (*AdaptorList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_AdaptorList_To_v1alpha1_AdaptorList(a.(*infra.AdaptorList), b.(*AdaptorList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*AdaptorSpec)(nil), (*infra.AdaptorSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_AdaptorSpec_To_infra_AdaptorSpec(a.(*AdaptorSpec), b.(*infra.AdaptorSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.AdaptorSpec)(nil), (*AdaptorSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_AdaptorSpec_To_v1alpha1_AdaptorSpec(a.(*infra.AdaptorSpec), b.(*AdaptorSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*AdaptorStatus)(nil), (*infra.AdaptorStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_AdaptorStatus_To_infra_AdaptorStatus(a.(*AdaptorStatus), b.(*infra.AdaptorStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.AdaptorStatus)(nil), (*AdaptorStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_AdaptorStatus_To_v1alpha1_AdaptorStatus(a.(*infra.AdaptorStatus), b.(*AdaptorStatus), scope) + }); err != nil { + return err + } if err := s.AddGeneratedConversionFunc((*Cluster)(nil), (*infra.Cluster)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha1_Cluster_To_infra_Cluster(a.(*Cluster), b.(*infra.Cluster), scope) }); err != nil { @@ -458,6 +498,46 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddGeneratedConversionFunc((*Port)(nil), (*infra.Port)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_Port_To_infra_Port(a.(*Port), b.(*infra.Port), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.Port)(nil), (*Port)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_Port_To_v1alpha1_Port(a.(*infra.Port), b.(*Port), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*PortList)(nil), (*infra.PortList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_PortList_To_infra_PortList(a.(*PortList), b.(*infra.PortList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.PortList)(nil), (*PortList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_PortList_To_v1alpha1_PortList(a.(*infra.PortList), b.(*PortList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*PortSpec)(nil), (*infra.PortSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_PortSpec_To_infra_PortSpec(a.(*PortSpec), b.(*infra.PortSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.PortSpec)(nil), (*PortSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_PortSpec_To_v1alpha1_PortSpec(a.(*infra.PortSpec), b.(*PortSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*PortStatus)(nil), (*infra.PortStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_PortStatus_To_infra_PortStatus(a.(*PortStatus), b.(*infra.PortStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*infra.PortStatus)(nil), (*PortStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_infra_PortStatus_To_v1alpha1_PortStatus(a.(*infra.PortStatus), b.(*PortStatus), scope) + }); err != nil { + return err + } if err := s.AddGeneratedConversionFunc((*Rack)(nil), (*infra.Rack)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha1_Rack_To_infra_Rack(a.(*Rack), b.(*infra.Rack), scope) }); err != nil { @@ -578,11 +658,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddConversionFunc((*id.AdaptorID)(nil), (*idv1alpha1.AdaptorID)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_id_AdaptorID_To_v1alpha1_AdaptorID(a.(*id.AdaptorID), b.(*idv1alpha1.AdaptorID), scope) - }); err != nil { - return err - } if err := s.AddConversionFunc((*id.ClusterID)(nil), (*idv1alpha1.ClusterID)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_id_ClusterID_To_v1alpha1_ClusterID(a.(*id.ClusterID), b.(*idv1alpha1.ClusterID), scope) }); err != nil { @@ -598,6 +673,11 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*id.PartitionAdaptorID)(nil), (*idv1alpha1.PartitionAdaptorID)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_id_PartitionAdaptorID_To_v1alpha1_PartitionAdaptorID(a.(*id.PartitionAdaptorID), b.(*idv1alpha1.PartitionAdaptorID), scope) + }); err != nil { + return err + } if err := s.AddConversionFunc((*id.PartitionAttachmentID)(nil), (*idv1alpha1.PartitionAttachmentID)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_id_PartitionAttachmentID_To_v1alpha1_PartitionAttachmentID(a.(*id.PartitionAttachmentID), b.(*idv1alpha1.PartitionAttachmentID), scope) }); err != nil { @@ -618,8 +698,8 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddConversionFunc((*id.PortID)(nil), (*idv1alpha1.PortID)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_id_PortID_To_v1alpha1_PortID(a.(*id.PortID), b.(*idv1alpha1.PortID), scope) + if err := s.AddConversionFunc((*id.PartitionPortID)(nil), (*idv1alpha1.PartitionPortID)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_id_PartitionPortID_To_v1alpha1_PartitionPortID(a.(*id.PartitionPortID), b.(*idv1alpha1.PartitionPortID), scope) }); err != nil { return err } @@ -643,11 +723,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddConversionFunc((*idv1alpha1.AdaptorID)(nil), (*id.AdaptorID)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha1_AdaptorID_To_id_AdaptorID(a.(*idv1alpha1.AdaptorID), b.(*id.AdaptorID), scope) - }); err != nil { - return err - } if err := s.AddConversionFunc((*idv1alpha1.ClusterID)(nil), (*id.ClusterID)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha1_ClusterID_To_id_ClusterID(a.(*idv1alpha1.ClusterID), b.(*id.ClusterID), scope) }); err != nil { @@ -678,6 +753,11 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*idv1alpha1.PartitionAdaptorID)(nil), (*id.PartitionAdaptorID)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_PartitionAdaptorID_To_id_PartitionAdaptorID(a.(*idv1alpha1.PartitionAdaptorID), b.(*id.PartitionAdaptorID), scope) + }); err != nil { + return err + } if err := s.AddConversionFunc((*idv1alpha1.PartitionAttachmentID)(nil), (*id.PartitionAttachmentID)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha1_PartitionAttachmentID_To_id_PartitionAttachmentID(a.(*idv1alpha1.PartitionAttachmentID), b.(*id.PartitionAttachmentID), scope) }); err != nil { @@ -698,8 +778,8 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddConversionFunc((*idv1alpha1.PortID)(nil), (*id.PortID)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha1_PortID_To_id_PortID(a.(*idv1alpha1.PortID), b.(*id.PortID), scope) + if err := s.AddConversionFunc((*idv1alpha1.PartitionPortID)(nil), (*id.PartitionPortID)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_PartitionPortID_To_id_PartitionPortID(a.(*idv1alpha1.PartitionPortID), b.(*id.PartitionPortID), scope) }); err != nil { return err } @@ -711,6 +791,134 @@ func RegisterConversions(s *runtime.Scheme) error { return nil } +func autoConvert_v1alpha1_Adaptor_To_infra_Adaptor(in *Adaptor, out *infra.Adaptor, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_AdaptorSpec_To_infra_AdaptorSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_AdaptorStatus_To_infra_AdaptorStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_Adaptor_To_infra_Adaptor is an autogenerated conversion function. +func Convert_v1alpha1_Adaptor_To_infra_Adaptor(in *Adaptor, out *infra.Adaptor, s conversion.Scope) error { + return autoConvert_v1alpha1_Adaptor_To_infra_Adaptor(in, out, s) +} + +func autoConvert_infra_Adaptor_To_v1alpha1_Adaptor(in *infra.Adaptor, out *Adaptor, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_infra_AdaptorSpec_To_v1alpha1_AdaptorSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_infra_AdaptorStatus_To_v1alpha1_AdaptorStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_infra_Adaptor_To_v1alpha1_Adaptor is an autogenerated conversion function. +func Convert_infra_Adaptor_To_v1alpha1_Adaptor(in *infra.Adaptor, out *Adaptor, s conversion.Scope) error { + return autoConvert_infra_Adaptor_To_v1alpha1_Adaptor(in, out, s) +} + +func autoConvert_v1alpha1_AdaptorList_To_infra_AdaptorList(in *AdaptorList, out *infra.AdaptorList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]infra.Adaptor, len(*in)) + for i := range *in { + if err := Convert_v1alpha1_Adaptor_To_infra_Adaptor(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha1_AdaptorList_To_infra_AdaptorList is an autogenerated conversion function. +func Convert_v1alpha1_AdaptorList_To_infra_AdaptorList(in *AdaptorList, out *infra.AdaptorList, s conversion.Scope) error { + return autoConvert_v1alpha1_AdaptorList_To_infra_AdaptorList(in, out, s) +} + +func autoConvert_infra_AdaptorList_To_v1alpha1_AdaptorList(in *infra.AdaptorList, out *AdaptorList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Adaptor, len(*in)) + for i := range *in { + if err := Convert_infra_Adaptor_To_v1alpha1_Adaptor(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_infra_AdaptorList_To_v1alpha1_AdaptorList is an autogenerated conversion function. +func Convert_infra_AdaptorList_To_v1alpha1_AdaptorList(in *infra.AdaptorList, out *AdaptorList, s conversion.Scope) error { + return autoConvert_infra_AdaptorList_To_v1alpha1_AdaptorList(in, out, s) +} + +func autoConvert_v1alpha1_AdaptorSpec_To_infra_AdaptorSpec(in *AdaptorSpec, out *infra.AdaptorSpec, s conversion.Scope) error { + if err := Convert_v1alpha1_PartitionAdaptorID_To_id_PartitionAdaptorID(&in.PartitionAdaptorID, &out.PartitionAdaptorID, s); err != nil { + return err + } + if err := asv1alpha1.Convert_v1alpha1_UserDefinedLabels_To_common_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_AdaptorSpec_To_infra_AdaptorSpec is an autogenerated conversion function. +func Convert_v1alpha1_AdaptorSpec_To_infra_AdaptorSpec(in *AdaptorSpec, out *infra.AdaptorSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_AdaptorSpec_To_infra_AdaptorSpec(in, out, s) +} + +func autoConvert_infra_AdaptorSpec_To_v1alpha1_AdaptorSpec(in *infra.AdaptorSpec, out *AdaptorSpec, s conversion.Scope) error { + if err := Convert_id_PartitionAdaptorID_To_v1alpha1_PartitionAdaptorID(&in.PartitionAdaptorID, &out.PartitionAdaptorID, s); err != nil { + return err + } + if err := asv1alpha1.Convert_common_UserDefinedLabels_To_v1alpha1_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + return nil +} + +// Convert_infra_AdaptorSpec_To_v1alpha1_AdaptorSpec is an autogenerated conversion function. +func Convert_infra_AdaptorSpec_To_v1alpha1_AdaptorSpec(in *infra.AdaptorSpec, out *AdaptorSpec, s conversion.Scope) error { + return autoConvert_infra_AdaptorSpec_To_v1alpha1_AdaptorSpec(in, out, s) +} + +func autoConvert_v1alpha1_AdaptorStatus_To_infra_AdaptorStatus(in *AdaptorStatus, out *infra.AdaptorStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_v1alpha1_ConditionedStatus_To_condition_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_AdaptorStatus_To_infra_AdaptorStatus is an autogenerated conversion function. +func Convert_v1alpha1_AdaptorStatus_To_infra_AdaptorStatus(in *AdaptorStatus, out *infra.AdaptorStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_AdaptorStatus_To_infra_AdaptorStatus(in, out, s) +} + +func autoConvert_infra_AdaptorStatus_To_v1alpha1_AdaptorStatus(in *infra.AdaptorStatus, out *AdaptorStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_condition_ConditionedStatus_To_v1alpha1_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_infra_AdaptorStatus_To_v1alpha1_AdaptorStatus is an autogenerated conversion function. +func Convert_infra_AdaptorStatus_To_v1alpha1_AdaptorStatus(in *infra.AdaptorStatus, out *AdaptorStatus, s conversion.Scope) error { + return autoConvert_infra_AdaptorStatus_To_v1alpha1_AdaptorStatus(in, out, s) +} + func autoConvert_v1alpha1_Cluster_To_infra_Cluster(in *Cluster, out *infra.Cluster, s conversion.Scope) error { out.ObjectMeta = in.ObjectMeta if err := Convert_v1alpha1_ClusterSpec_To_infra_ClusterSpec(&in.Spec, &out.Spec, s); err != nil { @@ -2079,6 +2287,134 @@ func Convert_infra_PartitionStatus_To_v1alpha1_PartitionStatus(in *infra.Partiti return autoConvert_infra_PartitionStatus_To_v1alpha1_PartitionStatus(in, out, s) } +func autoConvert_v1alpha1_Port_To_infra_Port(in *Port, out *infra.Port, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_PortSpec_To_infra_PortSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_PortStatus_To_infra_PortStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_Port_To_infra_Port is an autogenerated conversion function. +func Convert_v1alpha1_Port_To_infra_Port(in *Port, out *infra.Port, s conversion.Scope) error { + return autoConvert_v1alpha1_Port_To_infra_Port(in, out, s) +} + +func autoConvert_infra_Port_To_v1alpha1_Port(in *infra.Port, out *Port, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_infra_PortSpec_To_v1alpha1_PortSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_infra_PortStatus_To_v1alpha1_PortStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_infra_Port_To_v1alpha1_Port is an autogenerated conversion function. +func Convert_infra_Port_To_v1alpha1_Port(in *infra.Port, out *Port, s conversion.Scope) error { + return autoConvert_infra_Port_To_v1alpha1_Port(in, out, s) +} + +func autoConvert_v1alpha1_PortList_To_infra_PortList(in *PortList, out *infra.PortList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]infra.Port, len(*in)) + for i := range *in { + if err := Convert_v1alpha1_Port_To_infra_Port(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha1_PortList_To_infra_PortList is an autogenerated conversion function. +func Convert_v1alpha1_PortList_To_infra_PortList(in *PortList, out *infra.PortList, s conversion.Scope) error { + return autoConvert_v1alpha1_PortList_To_infra_PortList(in, out, s) +} + +func autoConvert_infra_PortList_To_v1alpha1_PortList(in *infra.PortList, out *PortList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Port, len(*in)) + for i := range *in { + if err := Convert_infra_Port_To_v1alpha1_Port(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_infra_PortList_To_v1alpha1_PortList is an autogenerated conversion function. +func Convert_infra_PortList_To_v1alpha1_PortList(in *infra.PortList, out *PortList, s conversion.Scope) error { + return autoConvert_infra_PortList_To_v1alpha1_PortList(in, out, s) +} + +func autoConvert_v1alpha1_PortSpec_To_infra_PortSpec(in *PortSpec, out *infra.PortSpec, s conversion.Scope) error { + if err := Convert_v1alpha1_PartitionPortID_To_id_PartitionPortID(&in.PartitionPortID, &out.PartitionPortID, s); err != nil { + return err + } + if err := asv1alpha1.Convert_v1alpha1_UserDefinedLabels_To_common_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_PortSpec_To_infra_PortSpec is an autogenerated conversion function. +func Convert_v1alpha1_PortSpec_To_infra_PortSpec(in *PortSpec, out *infra.PortSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_PortSpec_To_infra_PortSpec(in, out, s) +} + +func autoConvert_infra_PortSpec_To_v1alpha1_PortSpec(in *infra.PortSpec, out *PortSpec, s conversion.Scope) error { + if err := Convert_id_PartitionPortID_To_v1alpha1_PartitionPortID(&in.PartitionPortID, &out.PartitionPortID, s); err != nil { + return err + } + if err := asv1alpha1.Convert_common_UserDefinedLabels_To_v1alpha1_UserDefinedLabels(&in.UserDefinedLabels, &out.UserDefinedLabels, s); err != nil { + return err + } + return nil +} + +// Convert_infra_PortSpec_To_v1alpha1_PortSpec is an autogenerated conversion function. +func Convert_infra_PortSpec_To_v1alpha1_PortSpec(in *infra.PortSpec, out *PortSpec, s conversion.Scope) error { + return autoConvert_infra_PortSpec_To_v1alpha1_PortSpec(in, out, s) +} + +func autoConvert_v1alpha1_PortStatus_To_infra_PortStatus(in *PortStatus, out *infra.PortStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_v1alpha1_ConditionedStatus_To_condition_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_PortStatus_To_infra_PortStatus is an autogenerated conversion function. +func Convert_v1alpha1_PortStatus_To_infra_PortStatus(in *PortStatus, out *infra.PortStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_PortStatus_To_infra_PortStatus(in, out, s) +} + +func autoConvert_infra_PortStatus_To_v1alpha1_PortStatus(in *infra.PortStatus, out *PortStatus, s conversion.Scope) error { + if err := asv1alpha1.Convert_condition_ConditionedStatus_To_v1alpha1_ConditionedStatus(&in.ConditionedStatus, &out.ConditionedStatus, s); err != nil { + return err + } + return nil +} + +// Convert_infra_PortStatus_To_v1alpha1_PortStatus is an autogenerated conversion function. +func Convert_infra_PortStatus_To_v1alpha1_PortStatus(in *infra.PortStatus, out *PortStatus, s conversion.Scope) error { + return autoConvert_infra_PortStatus_To_v1alpha1_PortStatus(in, out, s) +} + func autoConvert_v1alpha1_Rack_To_infra_Rack(in *Rack, out *infra.Rack, s conversion.Scope) error { out.ObjectMeta = in.ObjectMeta if err := Convert_v1alpha1_RackSpec_To_infra_RackSpec(&in.Spec, &out.Spec, s); err != nil { diff --git a/apis/infra/v1alpha1/zz_generated.deepcopy.go b/apis/infra/v1alpha1/zz_generated.deepcopy.go index 3310390..2aa1289 100644 --- a/apis/infra/v1alpha1/zz_generated.deepcopy.go +++ b/apis/infra/v1alpha1/zz_generated.deepcopy.go @@ -25,6 +25,102 @@ import ( runtime "k8s.io/apimachinery/pkg/runtime" ) +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Adaptor) DeepCopyInto(out *Adaptor) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Adaptor. +func (in *Adaptor) DeepCopy() *Adaptor { + if in == nil { + return nil + } + out := new(Adaptor) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Adaptor) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AdaptorList) DeepCopyInto(out *AdaptorList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Adaptor, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AdaptorList. +func (in *AdaptorList) DeepCopy() *AdaptorList { + if in == nil { + return nil + } + out := new(AdaptorList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AdaptorList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AdaptorSpec) DeepCopyInto(out *AdaptorSpec) { + *out = *in + in.PartitionAdaptorID.DeepCopyInto(&out.PartitionAdaptorID) + in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AdaptorSpec. +func (in *AdaptorSpec) DeepCopy() *AdaptorSpec { + if in == nil { + return nil + } + out := new(AdaptorSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AdaptorStatus) DeepCopyInto(out *AdaptorStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AdaptorStatus. +func (in *AdaptorStatus) DeepCopy() *AdaptorStatus { + if in == nil { + return nil + } + out := new(AdaptorStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Cluster) DeepCopyInto(out *Cluster) { *out = *in @@ -528,6 +624,11 @@ func (in *LinkSetStatus) DeepCopy() *LinkSetStatus { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *LinkSpec) DeepCopyInto(out *LinkSpec) { *out = *in + if in.Internal != nil { + in, out := &in.Internal, &out.Internal + *out = new(bool) + **out = **in + } if in.Endpoints != nil { in, out := &in.Endpoints, &out.Endpoints *out = make([]*idv1alpha1.PartitionEndpointID, len(*in)) @@ -1181,6 +1282,102 @@ func (in *PartitionStatus) DeepCopy() *PartitionStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Port) DeepCopyInto(out *Port) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Port. +func (in *Port) DeepCopy() *Port { + if in == nil { + return nil + } + out := new(Port) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Port) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PortList) DeepCopyInto(out *PortList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Port, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PortList. +func (in *PortList) DeepCopy() *PortList { + if in == nil { + return nil + } + out := new(PortList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *PortList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PortSpec) DeepCopyInto(out *PortSpec) { + *out = *in + in.PartitionPortID.DeepCopyInto(&out.PartitionPortID) + in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PortSpec. +func (in *PortSpec) DeepCopy() *PortSpec { + if in == nil { + return nil + } + out := new(PortSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PortStatus) DeepCopyInto(out *PortStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PortStatus. +func (in *PortStatus) DeepCopy() *PortStatus { + if in == nil { + return nil + } + out := new(PortStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Rack) DeepCopyInto(out *Rack) { *out = *in diff --git a/apis/infra/zz_generated.deepcopy.go b/apis/infra/zz_generated.deepcopy.go index b790943..a31d2e3 100644 --- a/apis/infra/zz_generated.deepcopy.go +++ b/apis/infra/zz_generated.deepcopy.go @@ -25,6 +25,118 @@ import ( runtime "k8s.io/apimachinery/pkg/runtime" ) +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Adaptor) DeepCopyInto(out *Adaptor) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Adaptor. +func (in *Adaptor) DeepCopy() *Adaptor { + if in == nil { + return nil + } + out := new(Adaptor) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Adaptor) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AdaptorFilter) DeepCopyInto(out *AdaptorFilter) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AdaptorFilter. +func (in *AdaptorFilter) DeepCopy() *AdaptorFilter { + if in == nil { + return nil + } + out := new(AdaptorFilter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AdaptorList) DeepCopyInto(out *AdaptorList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Adaptor, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AdaptorList. +func (in *AdaptorList) DeepCopy() *AdaptorList { + if in == nil { + return nil + } + out := new(AdaptorList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AdaptorList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AdaptorSpec) DeepCopyInto(out *AdaptorSpec) { + *out = *in + in.PartitionAdaptorID.DeepCopyInto(&out.PartitionAdaptorID) + in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AdaptorSpec. +func (in *AdaptorSpec) DeepCopy() *AdaptorSpec { + if in == nil { + return nil + } + out := new(AdaptorSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AdaptorStatus) DeepCopyInto(out *AdaptorStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AdaptorStatus. +func (in *AdaptorStatus) DeepCopy() *AdaptorStatus { + if in == nil { + return nil + } + out := new(AdaptorStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Cluster) DeepCopyInto(out *Cluster) { *out = *in @@ -1357,6 +1469,118 @@ func (in *PartitionStatus) DeepCopy() *PartitionStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Port) DeepCopyInto(out *Port) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Port. +func (in *Port) DeepCopy() *Port { + if in == nil { + return nil + } + out := new(Port) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Port) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PortFilter) DeepCopyInto(out *PortFilter) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PortFilter. +func (in *PortFilter) DeepCopy() *PortFilter { + if in == nil { + return nil + } + out := new(PortFilter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PortList) DeepCopyInto(out *PortList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Port, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PortList. +func (in *PortList) DeepCopy() *PortList { + if in == nil { + return nil + } + out := new(PortList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *PortList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PortSpec) DeepCopyInto(out *PortSpec) { + *out = *in + in.PartitionPortID.DeepCopyInto(&out.PartitionPortID) + in.UserDefinedLabels.DeepCopyInto(&out.UserDefinedLabels) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PortSpec. +func (in *PortSpec) DeepCopy() *PortSpec { + if in == nil { + return nil + } + out := new(PortSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PortStatus) DeepCopyInto(out *PortStatus) { + *out = *in + in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PortStatus. +func (in *PortStatus) DeepCopy() *PortStatus { + if in == nil { + return nil + } + out := new(PortStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Rack) DeepCopyInto(out *Rack) { *out = *in diff --git a/crds/infra.kuid.dev_adaptors.yaml b/crds/infra.kuid.dev_adaptors.yaml new file mode 100644 index 0000000..dff40ef --- /dev/null +++ b/crds/infra.kuid.dev_adaptors.yaml @@ -0,0 +1,157 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: adaptors.infra.kuid.dev +spec: + group: infra.kuid.dev + names: + categories: + - kuid + kind: Adaptor + listKind: AdaptorList + plural: adaptors + singular: adaptor + scope: Namespaced + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: |- + An Adaptor represents a communication interface or connection point within a Node, + facilitating network communication and data transfer between different components + or systems within the environment. `Adaptors` serve as gateways for transmitting and + receiving data, enabling seamless communication between Nodes. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: AdaptorSpec defines the desired state of Adaptor + properties: + adaptor: + description: Adaptor defines the name of the adaptor + type: string + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + module: + description: Module defines the module reference id + type: integer + moduleBay: + description: ModuleBay defines the moduleBay reference id + type: integer + node: + description: Node defines the name of the node + type: string + partition: + description: Partition defines the partition this resource belongs + to + type: string + port: + description: Port defines the id of the port + type: integer + region: + description: Region defines the region of the resource + type: string + site: + description: Site defines the site of the resource + type: string + required: + - adaptor + - node + - partition + - port + - region + - site + type: object + status: + description: AdaptorStatus defines the observed state of Adaptor + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object + type: object + served: true + storage: true + subresources: + status: {} diff --git a/crds/infra.kuid.dev_clusters.yaml b/crds/infra.kuid.dev_clusters.yaml index d8ae4a4..fe08422 100644 --- a/crds/infra.kuid.dev_clusters.yaml +++ b/crds/infra.kuid.dev_clusters.yaml @@ -16,143 +16,6 @@ spec: singular: cluster scope: Namespaced versions: - - name: infra - schema: - openAPIV3Schema: - description: A Cluster represents a kubernetes cluster and is typically used - as a nodeGroup identifier. - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: ClusterSpec defines the desired state of Cluster - properties: - cluster: - description: Cluster defines the name of the cluster - type: string - labels: - additionalProperties: - type: string - description: Labels as user defined labels - type: object - location: - description: |- - Location defines the location information where this resource is located - in lon/lat coordinates - properties: - latitude: - type: string - longitude: - type: string - required: - - latitude - - longitude - type: object - partition: - description: Partition defines the partition this resource belongs - to - type: string - provider: - description: Provider defines the provider implementing this resource. - type: string - region: - description: Region defines the region of the resource - type: string - site: - description: Site defines the site of the resource - type: string - required: - - cluster - - partition - - provider - - region - - site - type: object - status: - description: ClusterStatus defines the observed state of Cluster - properties: - conditions: - description: Conditions of the resource. - items: - properties: - lastTransitionTime: - description: |- - lastTransitionTime is the last time the condition transitioned from one status to another. - This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. - format: date-time - type: string - message: - description: |- - message is a human readable message indicating details about the transition. - This may be an empty string. - maxLength: 32768 - type: string - observedGeneration: - description: |- - observedGeneration represents the .metadata.generation that the condition was set based upon. - For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date - with respect to the current state of the instance. - format: int64 - minimum: 0 - type: integer - reason: - description: |- - reason contains a programmatic identifier indicating the reason for the condition's last transition. - Producers of specific condition types may define expected values and meanings for this field, - and whether the values are considered a guaranteed API. - The value should be a CamelCase string. - This field may not be empty. - maxLength: 1024 - minLength: 1 - pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ - type: string - status: - description: status of the condition, one of True, False, Unknown. - enum: - - "True" - - "False" - - Unknown - type: string - type: - description: |- - type of condition in CamelCase or in foo.example.com/CamelCase. - --- - Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be - useful (see .node.status.conditions), the ability to deconflict is important. - The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) - maxLength: 316 - pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ - type: string - required: - - lastTransitionTime - - message - - reason - - status - - type - type: object - type: array - x-kubernetes-list-map-keys: - - type - x-kubernetes-list-type: map - type: object - type: object - served: true - storage: false - name: v1alpha1 schema: openAPIV3Schema: diff --git a/crds/infra.kuid.dev_endpoints.yaml b/crds/infra.kuid.dev_endpoints.yaml index 0722ba5..850debe 100644 --- a/crds/infra.kuid.dev_endpoints.yaml +++ b/crds/infra.kuid.dev_endpoints.yaml @@ -16,156 +16,6 @@ spec: singular: endpoint scope: Namespaced versions: - - name: infra - schema: - openAPIV3Schema: - description: |- - An Endpoint represents a communication interface or connection point within a Node, - facilitating network communication and data transfer between different components - or systems within the environment. `Endpoints` serve as gateways for transmitting and - receiving data, enabling seamless communication between Nodes. - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: EndpointSpec defines the desired state of Endpoint - properties: - adaptor: - description: Adaptor defines the name of the adaptor - type: string - endpoint: - description: Endpoint defines the name of the endpoint - type: integer - labels: - additionalProperties: - type: string - description: Labels as user defined labels - type: object - module: - description: Module defines the module reference id - type: integer - moduleBay: - description: ModuleBay defines the moduleBay reference id - type: integer - name: - description: Name is used to refer to internal names of the node - type: string - node: - description: Node defines the name of the node - type: string - partition: - description: Partition defines the partition this resource belongs - to - type: string - port: - description: Port defines the id of the port - type: integer - region: - description: Region defines the region of the resource - type: string - site: - description: Site defines the site of the resource - type: string - speed: - description: (Gbps) - type: string - vlanTagging: - description: VLANTagging defines if VLAN tagging is enabled or disabled - on the interface - type: boolean - required: - - endpoint - - node - - partition - - port - - region - - site - type: object - status: - description: EndpointStatus defines the observed state of Endpoint - properties: - conditions: - description: Conditions of the resource. - items: - properties: - lastTransitionTime: - description: |- - lastTransitionTime is the last time the condition transitioned from one status to another. - This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. - format: date-time - type: string - message: - description: |- - message is a human readable message indicating details about the transition. - This may be an empty string. - maxLength: 32768 - type: string - observedGeneration: - description: |- - observedGeneration represents the .metadata.generation that the condition was set based upon. - For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date - with respect to the current state of the instance. - format: int64 - minimum: 0 - type: integer - reason: - description: |- - reason contains a programmatic identifier indicating the reason for the condition's last transition. - Producers of specific condition types may define expected values and meanings for this field, - and whether the values are considered a guaranteed API. - The value should be a CamelCase string. - This field may not be empty. - maxLength: 1024 - minLength: 1 - pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ - type: string - status: - description: status of the condition, one of True, False, Unknown. - enum: - - "True" - - "False" - - Unknown - type: string - type: - description: |- - type of condition in CamelCase or in foo.example.com/CamelCase. - --- - Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be - useful (see .node.status.conditions), the ability to deconflict is important. - The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) - maxLength: 316 - pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ - type: string - required: - - lastTransitionTime - - message - - reason - - status - - type - type: object - type: array - x-kubernetes-list-map-keys: - - type - x-kubernetes-list-type: map - type: object - type: object - served: true - storage: false - name: v1alpha1 schema: openAPIV3Schema: diff --git a/crds/infra.kuid.dev_endpointsets.yaml b/crds/infra.kuid.dev_endpointsets.yaml index 127de78..4f0132b 100644 --- a/crds/infra.kuid.dev_endpointsets.yaml +++ b/crds/infra.kuid.dev_endpointsets.yaml @@ -16,179 +16,6 @@ spec: singular: endpointset scope: Namespaced versions: - - name: infra - schema: - openAPIV3Schema: - description: |- - A EndpointSet represents a set of endpoints that belong together within a nodeGroup. - E.g. it can be used to model a logical Link Aggregation group within - a node or it can be used to represent a logical multi-homing construction - between a set of nodes belonging to a single nodeGroup. - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: |- - EndpointSetSpec defines the desired state of EndpointSet - An EndpointSet can be a LAG (single Homed) or ESI (multiHomed). The EndpointSet - can only belong to a single NodeGroup - properties: - endpoints: - description: |- - Endpoints defines the Endpoints that are part of the EndpointSet - Min 1, Max 16 - items: - properties: - adaptor: - description: Adaptor defines the name of the adaptor - type: string - endpoint: - description: Endpoint defines the name of the endpoint - type: integer - module: - description: Module defines the module reference id - type: integer - moduleBay: - description: ModuleBay defines the moduleBay reference id - type: integer - name: - description: Name is used to refer to internal names of the - node - type: string - node: - description: Node defines the name of the node - type: string - partition: - description: Partition defines the partition this resource belongs - to - type: string - port: - description: Port defines the id of the port - type: integer - region: - description: Region defines the region of the resource - type: string - site: - description: Site defines the site of the resource - type: string - required: - - endpoint - - node - - partition - - port - - region - - site - type: object - type: array - labels: - additionalProperties: - type: string - description: Labels as user defined labels - type: object - lacp: - description: Lacp defines if the lag enabled LACP - type: boolean - required: - - endpoints - type: object - status: - description: EndpointSetStatus defines the observed state of EndpointSet - properties: - conditions: - description: Conditions of the resource. - items: - properties: - lastTransitionTime: - description: |- - lastTransitionTime is the last time the condition transitioned from one status to another. - This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. - format: date-time - type: string - message: - description: |- - message is a human readable message indicating details about the transition. - This may be an empty string. - maxLength: 32768 - type: string - observedGeneration: - description: |- - observedGeneration represents the .metadata.generation that the condition was set based upon. - For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date - with respect to the current state of the instance. - format: int64 - minimum: 0 - type: integer - reason: - description: |- - reason contains a programmatic identifier indicating the reason for the condition's last transition. - Producers of specific condition types may define expected values and meanings for this field, - and whether the values are considered a guaranteed API. - The value should be a CamelCase string. - This field may not be empty. - maxLength: 1024 - minLength: 1 - pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ - type: string - status: - description: status of the condition, one of True, False, Unknown. - enum: - - "True" - - "False" - - Unknown - type: string - type: - description: |- - type of condition in CamelCase or in foo.example.com/CamelCase. - --- - Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be - useful (see .node.status.conditions), the ability to deconflict is important. - The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) - maxLength: 316 - pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ - type: string - required: - - lastTransitionTime - - message - - reason - - status - - type - type: object - type: array - x-kubernetes-list-map-keys: - - type - x-kubernetes-list-type: map - esi: - description: |- - ESI defines the ethernet segment identifier of the logical link - if set this is a multi-homed logical endpoint - the ESI is a global unique identifier within the administrative domain - format: int32 - type: integer - lagID: - description: |- - LagId defines the lag id for the logical single-homed or multi-homed - endpoint - format: int32 - type: integer - type: object - type: object - served: true - storage: false - name: v1alpha1 schema: openAPIV3Schema: diff --git a/crds/infra.kuid.dev_links.yaml b/crds/infra.kuid.dev_links.yaml index 19b512c..5635300 100644 --- a/crds/infra.kuid.dev_links.yaml +++ b/crds/infra.kuid.dev_links.yaml @@ -16,158 +16,6 @@ spec: singular: link scope: Namespaced versions: - - name: infra - schema: - openAPIV3Schema: - description: |- - A link represents a physical/logical connection that enables communication and data transfer - between 2 endpoints of a node. - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: LinkSpec defines the desired state of Link - properties: - endpoints: - description: |- - Endpoints define the 2 endpoint identifiers of the link - Can only have 2 endpoints - items: - properties: - adaptor: - description: Adaptor defines the name of the adaptor - type: string - endpoint: - description: Endpoint defines the name of the endpoint - type: integer - module: - description: Module defines the module reference id - type: integer - moduleBay: - description: ModuleBay defines the moduleBay reference id - type: integer - name: - description: Name is used to refer to internal names of the - node - type: string - node: - description: Node defines the name of the node - type: string - partition: - description: Partition defines the partition this resource belongs - to - type: string - port: - description: Port defines the id of the port - type: integer - region: - description: Region defines the region of the resource - type: string - site: - description: Site defines the site of the resource - type: string - required: - - endpoint - - node - - partition - - port - - region - - site - type: object - type: array - labels: - additionalProperties: - type: string - description: Labels as user defined labels - type: object - required: - - endpoints - type: object - status: - description: LinkStatus defines the observed state of Link - properties: - conditions: - description: Conditions of the resource. - items: - properties: - lastTransitionTime: - description: |- - lastTransitionTime is the last time the condition transitioned from one status to another. - This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. - format: date-time - type: string - message: - description: |- - message is a human readable message indicating details about the transition. - This may be an empty string. - maxLength: 32768 - type: string - observedGeneration: - description: |- - observedGeneration represents the .metadata.generation that the condition was set based upon. - For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date - with respect to the current state of the instance. - format: int64 - minimum: 0 - type: integer - reason: - description: |- - reason contains a programmatic identifier indicating the reason for the condition's last transition. - Producers of specific condition types may define expected values and meanings for this field, - and whether the values are considered a guaranteed API. - The value should be a CamelCase string. - This field may not be empty. - maxLength: 1024 - minLength: 1 - pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ - type: string - status: - description: status of the condition, one of True, False, Unknown. - enum: - - "True" - - "False" - - Unknown - type: string - type: - description: |- - type of condition in CamelCase or in foo.example.com/CamelCase. - --- - Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be - useful (see .node.status.conditions), the ability to deconflict is important. - The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) - maxLength: 316 - pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ - type: string - required: - - lastTransitionTime - - message - - reason - - status - - type - type: object - type: array - x-kubernetes-list-map-keys: - - type - x-kubernetes-list-type: map - type: object - type: object - served: true - storage: false - name: v1alpha1 schema: openAPIV3Schema: @@ -242,6 +90,9 @@ spec: - site type: object type: array + internal: + description: Internal indicated if the link is internal to the topology + type: boolean labels: additionalProperties: type: string diff --git a/crds/infra.kuid.dev_linksets.yaml b/crds/infra.kuid.dev_linksets.yaml index e120cd5..ff2a484 100644 --- a/crds/infra.kuid.dev_linksets.yaml +++ b/crds/infra.kuid.dev_linksets.yaml @@ -16,171 +16,6 @@ spec: singular: linkset scope: Namespaced versions: - - name: infra - schema: - openAPIV3Schema: - description: |- - A linkSet represents a set of links that belong together within a node group or accross nodeGroups. - E.g. it can be used to model a logical Link Aggregation group between 2 nodes or - it can be used to represent a logical multi-homing construction between a set of nodes - belonging to 1 or multiple nodeGroups/Topologies. - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: LinkSetSpec defines the desired state of LinkSet - properties: - endpoints: - description: Endpoints define the endpoint identifiers of the LinkSet - items: - properties: - adaptor: - description: Adaptor defines the name of the adaptor - type: string - endpoint: - description: Endpoint defines the name of the endpoint - type: integer - module: - description: Module defines the module reference id - type: integer - moduleBay: - description: ModuleBay defines the moduleBay reference id - type: integer - name: - description: Name is used to refer to internal names of the - node - type: string - node: - description: Node defines the name of the node - type: string - partition: - description: Partition defines the partition this resource belongs - to - type: string - port: - description: Port defines the id of the port - type: integer - region: - description: Region defines the region of the resource - type: string - site: - description: Site defines the site of the resource - type: string - required: - - endpoint - - node - - partition - - port - - region - - site - type: object - type: array - labels: - additionalProperties: - type: string - description: Labels as user defined labels - type: object - required: - - endpoints - type: object - status: - description: LinkSetStatus defines the observed state of LinkSet - properties: - conditions: - description: Conditions of the resource. - items: - properties: - lastTransitionTime: - description: |- - lastTransitionTime is the last time the condition transitioned from one status to another. - This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. - format: date-time - type: string - message: - description: |- - message is a human readable message indicating details about the transition. - This may be an empty string. - maxLength: 32768 - type: string - observedGeneration: - description: |- - observedGeneration represents the .metadata.generation that the condition was set based upon. - For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date - with respect to the current state of the instance. - format: int64 - minimum: 0 - type: integer - reason: - description: |- - reason contains a programmatic identifier indicating the reason for the condition's last transition. - Producers of specific condition types may define expected values and meanings for this field, - and whether the values are considered a guaranteed API. - The value should be a CamelCase string. - This field may not be empty. - maxLength: 1024 - minLength: 1 - pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ - type: string - status: - description: status of the condition, one of True, False, Unknown. - enum: - - "True" - - "False" - - Unknown - type: string - type: - description: |- - type of condition in CamelCase or in foo.example.com/CamelCase. - --- - Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be - useful (see .node.status.conditions), the ability to deconflict is important. - The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) - maxLength: 316 - pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ - type: string - required: - - lastTransitionTime - - message - - reason - - status - - type - type: object - type: array - x-kubernetes-list-map-keys: - - type - x-kubernetes-list-type: map - esi: - description: |- - ESI defines the ethernet segment identifier of the logical link - if set this is a multi-homed linkset - the ESI is a global unique identifier within the administrative domain/topology - format: int32 - type: integer - lagId: - description: |- - LagId defines the lag id for the logical single-homed or multi-homed - endpoint - format: int32 - type: integer - type: object - type: object - served: true - storage: false - name: v1alpha1 schema: openAPIV3Schema: diff --git a/crds/infra.kuid.dev_modulebays.yaml b/crds/infra.kuid.dev_modulebays.yaml index c39426a..a455330 100644 --- a/crds/infra.kuid.dev_modulebays.yaml +++ b/crds/infra.kuid.dev_modulebays.yaml @@ -16,133 +16,6 @@ spec: singular: modulebay scope: Namespaced versions: - - name: infra - schema: - openAPIV3Schema: - description: |- - A ModuleBay serves as a modular slot or enclosure within a Node, designed to accommodate additional modules. - ModuleBays provide a flexible and scalable approach to extending the capabilities of Nodes, - allowing users to customize and enhance their infrastructure deployments according to specific requirements. - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: ModuleBaySpec defines the desired state of ModuleBay - properties: - labels: - additionalProperties: - type: string - description: Labels as user defined labels - type: object - node: - description: Node defines the name of the node - type: string - partition: - description: Partition defines the partition this resource belongs - to - type: string - psoition: - description: Position defines the position in the node the moduleBay - is deployed - type: integer - region: - description: Region defines the region of the resource - type: string - site: - description: Site defines the site of the resource - type: string - required: - - node - - partition - - psoition - - region - - site - type: object - status: - description: ModuleBayStatus defines the observed state of ModuleBay - properties: - conditions: - description: Conditions of the resource. - items: - properties: - lastTransitionTime: - description: |- - lastTransitionTime is the last time the condition transitioned from one status to another. - This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. - format: date-time - type: string - message: - description: |- - message is a human readable message indicating details about the transition. - This may be an empty string. - maxLength: 32768 - type: string - observedGeneration: - description: |- - observedGeneration represents the .metadata.generation that the condition was set based upon. - For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date - with respect to the current state of the instance. - format: int64 - minimum: 0 - type: integer - reason: - description: |- - reason contains a programmatic identifier indicating the reason for the condition's last transition. - Producers of specific condition types may define expected values and meanings for this field, - and whether the values are considered a guaranteed API. - The value should be a CamelCase string. - This field may not be empty. - maxLength: 1024 - minLength: 1 - pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ - type: string - status: - description: status of the condition, one of True, False, Unknown. - enum: - - "True" - - "False" - - Unknown - type: string - type: - description: |- - type of condition in CamelCase or in foo.example.com/CamelCase. - --- - Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be - useful (see .node.status.conditions), the ability to deconflict is important. - The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) - maxLength: 316 - pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ - type: string - required: - - lastTransitionTime - - message - - reason - - status - - type - type: object - type: array - x-kubernetes-list-map-keys: - - type - x-kubernetes-list-type: map - type: object - type: object - served: true - storage: false - name: v1alpha1 schema: openAPIV3Schema: diff --git a/crds/infra.kuid.dev_modules.yaml b/crds/infra.kuid.dev_modules.yaml index aac4e7c..4fa88e5 100644 --- a/crds/infra.kuid.dev_modules.yaml +++ b/crds/infra.kuid.dev_modules.yaml @@ -16,132 +16,6 @@ spec: singular: module scope: Namespaced versions: - - name: infra - schema: - openAPIV3Schema: - description: |- - A module refers to a hardware component or expansion module that can be installed within a ModuleBay of a Node. - Modules provide additional functionality and capabilities to the infrastructure environment, - allowing users to enhance and customize their deployments according to specific requirements. - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: ModuleSpec defines the desired state of Module - properties: - labels: - additionalProperties: - type: string - description: Labels as user defined labels - type: object - moduleBay: - description: ModuelBay defines the bay in which the module is deployed - type: integer - node: - description: Node defines the name of the node - type: string - partition: - description: Partition defines the partition this resource belongs - to - type: string - region: - description: Region defines the region of the resource - type: string - site: - description: Site defines the site of the resource - type: string - required: - - moduleBay - - node - - partition - - region - - site - type: object - status: - description: ModuleStatus defines the observed state of Module - properties: - conditions: - description: Conditions of the resource. - items: - properties: - lastTransitionTime: - description: |- - lastTransitionTime is the last time the condition transitioned from one status to another. - This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. - format: date-time - type: string - message: - description: |- - message is a human readable message indicating details about the transition. - This may be an empty string. - maxLength: 32768 - type: string - observedGeneration: - description: |- - observedGeneration represents the .metadata.generation that the condition was set based upon. - For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date - with respect to the current state of the instance. - format: int64 - minimum: 0 - type: integer - reason: - description: |- - reason contains a programmatic identifier indicating the reason for the condition's last transition. - Producers of specific condition types may define expected values and meanings for this field, - and whether the values are considered a guaranteed API. - The value should be a CamelCase string. - This field may not be empty. - maxLength: 1024 - minLength: 1 - pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ - type: string - status: - description: status of the condition, one of True, False, Unknown. - enum: - - "True" - - "False" - - Unknown - type: string - type: - description: |- - type of condition in CamelCase or in foo.example.com/CamelCase. - --- - Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be - useful (see .node.status.conditions), the ability to deconflict is important. - The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) - maxLength: 316 - pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ - type: string - required: - - lastTransitionTime - - message - - reason - - status - - type - type: object - type: array - x-kubernetes-list-map-keys: - - type - x-kubernetes-list-type: map - type: object - type: object - served: true - storage: false - name: v1alpha1 schema: openAPIV3Schema: diff --git a/crds/infra.kuid.dev_nodeitems.yaml b/crds/infra.kuid.dev_nodeitems.yaml index 136456c..da08fa6 100644 --- a/crds/infra.kuid.dev_nodeitems.yaml +++ b/crds/infra.kuid.dev_nodeitems.yaml @@ -16,129 +16,6 @@ spec: singular: nodeitem scope: Namespaced versions: - - name: infra - schema: - openAPIV3Schema: - description: |- - A NodeItem represents a specific hardware component or accessory associated with a Node. - NodeItems represent a wide range of hardware elements, e.g Fan(s), PowerUnit(s), CPU(s), - and other peripheral devices essential for the operation of the Node. - NodeItem is used to represent the modular components of a node. - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: NodeItemSpec defines the desired state of NodeItem - properties: - labels: - additionalProperties: - type: string - description: Labels as user defined labels - type: object - node: - description: Node defines the name of the node - type: string - partition: - description: Partition defines the partition this resource belongs - to - type: string - region: - description: Region defines the region of the resource - type: string - site: - description: Site defines the site of the resource - type: string - required: - - node - - partition - - region - - site - type: object - status: - description: NodeItemStatus defines the observed state of NodeItem - properties: - conditions: - description: Conditions of the resource. - items: - properties: - lastTransitionTime: - description: |- - lastTransitionTime is the last time the condition transitioned from one status to another. - This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. - format: date-time - type: string - message: - description: |- - message is a human readable message indicating details about the transition. - This may be an empty string. - maxLength: 32768 - type: string - observedGeneration: - description: |- - observedGeneration represents the .metadata.generation that the condition was set based upon. - For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date - with respect to the current state of the instance. - format: int64 - minimum: 0 - type: integer - reason: - description: |- - reason contains a programmatic identifier indicating the reason for the condition's last transition. - Producers of specific condition types may define expected values and meanings for this field, - and whether the values are considered a guaranteed API. - The value should be a CamelCase string. - This field may not be empty. - maxLength: 1024 - minLength: 1 - pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ - type: string - status: - description: status of the condition, one of True, False, Unknown. - enum: - - "True" - - "False" - - Unknown - type: string - type: - description: |- - type of condition in CamelCase or in foo.example.com/CamelCase. - --- - Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be - useful (see .node.status.conditions), the ability to deconflict is important. - The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) - maxLength: 316 - pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ - type: string - required: - - lastTransitionTime - - message - - reason - - status - - type - type: object - type: array - x-kubernetes-list-map-keys: - - type - x-kubernetes-list-type: map - type: object - type: object - served: true - storage: false - name: v1alpha1 schema: openAPIV3Schema: diff --git a/crds/infra.kuid.dev_nodes.jinja2 b/crds/infra.kuid.dev_nodes.jinja2 deleted file mode 100644 index f33b79a..0000000 --- a/crds/infra.kuid.dev_nodes.jinja2 +++ /dev/null @@ -1,22 +0,0 @@ -apiVersion: infra.kuid.dev/v1alpha1 -kind: Node -metadata: - name: {{ metadata.name }} - namespace: {{ metadata.namespace }} -spec: - partition: - region: - site: - node: - {%- if rack %} - rack: - {%- endif %} - {%- if position %} - position - {%- endif %} - {%- if location %} - location - {%- endif %} - provider: - platformType: - *labels: \ No newline at end of file diff --git a/crds/infra.kuid.dev_nodes.star b/crds/infra.kuid.dev_nodes.star deleted file mode 100644 index f9bb3ff..0000000 --- a/crds/infra.kuid.dev_nodes.star +++ /dev/null @@ -1,59 +0,0 @@ -load("id.kuid.dev.ids.star", "getNodeKeys") - -def getNodeKeys(): - return { - "partition": True, - "region": True, - "site": True, - "node": True, - } - -def getNodeID(partition, region, site, node): - return { - "partition": partition, - "region": region, - "site": site, - "node": node, - } - -def getNodeID(self): - nodeKeys = getNodeKeys() - spec = getSpec(self) - nodeID = {} - for key, val in spec.items(): - if key in nodeKeys: - nodeID[key] = val - return nodeID - -def genNodeIDString(nodeID): - return nodeID["partition"] + "." + nodeID["region"] + "." + nodeID["site"] + "." + nodeID["node"] - - -def getSpec(self): - return self.get("spec", {}) - -def getPartition(self): - spec = getSpec(self) - return spec.get("partition", "") - -def getProvider(self): - spec = getSpec(self) - return spec.get("provider", "") - -def getPlatformType(self): - spec = getSpec(self) - return spec.get("platformType", "") - -def getStatus(self): - return self.get("status", {}) - -def getNode(name, namespace, spec): - return { - "apiVersion": "infra.kuid.dev/v1alpha1", - "kind": "Node", - "metadata": { - "name": name, - "namespace": namespace, - }, - "spec": spec, - } \ No newline at end of file diff --git a/crds/infra.kuid.dev_nodes.yaml b/crds/infra.kuid.dev_nodes.yaml index 773f27a..9c3ef9f 100644 --- a/crds/infra.kuid.dev_nodes.yaml +++ b/crds/infra.kuid.dev_nodes.yaml @@ -16,163 +16,6 @@ spec: singular: node scope: Namespaced versions: - - name: infra - schema: - openAPIV3Schema: - description: |- - A Node represents a fundamental unit that implements compute, storage, and/or networking within your environment. - Nodes can embody physical, virtual, or containerized entities, offering versatility in deployment options to suit - diverse infrastructure requirements. - Nodes are logically organized within racks and sites/regions, establishing a hierarchical structure for efficient - resource management and organization. Additionally, Nodes are associated with nodeGroups, facilitating centralized - management and control within defined administrative boundaries. - Each Node is assigned a provider, representing the entity responsible for implementing the specifics of the Node. - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: NodeSpec defines the desired state of Node - properties: - labels: - additionalProperties: - type: string - description: Labels as user defined labels - type: object - location: - description: |- - Location defines the location information where this resource is located - in lon/lat coordinates - properties: - latitude: - type: string - longitude: - type: string - required: - - latitude - - longitude - type: object - node: - description: Node defines the name of the node - type: string - partition: - description: Partition defines the partition this resource belongs - to - type: string - platformType: - description: PlatformType define the type of platform implementing - the nodespec - type: string - position: - description: relative position in the rack - type: string - provider: - description: Provider defines the provider implementing this resource. - type: string - rack: - description: Rack defines the rack in which the node is deployed - type: string - region: - description: Region defines the region of the resource - type: string - site: - description: Site defines the site of the resource - type: string - required: - - node - - partition - - platformType - - provider - - region - - site - type: object - status: - description: NodeStatus defines the observed state of Node - properties: - conditions: - description: Conditions of the resource. - items: - properties: - lastTransitionTime: - description: |- - lastTransitionTime is the last time the condition transitioned from one status to another. - This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. - format: date-time - type: string - message: - description: |- - message is a human readable message indicating details about the transition. - This may be an empty string. - maxLength: 32768 - type: string - observedGeneration: - description: |- - observedGeneration represents the .metadata.generation that the condition was set based upon. - For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date - with respect to the current state of the instance. - format: int64 - minimum: 0 - type: integer - reason: - description: |- - reason contains a programmatic identifier indicating the reason for the condition's last transition. - Producers of specific condition types may define expected values and meanings for this field, - and whether the values are considered a guaranteed API. - The value should be a CamelCase string. - This field may not be empty. - maxLength: 1024 - minLength: 1 - pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ - type: string - status: - description: status of the condition, one of True, False, Unknown. - enum: - - "True" - - "False" - - Unknown - type: string - type: - description: |- - type of condition in CamelCase or in foo.example.com/CamelCase. - --- - Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be - useful (see .node.status.conditions), the ability to deconflict is important. - The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) - maxLength: 316 - pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ - type: string - required: - - lastTransitionTime - - message - - reason - - status - - type - type: object - type: array - x-kubernetes-list-map-keys: - - type - x-kubernetes-list-type: map - systemID: - description: System ID define the unique system id of the node - type: string - type: object - type: object - served: true - storage: false - name: v1alpha1 schema: openAPIV3Schema: diff --git a/crds/infra.kuid.dev_nodesets.yaml b/crds/infra.kuid.dev_nodesets.yaml index c65dfa8..dd13b8e 100644 --- a/crds/infra.kuid.dev_nodesets.yaml +++ b/crds/infra.kuid.dev_nodesets.yaml @@ -16,178 +16,6 @@ spec: singular: nodeset scope: Namespaced versions: - - name: infra - schema: - openAPIV3Schema: - description: |- - A NodeSet represents a set of nodes. - E.g. it can be used to model a set of nodes in a NodeSet that share the same - charecteristics wrt, Numa, interfaces, etc. - Another usage of NodeSet is the representation of a virtual Node that consists of multiple nodes. - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: NodeSetSetSpec defines the desired state of NodeSet - properties: - cluster: - description: Cluster defines the name of the cluster - type: string - labels: - additionalProperties: - type: string - description: Labels as user defined labels - type: object - nodeSet: - type: string - partition: - description: Partition defines the partition this resource belongs - to - type: string - region: - description: Region defines the region of the resource - type: string - selector: - description: Selector defines the selector criterias - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. - The requirements are ANDed. - items: - description: |- - A label selector requirement is a selector that contains values, a key, and an operator that - relates the key and values. - properties: - key: - description: key is the label key that the selector applies - to. - type: string - operator: - description: |- - operator represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: |- - values is an array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. This array is replaced during a strategic - merge patch. - items: - type: string - type: array - x-kubernetes-list-type: atomic - required: - - key - - operator - type: object - type: array - x-kubernetes-list-type: atomic - matchLabels: - additionalProperties: - type: string - description: |- - matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, whose key field is "key", the - operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - site: - description: Site defines the site of the resource - type: string - required: - - cluster - - nodeSet - - partition - - region - - site - type: object - status: - description: NodeSetStatus defines the observed state of NodeSet - properties: - conditions: - description: Conditions of the resource. - items: - properties: - lastTransitionTime: - description: |- - lastTransitionTime is the last time the condition transitioned from one status to another. - This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. - format: date-time - type: string - message: - description: |- - message is a human readable message indicating details about the transition. - This may be an empty string. - maxLength: 32768 - type: string - observedGeneration: - description: |- - observedGeneration represents the .metadata.generation that the condition was set based upon. - For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date - with respect to the current state of the instance. - format: int64 - minimum: 0 - type: integer - reason: - description: |- - reason contains a programmatic identifier indicating the reason for the condition's last transition. - Producers of specific condition types may define expected values and meanings for this field, - and whether the values are considered a guaranteed API. - The value should be a CamelCase string. - This field may not be empty. - maxLength: 1024 - minLength: 1 - pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ - type: string - status: - description: status of the condition, one of True, False, Unknown. - enum: - - "True" - - "False" - - Unknown - type: string - type: - description: |- - type of condition in CamelCase or in foo.example.com/CamelCase. - --- - Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be - useful (see .node.status.conditions), the ability to deconflict is important. - The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) - maxLength: 316 - pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ - type: string - required: - - lastTransitionTime - - message - - reason - - status - - type - type: object - type: array - x-kubernetes-list-map-keys: - - type - x-kubernetes-list-type: map - type: object - type: object - served: true - storage: false - name: v1alpha1 schema: openAPIV3Schema: diff --git a/crds/infra.kuid.dev_partitions.yaml b/crds/infra.kuid.dev_partitions.yaml index fbaa7db..ab718a1 100644 --- a/crds/infra.kuid.dev_partitions.yaml +++ b/crds/infra.kuid.dev_partitions.yaml @@ -16,106 +16,6 @@ spec: singular: partition scope: Namespaced versions: - - name: infra - schema: - openAPIV3Schema: - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: PartitionSpec defines the desired state of the partition - properties: - labels: - additionalProperties: - type: string - description: Labels as user defined labels - type: object - type: object - status: - description: PartitionStatus defines the observed state of Partition - properties: - conditions: - description: Conditions of the resource. - items: - properties: - lastTransitionTime: - description: |- - lastTransitionTime is the last time the condition transitioned from one status to another. - This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. - format: date-time - type: string - message: - description: |- - message is a human readable message indicating details about the transition. - This may be an empty string. - maxLength: 32768 - type: string - observedGeneration: - description: |- - observedGeneration represents the .metadata.generation that the condition was set based upon. - For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date - with respect to the current state of the instance. - format: int64 - minimum: 0 - type: integer - reason: - description: |- - reason contains a programmatic identifier indicating the reason for the condition's last transition. - Producers of specific condition types may define expected values and meanings for this field, - and whether the values are considered a guaranteed API. - The value should be a CamelCase string. - This field may not be empty. - maxLength: 1024 - minLength: 1 - pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ - type: string - status: - description: status of the condition, one of True, False, Unknown. - enum: - - "True" - - "False" - - Unknown - type: string - type: - description: |- - type of condition in CamelCase or in foo.example.com/CamelCase. - --- - Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be - useful (see .node.status.conditions), the ability to deconflict is important. - The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) - maxLength: 316 - pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ - type: string - required: - - lastTransitionTime - - message - - reason - - status - - type - type: object - type: array - x-kubernetes-list-map-keys: - - type - x-kubernetes-list-type: map - type: object - type: object - served: true - storage: false - name: v1alpha1 schema: openAPIV3Schema: diff --git a/crds/infra.kuid.dev_ports.yaml b/crds/infra.kuid.dev_ports.yaml new file mode 100644 index 0000000..4fe4bea --- /dev/null +++ b/crds/infra.kuid.dev_ports.yaml @@ -0,0 +1,153 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: ports.infra.kuid.dev +spec: + group: infra.kuid.dev + names: + categories: + - kuid + kind: Port + listKind: PortList + plural: ports + singular: port + scope: Namespaced + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: |- + An Port represents a communication interface or connection point within a Node, + facilitating network communication and data transfer between different components + or systems within the environment. `Ports` serve as gateways for transmitting and + receiving data, enabling seamless communication between Nodes. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: PortSpec defines the desired state of Port + properties: + labels: + additionalProperties: + type: string + description: Labels as user defined labels + type: object + module: + description: Module defines the module reference id + type: integer + moduleBay: + description: ModuleBay defines the moduleBay reference id + type: integer + node: + description: Node defines the name of the node + type: string + partition: + description: Partition defines the partition this resource belongs + to + type: string + port: + description: Port defines the id of the port + type: integer + region: + description: Region defines the region of the resource + type: string + site: + description: Site defines the site of the resource + type: string + required: + - node + - partition + - port + - region + - site + type: object + status: + description: PortStatus defines the observed state of Port + properties: + conditions: + description: Conditions of the resource. + items: + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object + type: object + served: true + storage: true + subresources: + status: {} diff --git a/crds/infra.kuid.dev_racks.yaml b/crds/infra.kuid.dev_racks.yaml index 9597960..4b5fa82 100644 --- a/crds/infra.kuid.dev_racks.yaml +++ b/crds/infra.kuid.dev_racks.yaml @@ -16,138 +16,6 @@ spec: singular: rack scope: Namespaced versions: - - name: infra - schema: - openAPIV3Schema: - description: |- - A rack represents a physical equipment rack within your environment. Each rack is designed to accommodate - the installation of devices and equipment. - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: RackSpec defines the desired state of Rack - properties: - height: - description: The height of the rack, measured in units. - type: string - labels: - additionalProperties: - type: string - description: Labels as user defined labels - type: object - location: - description: |- - Location defines the location information where this resource is located - in lon/lat coordinates - properties: - latitude: - type: string - longitude: - type: string - required: - - latitude - - longitude - type: object - region: - description: Region defines the region of the resource - type: string - site: - description: Site defines the site of the resource - type: string - width: - description: The canonical distance between the two vertical rails - on a face. In inch - type: string - required: - - region - - site - type: object - status: - description: RackStatus defines the observed state of Rack - properties: - conditions: - description: Conditions of the resource. - items: - properties: - lastTransitionTime: - description: |- - lastTransitionTime is the last time the condition transitioned from one status to another. - This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. - format: date-time - type: string - message: - description: |- - message is a human readable message indicating details about the transition. - This may be an empty string. - maxLength: 32768 - type: string - observedGeneration: - description: |- - observedGeneration represents the .metadata.generation that the condition was set based upon. - For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date - with respect to the current state of the instance. - format: int64 - minimum: 0 - type: integer - reason: - description: |- - reason contains a programmatic identifier indicating the reason for the condition's last transition. - Producers of specific condition types may define expected values and meanings for this field, - and whether the values are considered a guaranteed API. - The value should be a CamelCase string. - This field may not be empty. - maxLength: 1024 - minLength: 1 - pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ - type: string - status: - description: status of the condition, one of True, False, Unknown. - enum: - - "True" - - "False" - - Unknown - type: string - type: - description: |- - type of condition in CamelCase or in foo.example.com/CamelCase. - --- - Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be - useful (see .node.status.conditions), the ability to deconflict is important. - The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) - maxLength: 316 - pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ - type: string - required: - - lastTransitionTime - - message - - reason - - status - - type - type: object - type: array - x-kubernetes-list-map-keys: - - type - x-kubernetes-list-type: map - type: object - type: object - served: true - storage: false - name: v1alpha1 schema: openAPIV3Schema: diff --git a/crds/infra.kuid.dev_regions.yaml b/crds/infra.kuid.dev_regions.yaml index e7fd6e5..ab569cc 100644 --- a/crds/infra.kuid.dev_regions.yaml +++ b/crds/infra.kuid.dev_regions.yaml @@ -16,109 +16,6 @@ spec: singular: region scope: Namespaced versions: - - name: infra - schema: - openAPIV3Schema: - description: |- - A Region represent a geography in which multiple infrastructure resources are grouped - A Region might represent a continent, country, city, campus, or other area depending on your environment. - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: RegionSpec defines the desired state of Region - properties: - labels: - additionalProperties: - type: string - description: Labels as user defined labels - type: object - type: object - status: - description: RegionStatus defines the observed state of Region - properties: - conditions: - description: Conditions of the resource. - items: - properties: - lastTransitionTime: - description: |- - lastTransitionTime is the last time the condition transitioned from one status to another. - This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. - format: date-time - type: string - message: - description: |- - message is a human readable message indicating details about the transition. - This may be an empty string. - maxLength: 32768 - type: string - observedGeneration: - description: |- - observedGeneration represents the .metadata.generation that the condition was set based upon. - For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date - with respect to the current state of the instance. - format: int64 - minimum: 0 - type: integer - reason: - description: |- - reason contains a programmatic identifier indicating the reason for the condition's last transition. - Producers of specific condition types may define expected values and meanings for this field, - and whether the values are considered a guaranteed API. - The value should be a CamelCase string. - This field may not be empty. - maxLength: 1024 - minLength: 1 - pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ - type: string - status: - description: status of the condition, one of True, False, Unknown. - enum: - - "True" - - "False" - - Unknown - type: string - type: - description: |- - type of condition in CamelCase or in foo.example.com/CamelCase. - --- - Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be - useful (see .node.status.conditions), the ability to deconflict is important. - The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) - maxLength: 316 - pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ - type: string - required: - - lastTransitionTime - - message - - reason - - status - - type - type: object - type: array - x-kubernetes-list-map-keys: - - type - x-kubernetes-list-type: map - type: object - type: object - served: true - storage: false - name: v1alpha1 schema: openAPIV3Schema: diff --git a/crds/infra.kuid.dev_sites.yaml b/crds/infra.kuid.dev_sites.yaml index 1ce7efd..9e261c5 100644 --- a/crds/infra.kuid.dev_sites.yaml +++ b/crds/infra.kuid.dev_sites.yaml @@ -16,132 +16,6 @@ spec: singular: site scope: Namespaced versions: - - name: infra - schema: - openAPIV3Schema: - description: |- - A site serves as a fundamental organizational unit for managing infrastructure resources within your environment. - The utilization of sites may vary based on the organizational structure and requirements, - but in essence, each site typically corresponds to a distinct building or campus. - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: SiteSpec defines the desired state of Site - properties: - labels: - additionalProperties: - type: string - description: Labels as user defined labels - type: object - location: - description: |- - Location defines the location information where this resource is located - in lon/lat coordinates - properties: - latitude: - type: string - longitude: - type: string - required: - - latitude - - longitude - type: object - region: - description: Region defines the region of the resource - type: string - site: - description: Site defines the site of the resource - type: string - required: - - region - - site - type: object - status: - description: SiteStatus defines the observed state of Site - properties: - conditions: - description: Conditions of the resource. - items: - properties: - lastTransitionTime: - description: |- - lastTransitionTime is the last time the condition transitioned from one status to another. - This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. - format: date-time - type: string - message: - description: |- - message is a human readable message indicating details about the transition. - This may be an empty string. - maxLength: 32768 - type: string - observedGeneration: - description: |- - observedGeneration represents the .metadata.generation that the condition was set based upon. - For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date - with respect to the current state of the instance. - format: int64 - minimum: 0 - type: integer - reason: - description: |- - reason contains a programmatic identifier indicating the reason for the condition's last transition. - Producers of specific condition types may define expected values and meanings for this field, - and whether the values are considered a guaranteed API. - The value should be a CamelCase string. - This field may not be empty. - maxLength: 1024 - minLength: 1 - pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ - type: string - status: - description: status of the condition, one of True, False, Unknown. - enum: - - "True" - - "False" - - Unknown - type: string - type: - description: |- - type of condition in CamelCase or in foo.example.com/CamelCase. - --- - Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be - useful (see .node.status.conditions), the ability to deconflict is important. - The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) - maxLength: 316 - pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ - type: string - required: - - lastTransitionTime - - message - - reason - - status - - type - type: object - type: array - x-kubernetes-list-map-keys: - - type - x-kubernetes-list-type: map - type: object - type: object - served: true - storage: false - name: v1alpha1 schema: openAPIV3Schema: diff --git a/pkg/generated/clientset/versioned/typed/infra/v1alpha1/adaptor.go b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/adaptor.go new file mode 100644 index 0000000..0ad9cc8 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/adaptor.go @@ -0,0 +1,68 @@ +/* +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. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + scheme "github.com/kuidio/kuid/pkg/generated/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + gentype "k8s.io/client-go/gentype" +) + +// AdaptorsGetter has a method to return a AdaptorInterface. +// A group's client should implement this interface. +type AdaptorsGetter interface { + Adaptors(namespace string) AdaptorInterface +} + +// AdaptorInterface has methods to work with Adaptor resources. +type AdaptorInterface interface { + Create(ctx context.Context, adaptor *v1alpha1.Adaptor, opts v1.CreateOptions) (*v1alpha1.Adaptor, error) + Update(ctx context.Context, adaptor *v1alpha1.Adaptor, opts v1.UpdateOptions) (*v1alpha1.Adaptor, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, adaptor *v1alpha1.Adaptor, opts v1.UpdateOptions) (*v1alpha1.Adaptor, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.Adaptor, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.AdaptorList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Adaptor, err error) + AdaptorExpansion +} + +// adaptors implements AdaptorInterface +type adaptors struct { + *gentype.ClientWithList[*v1alpha1.Adaptor, *v1alpha1.AdaptorList] +} + +// newAdaptors returns a Adaptors +func newAdaptors(c *InfraV1alpha1Client, namespace string) *adaptors { + return &adaptors{ + gentype.NewClientWithList[*v1alpha1.Adaptor, *v1alpha1.AdaptorList]( + "adaptors", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.Adaptor { return &v1alpha1.Adaptor{} }, + func() *v1alpha1.AdaptorList { return &v1alpha1.AdaptorList{} }), + } +} diff --git a/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_adaptor.go b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_adaptor.go new file mode 100644 index 0000000..cab171f --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_adaptor.go @@ -0,0 +1,146 @@ +/* +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. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeAdaptors implements AdaptorInterface +type FakeAdaptors struct { + Fake *FakeInfraV1alpha1 + ns string +} + +var adaptorsResource = v1alpha1.SchemeGroupVersion.WithResource("adaptors") + +var adaptorsKind = v1alpha1.SchemeGroupVersion.WithKind("Adaptor") + +// Get takes name of the adaptor, and returns the corresponding adaptor object, and an error if there is any. +func (c *FakeAdaptors) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Adaptor, err error) { + emptyResult := &v1alpha1.Adaptor{} + obj, err := c.Fake. + Invokes(testing.NewGetActionWithOptions(adaptorsResource, c.ns, name, options), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Adaptor), err +} + +// List takes label and field selectors, and returns the list of Adaptors that match those selectors. +func (c *FakeAdaptors) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.AdaptorList, err error) { + emptyResult := &v1alpha1.AdaptorList{} + obj, err := c.Fake. + Invokes(testing.NewListActionWithOptions(adaptorsResource, adaptorsKind, c.ns, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.AdaptorList{ListMeta: obj.(*v1alpha1.AdaptorList).ListMeta} + for _, item := range obj.(*v1alpha1.AdaptorList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested adaptors. +func (c *FakeAdaptors) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchActionWithOptions(adaptorsResource, c.ns, opts)) + +} + +// Create takes the representation of a adaptor and creates it. Returns the server's representation of the adaptor, and an error, if there is any. +func (c *FakeAdaptors) Create(ctx context.Context, adaptor *v1alpha1.Adaptor, opts v1.CreateOptions) (result *v1alpha1.Adaptor, err error) { + emptyResult := &v1alpha1.Adaptor{} + obj, err := c.Fake. + Invokes(testing.NewCreateActionWithOptions(adaptorsResource, c.ns, adaptor, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Adaptor), err +} + +// Update takes the representation of a adaptor and updates it. Returns the server's representation of the adaptor, and an error, if there is any. +func (c *FakeAdaptors) Update(ctx context.Context, adaptor *v1alpha1.Adaptor, opts v1.UpdateOptions) (result *v1alpha1.Adaptor, err error) { + emptyResult := &v1alpha1.Adaptor{} + obj, err := c.Fake. + Invokes(testing.NewUpdateActionWithOptions(adaptorsResource, c.ns, adaptor, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Adaptor), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeAdaptors) UpdateStatus(ctx context.Context, adaptor *v1alpha1.Adaptor, opts v1.UpdateOptions) (result *v1alpha1.Adaptor, err error) { + emptyResult := &v1alpha1.Adaptor{} + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceActionWithOptions(adaptorsResource, "status", c.ns, adaptor, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Adaptor), err +} + +// Delete takes name of the adaptor and deletes it. Returns an error if one occurs. +func (c *FakeAdaptors) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(adaptorsResource, c.ns, name, opts), &v1alpha1.Adaptor{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeAdaptors) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(adaptorsResource, c.ns, opts, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.AdaptorList{}) + return err +} + +// Patch applies the patch and returns the patched adaptor. +func (c *FakeAdaptors) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Adaptor, err error) { + emptyResult := &v1alpha1.Adaptor{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(adaptorsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Adaptor), err +} diff --git a/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_infra_client.go b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_infra_client.go index 017a018..4480fa4 100644 --- a/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_infra_client.go +++ b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_infra_client.go @@ -27,6 +27,10 @@ type FakeInfraV1alpha1 struct { *testing.Fake } +func (c *FakeInfraV1alpha1) Adaptors(namespace string) v1alpha1.AdaptorInterface { + return &FakeAdaptors{c, namespace} +} + func (c *FakeInfraV1alpha1) Clusters(namespace string) v1alpha1.ClusterInterface { return &FakeClusters{c, namespace} } @@ -71,6 +75,10 @@ func (c *FakeInfraV1alpha1) Partitions(namespace string) v1alpha1.PartitionInter return &FakePartitions{c, namespace} } +func (c *FakeInfraV1alpha1) Ports(namespace string) v1alpha1.PortInterface { + return &FakePorts{c, namespace} +} + func (c *FakeInfraV1alpha1) Racks(namespace string) v1alpha1.RackInterface { return &FakeRacks{c, namespace} } diff --git a/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_port.go b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_port.go new file mode 100644 index 0000000..04e7e74 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/fake/fake_port.go @@ -0,0 +1,146 @@ +/* +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. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakePorts implements PortInterface +type FakePorts struct { + Fake *FakeInfraV1alpha1 + ns string +} + +var portsResource = v1alpha1.SchemeGroupVersion.WithResource("ports") + +var portsKind = v1alpha1.SchemeGroupVersion.WithKind("Port") + +// Get takes name of the port, and returns the corresponding port object, and an error if there is any. +func (c *FakePorts) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Port, err error) { + emptyResult := &v1alpha1.Port{} + obj, err := c.Fake. + Invokes(testing.NewGetActionWithOptions(portsResource, c.ns, name, options), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Port), err +} + +// List takes label and field selectors, and returns the list of Ports that match those selectors. +func (c *FakePorts) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.PortList, err error) { + emptyResult := &v1alpha1.PortList{} + obj, err := c.Fake. + Invokes(testing.NewListActionWithOptions(portsResource, portsKind, c.ns, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.PortList{ListMeta: obj.(*v1alpha1.PortList).ListMeta} + for _, item := range obj.(*v1alpha1.PortList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested ports. +func (c *FakePorts) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchActionWithOptions(portsResource, c.ns, opts)) + +} + +// Create takes the representation of a port and creates it. Returns the server's representation of the port, and an error, if there is any. +func (c *FakePorts) Create(ctx context.Context, port *v1alpha1.Port, opts v1.CreateOptions) (result *v1alpha1.Port, err error) { + emptyResult := &v1alpha1.Port{} + obj, err := c.Fake. + Invokes(testing.NewCreateActionWithOptions(portsResource, c.ns, port, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Port), err +} + +// Update takes the representation of a port and updates it. Returns the server's representation of the port, and an error, if there is any. +func (c *FakePorts) Update(ctx context.Context, port *v1alpha1.Port, opts v1.UpdateOptions) (result *v1alpha1.Port, err error) { + emptyResult := &v1alpha1.Port{} + obj, err := c.Fake. + Invokes(testing.NewUpdateActionWithOptions(portsResource, c.ns, port, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Port), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakePorts) UpdateStatus(ctx context.Context, port *v1alpha1.Port, opts v1.UpdateOptions) (result *v1alpha1.Port, err error) { + emptyResult := &v1alpha1.Port{} + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceActionWithOptions(portsResource, "status", c.ns, port, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Port), err +} + +// Delete takes name of the port and deletes it. Returns an error if one occurs. +func (c *FakePorts) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(portsResource, c.ns, name, opts), &v1alpha1.Port{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakePorts) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(portsResource, c.ns, opts, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.PortList{}) + return err +} + +// Patch applies the patch and returns the patched port. +func (c *FakePorts) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Port, err error) { + emptyResult := &v1alpha1.Port{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(portsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Port), err +} diff --git a/pkg/generated/clientset/versioned/typed/infra/v1alpha1/generated_expansion.go b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/generated_expansion.go index 69e6aaa..bcd7bf1 100644 --- a/pkg/generated/clientset/versioned/typed/infra/v1alpha1/generated_expansion.go +++ b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/generated_expansion.go @@ -17,6 +17,8 @@ limitations under the License. package v1alpha1 +type AdaptorExpansion interface{} + type ClusterExpansion interface{} type EndpointExpansion interface{} @@ -39,6 +41,8 @@ type NodeSetExpansion interface{} type PartitionExpansion interface{} +type PortExpansion interface{} + type RackExpansion interface{} type RegionExpansion interface{} diff --git a/pkg/generated/clientset/versioned/typed/infra/v1alpha1/infra_client.go b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/infra_client.go index c7d4d4f..4f021fb 100644 --- a/pkg/generated/clientset/versioned/typed/infra/v1alpha1/infra_client.go +++ b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/infra_client.go @@ -27,6 +27,7 @@ import ( type InfraV1alpha1Interface interface { RESTClient() rest.Interface + AdaptorsGetter ClustersGetter EndpointsGetter EndpointSetsGetter @@ -38,6 +39,7 @@ type InfraV1alpha1Interface interface { NodeItemsGetter NodeSetsGetter PartitionsGetter + PortsGetter RacksGetter RegionsGetter SitesGetter @@ -48,6 +50,10 @@ type InfraV1alpha1Client struct { restClient rest.Interface } +func (c *InfraV1alpha1Client) Adaptors(namespace string) AdaptorInterface { + return newAdaptors(c, namespace) +} + func (c *InfraV1alpha1Client) Clusters(namespace string) ClusterInterface { return newClusters(c, namespace) } @@ -92,6 +98,10 @@ func (c *InfraV1alpha1Client) Partitions(namespace string) PartitionInterface { return newPartitions(c, namespace) } +func (c *InfraV1alpha1Client) Ports(namespace string) PortInterface { + return newPorts(c, namespace) +} + func (c *InfraV1alpha1Client) Racks(namespace string) RackInterface { return newRacks(c, namespace) } diff --git a/pkg/generated/clientset/versioned/typed/infra/v1alpha1/port.go b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/port.go new file mode 100644 index 0000000..836f44b --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/infra/v1alpha1/port.go @@ -0,0 +1,68 @@ +/* +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. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + scheme "github.com/kuidio/kuid/pkg/generated/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + gentype "k8s.io/client-go/gentype" +) + +// PortsGetter has a method to return a PortInterface. +// A group's client should implement this interface. +type PortsGetter interface { + Ports(namespace string) PortInterface +} + +// PortInterface has methods to work with Port resources. +type PortInterface interface { + Create(ctx context.Context, port *v1alpha1.Port, opts v1.CreateOptions) (*v1alpha1.Port, error) + Update(ctx context.Context, port *v1alpha1.Port, opts v1.UpdateOptions) (*v1alpha1.Port, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, port *v1alpha1.Port, opts v1.UpdateOptions) (*v1alpha1.Port, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.Port, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.PortList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Port, err error) + PortExpansion +} + +// ports implements PortInterface +type ports struct { + *gentype.ClientWithList[*v1alpha1.Port, *v1alpha1.PortList] +} + +// newPorts returns a Ports +func newPorts(c *InfraV1alpha1Client, namespace string) *ports { + return &ports{ + gentype.NewClientWithList[*v1alpha1.Port, *v1alpha1.PortList]( + "ports", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.Port { return &v1alpha1.Port{} }, + func() *v1alpha1.PortList { return &v1alpha1.PortList{} }), + } +} diff --git a/pkg/generated/informers/externalversions/generic.go b/pkg/generated/informers/externalversions/generic.go index 836858f..e6e4b11 100644 --- a/pkg/generated/informers/externalversions/generic.go +++ b/pkg/generated/informers/externalversions/generic.go @@ -72,6 +72,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource return &genericInformer{resource: resource.GroupResource(), informer: f.Extcomm().V1alpha1().EXTCOMMIndexes().Informer()}, nil // Group=infra.kuid.dev, Version=v1alpha1 + case infrav1alpha1.SchemeGroupVersion.WithResource("adaptors"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Infra().V1alpha1().Adaptors().Informer()}, nil case infrav1alpha1.SchemeGroupVersion.WithResource("clusters"): return &genericInformer{resource: resource.GroupResource(), informer: f.Infra().V1alpha1().Clusters().Informer()}, nil case infrav1alpha1.SchemeGroupVersion.WithResource("endpoints"): @@ -94,6 +96,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource return &genericInformer{resource: resource.GroupResource(), informer: f.Infra().V1alpha1().NodeSets().Informer()}, nil case infrav1alpha1.SchemeGroupVersion.WithResource("partitions"): return &genericInformer{resource: resource.GroupResource(), informer: f.Infra().V1alpha1().Partitions().Informer()}, nil + case infrav1alpha1.SchemeGroupVersion.WithResource("ports"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Infra().V1alpha1().Ports().Informer()}, nil case infrav1alpha1.SchemeGroupVersion.WithResource("racks"): return &genericInformer{resource: resource.GroupResource(), informer: f.Infra().V1alpha1().Racks().Informer()}, nil case infrav1alpha1.SchemeGroupVersion.WithResource("regions"): diff --git a/pkg/generated/informers/externalversions/infra/v1alpha1/adaptor.go b/pkg/generated/informers/externalversions/infra/v1alpha1/adaptor.go new file mode 100644 index 0000000..6931659 --- /dev/null +++ b/pkg/generated/informers/externalversions/infra/v1alpha1/adaptor.go @@ -0,0 +1,89 @@ +/* +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. +*/ +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + infrav1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + versioned "github.com/kuidio/kuid/pkg/generated/clientset/versioned" + internalinterfaces "github.com/kuidio/kuid/pkg/generated/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/kuidio/kuid/pkg/generated/listers/infra/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// AdaptorInformer provides access to a shared informer and lister for +// Adaptors. +type AdaptorInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.AdaptorLister +} + +type adaptorInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewAdaptorInformer constructs a new informer for Adaptor type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewAdaptorInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredAdaptorInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredAdaptorInformer constructs a new informer for Adaptor type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredAdaptorInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.InfraV1alpha1().Adaptors(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.InfraV1alpha1().Adaptors(namespace).Watch(context.TODO(), options) + }, + }, + &infrav1alpha1.Adaptor{}, + resyncPeriod, + indexers, + ) +} + +func (f *adaptorInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredAdaptorInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *adaptorInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&infrav1alpha1.Adaptor{}, f.defaultInformer) +} + +func (f *adaptorInformer) Lister() v1alpha1.AdaptorLister { + return v1alpha1.NewAdaptorLister(f.Informer().GetIndexer()) +} diff --git a/pkg/generated/informers/externalversions/infra/v1alpha1/interface.go b/pkg/generated/informers/externalversions/infra/v1alpha1/interface.go index 62d941f..becc853 100644 --- a/pkg/generated/informers/externalversions/infra/v1alpha1/interface.go +++ b/pkg/generated/informers/externalversions/infra/v1alpha1/interface.go @@ -23,6 +23,8 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { + // Adaptors returns a AdaptorInformer. + Adaptors() AdaptorInformer // Clusters returns a ClusterInformer. Clusters() ClusterInformer // Endpoints returns a EndpointInformer. @@ -45,6 +47,8 @@ type Interface interface { NodeSets() NodeSetInformer // Partitions returns a PartitionInformer. Partitions() PartitionInformer + // Ports returns a PortInformer. + Ports() PortInformer // Racks returns a RackInformer. Racks() RackInformer // Regions returns a RegionInformer. @@ -64,6 +68,11 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } +// Adaptors returns a AdaptorInformer. +func (v *version) Adaptors() AdaptorInformer { + return &adaptorInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + // Clusters returns a ClusterInformer. func (v *version) Clusters() ClusterInformer { return &clusterInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} @@ -119,6 +128,11 @@ func (v *version) Partitions() PartitionInformer { return &partitionInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } +// Ports returns a PortInformer. +func (v *version) Ports() PortInformer { + return &portInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + // Racks returns a RackInformer. func (v *version) Racks() RackInformer { return &rackInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} diff --git a/pkg/generated/informers/externalversions/infra/v1alpha1/port.go b/pkg/generated/informers/externalversions/infra/v1alpha1/port.go new file mode 100644 index 0000000..62ab171 --- /dev/null +++ b/pkg/generated/informers/externalversions/infra/v1alpha1/port.go @@ -0,0 +1,89 @@ +/* +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. +*/ +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + infrav1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + versioned "github.com/kuidio/kuid/pkg/generated/clientset/versioned" + internalinterfaces "github.com/kuidio/kuid/pkg/generated/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/kuidio/kuid/pkg/generated/listers/infra/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// PortInformer provides access to a shared informer and lister for +// Ports. +type PortInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.PortLister +} + +type portInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewPortInformer constructs a new informer for Port type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPortInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPortInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredPortInformer constructs a new informer for Port type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPortInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.InfraV1alpha1().Ports(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.InfraV1alpha1().Ports(namespace).Watch(context.TODO(), options) + }, + }, + &infrav1alpha1.Port{}, + resyncPeriod, + indexers, + ) +} + +func (f *portInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPortInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *portInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&infrav1alpha1.Port{}, f.defaultInformer) +} + +func (f *portInformer) Lister() v1alpha1.PortLister { + return v1alpha1.NewPortLister(f.Informer().GetIndexer()) +} diff --git a/pkg/generated/listers/infra/v1alpha1/adaptor.go b/pkg/generated/listers/infra/v1alpha1/adaptor.go new file mode 100644 index 0000000..3894200 --- /dev/null +++ b/pkg/generated/listers/infra/v1alpha1/adaptor.go @@ -0,0 +1,69 @@ +/* +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. +*/ +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" + "k8s.io/client-go/tools/cache" +) + +// AdaptorLister helps list Adaptors. +// All objects returned here must be treated as read-only. +type AdaptorLister interface { + // List lists all Adaptors in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.Adaptor, err error) + // Adaptors returns an object that can list and get Adaptors. + Adaptors(namespace string) AdaptorNamespaceLister + AdaptorListerExpansion +} + +// adaptorLister implements the AdaptorLister interface. +type adaptorLister struct { + listers.ResourceIndexer[*v1alpha1.Adaptor] +} + +// NewAdaptorLister returns a new AdaptorLister. +func NewAdaptorLister(indexer cache.Indexer) AdaptorLister { + return &adaptorLister{listers.New[*v1alpha1.Adaptor](indexer, v1alpha1.Resource("adaptor"))} +} + +// Adaptors returns an object that can list and get Adaptors. +func (s *adaptorLister) Adaptors(namespace string) AdaptorNamespaceLister { + return adaptorNamespaceLister{listers.NewNamespaced[*v1alpha1.Adaptor](s.ResourceIndexer, namespace)} +} + +// AdaptorNamespaceLister helps list and get Adaptors. +// All objects returned here must be treated as read-only. +type AdaptorNamespaceLister interface { + // List lists all Adaptors in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.Adaptor, err error) + // Get retrieves the Adaptor from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.Adaptor, error) + AdaptorNamespaceListerExpansion +} + +// adaptorNamespaceLister implements the AdaptorNamespaceLister +// interface. +type adaptorNamespaceLister struct { + listers.ResourceIndexer[*v1alpha1.Adaptor] +} diff --git a/pkg/generated/listers/infra/v1alpha1/expansion_generated.go b/pkg/generated/listers/infra/v1alpha1/expansion_generated.go index 241995f..56f04d6 100644 --- a/pkg/generated/listers/infra/v1alpha1/expansion_generated.go +++ b/pkg/generated/listers/infra/v1alpha1/expansion_generated.go @@ -17,6 +17,14 @@ limitations under the License. package v1alpha1 +// AdaptorListerExpansion allows custom methods to be added to +// AdaptorLister. +type AdaptorListerExpansion interface{} + +// AdaptorNamespaceListerExpansion allows custom methods to be added to +// AdaptorNamespaceLister. +type AdaptorNamespaceListerExpansion interface{} + // ClusterListerExpansion allows custom methods to be added to // ClusterLister. type ClusterListerExpansion interface{} @@ -105,6 +113,14 @@ type PartitionListerExpansion interface{} // PartitionNamespaceLister. type PartitionNamespaceListerExpansion interface{} +// PortListerExpansion allows custom methods to be added to +// PortLister. +type PortListerExpansion interface{} + +// PortNamespaceListerExpansion allows custom methods to be added to +// PortNamespaceLister. +type PortNamespaceListerExpansion interface{} + // RackListerExpansion allows custom methods to be added to // RackLister. type RackListerExpansion interface{} diff --git a/pkg/generated/listers/infra/v1alpha1/port.go b/pkg/generated/listers/infra/v1alpha1/port.go new file mode 100644 index 0000000..c040ff3 --- /dev/null +++ b/pkg/generated/listers/infra/v1alpha1/port.go @@ -0,0 +1,69 @@ +/* +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. +*/ +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/kuidio/kuid/apis/infra/v1alpha1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" + "k8s.io/client-go/tools/cache" +) + +// PortLister helps list Ports. +// All objects returned here must be treated as read-only. +type PortLister interface { + // List lists all Ports in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.Port, err error) + // Ports returns an object that can list and get Ports. + Ports(namespace string) PortNamespaceLister + PortListerExpansion +} + +// portLister implements the PortLister interface. +type portLister struct { + listers.ResourceIndexer[*v1alpha1.Port] +} + +// NewPortLister returns a new PortLister. +func NewPortLister(indexer cache.Indexer) PortLister { + return &portLister{listers.New[*v1alpha1.Port](indexer, v1alpha1.Resource("port"))} +} + +// Ports returns an object that can list and get Ports. +func (s *portLister) Ports(namespace string) PortNamespaceLister { + return portNamespaceLister{listers.NewNamespaced[*v1alpha1.Port](s.ResourceIndexer, namespace)} +} + +// PortNamespaceLister helps list and get Ports. +// All objects returned here must be treated as read-only. +type PortNamespaceLister interface { + // List lists all Ports in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.Port, err error) + // Get retrieves the Port from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.Port, error) + PortNamespaceListerExpansion +} + +// portNamespaceLister implements the PortNamespaceLister +// interface. +type portNamespaceLister struct { + listers.ResourceIndexer[*v1alpha1.Port] +} diff --git a/pkg/generated/openapi/zz_generated.openapi.go b/pkg/generated/openapi/zz_generated.openapi.go index e7e6e4a..686dbca 100644 --- a/pkg/generated/openapi/zz_generated.openapi.go +++ b/pkg/generated/openapi/zz_generated.openapi.go @@ -95,16 +95,20 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "github.com/kuidio/kuid/apis/backend/vlan/v1alpha1.VLANIndexStatus": schema_apis_backend_vlan_v1alpha1_VLANIndexStatus(ref), "github.com/kuidio/kuid/apis/common/v1alpha1.ClaimLabels": schema_kuid_apis_common_v1alpha1_ClaimLabels(ref), "github.com/kuidio/kuid/apis/common/v1alpha1.UserDefinedLabels": schema_kuid_apis_common_v1alpha1_UserDefinedLabels(ref), - "github.com/kuidio/kuid/apis/id/v1alpha1.AdaptorID": schema_kuid_apis_id_v1alpha1_AdaptorID(ref), "github.com/kuidio/kuid/apis/id/v1alpha1.ClusterID": schema_kuid_apis_id_v1alpha1_ClusterID(ref), "github.com/kuidio/kuid/apis/id/v1alpha1.EndpointID": schema_kuid_apis_id_v1alpha1_EndpointID(ref), "github.com/kuidio/kuid/apis/id/v1alpha1.NodeID": schema_kuid_apis_id_v1alpha1_NodeID(ref), + "github.com/kuidio/kuid/apis/id/v1alpha1.PartitionAdaptorID": schema_kuid_apis_id_v1alpha1_PartitionAdaptorID(ref), "github.com/kuidio/kuid/apis/id/v1alpha1.PartitionAttachmentID": schema_kuid_apis_id_v1alpha1_PartitionAttachmentID(ref), "github.com/kuidio/kuid/apis/id/v1alpha1.PartitionClusterID": schema_kuid_apis_id_v1alpha1_PartitionClusterID(ref), "github.com/kuidio/kuid/apis/id/v1alpha1.PartitionEndpointID": schema_kuid_apis_id_v1alpha1_PartitionEndpointID(ref), "github.com/kuidio/kuid/apis/id/v1alpha1.PartitionNodeID": schema_kuid_apis_id_v1alpha1_PartitionNodeID(ref), - "github.com/kuidio/kuid/apis/id/v1alpha1.PortID": schema_kuid_apis_id_v1alpha1_PortID(ref), + "github.com/kuidio/kuid/apis/id/v1alpha1.PartitionPortID": schema_kuid_apis_id_v1alpha1_PartitionPortID(ref), "github.com/kuidio/kuid/apis/id/v1alpha1.SiteID": schema_kuid_apis_id_v1alpha1_SiteID(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.Adaptor": schema_kuid_apis_infra_v1alpha1_Adaptor(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.AdaptorList": schema_kuid_apis_infra_v1alpha1_AdaptorList(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.AdaptorSpec": schema_kuid_apis_infra_v1alpha1_AdaptorSpec(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.AdaptorStatus": schema_kuid_apis_infra_v1alpha1_AdaptorStatus(ref), "github.com/kuidio/kuid/apis/infra/v1alpha1.Cluster": schema_kuid_apis_infra_v1alpha1_Cluster(ref), "github.com/kuidio/kuid/apis/infra/v1alpha1.ClusterList": schema_kuid_apis_infra_v1alpha1_ClusterList(ref), "github.com/kuidio/kuid/apis/infra/v1alpha1.ClusterSpec": schema_kuid_apis_infra_v1alpha1_ClusterSpec(ref), @@ -150,6 +154,10 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "github.com/kuidio/kuid/apis/infra/v1alpha1.PartitionList": schema_kuid_apis_infra_v1alpha1_PartitionList(ref), "github.com/kuidio/kuid/apis/infra/v1alpha1.PartitionSpec": schema_kuid_apis_infra_v1alpha1_PartitionSpec(ref), "github.com/kuidio/kuid/apis/infra/v1alpha1.PartitionStatus": schema_kuid_apis_infra_v1alpha1_PartitionStatus(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.Port": schema_kuid_apis_infra_v1alpha1_Port(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.PortList": schema_kuid_apis_infra_v1alpha1_PortList(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.PortSpec": schema_kuid_apis_infra_v1alpha1_PortSpec(ref), + "github.com/kuidio/kuid/apis/infra/v1alpha1.PortStatus": schema_kuid_apis_infra_v1alpha1_PortStatus(ref), "github.com/kuidio/kuid/apis/infra/v1alpha1.Rack": schema_kuid_apis_infra_v1alpha1_Rack(ref), "github.com/kuidio/kuid/apis/infra/v1alpha1.RackList": schema_kuid_apis_infra_v1alpha1_RackList(ref), "github.com/kuidio/kuid/apis/infra/v1alpha1.RackSpec": schema_kuid_apis_infra_v1alpha1_RackSpec(ref), @@ -3461,7 +3469,44 @@ func schema_kuid_apis_common_v1alpha1_UserDefinedLabels(ref common.ReferenceCall } } -func schema_kuid_apis_id_v1alpha1_AdaptorID(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_kuid_apis_id_v1alpha1_ClusterID(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "region": { + SchemaProps: spec.SchemaProps{ + Description: "Region defines the region of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "site": { + SchemaProps: spec.SchemaProps{ + Description: "Site defines the site of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "cluster": { + SchemaProps: spec.SchemaProps{ + Description: "Cluster defines the name of the cluster", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"region", "site", "cluster"}, + }, + }, + } +} + +func schema_kuid_apis_id_v1alpha1_EndpointID(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -3521,14 +3566,22 @@ func schema_kuid_apis_id_v1alpha1_AdaptorID(ref common.ReferenceCallback) common Format: "", }, }, + "endpoint": { + SchemaProps: spec.SchemaProps{ + Description: "Endpoint defines the name of the endpoint", + Default: 0, + Type: []string{"integer"}, + Format: "int32", + }, + }, }, - Required: []string{"region", "site", "node", "port", "adaptor"}, + Required: []string{"region", "site", "node", "port", "adaptor", "endpoint"}, }, }, } } -func schema_kuid_apis_id_v1alpha1_ClusterID(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_kuid_apis_id_v1alpha1_NodeID(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -3550,27 +3603,35 @@ func schema_kuid_apis_id_v1alpha1_ClusterID(ref common.ReferenceCallback) common Format: "", }, }, - "cluster": { + "node": { SchemaProps: spec.SchemaProps{ - Description: "Cluster defines the name of the cluster", + Description: "Node defines the name of the node", Default: "", Type: []string{"string"}, Format: "", }, }, }, - Required: []string{"region", "site", "cluster"}, + Required: []string{"region", "site", "node"}, }, }, } } -func schema_kuid_apis_id_v1alpha1_EndpointID(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_kuid_apis_id_v1alpha1_PartitionAdaptorID(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ Type: []string{"object"}, Properties: map[string]spec.Schema{ + "partition": { + SchemaProps: spec.SchemaProps{ + Description: "Partition defines the partition this resource belongs to", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, "region": { SchemaProps: spec.SchemaProps{ Description: "Region defines the region of the resource", @@ -3625,53 +3686,8 @@ func schema_kuid_apis_id_v1alpha1_EndpointID(ref common.ReferenceCallback) commo Format: "", }, }, - "endpoint": { - SchemaProps: spec.SchemaProps{ - Description: "Endpoint defines the name of the endpoint", - Default: 0, - Type: []string{"integer"}, - Format: "int32", - }, - }, }, - Required: []string{"region", "site", "node", "port", "adaptor", "endpoint"}, - }, - }, - } -} - -func schema_kuid_apis_id_v1alpha1_NodeID(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "region": { - SchemaProps: spec.SchemaProps{ - Description: "Region defines the region of the resource", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "site": { - SchemaProps: spec.SchemaProps{ - Description: "Site defines the site of the resource", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "node": { - SchemaProps: spec.SchemaProps{ - Description: "Node defines the name of the node", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - Required: []string{"region", "site", "node"}, + Required: []string{"partition", "region", "site", "node", "port", "adaptor"}, }, }, } @@ -3922,12 +3938,213 @@ func schema_kuid_apis_id_v1alpha1_PartitionNodeID(ref common.ReferenceCallback) } } -func schema_kuid_apis_id_v1alpha1_PortID(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_kuid_apis_id_v1alpha1_PartitionPortID(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ Type: []string{"object"}, Properties: map[string]spec.Schema{ + "partition": { + SchemaProps: spec.SchemaProps{ + Description: "Partition defines the partition this resource belongs to", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "region": { + SchemaProps: spec.SchemaProps{ + Description: "Region defines the region of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "site": { + SchemaProps: spec.SchemaProps{ + Description: "Site defines the site of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "node": { + SchemaProps: spec.SchemaProps{ + Description: "Node defines the name of the node", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "moduleBay": { + SchemaProps: spec.SchemaProps{ + Description: "ModuleBay defines the moduleBay reference id", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "module": { + SchemaProps: spec.SchemaProps{ + Description: "Module defines the module reference id", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "port": { + SchemaProps: spec.SchemaProps{ + Description: "Port defines the id of the port", + Default: 0, + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + Required: []string{"partition", "region", "site", "node", "port"}, + }, + }, + } +} + +func schema_kuid_apis_id_v1alpha1_SiteID(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "region": { + SchemaProps: spec.SchemaProps{ + Description: "Region defines the region of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "site": { + SchemaProps: spec.SchemaProps{ + Description: "Site defines the site of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"region", "site"}, + }, + }, + } +} + +func schema_kuid_apis_infra_v1alpha1_Adaptor(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "An Adaptor represents a communication interface or connection point within a Node, facilitating network communication and data transfer between different components or systems within the environment. `Adaptors` serve as gateways for transmitting and receiving data, enabling seamless communication between Nodes.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.AdaptorSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.AdaptorStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/infra/v1alpha1.AdaptorSpec", "github.com/kuidio/kuid/apis/infra/v1alpha1.AdaptorStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_AdaptorList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "AdaptorList contains a list of Adaptors", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.Adaptor"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/infra/v1alpha1.Adaptor", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_AdaptorSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "AdaptorSpec defines the desired state of Adaptor", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "partition": { + SchemaProps: spec.SchemaProps{ + Description: "Partition defines the partition this resource belongs to", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, "region": { SchemaProps: spec.SchemaProps{ Description: "Region defines the region of the resource", @@ -3974,39 +4191,63 @@ func schema_kuid_apis_id_v1alpha1_PortID(ref common.ReferenceCallback) common.Op Format: "int32", }, }, + "adaptor": { + SchemaProps: spec.SchemaProps{ + Description: "Adaptor defines the name of the adaptor", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "labels": { + SchemaProps: spec.SchemaProps{ + Description: "Labels as user defined labels", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, }, - Required: []string{"region", "site", "node", "port"}, + Required: []string{"partition", "region", "site", "node", "port", "adaptor"}, }, }, } } -func schema_kuid_apis_id_v1alpha1_SiteID(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_kuid_apis_infra_v1alpha1_AdaptorStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, + Description: "AdaptorStatus defines the observed state of Adaptor", + Type: []string{"object"}, Properties: map[string]spec.Schema{ - "region": { - SchemaProps: spec.SchemaProps{ - Description: "Region defines the region of the resource", - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "site": { + "conditions": { SchemaProps: spec.SchemaProps{ - Description: "Site defines the site of the resource", - Default: "", - Type: []string{"string"}, - Format: "", + Description: "Conditions of the resource.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"), + }, + }, + }, }, }, }, - Required: []string{"region", "site"}, }, }, + Dependencies: []string{ + "github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"}, } } @@ -4936,6 +5177,13 @@ func schema_kuid_apis_infra_v1alpha1_LinkSpec(ref common.ReferenceCallback) comm Description: "LinkSpec defines the desired state of Link", Type: []string{"object"}, Properties: map[string]spec.Schema{ + "internal": { + SchemaProps: spec.SchemaProps{ + Description: "Internal indicated if the link is internal to the topology", + Type: []string{"boolean"}, + Format: "", + }, + }, "endpoints": { SchemaProps: spec.SchemaProps{ Description: "Endpoints define the 2 endpoint identifiers of the link Can only have 2 endpoints", @@ -6194,6 +6442,215 @@ func schema_kuid_apis_infra_v1alpha1_PartitionStatus(ref common.ReferenceCallbac } } +func schema_kuid_apis_infra_v1alpha1_Port(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "An Port represents a communication interface or connection point within a Node, facilitating network communication and data transfer between different components or systems within the environment. `Ports` serve as gateways for transmitting and receiving data, enabling seamless communication between Nodes.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.PortSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.PortStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/infra/v1alpha1.PortSpec", "github.com/kuidio/kuid/apis/infra/v1alpha1.PortStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_PortList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PortList contains a list of Ports", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kuidio/kuid/apis/infra/v1alpha1.Port"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/kuidio/kuid/apis/infra/v1alpha1.Port", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_kuid_apis_infra_v1alpha1_PortSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PortSpec defines the desired state of Port", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "partition": { + SchemaProps: spec.SchemaProps{ + Description: "Partition defines the partition this resource belongs to", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "region": { + SchemaProps: spec.SchemaProps{ + Description: "Region defines the region of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "site": { + SchemaProps: spec.SchemaProps{ + Description: "Site defines the site of the resource", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "node": { + SchemaProps: spec.SchemaProps{ + Description: "Node defines the name of the node", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "moduleBay": { + SchemaProps: spec.SchemaProps{ + Description: "ModuleBay defines the moduleBay reference id", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "module": { + SchemaProps: spec.SchemaProps{ + Description: "Module defines the module reference id", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "port": { + SchemaProps: spec.SchemaProps{ + Description: "Port defines the id of the port", + Default: 0, + Type: []string{"integer"}, + Format: "int32", + }, + }, + "labels": { + SchemaProps: spec.SchemaProps{ + Description: "Labels as user defined labels", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"partition", "region", "site", "node", "port"}, + }, + }, + } +} + +func schema_kuid_apis_infra_v1alpha1_PortStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PortStatus defines the observed state of Port", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "conditions": { + SchemaProps: spec.SchemaProps{ + Description: "Conditions of the resource.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/kform-dev/choreo/apis/condition/v1alpha1.Condition"}, + } +} + func schema_kuid_apis_infra_v1alpha1_Rack(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{