Skip to content

Commit 1037f95

Browse files
committed
Add ClusterSPI CRD
1 parent 0cb4240 commit 1037f95

4 files changed

Lines changed: 317 additions & 0 deletions

File tree

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/*
2+
Copyright 2026 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1alpha1
18+
19+
import (
20+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21+
)
22+
23+
// ClusterStoragePolicyInfoSpec defines the desired state of ClusterStoragePolicyInfo.
24+
// +k8s:openapi-gen=true
25+
type ClusterStoragePolicyInfoSpec struct {
26+
27+
// K8sCompliantName is the Kubernetes-compliant name for the storage policy exposed to DevOps.
28+
// +required
29+
K8sCompliantName string `json:"k8sCompliantName"`
30+
31+
// StoragePolicyID is the vSphere storage policy identifier.
32+
// +required
33+
StoragePolicyID string `json:"storagePolicyID"`
34+
}
35+
36+
// TopologyInfo describes topology accessibility for the storage policy within the cluster.
37+
type TopologyInfo struct {
38+
// Zones lists zones where the policy is accessible for this cluster.
39+
// +optional
40+
Zones []string `json:"zones,omitempty"`
41+
42+
// Error describes a failure condition when resolving topology for this storage policy.
43+
// +optional
44+
Error string `json:"error,omitempty"`
45+
}
46+
47+
// ClusterStoragePolicyInfoStatus defines the observed state of ClusterStoragePolicyInfo.
48+
// +k8s:openapi-gen=true
49+
type ClusterStoragePolicyInfoStatus struct {
50+
// TopologyInfo contains observed topology for this storage policy in the cluster.
51+
// +optional
52+
TopologyInfo *TopologyInfo `json:"topologyInfo,omitempty"`
53+
54+
// Error describes a failure condition when observing or reconciling this resource.
55+
// +optional
56+
Error string `json:"error,omitempty"`
57+
}
58+
59+
// +genclient:nonNamespaced
60+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
61+
62+
// +k8s:openapi-gen=true
63+
// +kubebuilder:subresource:status
64+
// +kubebuilder:object:root=true
65+
// +kubebuilder:resource:shortName=cspi,scope=Cluster,path=clusterstoragepolicyinfoes
66+
67+
// ClusterStoragePolicyInfo is the Schema for the clusterstoragepolicyinfoes API.
68+
type ClusterStoragePolicyInfo struct {
69+
metav1.TypeMeta `json:",inline"`
70+
metav1.ObjectMeta `json:"metadata,omitempty"`
71+
72+
Spec ClusterStoragePolicyInfoSpec `json:"spec,omitempty"`
73+
Status ClusterStoragePolicyInfoStatus `json:"status,omitempty"`
74+
}
75+
76+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
77+
78+
// ClusterStoragePolicyInfoList contains a list of ClusterStoragePolicyInfo.
79+
type ClusterStoragePolicyInfoList struct {
80+
metav1.TypeMeta `json:",inline"`
81+
metav1.ListMeta `json:"metadata,omitempty"`
82+
Items []ClusterStoragePolicyInfo `json:"items"`
83+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
Copyright 2026 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
// +k8s:deepcopy-gen=package
18+
// +k8s:defaulter-gen=TypeMeta
19+
// +groupName=cns.vmware.com
20+
package v1alpha1

pkg/apis/cnsoperator/clusterstoragepolicyinfo/v1alpha1/zz_generated.deepcopy.go

Lines changed: 123 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
---
2+
apiVersion: apiextensions.k8s.io/v1
3+
kind: CustomResourceDefinition
4+
metadata:
5+
annotations:
6+
controller-gen.kubebuilder.io/version: v0.19.0
7+
name: clusterstoragepolicyinfoes.cns.vmware.com
8+
spec:
9+
group: cns.vmware.com
10+
names:
11+
kind: ClusterStoragePolicyInfo
12+
listKind: ClusterStoragePolicyInfoList
13+
plural: clusterstoragepolicyinfoes
14+
shortNames:
15+
- cspi
16+
singular: clusterstoragepolicyinfo
17+
scope: Cluster
18+
versions:
19+
- name: v1alpha1
20+
schema:
21+
openAPIV3Schema:
22+
description: ClusterStoragePolicyInfo is the Schema for the clusterstoragepolicyinfoes
23+
API.
24+
properties:
25+
apiVersion:
26+
description: |-
27+
APIVersion defines the versioned schema of this representation of an object.
28+
Servers should convert recognized schemas to the latest internal value, and
29+
may reject unrecognized values.
30+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
31+
type: string
32+
kind:
33+
description: |-
34+
Kind is a string value representing the REST resource this object represents.
35+
Servers may infer this from the endpoint the client submits requests to.
36+
Cannot be updated.
37+
In CamelCase.
38+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
39+
type: string
40+
metadata:
41+
type: object
42+
spec:
43+
description: ClusterStoragePolicyInfoSpec defines the desired state of
44+
ClusterStoragePolicyInfo.
45+
properties:
46+
k8sCompliantName:
47+
description: K8sCompliantName is the Kubernetes-compliant name for
48+
the storage policy exposed to DevOps.
49+
type: string
50+
storagePolicyID:
51+
description: StoragePolicyID is the vSphere storage policy identifier.
52+
type: string
53+
required:
54+
- k8sCompliantName
55+
- storagePolicyID
56+
type: object
57+
status:
58+
description: ClusterStoragePolicyInfoStatus defines the observed state
59+
of ClusterStoragePolicyInfo.
60+
properties:
61+
error:
62+
description: Error describes a failure condition when observing or
63+
reconciling this resource.
64+
type: string
65+
topologyInfo:
66+
description: TopologyInfo contains observed topology for this storage
67+
policy in the cluster.
68+
properties:
69+
error:
70+
description: Error describes a failure condition when resolving
71+
topology for this storage policy.
72+
type: string
73+
zones:
74+
description: Zones lists zones where the policy is accessible
75+
for this cluster.
76+
items:
77+
type: string
78+
type: array
79+
type: object
80+
type: object
81+
type: object
82+
served: true
83+
storage: true
84+
subresources:
85+
status: {}
86+
status:
87+
acceptedNames:
88+
kind: ""
89+
plural: ""
90+
conditions: []
91+
storedVersions: []

0 commit comments

Comments
 (0)