diff --git a/pkg/apis/cnsoperator/config/cns.vmware.com_infrastoragepolicyinfoes.yaml b/pkg/apis/cnsoperator/config/cns.vmware.com_infrastoragepolicyinfoes.yaml new file mode 100644 index 0000000000..d264e45961 --- /dev/null +++ b/pkg/apis/cnsoperator/config/cns.vmware.com_infrastoragepolicyinfoes.yaml @@ -0,0 +1,76 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.19.0 + name: infrastoragepolicyinfoes.cns.vmware.com +spec: + group: cns.vmware.com + names: + kind: InfraStoragePolicyInfo + listKind: InfraStoragePolicyInfoList + plural: infrastoragepolicyinfoes + shortNames: + - infraspi + singular: infrastoragepolicyinfo + scope: Cluster + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: InfraStoragePolicyInfo is the Schema for the infrastoragepolicyinfoes + API. + 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 + status: + description: InfraStoragePolicyInfoStatus defines the observed state of + InfraStoragePolicyInfo. + properties: + error: + description: Error describes a failure condition when observing or + reconciling this resource. + type: string + topology: + description: Topology contains observed topology for this storage + policy in the cluster. + properties: + accessibleZones: + description: AccessibleZones lists zones where the policy is accessible + for this cluster. + items: + type: string + type: array + error: + description: Error describes a failure condition when resolving + topology for this storage policy. + type: string + type: object + type: object + type: object + served: true + storage: true + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/pkg/apis/cnsoperator/infrastoragepolicyinfo/v1alpha1/doc.go b/pkg/apis/cnsoperator/infrastoragepolicyinfo/v1alpha1/doc.go new file mode 100644 index 0000000000..eb828ce608 --- /dev/null +++ b/pkg/apis/cnsoperator/infrastoragepolicyinfo/v1alpha1/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2026 The Kubernetes Authors. + +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. +*/ + +// +k8s:deepcopy-gen=package +// +k8s:defaulter-gen=TypeMeta +// +groupName=cns.vmware.com +package v1alpha1 diff --git a/pkg/apis/cnsoperator/infrastoragepolicyinfo/v1alpha1/infrastoragepolicyinfo_types.go b/pkg/apis/cnsoperator/infrastoragepolicyinfo/v1alpha1/infrastoragepolicyinfo_types.go new file mode 100644 index 0000000000..7c72b70a03 --- /dev/null +++ b/pkg/apis/cnsoperator/infrastoragepolicyinfo/v1alpha1/infrastoragepolicyinfo_types.go @@ -0,0 +1,69 @@ +/* +Copyright 2026 The Kubernetes Authors. + +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 ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// Topology describes topology accessibility for the storage policy within the cluster. +type Topology struct { + // AccessibleZones lists zones where the policy is accessible for this cluster. + // +optional + AccessibleZones []string `json:"accessibleZones,omitempty"` + + // Error describes a failure condition when resolving topology for this storage policy. + // +optional + Error string `json:"error,omitempty"` +} + +// InfraStoragePolicyInfoStatus defines the observed state of InfraStoragePolicyInfo. +// +k8s:openapi-gen=true +type InfraStoragePolicyInfoStatus struct { + // Topology contains observed topology for this storage policy in the cluster. + // +optional + Topology *Topology `json:"topology,omitempty"` + + // Error describes a failure condition when observing or reconciling this resource. + // +optional + Error string `json:"error,omitempty"` +} + +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// +k8s:openapi-gen=true +// +kubebuilder:subresource:status +// +kubebuilder:object:root=true +// +kubebuilder:resource:shortName=infraspi,scope=Cluster,path=infrastoragepolicyinfoes + +// InfraStoragePolicyInfo is the Schema for the infrastoragepolicyinfoes API. +type InfraStoragePolicyInfo struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Status InfraStoragePolicyInfoStatus `json:"status,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// InfraStoragePolicyInfoList contains a list of InfraStoragePolicyInfo. +type InfraStoragePolicyInfoList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []InfraStoragePolicyInfo `json:"items"` +} diff --git a/pkg/apis/cnsoperator/infrastoragepolicyinfo/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/cnsoperator/infrastoragepolicyinfo/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 0000000000..fd57570f97 --- /dev/null +++ b/pkg/apis/cnsoperator/infrastoragepolicyinfo/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,107 @@ +//go:build !ignore_autogenerated + +// Code generated by controller-gen. DO NOT EDIT. + +package v1alpha1 + +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 *InfraStoragePolicyInfo) DeepCopyInto(out *InfraStoragePolicyInfo) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InfraStoragePolicyInfo. +func (in *InfraStoragePolicyInfo) DeepCopy() *InfraStoragePolicyInfo { + if in == nil { + return nil + } + out := new(InfraStoragePolicyInfo) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *InfraStoragePolicyInfo) 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 *InfraStoragePolicyInfoList) DeepCopyInto(out *InfraStoragePolicyInfoList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]InfraStoragePolicyInfo, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InfraStoragePolicyInfoList. +func (in *InfraStoragePolicyInfoList) DeepCopy() *InfraStoragePolicyInfoList { + if in == nil { + return nil + } + out := new(InfraStoragePolicyInfoList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *InfraStoragePolicyInfoList) 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 *InfraStoragePolicyInfoStatus) DeepCopyInto(out *InfraStoragePolicyInfoStatus) { + *out = *in + if in.Topology != nil { + in, out := &in.Topology, &out.Topology + *out = new(Topology) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InfraStoragePolicyInfoStatus. +func (in *InfraStoragePolicyInfoStatus) DeepCopy() *InfraStoragePolicyInfoStatus { + if in == nil { + return nil + } + out := new(InfraStoragePolicyInfoStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Topology) DeepCopyInto(out *Topology) { + *out = *in + if in.AccessibleZones != nil { + in, out := &in.AccessibleZones, &out.AccessibleZones + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Topology. +func (in *Topology) DeepCopy() *Topology { + if in == nil { + return nil + } + out := new(Topology) + in.DeepCopyInto(out) + return out +}