|
| 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