Matteo Scandolo | a428586 | 2020-12-01 18:10:10 -0800 | [diff] [blame^] | 1 | /* |
| 2 | Copyright 2017 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 v1 |
| 18 | |
| 19 | import ( |
| 20 | v1 "k8s.io/api/core/v1" |
| 21 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 22 | ) |
| 23 | |
| 24 | // +genclient |
| 25 | // +genclient:nonNamespaced |
| 26 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 27 | |
| 28 | // StorageClass describes the parameters for a class of storage for |
| 29 | // which PersistentVolumes can be dynamically provisioned. |
| 30 | // |
| 31 | // StorageClasses are non-namespaced; the name of the storage class |
| 32 | // according to etcd is in ObjectMeta.Name. |
| 33 | type StorageClass struct { |
| 34 | metav1.TypeMeta `json:",inline"` |
| 35 | // Standard object's metadata. |
| 36 | // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata |
| 37 | // +optional |
| 38 | metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` |
| 39 | |
| 40 | // Provisioner indicates the type of the provisioner. |
| 41 | Provisioner string `json:"provisioner" protobuf:"bytes,2,opt,name=provisioner"` |
| 42 | |
| 43 | // Parameters holds the parameters for the provisioner that should |
| 44 | // create volumes of this storage class. |
| 45 | // +optional |
| 46 | Parameters map[string]string `json:"parameters,omitempty" protobuf:"bytes,3,rep,name=parameters"` |
| 47 | |
| 48 | // Dynamically provisioned PersistentVolumes of this storage class are |
| 49 | // created with this reclaimPolicy. Defaults to Delete. |
| 50 | // +optional |
| 51 | ReclaimPolicy *v1.PersistentVolumeReclaimPolicy `json:"reclaimPolicy,omitempty" protobuf:"bytes,4,opt,name=reclaimPolicy,casttype=k8s.io/api/core/v1.PersistentVolumeReclaimPolicy"` |
| 52 | |
| 53 | // Dynamically provisioned PersistentVolumes of this storage class are |
| 54 | // created with these mountOptions, e.g. ["ro", "soft"]. Not validated - |
| 55 | // mount of the PVs will simply fail if one is invalid. |
| 56 | // +optional |
| 57 | MountOptions []string `json:"mountOptions,omitempty" protobuf:"bytes,5,opt,name=mountOptions"` |
| 58 | |
| 59 | // AllowVolumeExpansion shows whether the storage class allow volume expand |
| 60 | // +optional |
| 61 | AllowVolumeExpansion *bool `json:"allowVolumeExpansion,omitempty" protobuf:"varint,6,opt,name=allowVolumeExpansion"` |
| 62 | |
| 63 | // VolumeBindingMode indicates how PersistentVolumeClaims should be |
| 64 | // provisioned and bound. When unset, VolumeBindingImmediate is used. |
| 65 | // This field is only honored by servers that enable the VolumeScheduling feature. |
| 66 | // +optional |
| 67 | VolumeBindingMode *VolumeBindingMode `json:"volumeBindingMode,omitempty" protobuf:"bytes,7,opt,name=volumeBindingMode"` |
| 68 | |
| 69 | // Restrict the node topologies where volumes can be dynamically provisioned. |
| 70 | // Each volume plugin defines its own supported topology specifications. |
| 71 | // An empty TopologySelectorTerm list means there is no topology restriction. |
| 72 | // This field is only honored by servers that enable the VolumeScheduling feature. |
| 73 | // +optional |
| 74 | AllowedTopologies []v1.TopologySelectorTerm `json:"allowedTopologies,omitempty" protobuf:"bytes,8,rep,name=allowedTopologies"` |
| 75 | } |
| 76 | |
| 77 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 78 | |
| 79 | // StorageClassList is a collection of storage classes. |
| 80 | type StorageClassList struct { |
| 81 | metav1.TypeMeta `json:",inline"` |
| 82 | // Standard list metadata |
| 83 | // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata |
| 84 | // +optional |
| 85 | metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` |
| 86 | |
| 87 | // Items is the list of StorageClasses |
| 88 | Items []StorageClass `json:"items" protobuf:"bytes,2,rep,name=items"` |
| 89 | } |
| 90 | |
| 91 | // VolumeBindingMode indicates how PersistentVolumeClaims should be bound. |
| 92 | type VolumeBindingMode string |
| 93 | |
| 94 | const ( |
| 95 | // VolumeBindingImmediate indicates that PersistentVolumeClaims should be |
| 96 | // immediately provisioned and bound. This is the default mode. |
| 97 | VolumeBindingImmediate VolumeBindingMode = "Immediate" |
| 98 | |
| 99 | // VolumeBindingWaitForFirstConsumer indicates that PersistentVolumeClaims |
| 100 | // should not be provisioned and bound until the first Pod is created that |
| 101 | // references the PeristentVolumeClaim. The volume provisioning and |
| 102 | // binding will occur during Pod scheduing. |
| 103 | VolumeBindingWaitForFirstConsumer VolumeBindingMode = "WaitForFirstConsumer" |
| 104 | ) |
| 105 | |
| 106 | // +genclient |
| 107 | // +genclient:nonNamespaced |
| 108 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 109 | |
| 110 | // VolumeAttachment captures the intent to attach or detach the specified volume |
| 111 | // to/from the specified node. |
| 112 | // |
| 113 | // VolumeAttachment objects are non-namespaced. |
| 114 | type VolumeAttachment struct { |
| 115 | metav1.TypeMeta `json:",inline"` |
| 116 | |
| 117 | // Standard object metadata. |
| 118 | // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata |
| 119 | // +optional |
| 120 | metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` |
| 121 | |
| 122 | // Specification of the desired attach/detach volume behavior. |
| 123 | // Populated by the Kubernetes system. |
| 124 | Spec VolumeAttachmentSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` |
| 125 | |
| 126 | // Status of the VolumeAttachment request. |
| 127 | // Populated by the entity completing the attach or detach |
| 128 | // operation, i.e. the external-attacher. |
| 129 | // +optional |
| 130 | Status VolumeAttachmentStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` |
| 131 | } |
| 132 | |
| 133 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 134 | |
| 135 | // VolumeAttachmentList is a collection of VolumeAttachment objects. |
| 136 | type VolumeAttachmentList struct { |
| 137 | metav1.TypeMeta `json:",inline"` |
| 138 | // Standard list metadata |
| 139 | // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata |
| 140 | // +optional |
| 141 | metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` |
| 142 | |
| 143 | // Items is the list of VolumeAttachments |
| 144 | Items []VolumeAttachment `json:"items" protobuf:"bytes,2,rep,name=items"` |
| 145 | } |
| 146 | |
| 147 | // VolumeAttachmentSpec is the specification of a VolumeAttachment request. |
| 148 | type VolumeAttachmentSpec struct { |
| 149 | // Attacher indicates the name of the volume driver that MUST handle this |
| 150 | // request. This is the name returned by GetPluginName(). |
| 151 | Attacher string `json:"attacher" protobuf:"bytes,1,opt,name=attacher"` |
| 152 | |
| 153 | // Source represents the volume that should be attached. |
| 154 | Source VolumeAttachmentSource `json:"source" protobuf:"bytes,2,opt,name=source"` |
| 155 | |
| 156 | // The node that the volume should be attached to. |
| 157 | NodeName string `json:"nodeName" protobuf:"bytes,3,opt,name=nodeName"` |
| 158 | } |
| 159 | |
| 160 | // VolumeAttachmentSource represents a volume that should be attached. |
| 161 | // Right now only PersistenVolumes can be attached via external attacher, |
| 162 | // in future we may allow also inline volumes in pods. |
| 163 | // Exactly one member can be set. |
| 164 | type VolumeAttachmentSource struct { |
| 165 | // Name of the persistent volume to attach. |
| 166 | // +optional |
| 167 | PersistentVolumeName *string `json:"persistentVolumeName,omitempty" protobuf:"bytes,1,opt,name=persistentVolumeName"` |
| 168 | |
| 169 | // inlineVolumeSpec contains all the information necessary to attach |
| 170 | // a persistent volume defined by a pod's inline VolumeSource. This field |
| 171 | // is populated only for the CSIMigration feature. It contains |
| 172 | // translated fields from a pod's inline VolumeSource to a |
| 173 | // PersistentVolumeSpec. This field is alpha-level and is only |
| 174 | // honored by servers that enabled the CSIMigration feature. |
| 175 | // +optional |
| 176 | InlineVolumeSpec *v1.PersistentVolumeSpec `json:"inlineVolumeSpec,omitempty" protobuf:"bytes,2,opt,name=inlineVolumeSpec"` |
| 177 | } |
| 178 | |
| 179 | // VolumeAttachmentStatus is the status of a VolumeAttachment request. |
| 180 | type VolumeAttachmentStatus struct { |
| 181 | // Indicates the volume is successfully attached. |
| 182 | // This field must only be set by the entity completing the attach |
| 183 | // operation, i.e. the external-attacher. |
| 184 | Attached bool `json:"attached" protobuf:"varint,1,opt,name=attached"` |
| 185 | |
| 186 | // Upon successful attach, this field is populated with any |
| 187 | // information returned by the attach operation that must be passed |
| 188 | // into subsequent WaitForAttach or Mount calls. |
| 189 | // This field must only be set by the entity completing the attach |
| 190 | // operation, i.e. the external-attacher. |
| 191 | // +optional |
| 192 | AttachmentMetadata map[string]string `json:"attachmentMetadata,omitempty" protobuf:"bytes,2,rep,name=attachmentMetadata"` |
| 193 | |
| 194 | // The last error encountered during attach operation, if any. |
| 195 | // This field must only be set by the entity completing the attach |
| 196 | // operation, i.e. the external-attacher. |
| 197 | // +optional |
| 198 | AttachError *VolumeError `json:"attachError,omitempty" protobuf:"bytes,3,opt,name=attachError,casttype=VolumeError"` |
| 199 | |
| 200 | // The last error encountered during detach operation, if any. |
| 201 | // This field must only be set by the entity completing the detach |
| 202 | // operation, i.e. the external-attacher. |
| 203 | // +optional |
| 204 | DetachError *VolumeError `json:"detachError,omitempty" protobuf:"bytes,4,opt,name=detachError,casttype=VolumeError"` |
| 205 | } |
| 206 | |
| 207 | // VolumeError captures an error encountered during a volume operation. |
| 208 | type VolumeError struct { |
| 209 | // Time the error was encountered. |
| 210 | // +optional |
| 211 | Time metav1.Time `json:"time,omitempty" protobuf:"bytes,1,opt,name=time"` |
| 212 | |
| 213 | // String detailing the error encountered during Attach or Detach operation. |
| 214 | // This string may be logged, so it should not contain sensitive |
| 215 | // information. |
| 216 | // +optional |
| 217 | Message string `json:"message,omitempty" protobuf:"bytes,2,opt,name=message"` |
| 218 | } |
| 219 | |
| 220 | // +genclient |
| 221 | // +genclient:nonNamespaced |
| 222 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 223 | |
| 224 | // CSIDriver captures information about a Container Storage Interface (CSI) |
| 225 | // volume driver deployed on the cluster. |
| 226 | // Kubernetes attach detach controller uses this object to determine whether attach is required. |
| 227 | // Kubelet uses this object to determine whether pod information needs to be passed on mount. |
| 228 | // CSIDriver objects are non-namespaced. |
| 229 | type CSIDriver struct { |
| 230 | metav1.TypeMeta `json:",inline"` |
| 231 | |
| 232 | // Standard object metadata. |
| 233 | // metadata.Name indicates the name of the CSI driver that this object |
| 234 | // refers to; it MUST be the same name returned by the CSI GetPluginName() |
| 235 | // call for that driver. |
| 236 | // The driver name must be 63 characters or less, beginning and ending with |
| 237 | // an alphanumeric character ([a-z0-9A-Z]) with dashes (-), dots (.), and |
| 238 | // alphanumerics between. |
| 239 | // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata |
| 240 | metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` |
| 241 | |
| 242 | // Specification of the CSI Driver. |
| 243 | Spec CSIDriverSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` |
| 244 | } |
| 245 | |
| 246 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 247 | |
| 248 | // CSIDriverList is a collection of CSIDriver objects. |
| 249 | type CSIDriverList struct { |
| 250 | metav1.TypeMeta `json:",inline"` |
| 251 | |
| 252 | // Standard list metadata |
| 253 | // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata |
| 254 | // +optional |
| 255 | metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` |
| 256 | |
| 257 | // items is the list of CSIDriver |
| 258 | Items []CSIDriver `json:"items" protobuf:"bytes,2,rep,name=items"` |
| 259 | } |
| 260 | |
| 261 | // CSIDriverSpec is the specification of a CSIDriver. |
| 262 | type CSIDriverSpec struct { |
| 263 | // attachRequired indicates this CSI volume driver requires an attach |
| 264 | // operation (because it implements the CSI ControllerPublishVolume() |
| 265 | // method), and that the Kubernetes attach detach controller should call |
| 266 | // the attach volume interface which checks the volumeattachment status |
| 267 | // and waits until the volume is attached before proceeding to mounting. |
| 268 | // The CSI external-attacher coordinates with CSI volume driver and updates |
| 269 | // the volumeattachment status when the attach operation is complete. |
| 270 | // If the CSIDriverRegistry feature gate is enabled and the value is |
| 271 | // specified to false, the attach operation will be skipped. |
| 272 | // Otherwise the attach operation will be called. |
| 273 | // +optional |
| 274 | AttachRequired *bool `json:"attachRequired,omitempty" protobuf:"varint,1,opt,name=attachRequired"` |
| 275 | |
| 276 | // If set to true, podInfoOnMount indicates this CSI volume driver |
| 277 | // requires additional pod information (like podName, podUID, etc.) during |
| 278 | // mount operations. |
| 279 | // If set to false, pod information will not be passed on mount. |
| 280 | // Default is false. |
| 281 | // The CSI driver specifies podInfoOnMount as part of driver deployment. |
| 282 | // If true, Kubelet will pass pod information as VolumeContext in the CSI |
| 283 | // NodePublishVolume() calls. |
| 284 | // The CSI driver is responsible for parsing and validating the information |
| 285 | // passed in as VolumeContext. |
| 286 | // The following VolumeConext will be passed if podInfoOnMount is set to true. |
| 287 | // This list might grow, but the prefix will be used. |
| 288 | // "csi.storage.k8s.io/pod.name": pod.Name |
| 289 | // "csi.storage.k8s.io/pod.namespace": pod.Namespace |
| 290 | // "csi.storage.k8s.io/pod.uid": string(pod.UID) |
| 291 | // "csi.storage.k8s.io/ephemeral": "true" iff the volume is an ephemeral inline volume |
| 292 | // defined by a CSIVolumeSource, otherwise "false" |
| 293 | // |
| 294 | // "csi.storage.k8s.io/ephemeral" is a new feature in Kubernetes 1.16. It is only |
| 295 | // required for drivers which support both the "Persistent" and "Ephemeral" VolumeLifecycleMode. |
| 296 | // Other drivers can leave pod info disabled and/or ignore this field. |
| 297 | // As Kubernetes 1.15 doesn't support this field, drivers can only support one mode when |
| 298 | // deployed on such a cluster and the deployment determines which mode that is, for example |
| 299 | // via a command line parameter of the driver. |
| 300 | // +optional |
| 301 | PodInfoOnMount *bool `json:"podInfoOnMount,omitempty" protobuf:"bytes,2,opt,name=podInfoOnMount"` |
| 302 | |
| 303 | // volumeLifecycleModes defines what kind of volumes this CSI volume driver supports. |
| 304 | // The default if the list is empty is "Persistent", which is the usage |
| 305 | // defined by the CSI specification and implemented in Kubernetes via the usual |
| 306 | // PV/PVC mechanism. |
| 307 | // The other mode is "Ephemeral". In this mode, volumes are defined inline |
| 308 | // inside the pod spec with CSIVolumeSource and their lifecycle is tied to |
| 309 | // the lifecycle of that pod. A driver has to be aware of this |
| 310 | // because it is only going to get a NodePublishVolume call for such a volume. |
| 311 | // For more information about implementing this mode, see |
| 312 | // https://kubernetes-csi.github.io/docs/ephemeral-local-volumes.html |
| 313 | // A driver can support one or more of these modes and |
| 314 | // more modes may be added in the future. |
| 315 | // This field is beta. |
| 316 | // +optional |
| 317 | // +listType=set |
| 318 | VolumeLifecycleModes []VolumeLifecycleMode `json:"volumeLifecycleModes,omitempty" protobuf:"bytes,3,opt,name=volumeLifecycleModes"` |
| 319 | |
| 320 | // If set to true, storageCapacity indicates that the CSI |
| 321 | // volume driver wants pod scheduling to consider the storage |
| 322 | // capacity that the driver deployment will report by creating |
| 323 | // CSIStorageCapacity objects with capacity information. |
| 324 | // |
| 325 | // The check can be enabled immediately when deploying a driver. |
| 326 | // In that case, provisioning new volumes with late binding |
| 327 | // will pause until the driver deployment has published |
| 328 | // some suitable CSIStorageCapacity object. |
| 329 | // |
| 330 | // Alternatively, the driver can be deployed with the field |
| 331 | // unset or false and it can be flipped later when storage |
| 332 | // capacity information has been published. |
| 333 | // |
| 334 | // This is an alpha field and only available when the CSIStorageCapacity |
| 335 | // feature is enabled. The default is false. |
| 336 | // |
| 337 | // +optional |
| 338 | StorageCapacity *bool `json:"storageCapacity,omitempty" protobuf:"bytes,4,opt,name=storageCapacity"` |
| 339 | |
| 340 | // Defines if the underlying volume supports changing ownership and |
| 341 | // permission of the volume before being mounted. |
| 342 | // Refer to the specific FSGroupPolicy values for additional details. |
| 343 | // This field is alpha-level, and is only honored by servers |
| 344 | // that enable the CSIVolumeFSGroupPolicy feature gate. |
| 345 | // +optional |
| 346 | FSGroupPolicy *FSGroupPolicy `json:"fsGroupPolicy,omitempty" protobuf:"bytes,5,opt,name=fsGroupPolicy"` |
| 347 | } |
| 348 | |
| 349 | // FSGroupPolicy specifies if a CSI Driver supports modifying |
| 350 | // volume ownership and permissions of the volume to be mounted. |
| 351 | // More modes may be added in the future. |
| 352 | type FSGroupPolicy string |
| 353 | |
| 354 | const ( |
| 355 | // ReadWriteOnceWithFSTypeFSGroupPolicy indicates that each volume will be examined |
| 356 | // to determine if the volume ownership and permissions |
| 357 | // should be modified. If a fstype is defined and the volume's access mode |
| 358 | // contains ReadWriteOnce, then the defined fsGroup will be applied. |
| 359 | // This mode should be defined if it's expected that the |
| 360 | // fsGroup may need to be modified depending on the pod's SecurityPolicy. |
| 361 | // This is the default behavior if no other FSGroupPolicy is defined. |
| 362 | ReadWriteOnceWithFSTypeFSGroupPolicy FSGroupPolicy = "ReadWriteOnceWithFSType" |
| 363 | |
| 364 | // FileFSGroupPolicy indicates that CSI driver supports volume ownership |
| 365 | // and permission change via fsGroup, and Kubernetes may use fsGroup |
| 366 | // to change permissions and ownership of the volume to match user requested fsGroup in |
| 367 | // the pod's SecurityPolicy regardless of fstype or access mode. |
| 368 | // This mode should be defined if the fsGroup is expected to always change on mount |
| 369 | FileFSGroupPolicy FSGroupPolicy = "File" |
| 370 | |
| 371 | // NoneFSGroupPolicy indicates that volumes will be mounted without performing |
| 372 | // any ownership or permission modifications, as the CSIDriver does not support |
| 373 | // these operations. |
| 374 | // This mode should be selected if the CSIDriver does not support fsGroup modifications, |
| 375 | // for example when Kubernetes cannot change ownership and permissions on a volume due |
| 376 | // to root-squash settings on a NFS volume. |
| 377 | NoneFSGroupPolicy FSGroupPolicy = "None" |
| 378 | ) |
| 379 | |
| 380 | // VolumeLifecycleMode is an enumeration of possible usage modes for a volume |
| 381 | // provided by a CSI driver. More modes may be added in the future. |
| 382 | type VolumeLifecycleMode string |
| 383 | |
| 384 | const ( |
| 385 | // VolumeLifecyclePersistent explicitly confirms that the driver implements |
| 386 | // the full CSI spec. It is the default when CSIDriverSpec.VolumeLifecycleModes is not |
| 387 | // set. Such volumes are managed in Kubernetes via the persistent volume |
| 388 | // claim mechanism and have a lifecycle that is independent of the pods which |
| 389 | // use them. |
| 390 | VolumeLifecyclePersistent VolumeLifecycleMode = "Persistent" |
| 391 | |
| 392 | // VolumeLifecycleEphemeral indicates that the driver can be used for |
| 393 | // ephemeral inline volumes. Such volumes are specified inside the pod |
| 394 | // spec with a CSIVolumeSource and, as far as Kubernetes is concerned, have |
| 395 | // a lifecycle that is tied to the lifecycle of the pod. For example, such |
| 396 | // a volume might contain data that gets created specifically for that pod, |
| 397 | // like secrets. |
| 398 | // But how the volume actually gets created and managed is entirely up to |
| 399 | // the driver. It might also use reference counting to share the same volume |
| 400 | // instance among different pods if the CSIVolumeSource of those pods is |
| 401 | // identical. |
| 402 | VolumeLifecycleEphemeral VolumeLifecycleMode = "Ephemeral" |
| 403 | ) |
| 404 | |
| 405 | // +genclient |
| 406 | // +genclient:nonNamespaced |
| 407 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 408 | |
| 409 | // CSINode holds information about all CSI drivers installed on a node. |
| 410 | // CSI drivers do not need to create the CSINode object directly. As long as |
| 411 | // they use the node-driver-registrar sidecar container, the kubelet will |
| 412 | // automatically populate the CSINode object for the CSI driver as part of |
| 413 | // kubelet plugin registration. |
| 414 | // CSINode has the same name as a node. If the object is missing, it means either |
| 415 | // there are no CSI Drivers available on the node, or the Kubelet version is low |
| 416 | // enough that it doesn't create this object. |
| 417 | // CSINode has an OwnerReference that points to the corresponding node object. |
| 418 | type CSINode struct { |
| 419 | metav1.TypeMeta `json:",inline"` |
| 420 | |
| 421 | // metadata.name must be the Kubernetes node name. |
| 422 | metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` |
| 423 | |
| 424 | // spec is the specification of CSINode |
| 425 | Spec CSINodeSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` |
| 426 | } |
| 427 | |
| 428 | // CSINodeSpec holds information about the specification of all CSI drivers installed on a node |
| 429 | type CSINodeSpec struct { |
| 430 | // drivers is a list of information of all CSI Drivers existing on a node. |
| 431 | // If all drivers in the list are uninstalled, this can become empty. |
| 432 | // +patchMergeKey=name |
| 433 | // +patchStrategy=merge |
| 434 | Drivers []CSINodeDriver `json:"drivers" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,1,rep,name=drivers"` |
| 435 | } |
| 436 | |
| 437 | // CSINodeDriver holds information about the specification of one CSI driver installed on a node |
| 438 | type CSINodeDriver struct { |
| 439 | // This is the name of the CSI driver that this object refers to. |
| 440 | // This MUST be the same name returned by the CSI GetPluginName() call for |
| 441 | // that driver. |
| 442 | Name string `json:"name" protobuf:"bytes,1,opt,name=name"` |
| 443 | |
| 444 | // nodeID of the node from the driver point of view. |
| 445 | // This field enables Kubernetes to communicate with storage systems that do |
| 446 | // not share the same nomenclature for nodes. For example, Kubernetes may |
| 447 | // refer to a given node as "node1", but the storage system may refer to |
| 448 | // the same node as "nodeA". When Kubernetes issues a command to the storage |
| 449 | // system to attach a volume to a specific node, it can use this field to |
| 450 | // refer to the node name using the ID that the storage system will |
| 451 | // understand, e.g. "nodeA" instead of "node1". This field is required. |
| 452 | NodeID string `json:"nodeID" protobuf:"bytes,2,opt,name=nodeID"` |
| 453 | |
| 454 | // topologyKeys is the list of keys supported by the driver. |
| 455 | // When a driver is initialized on a cluster, it provides a set of topology |
| 456 | // keys that it understands (e.g. "company.com/zone", "company.com/region"). |
| 457 | // When a driver is initialized on a node, it provides the same topology keys |
| 458 | // along with values. Kubelet will expose these topology keys as labels |
| 459 | // on its own node object. |
| 460 | // When Kubernetes does topology aware provisioning, it can use this list to |
| 461 | // determine which labels it should retrieve from the node object and pass |
| 462 | // back to the driver. |
| 463 | // It is possible for different nodes to use different topology keys. |
| 464 | // This can be empty if driver does not support topology. |
| 465 | // +optional |
| 466 | TopologyKeys []string `json:"topologyKeys" protobuf:"bytes,3,rep,name=topologyKeys"` |
| 467 | |
| 468 | // allocatable represents the volume resources of a node that are available for scheduling. |
| 469 | // This field is beta. |
| 470 | // +optional |
| 471 | Allocatable *VolumeNodeResources `json:"allocatable,omitempty" protobuf:"bytes,4,opt,name=allocatable"` |
| 472 | } |
| 473 | |
| 474 | // VolumeNodeResources is a set of resource limits for scheduling of volumes. |
| 475 | type VolumeNodeResources struct { |
| 476 | // Maximum number of unique volumes managed by the CSI driver that can be used on a node. |
| 477 | // A volume that is both attached and mounted on a node is considered to be used once, not twice. |
| 478 | // The same rule applies for a unique volume that is shared among multiple pods on the same node. |
| 479 | // If this field is not specified, then the supported number of volumes on this node is unbounded. |
| 480 | // +optional |
| 481 | Count *int32 `json:"count,omitempty" protobuf:"varint,1,opt,name=count"` |
| 482 | } |
| 483 | |
| 484 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 485 | |
| 486 | // CSINodeList is a collection of CSINode objects. |
| 487 | type CSINodeList struct { |
| 488 | metav1.TypeMeta `json:",inline"` |
| 489 | |
| 490 | // Standard list metadata |
| 491 | // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata |
| 492 | // +optional |
| 493 | metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` |
| 494 | |
| 495 | // items is the list of CSINode |
| 496 | Items []CSINode `json:"items" protobuf:"bytes,2,rep,name=items"` |
| 497 | } |