...

Source file src/k8s.io/api/storage/v1beta1/types.go

Documentation: k8s.io/api/storage/v1beta1

     1  /*
     2  Copyright 2016 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 v1beta1
    18  
    19  import (
    20  	v1 "k8s.io/api/core/v1"
    21  	"k8s.io/apimachinery/pkg/api/resource"
    22  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
    23  )
    24  
    25  // +genclient
    26  // +genclient:nonNamespaced
    27  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
    28  // +k8s:prerelease-lifecycle-gen:introduced=1.4
    29  // +k8s:prerelease-lifecycle-gen:deprecated=1.19
    30  // +k8s:prerelease-lifecycle-gen:replacement=storage.k8s.io,v1,StorageClass
    31  
    32  // StorageClass describes the parameters for a class of storage for
    33  // which PersistentVolumes can be dynamically provisioned.
    34  //
    35  // StorageClasses are non-namespaced; the name of the storage class
    36  // according to etcd is in ObjectMeta.Name.
    37  type StorageClass struct {
    38  	metav1.TypeMeta `json:",inline"`
    39  
    40  	// Standard object's metadata.
    41  	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
    42  	// +optional
    43  	metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
    44  
    45  	// provisioner indicates the type of the provisioner.
    46  	Provisioner string `json:"provisioner" protobuf:"bytes,2,opt,name=provisioner"`
    47  
    48  	// parameters holds the parameters for the provisioner that should
    49  	// create volumes of this storage class.
    50  	// +optional
    51  	Parameters map[string]string `json:"parameters,omitempty" protobuf:"bytes,3,rep,name=parameters"`
    52  
    53  	// reclaimPolicy controls the reclaimPolicy for dynamically provisioned PersistentVolumes of this storage class.
    54  	// Defaults to Delete.
    55  	// +optional
    56  	ReclaimPolicy *v1.PersistentVolumeReclaimPolicy `json:"reclaimPolicy,omitempty" protobuf:"bytes,4,opt,name=reclaimPolicy,casttype=k8s.io/api/core/v1.PersistentVolumeReclaimPolicy"`
    57  
    58  	// mountOptions controls the mountOptions for dynamically provisioned PersistentVolumes of this storage class.
    59  	// e.g. ["ro", "soft"]. Not validated -
    60  	// mount of the PVs will simply fail if one is invalid.
    61  	// +optional
    62  	// +listType=atomic
    63  	MountOptions []string `json:"mountOptions,omitempty" protobuf:"bytes,5,opt,name=mountOptions"`
    64  
    65  	// allowVolumeExpansion shows whether the storage class allow volume expand
    66  	// +optional
    67  	AllowVolumeExpansion *bool `json:"allowVolumeExpansion,omitempty" protobuf:"varint,6,opt,name=allowVolumeExpansion"`
    68  
    69  	// volumeBindingMode indicates how PersistentVolumeClaims should be
    70  	// provisioned and bound.  When unset, VolumeBindingImmediate is used.
    71  	// This field is only honored by servers that enable the VolumeScheduling feature.
    72  	// +optional
    73  	VolumeBindingMode *VolumeBindingMode `json:"volumeBindingMode,omitempty" protobuf:"bytes,7,opt,name=volumeBindingMode"`
    74  
    75  	// allowedTopologies restrict the node topologies where volumes can be dynamically provisioned.
    76  	// Each volume plugin defines its own supported topology specifications.
    77  	// An empty TopologySelectorTerm list means there is no topology restriction.
    78  	// This field is only honored by servers that enable the VolumeScheduling feature.
    79  	// +optional
    80  	// +listType=atomic
    81  	AllowedTopologies []v1.TopologySelectorTerm `json:"allowedTopologies,omitempty" protobuf:"bytes,8,rep,name=allowedTopologies"`
    82  }
    83  
    84  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
    85  // +k8s:prerelease-lifecycle-gen:introduced=1.4
    86  // +k8s:prerelease-lifecycle-gen:deprecated=1.19
    87  // +k8s:prerelease-lifecycle-gen:replacement=storage.k8s.io,v1,StorageClassList
    88  
    89  // StorageClassList is a collection of storage classes.
    90  type StorageClassList struct {
    91  	metav1.TypeMeta `json:",inline"`
    92  
    93  	// Standard list metadata
    94  	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
    95  	// +optional
    96  	metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
    97  
    98  	// items is the list of StorageClasses
    99  	Items []StorageClass `json:"items" protobuf:"bytes,2,rep,name=items"`
   100  }
   101  
   102  // VolumeBindingMode indicates how PersistentVolumeClaims should be bound.
   103  type VolumeBindingMode string
   104  
   105  const (
   106  	// VolumeBindingImmediate indicates that PersistentVolumeClaims should be
   107  	// immediately provisioned and bound.  This is the default mode.
   108  	VolumeBindingImmediate VolumeBindingMode = "Immediate"
   109  
   110  	// VolumeBindingWaitForFirstConsumer indicates that PersistentVolumeClaims
   111  	// should not be provisioned and bound until the first Pod is created that
   112  	// references the PeristentVolumeClaim.  The volume provisioning and
   113  	// binding will occur during Pod scheduing.
   114  	VolumeBindingWaitForFirstConsumer VolumeBindingMode = "WaitForFirstConsumer"
   115  )
   116  
   117  // +genclient
   118  // +genclient:nonNamespaced
   119  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
   120  // +k8s:prerelease-lifecycle-gen:introduced=1.10
   121  // +k8s:prerelease-lifecycle-gen:deprecated=1.19
   122  // +k8s:prerelease-lifecycle-gen:replacement=storage.k8s.io,v1,VolumeAttachment
   123  
   124  // VolumeAttachment captures the intent to attach or detach the specified volume
   125  // to/from the specified node.
   126  //
   127  // VolumeAttachment objects are non-namespaced.
   128  type VolumeAttachment struct {
   129  	metav1.TypeMeta `json:",inline"`
   130  
   131  	// Standard object metadata.
   132  	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
   133  	// +optional
   134  	metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
   135  
   136  	// spec represents specification of the desired attach/detach volume behavior.
   137  	// Populated by the Kubernetes system.
   138  	Spec VolumeAttachmentSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"`
   139  
   140  	// status represents status of the VolumeAttachment request.
   141  	// Populated by the entity completing the attach or detach
   142  	// operation, i.e. the external-attacher.
   143  	// +optional
   144  	Status VolumeAttachmentStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
   145  }
   146  
   147  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
   148  // +k8s:prerelease-lifecycle-gen:introduced=1.10
   149  // +k8s:prerelease-lifecycle-gen:deprecated=1.19
   150  // +k8s:prerelease-lifecycle-gen:replacement=storage.k8s.io,v1,VolumeAttachmentList
   151  
   152  // VolumeAttachmentList is a collection of VolumeAttachment objects.
   153  type VolumeAttachmentList struct {
   154  	metav1.TypeMeta `json:",inline"`
   155  
   156  	// Standard list metadata
   157  	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
   158  	// +optional
   159  	metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
   160  
   161  	// items is the list of VolumeAttachments
   162  	Items []VolumeAttachment `json:"items" protobuf:"bytes,2,rep,name=items"`
   163  }
   164  
   165  // VolumeAttachmentSpec is the specification of a VolumeAttachment request.
   166  type VolumeAttachmentSpec struct {
   167  	// attacher indicates the name of the volume driver that MUST handle this
   168  	// request. This is the name returned by GetPluginName().
   169  	Attacher string `json:"attacher" protobuf:"bytes,1,opt,name=attacher"`
   170  
   171  	// source represents the volume that should be attached.
   172  	Source VolumeAttachmentSource `json:"source" protobuf:"bytes,2,opt,name=source"`
   173  
   174  	// nodeName represents the node that the volume should be attached to.
   175  	NodeName string `json:"nodeName" protobuf:"bytes,3,opt,name=nodeName"`
   176  }
   177  
   178  // VolumeAttachmentSource represents a volume that should be attached.
   179  // Right now only PersistenVolumes can be attached via external attacher,
   180  // in future we may allow also inline volumes in pods.
   181  // Exactly one member can be set.
   182  type VolumeAttachmentSource struct {
   183  	// persistentVolumeName represents the name of the persistent volume to attach.
   184  	// +optional
   185  	PersistentVolumeName *string `json:"persistentVolumeName,omitempty" protobuf:"bytes,1,opt,name=persistentVolumeName"`
   186  
   187  	// inlineVolumeSpec contains all the information necessary to attach
   188  	// a persistent volume defined by a pod's inline VolumeSource. This field
   189  	// is populated only for the CSIMigration feature. It contains
   190  	// translated fields from a pod's inline VolumeSource to a
   191  	// PersistentVolumeSpec. This field is beta-level and is only
   192  	// honored by servers that enabled the CSIMigration feature.
   193  	// +optional
   194  	InlineVolumeSpec *v1.PersistentVolumeSpec `json:"inlineVolumeSpec,omitempty" protobuf:"bytes,2,opt,name=inlineVolumeSpec"`
   195  }
   196  
   197  // VolumeAttachmentStatus is the status of a VolumeAttachment request.
   198  type VolumeAttachmentStatus struct {
   199  	// attached indicates the volume is successfully attached.
   200  	// This field must only be set by the entity completing the attach
   201  	// operation, i.e. the external-attacher.
   202  	Attached bool `json:"attached" protobuf:"varint,1,opt,name=attached"`
   203  
   204  	// attachmentMetadata is populated with any
   205  	// information returned by the attach operation, upon successful attach, that must be passed
   206  	// into subsequent WaitForAttach or Mount calls.
   207  	// This field must only be set by the entity completing the attach
   208  	// operation, i.e. the external-attacher.
   209  	// +optional
   210  	AttachmentMetadata map[string]string `json:"attachmentMetadata,omitempty" protobuf:"bytes,2,rep,name=attachmentMetadata"`
   211  
   212  	// attachError represents the last error encountered during attach operation, if any.
   213  	// This field must only be set by the entity completing the attach
   214  	// operation, i.e. the external-attacher.
   215  	// +optional
   216  	AttachError *VolumeError `json:"attachError,omitempty" protobuf:"bytes,3,opt,name=attachError,casttype=VolumeError"`
   217  
   218  	// detachError represents the last error encountered during detach operation, if any.
   219  	// This field must only be set by the entity completing the detach
   220  	// operation, i.e. the external-attacher.
   221  	// +optional
   222  	DetachError *VolumeError `json:"detachError,omitempty" protobuf:"bytes,4,opt,name=detachError,casttype=VolumeError"`
   223  }
   224  
   225  // VolumeError captures an error encountered during a volume operation.
   226  type VolumeError struct {
   227  	// time represents the time the error was encountered.
   228  	// +optional
   229  	Time metav1.Time `json:"time,omitempty" protobuf:"bytes,1,opt,name=time"`
   230  
   231  	// message represents the error encountered during Attach or Detach operation.
   232  	// This string may be logged, so it should not contain sensitive
   233  	// information.
   234  	// +optional
   235  	Message string `json:"message,omitempty" protobuf:"bytes,2,opt,name=message"`
   236  }
   237  
   238  // +genclient
   239  // +genclient:nonNamespaced
   240  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
   241  // +k8s:prerelease-lifecycle-gen:introduced=1.14
   242  // +k8s:prerelease-lifecycle-gen:deprecated=1.19
   243  // +k8s:prerelease-lifecycle-gen:replacement=storage.k8s.io,v1,CSIDriver
   244  
   245  // CSIDriver captures information about a Container Storage Interface (CSI)
   246  // volume driver deployed on the cluster.
   247  // CSI drivers do not need to create the CSIDriver object directly. Instead they may use the
   248  // cluster-driver-registrar sidecar container. When deployed with a CSI driver it automatically
   249  // creates a CSIDriver object representing the driver.
   250  // Kubernetes attach detach controller uses this object to determine whether attach is required.
   251  // Kubelet uses this object to determine whether pod information needs to be passed on mount.
   252  // CSIDriver objects are non-namespaced.
   253  type CSIDriver struct {
   254  	metav1.TypeMeta `json:",inline"`
   255  
   256  	// Standard object metadata.
   257  	// metadata.Name indicates the name of the CSI driver that this object
   258  	// refers to; it MUST be the same name returned by the CSI GetPluginName()
   259  	// call for that driver.
   260  	// The driver name must be 63 characters or less, beginning and ending with
   261  	// an alphanumeric character ([a-z0-9A-Z]) with dashes (-), dots (.), and
   262  	// alphanumerics between.
   263  	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
   264  	metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
   265  
   266  	// spec represents the specification of the CSI Driver.
   267  	Spec CSIDriverSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"`
   268  }
   269  
   270  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
   271  // +k8s:prerelease-lifecycle-gen:introduced=1.14
   272  // +k8s:prerelease-lifecycle-gen:deprecated=1.19
   273  // +k8s:prerelease-lifecycle-gen:replacement=storage.k8s.io,v1,CSIDriverList
   274  
   275  // CSIDriverList is a collection of CSIDriver objects.
   276  type CSIDriverList struct {
   277  	metav1.TypeMeta `json:",inline"`
   278  
   279  	// Standard list metadata
   280  	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
   281  	// +optional
   282  	metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
   283  
   284  	// items is the list of CSIDriver
   285  	Items []CSIDriver `json:"items" protobuf:"bytes,2,rep,name=items"`
   286  }
   287  
   288  // CSIDriverSpec is the specification of a CSIDriver.
   289  type CSIDriverSpec struct {
   290  	// attachRequired indicates this CSI volume driver requires an attach
   291  	// operation (because it implements the CSI ControllerPublishVolume()
   292  	// method), and that the Kubernetes attach detach controller should call
   293  	// the attach volume interface which checks the volumeattachment status
   294  	// and waits until the volume is attached before proceeding to mounting.
   295  	// The CSI external-attacher coordinates with CSI volume driver and updates
   296  	// the volumeattachment status when the attach operation is complete.
   297  	// If the CSIDriverRegistry feature gate is enabled and the value is
   298  	// specified to false, the attach operation will be skipped.
   299  	// Otherwise the attach operation will be called.
   300  	//
   301  	// This field is immutable.
   302  	//
   303  	// +optional
   304  	AttachRequired *bool `json:"attachRequired,omitempty" protobuf:"varint,1,opt,name=attachRequired"`
   305  
   306  	// podInfoOnMount indicates this CSI volume driver requires additional pod information (like podName, podUID, etc.)
   307  	// during mount operations, if set to true.
   308  	// If set to false, pod information will not be passed on mount.
   309  	// Default is false.
   310  	//
   311  	// The CSI driver specifies podInfoOnMount as part of driver deployment.
   312  	// If true, Kubelet will pass pod information as VolumeContext in the CSI NodePublishVolume() calls.
   313  	// The CSI driver is responsible for parsing and validating the information passed in as VolumeContext.
   314  	//
   315  	// The following VolumeContext will be passed if podInfoOnMount is set to true.
   316  	// This list might grow, but the prefix will be used.
   317  	// "csi.storage.k8s.io/pod.name": pod.Name
   318  	// "csi.storage.k8s.io/pod.namespace": pod.Namespace
   319  	// "csi.storage.k8s.io/pod.uid": string(pod.UID)
   320  	// "csi.storage.k8s.io/ephemeral": "true" if the volume is an ephemeral inline volume
   321  	//                                 defined by a CSIVolumeSource, otherwise "false"
   322  	//
   323  	// "csi.storage.k8s.io/ephemeral" is a new feature in Kubernetes 1.16. It is only
   324  	// required for drivers which support both the "Persistent" and "Ephemeral" VolumeLifecycleMode.
   325  	// Other drivers can leave pod info disabled and/or ignore this field.
   326  	// As Kubernetes 1.15 doesn't support this field, drivers can only support one mode when
   327  	// deployed on such a cluster and the deployment determines which mode that is, for example
   328  	// via a command line parameter of the driver.
   329  	//
   330  	// This field is immutable.
   331  	//
   332  	// +optional
   333  	PodInfoOnMount *bool `json:"podInfoOnMount,omitempty" protobuf:"bytes,2,opt,name=podInfoOnMount"`
   334  
   335  	// volumeLifecycleModes defines what kind of volumes this CSI volume driver supports.
   336  	// The default if the list is empty is "Persistent", which is the usage defined by the
   337  	// CSI specification and implemented in Kubernetes via the usual PV/PVC mechanism.
   338  	//
   339  	// The other mode is "Ephemeral". In this mode, volumes are defined inline inside the pod spec
   340  	// with CSIVolumeSource and their lifecycle is tied to the lifecycle of that pod.
   341  	// A driver has to be aware of this because it is only going to get a NodePublishVolume call for such a volume.
   342  	//
   343  	// For more information about implementing this mode, see
   344  	// https://kubernetes-csi.github.io/docs/ephemeral-local-volumes.html
   345  	// A driver can support one or more of these modes and
   346  	// more modes may be added in the future.
   347  	//
   348  	// This field is immutable.
   349  	//
   350  	// +optional
   351  	// +listType=atomic
   352  	VolumeLifecycleModes []VolumeLifecycleMode `json:"volumeLifecycleModes,omitempty" protobuf:"bytes,3,opt,name=volumeLifecycleModes"`
   353  
   354  	// storageCapacity indicates that the CSI volume driver wants pod scheduling to consider the storage
   355  	// capacity that the driver deployment will report by creating
   356  	// CSIStorageCapacity objects with capacity information, if set to true.
   357  	//
   358  	// The check can be enabled immediately when deploying a driver.
   359  	// In that case, provisioning new volumes with late binding
   360  	// will pause until the driver deployment has published
   361  	// some suitable CSIStorageCapacity object.
   362  	//
   363  	// Alternatively, the driver can be deployed with the field
   364  	// unset or false and it can be flipped later when storage
   365  	// capacity information has been published.
   366  	//
   367  	// This field was immutable in Kubernetes <= 1.22 and now is mutable.
   368  	//
   369  	// +optional
   370  	StorageCapacity *bool `json:"storageCapacity,omitempty" protobuf:"bytes,4,opt,name=storageCapacity"`
   371  
   372  	// fsGroupPolicy defines if the underlying volume supports changing ownership and
   373  	// permission of the volume before being mounted.
   374  	// Refer to the specific FSGroupPolicy values for additional details.
   375  	//
   376  	// This field is immutable.
   377  	//
   378  	// Defaults to ReadWriteOnceWithFSType, which will examine each volume
   379  	// to determine if Kubernetes should modify ownership and permissions of the volume.
   380  	// With the default policy the defined fsGroup will only be applied
   381  	// if a fstype is defined and the volume's access mode contains ReadWriteOnce.
   382  	//
   383  	// +optional
   384  	FSGroupPolicy *FSGroupPolicy `json:"fsGroupPolicy,omitempty" protobuf:"bytes,5,opt,name=fsGroupPolicy"`
   385  
   386  	// tokenRequests indicates the CSI driver needs pods' service account
   387  	// tokens it is mounting volume for to do necessary authentication. Kubelet
   388  	// will pass the tokens in VolumeContext in the CSI NodePublishVolume calls.
   389  	// The CSI driver should parse and validate the following VolumeContext:
   390  	// "csi.storage.k8s.io/serviceAccount.tokens": {
   391  	//   "<audience>": {
   392  	//     "token": <token>,
   393  	//     "expirationTimestamp": <expiration timestamp in RFC3339>,
   394  	//   },
   395  	//   ...
   396  	// }
   397  	//
   398  	// Note: Audience in each TokenRequest should be different and at
   399  	// most one token is empty string. To receive a new token after expiry,
   400  	// RequiresRepublish can be used to trigger NodePublishVolume periodically.
   401  	//
   402  	// +optional
   403  	// +listType=atomic
   404  	TokenRequests []TokenRequest `json:"tokenRequests,omitempty" protobuf:"bytes,6,opt,name=tokenRequests"`
   405  
   406  	// requiresRepublish indicates the CSI driver wants `NodePublishVolume`
   407  	// being periodically called to reflect any possible change in the mounted
   408  	// volume. This field defaults to false.
   409  	//
   410  	// Note: After a successful initial NodePublishVolume call, subsequent calls
   411  	// to NodePublishVolume should only update the contents of the volume. New
   412  	// mount points will not be seen by a running container.
   413  	//
   414  	// +optional
   415  	RequiresRepublish *bool `json:"requiresRepublish,omitempty" protobuf:"varint,7,opt,name=requiresRepublish"`
   416  
   417  	// seLinuxMount specifies if the CSI driver supports "-o context"
   418  	// mount option.
   419  	//
   420  	// When "true", the CSI driver must ensure that all volumes provided by this CSI
   421  	// driver can be mounted separately with different `-o context` options. This is
   422  	// typical for storage backends that provide volumes as filesystems on block
   423  	// devices or as independent shared volumes.
   424  	// Kubernetes will call NodeStage / NodePublish with "-o context=xyz" mount
   425  	// option when mounting a ReadWriteOncePod volume used in Pod that has
   426  	// explicitly set SELinux context. In the future, it may be expanded to other
   427  	// volume AccessModes. In any case, Kubernetes will ensure that the volume is
   428  	// mounted only with a single SELinux context.
   429  	//
   430  	// When "false", Kubernetes won't pass any special SELinux mount options to the driver.
   431  	// This is typical for volumes that represent subdirectories of a bigger shared filesystem.
   432  	//
   433  	// Default is "false".
   434  	//
   435  	// +featureGate=SELinuxMountReadWriteOncePod
   436  	// +optional
   437  	SELinuxMount *bool `json:"seLinuxMount,omitempty" protobuf:"varint,8,opt,name=seLinuxMount"`
   438  }
   439  
   440  // FSGroupPolicy specifies if a CSI Driver supports modifying
   441  // volume ownership and permissions of the volume to be mounted.
   442  // More modes may be added in the future.
   443  type FSGroupPolicy string
   444  
   445  const (
   446  	// ReadWriteOnceWithFSTypeFSGroupPolicy indicates that each volume will be examined
   447  	// to determine if the volume ownership and permissions
   448  	// should be modified. If a fstype is defined and the volume's access mode
   449  	// contains ReadWriteOnce, then the defined fsGroup will be applied.
   450  	// This is the default behavior if no other FSGroupPolicy is defined.
   451  	ReadWriteOnceWithFSTypeFSGroupPolicy FSGroupPolicy = "ReadWriteOnceWithFSType"
   452  
   453  	// FileFSGroupPolicy indicates that CSI driver supports volume ownership
   454  	// and permission change via fsGroup, and Kubernetes will change the permissions
   455  	// and ownership of every file in the volume to match the user requested fsGroup in
   456  	// the pod's SecurityPolicy regardless of fstype or access mode.
   457  	// Use this mode if Kubernetes should modify the permissions and ownership
   458  	// of the volume.
   459  	FileFSGroupPolicy FSGroupPolicy = "File"
   460  
   461  	// None indicates that volumes will be mounted without performing
   462  	// any ownership or permission modifications, as the CSIDriver does not support
   463  	// these operations.
   464  	NoneFSGroupPolicy FSGroupPolicy = "None"
   465  )
   466  
   467  // VolumeLifecycleMode is an enumeration of possible usage modes for a volume
   468  // provided by a CSI driver. More modes may be added in the future.
   469  type VolumeLifecycleMode string
   470  
   471  // TokenRequest contains parameters of a service account token.
   472  type TokenRequest struct {
   473  	// audience is the intended audience of the token in "TokenRequestSpec".
   474  	// It will default to the audiences of kube apiserver.
   475  	Audience string `json:"audience" protobuf:"bytes,1,opt,name=audience"`
   476  
   477  	// expirationSeconds is the duration of validity of the token in "TokenRequestSpec".
   478  	// It has the same default value of "ExpirationSeconds" in "TokenRequestSpec"
   479  	//
   480  	// +optional
   481  	ExpirationSeconds *int64 `json:"expirationSeconds,omitempty" protobuf:"varint,2,opt,name=expirationSeconds"`
   482  }
   483  
   484  const (
   485  	// VolumeLifecyclePersistent explicitly confirms that the driver implements
   486  	// the full CSI spec. It is the default when CSIDriverSpec.VolumeLifecycleModes is not
   487  	// set. Such volumes are managed in Kubernetes via the persistent volume
   488  	// claim mechanism and have a lifecycle that is independent of the pods which
   489  	// use them.
   490  	VolumeLifecyclePersistent VolumeLifecycleMode = "Persistent"
   491  
   492  	// VolumeLifecycleEphemeral indicates that the driver can be used for
   493  	// ephemeral inline volumes. Such volumes are specified inside the pod
   494  	// spec with a CSIVolumeSource and, as far as Kubernetes is concerned, have
   495  	// a lifecycle that is tied to the lifecycle of the pod. For example, such
   496  	// a volume might contain data that gets created specifically for that pod,
   497  	// like secrets.
   498  	// But how the volume actually gets created and managed is entirely up to
   499  	// the driver. It might also use reference counting to share the same volume
   500  	// instance among different pods if the CSIVolumeSource of those pods is
   501  	// identical.
   502  	VolumeLifecycleEphemeral VolumeLifecycleMode = "Ephemeral"
   503  )
   504  
   505  // +genclient
   506  // +genclient:nonNamespaced
   507  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
   508  // +k8s:prerelease-lifecycle-gen:introduced=1.14
   509  // +k8s:prerelease-lifecycle-gen:deprecated=1.17
   510  // +k8s:prerelease-lifecycle-gen:removed=1.22
   511  // +k8s:prerelease-lifecycle-gen:replacement=storage.k8s.io,v1,CSINode
   512  
   513  // DEPRECATED - This group version of CSINode is deprecated by storage/v1/CSINode.
   514  // See the release notes for more information.
   515  // CSINode holds information about all CSI drivers installed on a node.
   516  // CSI drivers do not need to create the CSINode object directly. As long as
   517  // they use the node-driver-registrar sidecar container, the kubelet will
   518  // automatically populate the CSINode object for the CSI driver as part of
   519  // kubelet plugin registration.
   520  // CSINode has the same name as a node. If the object is missing, it means either
   521  // there are no CSI Drivers available on the node, or the Kubelet version is low
   522  // enough that it doesn't create this object.
   523  // CSINode has an OwnerReference that points to the corresponding node object.
   524  type CSINode struct {
   525  	metav1.TypeMeta `json:",inline"`
   526  
   527  	// metadata.name must be the Kubernetes node name.
   528  	metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
   529  
   530  	// spec is the specification of CSINode
   531  	Spec CSINodeSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"`
   532  }
   533  
   534  // CSINodeSpec holds information about the specification of all CSI drivers installed on a node
   535  type CSINodeSpec struct {
   536  	// drivers is a list of information of all CSI Drivers existing on a node.
   537  	// If all drivers in the list are uninstalled, this can become empty.
   538  	// +patchMergeKey=name
   539  	// +patchStrategy=merge
   540  	// +listType=map
   541  	// +listMapKey=name
   542  	Drivers []CSINodeDriver `json:"drivers" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,1,rep,name=drivers"`
   543  }
   544  
   545  // CSINodeDriver holds information about the specification of one CSI driver installed on a node
   546  type CSINodeDriver struct {
   547  	// name represents the name of the CSI driver that this object refers to.
   548  	// This MUST be the same name returned by the CSI GetPluginName() call for
   549  	// that driver.
   550  	Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
   551  
   552  	// nodeID of the node from the driver point of view.
   553  	// This field enables Kubernetes to communicate with storage systems that do
   554  	// not share the same nomenclature for nodes. For example, Kubernetes may
   555  	// refer to a given node as "node1", but the storage system may refer to
   556  	// the same node as "nodeA". When Kubernetes issues a command to the storage
   557  	// system to attach a volume to a specific node, it can use this field to
   558  	// refer to the node name using the ID that the storage system will
   559  	// understand, e.g. "nodeA" instead of "node1". This field is required.
   560  	NodeID string `json:"nodeID" protobuf:"bytes,2,opt,name=nodeID"`
   561  
   562  	// topologyKeys is the list of keys supported by the driver.
   563  	// When a driver is initialized on a cluster, it provides a set of topology
   564  	// keys that it understands (e.g. "company.com/zone", "company.com/region").
   565  	// When a driver is initialized on a node, it provides the same topology keys
   566  	// along with values. Kubelet will expose these topology keys as labels
   567  	// on its own node object.
   568  	// When Kubernetes does topology aware provisioning, it can use this list to
   569  	// determine which labels it should retrieve from the node object and pass
   570  	// back to the driver.
   571  	// It is possible for different nodes to use different topology keys.
   572  	// This can be empty if driver does not support topology.
   573  	// +optional
   574  	// +listType=atomic
   575  	TopologyKeys []string `json:"topologyKeys" protobuf:"bytes,3,rep,name=topologyKeys"`
   576  
   577  	// allocatable represents the volume resources of a node that are available for scheduling.
   578  	// +optional
   579  	Allocatable *VolumeNodeResources `json:"allocatable,omitempty" protobuf:"bytes,4,opt,name=allocatable"`
   580  }
   581  
   582  // VolumeNodeResources is a set of resource limits for scheduling of volumes.
   583  type VolumeNodeResources struct {
   584  	// count indicates the maximum number of unique volumes managed by the CSI driver that can be used on a node.
   585  	// A volume that is both attached and mounted on a node is considered to be used once, not twice.
   586  	// The same rule applies for a unique volume that is shared among multiple pods on the same node.
   587  	// If this field is nil, then the supported number of volumes on this node is unbounded.
   588  	// +optional
   589  	Count *int32 `json:"count,omitempty" protobuf:"varint,1,opt,name=count"`
   590  }
   591  
   592  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
   593  // +k8s:prerelease-lifecycle-gen:introduced=1.14
   594  // +k8s:prerelease-lifecycle-gen:deprecated=1.17
   595  // +k8s:prerelease-lifecycle-gen:removed=1.22
   596  // +k8s:prerelease-lifecycle-gen:replacement=storage.k8s.io,v1,CSINode
   597  
   598  // CSINodeList is a collection of CSINode objects.
   599  type CSINodeList struct {
   600  	metav1.TypeMeta `json:",inline"`
   601  
   602  	// Standard list metadata
   603  	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
   604  	// +optional
   605  	metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
   606  
   607  	// items is the list of CSINode
   608  	Items []CSINode `json:"items" protobuf:"bytes,2,rep,name=items"`
   609  }
   610  
   611  // +genclient
   612  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
   613  // +k8s:prerelease-lifecycle-gen:introduced=1.21
   614  // +k8s:prerelease-lifecycle-gen:deprecated=1.24
   615  // +k8s:prerelease-lifecycle-gen:replacement=storage.k8s.io,v1,CSIStorageCapacity
   616  
   617  // CSIStorageCapacity stores the result of one CSI GetCapacity call.
   618  // For a given StorageClass, this describes the available capacity in a
   619  // particular topology segment.  This can be used when considering where to
   620  // instantiate new PersistentVolumes.
   621  //
   622  // For example this can express things like:
   623  // - StorageClass "standard" has "1234 GiB" available in "topology.kubernetes.io/zone=us-east1"
   624  // - StorageClass "localssd" has "10 GiB" available in "kubernetes.io/hostname=knode-abc123"
   625  //
   626  // The following three cases all imply that no capacity is available for
   627  // a certain combination:
   628  // - no object exists with suitable topology and storage class name
   629  // - such an object exists, but the capacity is unset
   630  // - such an object exists, but the capacity is zero
   631  //
   632  // The producer of these objects can decide which approach is more suitable.
   633  //
   634  // They are consumed by the kube-scheduler when a CSI driver opts into
   635  // capacity-aware scheduling with CSIDriverSpec.StorageCapacity. The scheduler
   636  // compares the MaximumVolumeSize against the requested size of pending volumes
   637  // to filter out unsuitable nodes. If MaximumVolumeSize is unset, it falls back
   638  // to a comparison against the less precise Capacity. If that is also unset,
   639  // the scheduler assumes that capacity is insufficient and tries some other
   640  // node.
   641  type CSIStorageCapacity struct {
   642  	metav1.TypeMeta `json:",inline"`
   643  
   644  	// Standard object's metadata. The name has no particular meaning. It must be
   645  	// be a DNS subdomain (dots allowed, 253 characters). To ensure that
   646  	// there are no conflicts with other CSI drivers on the cluster, the recommendation
   647  	// is to use csisc-<uuid>, a generated name, or a reverse-domain name which ends
   648  	// with the unique CSI driver name.
   649  	//
   650  	// Objects are namespaced.
   651  	//
   652  	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
   653  	// +optional
   654  	metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
   655  
   656  	// nodeTopology defines which nodes have access to the storage
   657  	// for which capacity was reported. If not set, the storage is
   658  	// not accessible from any node in the cluster. If empty, the
   659  	// storage is accessible from all nodes. This field is
   660  	// immutable.
   661  	//
   662  	// +optional
   663  	NodeTopology *metav1.LabelSelector `json:"nodeTopology,omitempty" protobuf:"bytes,2,opt,name=nodeTopology"`
   664  
   665  	// storageClassName represents the name of the StorageClass that the reported capacity applies to.
   666  	// It must meet the same requirements as the name of a StorageClass
   667  	// object (non-empty, DNS subdomain). If that object no longer exists,
   668  	// the CSIStorageCapacity object is obsolete and should be removed by its
   669  	// creator.
   670  	// This field is immutable.
   671  	StorageClassName string `json:"storageClassName" protobuf:"bytes,3,name=storageClassName"`
   672  
   673  	// capacity is the value reported by the CSI driver in its GetCapacityResponse
   674  	// for a GetCapacityRequest with topology and parameters that match the
   675  	// previous fields.
   676  	//
   677  	// The semantic is currently (CSI spec 1.2) defined as:
   678  	// The available capacity, in bytes, of the storage that can be used
   679  	// to provision volumes. If not set, that information is currently
   680  	// unavailable.
   681  	//
   682  	// +optional
   683  	Capacity *resource.Quantity `json:"capacity,omitempty" protobuf:"bytes,4,opt,name=capacity"`
   684  
   685  	// maximumVolumeSize is the value reported by the CSI driver in its GetCapacityResponse
   686  	// for a GetCapacityRequest with topology and parameters that match the
   687  	// previous fields.
   688  	//
   689  	// This is defined since CSI spec 1.4.0 as the largest size
   690  	// that may be used in a
   691  	// CreateVolumeRequest.capacity_range.required_bytes field to
   692  	// create a volume with the same parameters as those in
   693  	// GetCapacityRequest. The corresponding value in the Kubernetes
   694  	// API is ResourceRequirements.Requests in a volume claim.
   695  	//
   696  	// +optional
   697  	MaximumVolumeSize *resource.Quantity `json:"maximumVolumeSize,omitempty" protobuf:"bytes,5,opt,name=maximumVolumeSize"`
   698  }
   699  
   700  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
   701  // +k8s:prerelease-lifecycle-gen:introduced=1.21
   702  // +k8s:prerelease-lifecycle-gen:deprecated=1.24
   703  // +k8s:prerelease-lifecycle-gen:replacement=storage.k8s.io,v1,CSIStorageCapacityList
   704  
   705  // CSIStorageCapacityList is a collection of CSIStorageCapacity objects.
   706  type CSIStorageCapacityList struct {
   707  	metav1.TypeMeta `json:",inline"`
   708  
   709  	// Standard list metadata
   710  	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
   711  	// +optional
   712  	metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
   713  
   714  	// items is the list of CSIStorageCapacity objects.
   715  	Items []CSIStorageCapacity `json:"items" protobuf:"bytes,2,rep,name=items"`
   716  }
   717  

View as plain text