Skip to content

Commit 83be2b1

Browse files
committed
Add StoragePolicyInfo CRD
1 parent d6af437 commit 83be2b1

File tree

4 files changed

+602
-0
lines changed

4 files changed

+602
-0
lines changed
Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
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: storagepolicyinfoes.cns.vmware.com
8+
spec:
9+
group: cns.vmware.com
10+
names:
11+
kind: StoragePolicyInfo
12+
listKind: StoragePolicyInfoList
13+
plural: storagepolicyinfoes
14+
shortNames:
15+
- spi
16+
singular: storagepolicyinfo
17+
scope: Namespaced
18+
versions:
19+
- name: v1alpha1
20+
schema:
21+
openAPIV3Schema:
22+
description: StoragePolicyInfo is the Schema for the storagepolicyinfoes API
23+
properties:
24+
apiVersion:
25+
description: |-
26+
APIVersion defines the versioned schema of this representation of an object.
27+
Servers should convert recognized schemas to the latest internal value, and
28+
may reject unrecognized values.
29+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
30+
type: string
31+
kind:
32+
description: |-
33+
Kind is a string value representing the REST resource this object represents.
34+
Servers may infer this from the endpoint the client submits requests to.
35+
Cannot be updated.
36+
In CamelCase.
37+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
38+
type: string
39+
metadata:
40+
type: object
41+
spec:
42+
description: StoragePolicyInfoSpec defines the desired state of StoragePolicyInfo
43+
properties:
44+
k8sCompliantName:
45+
description: K8sCompliantName is the k8sCompliantName that the VI
46+
admin chose while creating the policy
47+
type: string
48+
storagePolicyID:
49+
description: StoragePolicyID is the vSphere storage policy ID
50+
type: string
51+
required:
52+
- k8sCompliantName
53+
- storagePolicyID
54+
type: object
55+
status:
56+
description: StoragePolicyInfoStatus defines the observed state of StoragePolicyInfo
57+
properties:
58+
encryptionInfo:
59+
description: EncryptionInfo describes encryption capabilities
60+
properties:
61+
encryptionType:
62+
description: |-
63+
EncryptionType indicates the type of encryption
64+
Valid values: "vm-crypt", "storage-level", "none"
65+
enum:
66+
- vm-encryption
67+
- vsan-encryption
68+
items:
69+
type: string
70+
type: array
71+
supported:
72+
description: Supported indicates whether encryption is supported
73+
or not.
74+
type: boolean
75+
required:
76+
- supported
77+
type: object
78+
error:
79+
description: Error describes the error encountered while retrieving
80+
the storage policy info
81+
type: string
82+
performanceInfo:
83+
description: PerformanceInfo describes performance characteristics
84+
properties:
85+
iopsLimit:
86+
description: IopsLimit is the IOPS limit for volumes created from
87+
this storage class (vSAN ESA only)
88+
format: int64
89+
type: integer
90+
required:
91+
- iopsLimit
92+
type: object
93+
storagePolicyDeleted:
94+
description: StoragePolicyDeleted indicates whether the underlying
95+
storagepolicy is deleted or not on the VC.
96+
type: boolean
97+
storageTypeInfo:
98+
description: StorageTypeInfo describes the underlying storage type
99+
items:
100+
description: StorageTypeInfo describes the underlying storage type
101+
properties:
102+
datastoreType:
103+
description: |-
104+
DatastoreType indicates the type of datastore
105+
Valid values: "vsan", "vmfs", "nfs", "vvol"
106+
enum:
107+
- vsan
108+
- vmfs
109+
- nfs
110+
- vvol
111+
type: string
112+
version:
113+
description: Version is the version of the datastore.
114+
type: string
115+
vsanArchitecture:
116+
description: |-
117+
VsanArchitecture indicates the vSAN architecture (only for vsan datastoreType)
118+
Valid values: "esa", "osa"
119+
enum:
120+
- esa
121+
- osa
122+
type: string
123+
required:
124+
- datastoreType
125+
- version
126+
type: object
127+
type: array
128+
topologyInfo:
129+
description: TopologyInfo describes the topology characteristics of
130+
the storage
131+
properties:
132+
accessibleZones:
133+
description: AccessibleZones lists the zones where this storage
134+
class can be accessed
135+
items:
136+
type: string
137+
type: array
138+
type:
139+
description: |-
140+
Type indicates whether the storage is zonal or cross-zonal
141+
Valid values: "zonal", "non-zonal"
142+
enum:
143+
- zonal
144+
- non-zonal
145+
type: string
146+
required:
147+
- type
148+
type: object
149+
volumeTypeInfo:
150+
description: VolumeTypeInfo describes supported volume types and access
151+
modes
152+
properties:
153+
supportedBlockVolumeModes:
154+
description: |-
155+
SupportedBlockVolumeModes gives the supported combinations of access modes and volume modes for a block volume.
156+
Valid values: "RWO_FileSystem", "RWX_Block"
157+
enum:
158+
- RWO_FileSystem
159+
- RWX_Block
160+
items:
161+
type: string
162+
type: array
163+
supportedFileVolumeModes:
164+
description: |-
165+
SupportedFileVolumeModes gives the supported combinations of access modes and volume modes for a file volume.
166+
Valid value: "RWX_FileSystem"
167+
enum:
168+
- RWX_FileSystem
169+
items:
170+
type: string
171+
type: array
172+
type: object
173+
type: object
174+
type: object
175+
served: true
176+
storage: true
177+
subresources:
178+
status: {}
179+
status:
180+
acceptedNames:
181+
kind: ""
182+
plural: ""
183+
conditions: []
184+
storedVersions: []
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
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+
// StoragePolicyInfoSpec defines the desired state of StoragePolicyInfo
24+
// +k8s:openapi-gen=true
25+
type StoragePolicyInfoSpec struct {
26+
// StoragePolicyID is the vSphere storage policy ID
27+
// +required
28+
StoragePolicyID string `json:"storagePolicyID"`
29+
30+
// K8sCompliantName is the k8sCompliantName that the VI admin chose while creating the policy
31+
// +required
32+
K8sCompliantName string `json:"k8sCompliantName"`
33+
}
34+
35+
// StoragePolicyInfoStatus defines the observed state of StoragePolicyInfo
36+
// +k8s:openapi-gen=true
37+
type StoragePolicyInfoStatus struct {
38+
// StoragePolicyDeleted indicates whether the underlying storagepolicy is deleted or not on the VC.
39+
// +optional
40+
StoragePolicyDeleted bool `json:"storagePolicyDeleted,omitempty"`
41+
42+
// StorageTypeInfo describes the underlying storage type
43+
// +optional
44+
StorageTypeInfo *[]StorageTypeInfo `json:"storageTypeInfo,omitempty"`
45+
46+
// VolumeTypeInfo describes supported volume types and access modes
47+
// +optional
48+
VolumeTypeInfo *VolumeTypeInfo `json:"volumeTypeInfo,omitempty"`
49+
50+
// TopologyInfo describes the topology characteristics of the storage
51+
// +optional
52+
TopologyInfo *TopologyInfo `json:"topologyInfo,omitempty"`
53+
54+
// EncryptionInfo describes encryption capabilities
55+
// +optional
56+
EncryptionInfo *EncryptionInfo `json:"encryptionInfo,omitempty"`
57+
58+
// PerformanceInfo describes performance characteristics
59+
// +optional
60+
PerformanceInfo *PerformanceInfo `json:"performanceInfo,omitempty"`
61+
62+
// Error describes the error encountered while retrieving the storage policy info
63+
// +optional
64+
Error string `json:"error,omitempty"`
65+
}
66+
67+
// StorageTypeInfo describes the underlying storage type
68+
type StorageTypeInfo struct {
69+
// DatastoreType indicates the type of datastore
70+
// Valid values: "vsan", "vmfs", "nfs", "vvol"
71+
// +required
72+
// +kubebuilder:validation:Enum=vsan;vmfs;nfs;vvol
73+
DatastoreType string `json:"datastoreType"`
74+
75+
// VsanArchitecture indicates the vSAN architecture (only for vsan datastoreType)
76+
// Valid values: "esa", "osa"
77+
// +optional
78+
// +kubebuilder:validation:Enum=esa;osa
79+
VsanArchitecture string `json:"vsanArchitecture,omitempty"`
80+
81+
// Version is the version of the datastore.
82+
// +required
83+
Version string `json:"version"`
84+
}
85+
86+
// VolumeTypeInfo describes supported volume types and access modes
87+
type VolumeTypeInfo struct {
88+
// SupportedBlockVolumeModes gives the supported combinations of access modes and volume modes for a block volume.
89+
// Valid values: "RWO_FileSystem", "RWX_Block"
90+
// +kubebuilder:validation:Enum=RWO_FileSystem;RWX_Block
91+
// +optional
92+
SupportedBlockVolumeModes []string `json:"supportedBlockVolumeModes,omitempty"`
93+
94+
// SupportedFileVolumeModes gives the supported combinations of access modes and volume modes for a file volume.
95+
// Valid value: "RWX_FileSystem"
96+
// +kubebuilder:validation:Enum=RWX_FileSystem
97+
// +optional
98+
SupportedFileVolumeModes []string `json:"supportedFileVolumeModes,omitempty"`
99+
}
100+
101+
// TopologyInfo describes the topology characteristics of the storage
102+
type TopologyInfo struct {
103+
// Type indicates whether the storage is zonal or cross-zonal
104+
// Valid values: "zonal", "non-zonal"
105+
// +required
106+
// +kubebuilder:validation:Enum=zonal;non-zonal
107+
Type string `json:"type"`
108+
109+
// AccessibleZones lists the zones where this storage class can be accessed
110+
// +optional
111+
AccessibleZones []string `json:"accessibleZones,omitempty"`
112+
}
113+
114+
// EncryptionInfo describes encryption capabilities
115+
type EncryptionInfo struct {
116+
// Supported indicates whether encryption is supported or not.
117+
// +required
118+
Supported bool `json:"supported"`
119+
120+
// EncryptionType indicates the type of encryption
121+
// Valid values: "vm-crypt", "storage-level", "none"
122+
// +optional
123+
// +kubebuilder:validation:Enum=vm-encryption;vsan-encryption
124+
EncryptionType []string `json:"encryptionType,omitempty"`
125+
}
126+
127+
// PerformanceInfo describes performance characteristics (vSAN only)
128+
type PerformanceInfo struct {
129+
// IopsLimit is the IOPS limit for volumes created from this storage class (vSAN ESA only)
130+
// +required
131+
IopsLimit *int64 `json:"iopsLimit"`
132+
}
133+
134+
// +genclient
135+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
136+
137+
// +k8s:openapi-gen=true
138+
// +kubebuilder:subresource:status
139+
// +kubebuilder:resource:shortName=spi
140+
// +kubebuilder:object:root=true
141+
142+
// StoragePolicyInfo is the Schema for the storagepolicyinfoes API
143+
type StoragePolicyInfo struct {
144+
metav1.TypeMeta `json:",inline"`
145+
metav1.ObjectMeta `json:"metadata,omitempty"`
146+
147+
Spec StoragePolicyInfoSpec `json:"spec,omitempty"`
148+
Status StoragePolicyInfoStatus `json:"status,omitempty"`
149+
}
150+
151+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
152+
153+
// StoragePolicyInfoList contains a list of StoragePolicyInfo
154+
type StoragePolicyInfoList struct {
155+
metav1.TypeMeta `json:",inline"`
156+
metav1.ListMeta `json:"metadata,omitempty"`
157+
Items []StoragePolicyInfo `json:"items"`
158+
}

0 commit comments

Comments
 (0)