1/* 2Copyright 2015 The Kubernetes Authors. 3 4Licensed under the Apache License, Version 2.0 (the "License"); 5you may not use this file except in compliance with the License. 6You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10Unless required by applicable law or agreed to in writing, software 11distributed under the License is distributed on an "AS IS" BASIS, 12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13See the License for the specific language governing permissions and 14limitations under the License. 15*/ 16 17package v1 18 19import ( 20 "k8s.io/apimachinery/pkg/api/resource" 21 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 22 "k8s.io/apimachinery/pkg/types" 23 "k8s.io/apimachinery/pkg/util/intstr" 24) 25 26const ( 27 // NamespaceDefault means the object is in the default namespace which is applied when not specified by clients 28 NamespaceDefault string = "default" 29 // NamespaceAll is the default argument to specify on a context when you want to list or filter resources across all namespaces 30 NamespaceAll string = "" 31 // NamespaceNodeLease is the namespace where we place node lease objects (used for node heartbeats) 32 NamespaceNodeLease string = "kube-node-lease" 33) 34 35// Volume represents a named volume in a pod that may be accessed by any container in the pod. 36type Volume struct { 37 // Volume's name. 38 // Must be a DNS_LABEL and unique within the pod. 39 // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names 40 Name string `json:"name" protobuf:"bytes,1,opt,name=name"` 41 // VolumeSource represents the location and type of the mounted volume. 42 // If not specified, the Volume is implied to be an EmptyDir. 43 // This implied behavior is deprecated and will be removed in a future version. 44 VolumeSource `json:",inline" protobuf:"bytes,2,opt,name=volumeSource"` 45} 46 47// Represents the source of a volume to mount. 48// Only one of its members may be specified. 49type VolumeSource struct { 50 // HostPath represents a pre-existing file or directory on the host 51 // machine that is directly exposed to the container. This is generally 52 // used for system agents or other privileged things that are allowed 53 // to see the host machine. Most containers will NOT need this. 54 // More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath 55 // --- 56 // TODO(jonesdl) We need to restrict who can use host directory mounts and who can/can not 57 // mount host directories as read/write. 58 // +optional 59 HostPath *HostPathVolumeSource `json:"hostPath,omitempty" protobuf:"bytes,1,opt,name=hostPath"` 60 // EmptyDir represents a temporary directory that shares a pod's lifetime. 61 // More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir 62 // +optional 63 EmptyDir *EmptyDirVolumeSource `json:"emptyDir,omitempty" protobuf:"bytes,2,opt,name=emptyDir"` 64 // GCEPersistentDisk represents a GCE Disk resource that is attached to a 65 // kubelet's host machine and then exposed to the pod. 66 // More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk 67 // +optional 68 GCEPersistentDisk *GCEPersistentDiskVolumeSource `json:"gcePersistentDisk,omitempty" protobuf:"bytes,3,opt,name=gcePersistentDisk"` 69 // AWSElasticBlockStore represents an AWS Disk resource that is attached to a 70 // kubelet's host machine and then exposed to the pod. 71 // More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore 72 // +optional 73 AWSElasticBlockStore *AWSElasticBlockStoreVolumeSource `json:"awsElasticBlockStore,omitempty" protobuf:"bytes,4,opt,name=awsElasticBlockStore"` 74 // GitRepo represents a git repository at a particular revision. 75 // DEPRECATED: GitRepo is deprecated. To provision a container with a git repo, mount an 76 // EmptyDir into an InitContainer that clones the repo using git, then mount the EmptyDir 77 // into the Pod's container. 78 // +optional 79 GitRepo *GitRepoVolumeSource `json:"gitRepo,omitempty" protobuf:"bytes,5,opt,name=gitRepo"` 80 // Secret represents a secret that should populate this volume. 81 // More info: https://kubernetes.io/docs/concepts/storage/volumes#secret 82 // +optional 83 Secret *SecretVolumeSource `json:"secret,omitempty" protobuf:"bytes,6,opt,name=secret"` 84 // NFS represents an NFS mount on the host that shares a pod's lifetime 85 // More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs 86 // +optional 87 NFS *NFSVolumeSource `json:"nfs,omitempty" protobuf:"bytes,7,opt,name=nfs"` 88 // ISCSI represents an ISCSI Disk resource that is attached to a 89 // kubelet's host machine and then exposed to the pod. 90 // More info: https://releases.k8s.io/HEAD/examples/volumes/iscsi/README.md 91 // +optional 92 ISCSI *ISCSIVolumeSource `json:"iscsi,omitempty" protobuf:"bytes,8,opt,name=iscsi"` 93 // Glusterfs represents a Glusterfs mount on the host that shares a pod's lifetime. 94 // More info: https://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md 95 // +optional 96 Glusterfs *GlusterfsVolumeSource `json:"glusterfs,omitempty" protobuf:"bytes,9,opt,name=glusterfs"` 97 // PersistentVolumeClaimVolumeSource represents a reference to a 98 // PersistentVolumeClaim in the same namespace. 99 // More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims 100 // +optional 101 PersistentVolumeClaim *PersistentVolumeClaimVolumeSource `json:"persistentVolumeClaim,omitempty" protobuf:"bytes,10,opt,name=persistentVolumeClaim"` 102 // RBD represents a Rados Block Device mount on the host that shares a pod's lifetime. 103 // More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md 104 // +optional 105 RBD *RBDVolumeSource `json:"rbd,omitempty" protobuf:"bytes,11,opt,name=rbd"` 106 // FlexVolume represents a generic volume resource that is 107 // provisioned/attached using an exec based plugin. 108 // +optional 109 FlexVolume *FlexVolumeSource `json:"flexVolume,omitempty" protobuf:"bytes,12,opt,name=flexVolume"` 110 // Cinder represents a cinder volume attached and mounted on kubelets host machine 111 // More info: https://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md 112 // +optional 113 Cinder *CinderVolumeSource `json:"cinder,omitempty" protobuf:"bytes,13,opt,name=cinder"` 114 // CephFS represents a Ceph FS mount on the host that shares a pod's lifetime 115 // +optional 116 CephFS *CephFSVolumeSource `json:"cephfs,omitempty" protobuf:"bytes,14,opt,name=cephfs"` 117 // Flocker represents a Flocker volume attached to a kubelet's host machine. This depends on the Flocker control service being running 118 // +optional 119 Flocker *FlockerVolumeSource `json:"flocker,omitempty" protobuf:"bytes,15,opt,name=flocker"` 120 // DownwardAPI represents downward API about the pod that should populate this volume 121 // +optional 122 DownwardAPI *DownwardAPIVolumeSource `json:"downwardAPI,omitempty" protobuf:"bytes,16,opt,name=downwardAPI"` 123 // FC represents a Fibre Channel resource that is attached to a kubelet's host machine and then exposed to the pod. 124 // +optional 125 FC *FCVolumeSource `json:"fc,omitempty" protobuf:"bytes,17,opt,name=fc"` 126 // AzureFile represents an Azure File Service mount on the host and bind mount to the pod. 127 // +optional 128 AzureFile *AzureFileVolumeSource `json:"azureFile,omitempty" protobuf:"bytes,18,opt,name=azureFile"` 129 // ConfigMap represents a configMap that should populate this volume 130 // +optional 131 ConfigMap *ConfigMapVolumeSource `json:"configMap,omitempty" protobuf:"bytes,19,opt,name=configMap"` 132 // VsphereVolume represents a vSphere volume attached and mounted on kubelets host machine 133 // +optional 134 VsphereVolume *VsphereVirtualDiskVolumeSource `json:"vsphereVolume,omitempty" protobuf:"bytes,20,opt,name=vsphereVolume"` 135 // Quobyte represents a Quobyte mount on the host that shares a pod's lifetime 136 // +optional 137 Quobyte *QuobyteVolumeSource `json:"quobyte,omitempty" protobuf:"bytes,21,opt,name=quobyte"` 138 // AzureDisk represents an Azure Data Disk mount on the host and bind mount to the pod. 139 // +optional 140 AzureDisk *AzureDiskVolumeSource `json:"azureDisk,omitempty" protobuf:"bytes,22,opt,name=azureDisk"` 141 // PhotonPersistentDisk represents a PhotonController persistent disk attached and mounted on kubelets host machine 142 PhotonPersistentDisk *PhotonPersistentDiskVolumeSource `json:"photonPersistentDisk,omitempty" protobuf:"bytes,23,opt,name=photonPersistentDisk"` 143 // Items for all in one resources secrets, configmaps, and downward API 144 Projected *ProjectedVolumeSource `json:"projected,omitempty" protobuf:"bytes,26,opt,name=projected"` 145 // PortworxVolume represents a portworx volume attached and mounted on kubelets host machine 146 // +optional 147 PortworxVolume *PortworxVolumeSource `json:"portworxVolume,omitempty" protobuf:"bytes,24,opt,name=portworxVolume"` 148 // ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes. 149 // +optional 150 ScaleIO *ScaleIOVolumeSource `json:"scaleIO,omitempty" protobuf:"bytes,25,opt,name=scaleIO"` 151 // StorageOS represents a StorageOS volume attached and mounted on Kubernetes nodes. 152 // +optional 153 StorageOS *StorageOSVolumeSource `json:"storageos,omitempty" protobuf:"bytes,27,opt,name=storageos"` 154 // CSI (Container Storage Interface) represents storage that is handled by an external CSI driver (Alpha feature). 155 // +optional 156 CSI *CSIVolumeSource `json:"csi,omitempty" protobuf:"bytes,28,opt,name=csi"` 157} 158 159// PersistentVolumeClaimVolumeSource references the user's PVC in the same namespace. 160// This volume finds the bound PV and mounts that volume for the pod. A 161// PersistentVolumeClaimVolumeSource is, essentially, a wrapper around another 162// type of volume that is owned by someone else (the system). 163type PersistentVolumeClaimVolumeSource struct { 164 // ClaimName is the name of a PersistentVolumeClaim in the same namespace as the pod using this volume. 165 // More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims 166 ClaimName string `json:"claimName" protobuf:"bytes,1,opt,name=claimName"` 167 // Will force the ReadOnly setting in VolumeMounts. 168 // Default false. 169 // +optional 170 ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,2,opt,name=readOnly"` 171} 172 173// PersistentVolumeSource is similar to VolumeSource but meant for the 174// administrator who creates PVs. Exactly one of its members must be set. 175type PersistentVolumeSource struct { 176 // GCEPersistentDisk represents a GCE Disk resource that is attached to a 177 // kubelet's host machine and then exposed to the pod. Provisioned by an admin. 178 // More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk 179 // +optional 180 GCEPersistentDisk *GCEPersistentDiskVolumeSource `json:"gcePersistentDisk,omitempty" protobuf:"bytes,1,opt,name=gcePersistentDisk"` 181 // AWSElasticBlockStore represents an AWS Disk resource that is attached to a 182 // kubelet's host machine and then exposed to the pod. 183 // More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore 184 // +optional 185 AWSElasticBlockStore *AWSElasticBlockStoreVolumeSource `json:"awsElasticBlockStore,omitempty" protobuf:"bytes,2,opt,name=awsElasticBlockStore"` 186 // HostPath represents a directory on the host. 187 // Provisioned by a developer or tester. 188 // This is useful for single-node development and testing only! 189 // On-host storage is not supported in any way and WILL NOT WORK in a multi-node cluster. 190 // More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath 191 // +optional 192 HostPath *HostPathVolumeSource `json:"hostPath,omitempty" protobuf:"bytes,3,opt,name=hostPath"` 193 // Glusterfs represents a Glusterfs volume that is attached to a host and 194 // exposed to the pod. Provisioned by an admin. 195 // More info: https://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md 196 // +optional 197 Glusterfs *GlusterfsPersistentVolumeSource `json:"glusterfs,omitempty" protobuf:"bytes,4,opt,name=glusterfs"` 198 // NFS represents an NFS mount on the host. Provisioned by an admin. 199 // More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs 200 // +optional 201 NFS *NFSVolumeSource `json:"nfs,omitempty" protobuf:"bytes,5,opt,name=nfs"` 202 // RBD represents a Rados Block Device mount on the host that shares a pod's lifetime. 203 // More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md 204 // +optional 205 RBD *RBDPersistentVolumeSource `json:"rbd,omitempty" protobuf:"bytes,6,opt,name=rbd"` 206 // ISCSI represents an ISCSI Disk resource that is attached to a 207 // kubelet's host machine and then exposed to the pod. Provisioned by an admin. 208 // +optional 209 ISCSI *ISCSIPersistentVolumeSource `json:"iscsi,omitempty" protobuf:"bytes,7,opt,name=iscsi"` 210 // Cinder represents a cinder volume attached and mounted on kubelets host machine 211 // More info: https://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md 212 // +optional 213 Cinder *CinderPersistentVolumeSource `json:"cinder,omitempty" protobuf:"bytes,8,opt,name=cinder"` 214 // CephFS represents a Ceph FS mount on the host that shares a pod's lifetime 215 // +optional 216 CephFS *CephFSPersistentVolumeSource `json:"cephfs,omitempty" protobuf:"bytes,9,opt,name=cephfs"` 217 // FC represents a Fibre Channel resource that is attached to a kubelet's host machine and then exposed to the pod. 218 // +optional 219 FC *FCVolumeSource `json:"fc,omitempty" protobuf:"bytes,10,opt,name=fc"` 220 // Flocker represents a Flocker volume attached to a kubelet's host machine and exposed to the pod for its usage. This depends on the Flocker control service being running 221 // +optional 222 Flocker *FlockerVolumeSource `json:"flocker,omitempty" protobuf:"bytes,11,opt,name=flocker"` 223 // FlexVolume represents a generic volume resource that is 224 // provisioned/attached using an exec based plugin. 225 // +optional 226 FlexVolume *FlexPersistentVolumeSource `json:"flexVolume,omitempty" protobuf:"bytes,12,opt,name=flexVolume"` 227 // AzureFile represents an Azure File Service mount on the host and bind mount to the pod. 228 // +optional 229 AzureFile *AzureFilePersistentVolumeSource `json:"azureFile,omitempty" protobuf:"bytes,13,opt,name=azureFile"` 230 // VsphereVolume represents a vSphere volume attached and mounted on kubelets host machine 231 // +optional 232 VsphereVolume *VsphereVirtualDiskVolumeSource `json:"vsphereVolume,omitempty" protobuf:"bytes,14,opt,name=vsphereVolume"` 233 // Quobyte represents a Quobyte mount on the host that shares a pod's lifetime 234 // +optional 235 Quobyte *QuobyteVolumeSource `json:"quobyte,omitempty" protobuf:"bytes,15,opt,name=quobyte"` 236 // AzureDisk represents an Azure Data Disk mount on the host and bind mount to the pod. 237 // +optional 238 AzureDisk *AzureDiskVolumeSource `json:"azureDisk,omitempty" protobuf:"bytes,16,opt,name=azureDisk"` 239 // PhotonPersistentDisk represents a PhotonController persistent disk attached and mounted on kubelets host machine 240 PhotonPersistentDisk *PhotonPersistentDiskVolumeSource `json:"photonPersistentDisk,omitempty" protobuf:"bytes,17,opt,name=photonPersistentDisk"` 241 // PortworxVolume represents a portworx volume attached and mounted on kubelets host machine 242 // +optional 243 PortworxVolume *PortworxVolumeSource `json:"portworxVolume,omitempty" protobuf:"bytes,18,opt,name=portworxVolume"` 244 // ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes. 245 // +optional 246 ScaleIO *ScaleIOPersistentVolumeSource `json:"scaleIO,omitempty" protobuf:"bytes,19,opt,name=scaleIO"` 247 // Local represents directly-attached storage with node affinity 248 // +optional 249 Local *LocalVolumeSource `json:"local,omitempty" protobuf:"bytes,20,opt,name=local"` 250 // StorageOS represents a StorageOS volume that is attached to the kubelet's host machine and mounted into the pod 251 // More info: https://releases.k8s.io/HEAD/examples/volumes/storageos/README.md 252 // +optional 253 StorageOS *StorageOSPersistentVolumeSource `json:"storageos,omitempty" protobuf:"bytes,21,opt,name=storageos"` 254 // CSI represents storage that is handled by an external CSI driver (Beta feature). 255 // +optional 256 CSI *CSIPersistentVolumeSource `json:"csi,omitempty" protobuf:"bytes,22,opt,name=csi"` 257} 258 259const ( 260 // BetaStorageClassAnnotation represents the beta/previous StorageClass annotation. 261 // It's currently still used and will be held for backwards compatibility 262 BetaStorageClassAnnotation = "volume.beta.kubernetes.io/storage-class" 263 264 // MountOptionAnnotation defines mount option annotation used in PVs 265 MountOptionAnnotation = "volume.beta.kubernetes.io/mount-options" 266) 267 268// +genclient 269// +genclient:nonNamespaced 270// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 271 272// PersistentVolume (PV) is a storage resource provisioned by an administrator. 273// It is analogous to a node. 274// More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes 275type PersistentVolume struct { 276 metav1.TypeMeta `json:",inline"` 277 // Standard object's metadata. 278 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata 279 // +optional 280 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 281 282 // Spec defines a specification of a persistent volume owned by the cluster. 283 // Provisioned by an administrator. 284 // More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistent-volumes 285 // +optional 286 Spec PersistentVolumeSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` 287 288 // Status represents the current information/status for the persistent volume. 289 // Populated by the system. 290 // Read-only. 291 // More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistent-volumes 292 // +optional 293 Status PersistentVolumeStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` 294} 295 296// PersistentVolumeSpec is the specification of a persistent volume. 297type PersistentVolumeSpec struct { 298 // A description of the persistent volume's resources and capacity. 299 // More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#capacity 300 // +optional 301 Capacity ResourceList `json:"capacity,omitempty" protobuf:"bytes,1,rep,name=capacity,casttype=ResourceList,castkey=ResourceName"` 302 // The actual volume backing the persistent volume. 303 PersistentVolumeSource `json:",inline" protobuf:"bytes,2,opt,name=persistentVolumeSource"` 304 // AccessModes contains all ways the volume can be mounted. 305 // More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes 306 // +optional 307 AccessModes []PersistentVolumeAccessMode `json:"accessModes,omitempty" protobuf:"bytes,3,rep,name=accessModes,casttype=PersistentVolumeAccessMode"` 308 // ClaimRef is part of a bi-directional binding between PersistentVolume and PersistentVolumeClaim. 309 // Expected to be non-nil when bound. 310 // claim.VolumeName is the authoritative bind between PV and PVC. 311 // More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#binding 312 // +optional 313 ClaimRef *ObjectReference `json:"claimRef,omitempty" protobuf:"bytes,4,opt,name=claimRef"` 314 // What happens to a persistent volume when released from its claim. 315 // Valid options are Retain (default for manually created PersistentVolumes), Delete (default 316 // for dynamically provisioned PersistentVolumes), and Recycle (deprecated). 317 // Recycle must be supported by the volume plugin underlying this PersistentVolume. 318 // More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#reclaiming 319 // +optional 320 PersistentVolumeReclaimPolicy PersistentVolumeReclaimPolicy `json:"persistentVolumeReclaimPolicy,omitempty" protobuf:"bytes,5,opt,name=persistentVolumeReclaimPolicy,casttype=PersistentVolumeReclaimPolicy"` 321 // Name of StorageClass to which this persistent volume belongs. Empty value 322 // means that this volume does not belong to any StorageClass. 323 // +optional 324 StorageClassName string `json:"storageClassName,omitempty" protobuf:"bytes,6,opt,name=storageClassName"` 325 // A list of mount options, e.g. ["ro", "soft"]. Not validated - mount will 326 // simply fail if one is invalid. 327 // More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes/#mount-options 328 // +optional 329 MountOptions []string `json:"mountOptions,omitempty" protobuf:"bytes,7,opt,name=mountOptions"` 330 // volumeMode defines if a volume is intended to be used with a formatted filesystem 331 // or to remain in raw block state. Value of Filesystem is implied when not included in spec. 332 // This is a beta feature. 333 // +optional 334 VolumeMode *PersistentVolumeMode `json:"volumeMode,omitempty" protobuf:"bytes,8,opt,name=volumeMode,casttype=PersistentVolumeMode"` 335 // NodeAffinity defines constraints that limit what nodes this volume can be accessed from. 336 // This field influences the scheduling of pods that use this volume. 337 // +optional 338 NodeAffinity *VolumeNodeAffinity `json:"nodeAffinity,omitempty" protobuf:"bytes,9,opt,name=nodeAffinity"` 339} 340 341// VolumeNodeAffinity defines constraints that limit what nodes this volume can be accessed from. 342type VolumeNodeAffinity struct { 343 // Required specifies hard node constraints that must be met. 344 Required *NodeSelector `json:"required,omitempty" protobuf:"bytes,1,opt,name=required"` 345} 346 347// PersistentVolumeReclaimPolicy describes a policy for end-of-life maintenance of persistent volumes. 348type PersistentVolumeReclaimPolicy string 349 350const ( 351 // PersistentVolumeReclaimRecycle means the volume will be recycled back into the pool of unbound persistent volumes on release from its claim. 352 // The volume plugin must support Recycling. 353 PersistentVolumeReclaimRecycle PersistentVolumeReclaimPolicy = "Recycle" 354 // PersistentVolumeReclaimDelete means the volume will be deleted from Kubernetes on release from its claim. 355 // The volume plugin must support Deletion. 356 PersistentVolumeReclaimDelete PersistentVolumeReclaimPolicy = "Delete" 357 // PersistentVolumeReclaimRetain means the volume will be left in its current phase (Released) for manual reclamation by the administrator. 358 // The default policy is Retain. 359 PersistentVolumeReclaimRetain PersistentVolumeReclaimPolicy = "Retain" 360) 361 362// PersistentVolumeMode describes how a volume is intended to be consumed, either Block or Filesystem. 363type PersistentVolumeMode string 364 365const ( 366 // PersistentVolumeBlock means the volume will not be formatted with a filesystem and will remain a raw block device. 367 PersistentVolumeBlock PersistentVolumeMode = "Block" 368 // PersistentVolumeFilesystem means the volume will be or is formatted with a filesystem. 369 PersistentVolumeFilesystem PersistentVolumeMode = "Filesystem" 370) 371 372// PersistentVolumeStatus is the current status of a persistent volume. 373type PersistentVolumeStatus struct { 374 // Phase indicates if a volume is available, bound to a claim, or released by a claim. 375 // More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#phase 376 // +optional 377 Phase PersistentVolumePhase `json:"phase,omitempty" protobuf:"bytes,1,opt,name=phase,casttype=PersistentVolumePhase"` 378 // A human-readable message indicating details about why the volume is in this state. 379 // +optional 380 Message string `json:"message,omitempty" protobuf:"bytes,2,opt,name=message"` 381 // Reason is a brief CamelCase string that describes any failure and is meant 382 // for machine parsing and tidy display in the CLI. 383 // +optional 384 Reason string `json:"reason,omitempty" protobuf:"bytes,3,opt,name=reason"` 385} 386 387// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 388 389// PersistentVolumeList is a list of PersistentVolume items. 390type PersistentVolumeList struct { 391 metav1.TypeMeta `json:",inline"` 392 // Standard list metadata. 393 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds 394 // +optional 395 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 396 // List of persistent volumes. 397 // More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes 398 Items []PersistentVolume `json:"items" protobuf:"bytes,2,rep,name=items"` 399} 400 401// +genclient 402// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 403 404// PersistentVolumeClaim is a user's request for and claim to a persistent volume 405type PersistentVolumeClaim struct { 406 metav1.TypeMeta `json:",inline"` 407 // Standard object's metadata. 408 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata 409 // +optional 410 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 411 412 // Spec defines the desired characteristics of a volume requested by a pod author. 413 // More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims 414 // +optional 415 Spec PersistentVolumeClaimSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` 416 417 // Status represents the current information/status of a persistent volume claim. 418 // Read-only. 419 // More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims 420 // +optional 421 Status PersistentVolumeClaimStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` 422} 423 424// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 425 426// PersistentVolumeClaimList is a list of PersistentVolumeClaim items. 427type PersistentVolumeClaimList struct { 428 metav1.TypeMeta `json:",inline"` 429 // Standard list metadata. 430 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds 431 // +optional 432 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 433 // A list of persistent volume claims. 434 // More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims 435 Items []PersistentVolumeClaim `json:"items" protobuf:"bytes,2,rep,name=items"` 436} 437 438// PersistentVolumeClaimSpec describes the common attributes of storage devices 439// and allows a Source for provider-specific attributes 440type PersistentVolumeClaimSpec struct { 441 // AccessModes contains the desired access modes the volume should have. 442 // More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1 443 // +optional 444 AccessModes []PersistentVolumeAccessMode `json:"accessModes,omitempty" protobuf:"bytes,1,rep,name=accessModes,casttype=PersistentVolumeAccessMode"` 445 // A label query over volumes to consider for binding. 446 // +optional 447 Selector *metav1.LabelSelector `json:"selector,omitempty" protobuf:"bytes,4,opt,name=selector"` 448 // Resources represents the minimum resources the volume should have. 449 // More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources 450 // +optional 451 Resources ResourceRequirements `json:"resources,omitempty" protobuf:"bytes,2,opt,name=resources"` 452 // VolumeName is the binding reference to the PersistentVolume backing this claim. 453 // +optional 454 VolumeName string `json:"volumeName,omitempty" protobuf:"bytes,3,opt,name=volumeName"` 455 // Name of the StorageClass required by the claim. 456 // More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1 457 // +optional 458 StorageClassName *string `json:"storageClassName,omitempty" protobuf:"bytes,5,opt,name=storageClassName"` 459 // volumeMode defines what type of volume is required by the claim. 460 // Value of Filesystem is implied when not included in claim spec. 461 // This is a beta feature. 462 // +optional 463 VolumeMode *PersistentVolumeMode `json:"volumeMode,omitempty" protobuf:"bytes,6,opt,name=volumeMode,casttype=PersistentVolumeMode"` 464 // This field requires the VolumeSnapshotDataSource alpha feature gate to be 465 // enabled and currently VolumeSnapshot is the only supported data source. 466 // If the provisioner can support VolumeSnapshot data source, it will create 467 // a new volume and data will be restored to the volume at the same time. 468 // If the provisioner does not support VolumeSnapshot data source, volume will 469 // not be created and the failure will be reported as an event. 470 // In the future, we plan to support more data source types and the behavior 471 // of the provisioner may change. 472 // +optional 473 DataSource *TypedLocalObjectReference `json:"dataSource,omitempty" protobuf:"bytes,7,opt,name=dataSource"` 474} 475 476// PersistentVolumeClaimConditionType is a valid value of PersistentVolumeClaimCondition.Type 477type PersistentVolumeClaimConditionType string 478 479const ( 480 // PersistentVolumeClaimResizing - a user trigger resize of pvc has been started 481 PersistentVolumeClaimResizing PersistentVolumeClaimConditionType = "Resizing" 482 // PersistentVolumeClaimFileSystemResizePending - controller resize is finished and a file system resize is pending on node 483 PersistentVolumeClaimFileSystemResizePending PersistentVolumeClaimConditionType = "FileSystemResizePending" 484) 485 486// PersistentVolumeClaimCondition contails details about state of pvc 487type PersistentVolumeClaimCondition struct { 488 Type PersistentVolumeClaimConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=PersistentVolumeClaimConditionType"` 489 Status ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=ConditionStatus"` 490 // Last time we probed the condition. 491 // +optional 492 LastProbeTime metav1.Time `json:"lastProbeTime,omitempty" protobuf:"bytes,3,opt,name=lastProbeTime"` 493 // Last time the condition transitioned from one status to another. 494 // +optional 495 LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,4,opt,name=lastTransitionTime"` 496 // Unique, this should be a short, machine understandable string that gives the reason 497 // for condition's last transition. If it reports "ResizeStarted" that means the underlying 498 // persistent volume is being resized. 499 // +optional 500 Reason string `json:"reason,omitempty" protobuf:"bytes,5,opt,name=reason"` 501 // Human-readable message indicating details about last transition. 502 // +optional 503 Message string `json:"message,omitempty" protobuf:"bytes,6,opt,name=message"` 504} 505 506// PersistentVolumeClaimStatus is the current status of a persistent volume claim. 507type PersistentVolumeClaimStatus struct { 508 // Phase represents the current phase of PersistentVolumeClaim. 509 // +optional 510 Phase PersistentVolumeClaimPhase `json:"phase,omitempty" protobuf:"bytes,1,opt,name=phase,casttype=PersistentVolumeClaimPhase"` 511 // AccessModes contains the actual access modes the volume backing the PVC has. 512 // More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1 513 // +optional 514 AccessModes []PersistentVolumeAccessMode `json:"accessModes,omitempty" protobuf:"bytes,2,rep,name=accessModes,casttype=PersistentVolumeAccessMode"` 515 // Represents the actual resources of the underlying volume. 516 // +optional 517 Capacity ResourceList `json:"capacity,omitempty" protobuf:"bytes,3,rep,name=capacity,casttype=ResourceList,castkey=ResourceName"` 518 // Current Condition of persistent volume claim. If underlying persistent volume is being 519 // resized then the Condition will be set to 'ResizeStarted'. 520 // +optional 521 // +patchMergeKey=type 522 // +patchStrategy=merge 523 Conditions []PersistentVolumeClaimCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,4,rep,name=conditions"` 524} 525 526type PersistentVolumeAccessMode string 527 528const ( 529 // can be mounted in read/write mode to exactly 1 host 530 ReadWriteOnce PersistentVolumeAccessMode = "ReadWriteOnce" 531 // can be mounted in read-only mode to many hosts 532 ReadOnlyMany PersistentVolumeAccessMode = "ReadOnlyMany" 533 // can be mounted in read/write mode to many hosts 534 ReadWriteMany PersistentVolumeAccessMode = "ReadWriteMany" 535) 536 537type PersistentVolumePhase string 538 539const ( 540 // used for PersistentVolumes that are not available 541 VolumePending PersistentVolumePhase = "Pending" 542 // used for PersistentVolumes that are not yet bound 543 // Available volumes are held by the binder and matched to PersistentVolumeClaims 544 VolumeAvailable PersistentVolumePhase = "Available" 545 // used for PersistentVolumes that are bound 546 VolumeBound PersistentVolumePhase = "Bound" 547 // used for PersistentVolumes where the bound PersistentVolumeClaim was deleted 548 // released volumes must be recycled before becoming available again 549 // this phase is used by the persistent volume claim binder to signal to another process to reclaim the resource 550 VolumeReleased PersistentVolumePhase = "Released" 551 // used for PersistentVolumes that failed to be correctly recycled or deleted after being released from a claim 552 VolumeFailed PersistentVolumePhase = "Failed" 553) 554 555type PersistentVolumeClaimPhase string 556 557const ( 558 // used for PersistentVolumeClaims that are not yet bound 559 ClaimPending PersistentVolumeClaimPhase = "Pending" 560 // used for PersistentVolumeClaims that are bound 561 ClaimBound PersistentVolumeClaimPhase = "Bound" 562 // used for PersistentVolumeClaims that lost their underlying 563 // PersistentVolume. The claim was bound to a PersistentVolume and this 564 // volume does not exist any longer and all data on it was lost. 565 ClaimLost PersistentVolumeClaimPhase = "Lost" 566) 567 568type HostPathType string 569 570const ( 571 // For backwards compatible, leave it empty if unset 572 HostPathUnset HostPathType = "" 573 // If nothing exists at the given path, an empty directory will be created there 574 // as needed with file mode 0755, having the same group and ownership with Kubelet. 575 HostPathDirectoryOrCreate HostPathType = "DirectoryOrCreate" 576 // A directory must exist at the given path 577 HostPathDirectory HostPathType = "Directory" 578 // If nothing exists at the given path, an empty file will be created there 579 // as needed with file mode 0644, having the same group and ownership with Kubelet. 580 HostPathFileOrCreate HostPathType = "FileOrCreate" 581 // A file must exist at the given path 582 HostPathFile HostPathType = "File" 583 // A UNIX socket must exist at the given path 584 HostPathSocket HostPathType = "Socket" 585 // A character device must exist at the given path 586 HostPathCharDev HostPathType = "CharDevice" 587 // A block device must exist at the given path 588 HostPathBlockDev HostPathType = "BlockDevice" 589) 590 591// Represents a host path mapped into a pod. 592// Host path volumes do not support ownership management or SELinux relabeling. 593type HostPathVolumeSource struct { 594 // Path of the directory on the host. 595 // If the path is a symlink, it will follow the link to the real path. 596 // More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath 597 Path string `json:"path" protobuf:"bytes,1,opt,name=path"` 598 // Type for HostPath Volume 599 // Defaults to "" 600 // More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath 601 // +optional 602 Type *HostPathType `json:"type,omitempty" protobuf:"bytes,2,opt,name=type"` 603} 604 605// Represents an empty directory for a pod. 606// Empty directory volumes support ownership management and SELinux relabeling. 607type EmptyDirVolumeSource struct { 608 // What type of storage medium should back this directory. 609 // The default is "" which means to use the node's default medium. 610 // Must be an empty string (default) or Memory. 611 // More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir 612 // +optional 613 Medium StorageMedium `json:"medium,omitempty" protobuf:"bytes,1,opt,name=medium,casttype=StorageMedium"` 614 // Total amount of local storage required for this EmptyDir volume. 615 // The size limit is also applicable for memory medium. 616 // The maximum usage on memory medium EmptyDir would be the minimum value between 617 // the SizeLimit specified here and the sum of memory limits of all containers in a pod. 618 // The default is nil which means that the limit is undefined. 619 // More info: http://kubernetes.io/docs/user-guide/volumes#emptydir 620 // +optional 621 SizeLimit *resource.Quantity `json:"sizeLimit,omitempty" protobuf:"bytes,2,opt,name=sizeLimit"` 622} 623 624// Represents a Glusterfs mount that lasts the lifetime of a pod. 625// Glusterfs volumes do not support ownership management or SELinux relabeling. 626type GlusterfsVolumeSource struct { 627 // EndpointsName is the endpoint name that details Glusterfs topology. 628 // More info: https://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md#create-a-pod 629 EndpointsName string `json:"endpoints" protobuf:"bytes,1,opt,name=endpoints"` 630 631 // Path is the Glusterfs volume path. 632 // More info: https://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md#create-a-pod 633 Path string `json:"path" protobuf:"bytes,2,opt,name=path"` 634 635 // ReadOnly here will force the Glusterfs volume to be mounted with read-only permissions. 636 // Defaults to false. 637 // More info: https://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md#create-a-pod 638 // +optional 639 ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,3,opt,name=readOnly"` 640} 641 642// Represents a Glusterfs mount that lasts the lifetime of a pod. 643// Glusterfs volumes do not support ownership management or SELinux relabeling. 644type GlusterfsPersistentVolumeSource struct { 645 // EndpointsName is the endpoint name that details Glusterfs topology. 646 // More info: https://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md#create-a-pod 647 EndpointsName string `json:"endpoints" protobuf:"bytes,1,opt,name=endpoints"` 648 649 // Path is the Glusterfs volume path. 650 // More info: https://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md#create-a-pod 651 Path string `json:"path" protobuf:"bytes,2,opt,name=path"` 652 653 // ReadOnly here will force the Glusterfs volume to be mounted with read-only permissions. 654 // Defaults to false. 655 // More info: https://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md#create-a-pod 656 // +optional 657 ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,3,opt,name=readOnly"` 658 659 // EndpointsNamespace is the namespace that contains Glusterfs endpoint. 660 // If this field is empty, the EndpointNamespace defaults to the same namespace as the bound PVC. 661 // More info: https://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md#create-a-pod 662 // +optional 663 EndpointsNamespace *string `json:"endpointsNamespace,omitempty" protobuf:"bytes,4,opt,name=endpointsNamespace"` 664} 665 666// Represents a Rados Block Device mount that lasts the lifetime of a pod. 667// RBD volumes support ownership management and SELinux relabeling. 668type RBDVolumeSource struct { 669 // A collection of Ceph monitors. 670 // More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it 671 CephMonitors []string `json:"monitors" protobuf:"bytes,1,rep,name=monitors"` 672 // The rados image name. 673 // More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it 674 RBDImage string `json:"image" protobuf:"bytes,2,opt,name=image"` 675 // Filesystem type of the volume that you want to mount. 676 // Tip: Ensure that the filesystem type is supported by the host operating system. 677 // Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. 678 // More info: https://kubernetes.io/docs/concepts/storage/volumes#rbd 679 // TODO: how do we prevent errors in the filesystem from compromising the machine 680 // +optional 681 FSType string `json:"fsType,omitempty" protobuf:"bytes,3,opt,name=fsType"` 682 // The rados pool name. 683 // Default is rbd. 684 // More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it 685 // +optional 686 RBDPool string `json:"pool,omitempty" protobuf:"bytes,4,opt,name=pool"` 687 // The rados user name. 688 // Default is admin. 689 // More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it 690 // +optional 691 RadosUser string `json:"user,omitempty" protobuf:"bytes,5,opt,name=user"` 692 // Keyring is the path to key ring for RBDUser. 693 // Default is /etc/ceph/keyring. 694 // More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it 695 // +optional 696 Keyring string `json:"keyring,omitempty" protobuf:"bytes,6,opt,name=keyring"` 697 // SecretRef is name of the authentication secret for RBDUser. If provided 698 // overrides keyring. 699 // Default is nil. 700 // More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it 701 // +optional 702 SecretRef *LocalObjectReference `json:"secretRef,omitempty" protobuf:"bytes,7,opt,name=secretRef"` 703 // ReadOnly here will force the ReadOnly setting in VolumeMounts. 704 // Defaults to false. 705 // More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it 706 // +optional 707 ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,8,opt,name=readOnly"` 708} 709 710// Represents a Rados Block Device mount that lasts the lifetime of a pod. 711// RBD volumes support ownership management and SELinux relabeling. 712type RBDPersistentVolumeSource struct { 713 // A collection of Ceph monitors. 714 // More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it 715 CephMonitors []string `json:"monitors" protobuf:"bytes,1,rep,name=monitors"` 716 // The rados image name. 717 // More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it 718 RBDImage string `json:"image" protobuf:"bytes,2,opt,name=image"` 719 // Filesystem type of the volume that you want to mount. 720 // Tip: Ensure that the filesystem type is supported by the host operating system. 721 // Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. 722 // More info: https://kubernetes.io/docs/concepts/storage/volumes#rbd 723 // TODO: how do we prevent errors in the filesystem from compromising the machine 724 // +optional 725 FSType string `json:"fsType,omitempty" protobuf:"bytes,3,opt,name=fsType"` 726 // The rados pool name. 727 // Default is rbd. 728 // More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it 729 // +optional 730 RBDPool string `json:"pool,omitempty" protobuf:"bytes,4,opt,name=pool"` 731 // The rados user name. 732 // Default is admin. 733 // More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it 734 // +optional 735 RadosUser string `json:"user,omitempty" protobuf:"bytes,5,opt,name=user"` 736 // Keyring is the path to key ring for RBDUser. 737 // Default is /etc/ceph/keyring. 738 // More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it 739 // +optional 740 Keyring string `json:"keyring,omitempty" protobuf:"bytes,6,opt,name=keyring"` 741 // SecretRef is name of the authentication secret for RBDUser. If provided 742 // overrides keyring. 743 // Default is nil. 744 // More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it 745 // +optional 746 SecretRef *SecretReference `json:"secretRef,omitempty" protobuf:"bytes,7,opt,name=secretRef"` 747 // ReadOnly here will force the ReadOnly setting in VolumeMounts. 748 // Defaults to false. 749 // More info: https://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it 750 // +optional 751 ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,8,opt,name=readOnly"` 752} 753 754// Represents a cinder volume resource in Openstack. 755// A Cinder volume must exist before mounting to a container. 756// The volume must also be in the same region as the kubelet. 757// Cinder volumes support ownership management and SELinux relabeling. 758type CinderVolumeSource struct { 759 // volume id used to identify the volume in cinder 760 // More info: https://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md 761 VolumeID string `json:"volumeID" protobuf:"bytes,1,opt,name=volumeID"` 762 // Filesystem type to mount. 763 // Must be a filesystem type supported by the host operating system. 764 // Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. 765 // More info: https://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md 766 // +optional 767 FSType string `json:"fsType,omitempty" protobuf:"bytes,2,opt,name=fsType"` 768 // Optional: Defaults to false (read/write). ReadOnly here will force 769 // the ReadOnly setting in VolumeMounts. 770 // More info: https://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md 771 // +optional 772 ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,3,opt,name=readOnly"` 773 // Optional: points to a secret object containing parameters used to connect 774 // to OpenStack. 775 // +optional 776 SecretRef *LocalObjectReference `json:"secretRef,omitempty" protobuf:"bytes,4,opt,name=secretRef"` 777} 778 779// Represents a cinder volume resource in Openstack. 780// A Cinder volume must exist before mounting to a container. 781// The volume must also be in the same region as the kubelet. 782// Cinder volumes support ownership management and SELinux relabeling. 783type CinderPersistentVolumeSource struct { 784 // volume id used to identify the volume in cinder 785 // More info: https://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md 786 VolumeID string `json:"volumeID" protobuf:"bytes,1,opt,name=volumeID"` 787 // Filesystem type to mount. 788 // Must be a filesystem type supported by the host operating system. 789 // Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. 790 // More info: https://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md 791 // +optional 792 FSType string `json:"fsType,omitempty" protobuf:"bytes,2,opt,name=fsType"` 793 // Optional: Defaults to false (read/write). ReadOnly here will force 794 // the ReadOnly setting in VolumeMounts. 795 // More info: https://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md 796 // +optional 797 ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,3,opt,name=readOnly"` 798 // Optional: points to a secret object containing parameters used to connect 799 // to OpenStack. 800 // +optional 801 SecretRef *SecretReference `json:"secretRef,omitempty" protobuf:"bytes,4,opt,name=secretRef"` 802} 803 804// Represents a Ceph Filesystem mount that lasts the lifetime of a pod 805// Cephfs volumes do not support ownership management or SELinux relabeling. 806type CephFSVolumeSource struct { 807 // Required: Monitors is a collection of Ceph monitors 808 // More info: https://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it 809 Monitors []string `json:"monitors" protobuf:"bytes,1,rep,name=monitors"` 810 // Optional: Used as the mounted root, rather than the full Ceph tree, default is / 811 // +optional 812 Path string `json:"path,omitempty" protobuf:"bytes,2,opt,name=path"` 813 // Optional: User is the rados user name, default is admin 814 // More info: https://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it 815 // +optional 816 User string `json:"user,omitempty" protobuf:"bytes,3,opt,name=user"` 817 // Optional: SecretFile is the path to key ring for User, default is /etc/ceph/user.secret 818 // More info: https://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it 819 // +optional 820 SecretFile string `json:"secretFile,omitempty" protobuf:"bytes,4,opt,name=secretFile"` 821 // Optional: SecretRef is reference to the authentication secret for User, default is empty. 822 // More info: https://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it 823 // +optional 824 SecretRef *LocalObjectReference `json:"secretRef,omitempty" protobuf:"bytes,5,opt,name=secretRef"` 825 // Optional: Defaults to false (read/write). ReadOnly here will force 826 // the ReadOnly setting in VolumeMounts. 827 // More info: https://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it 828 // +optional 829 ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,6,opt,name=readOnly"` 830} 831 832// SecretReference represents a Secret Reference. It has enough information to retrieve secret 833// in any namespace 834type SecretReference struct { 835 // Name is unique within a namespace to reference a secret resource. 836 // +optional 837 Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"` 838 // Namespace defines the space within which the secret name must be unique. 839 // +optional 840 Namespace string `json:"namespace,omitempty" protobuf:"bytes,2,opt,name=namespace"` 841} 842 843// Represents a Ceph Filesystem mount that lasts the lifetime of a pod 844// Cephfs volumes do not support ownership management or SELinux relabeling. 845type CephFSPersistentVolumeSource struct { 846 // Required: Monitors is a collection of Ceph monitors 847 // More info: https://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it 848 Monitors []string `json:"monitors" protobuf:"bytes,1,rep,name=monitors"` 849 // Optional: Used as the mounted root, rather than the full Ceph tree, default is / 850 // +optional 851 Path string `json:"path,omitempty" protobuf:"bytes,2,opt,name=path"` 852 // Optional: User is the rados user name, default is admin 853 // More info: https://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it 854 // +optional 855 User string `json:"user,omitempty" protobuf:"bytes,3,opt,name=user"` 856 // Optional: SecretFile is the path to key ring for User, default is /etc/ceph/user.secret 857 // More info: https://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it 858 // +optional 859 SecretFile string `json:"secretFile,omitempty" protobuf:"bytes,4,opt,name=secretFile"` 860 // Optional: SecretRef is reference to the authentication secret for User, default is empty. 861 // More info: https://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it 862 // +optional 863 SecretRef *SecretReference `json:"secretRef,omitempty" protobuf:"bytes,5,opt,name=secretRef"` 864 // Optional: Defaults to false (read/write). ReadOnly here will force 865 // the ReadOnly setting in VolumeMounts. 866 // More info: https://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it 867 // +optional 868 ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,6,opt,name=readOnly"` 869} 870 871// Represents a Flocker volume mounted by the Flocker agent. 872// One and only one of datasetName and datasetUUID should be set. 873// Flocker volumes do not support ownership management or SELinux relabeling. 874type FlockerVolumeSource struct { 875 // Name of the dataset stored as metadata -> name on the dataset for Flocker 876 // should be considered as deprecated 877 // +optional 878 DatasetName string `json:"datasetName,omitempty" protobuf:"bytes,1,opt,name=datasetName"` 879 // UUID of the dataset. This is unique identifier of a Flocker dataset 880 // +optional 881 DatasetUUID string `json:"datasetUUID,omitempty" protobuf:"bytes,2,opt,name=datasetUUID"` 882} 883 884// StorageMedium defines ways that storage can be allocated to a volume. 885type StorageMedium string 886 887const ( 888 StorageMediumDefault StorageMedium = "" // use whatever the default is for the node, assume anything we don't explicitly handle is this 889 StorageMediumMemory StorageMedium = "Memory" // use memory (e.g. tmpfs on linux) 890 StorageMediumHugePages StorageMedium = "HugePages" // use hugepages 891) 892 893// Protocol defines network protocols supported for things like container ports. 894type Protocol string 895 896const ( 897 // ProtocolTCP is the TCP protocol. 898 ProtocolTCP Protocol = "TCP" 899 // ProtocolUDP is the UDP protocol. 900 ProtocolUDP Protocol = "UDP" 901 // ProtocolSCTP is the SCTP protocol. 902 ProtocolSCTP Protocol = "SCTP" 903) 904 905// Represents a Persistent Disk resource in Google Compute Engine. 906// 907// A GCE PD must exist before mounting to a container. The disk must 908// also be in the same GCE project and zone as the kubelet. A GCE PD 909// can only be mounted as read/write once or read-only many times. GCE 910// PDs support ownership management and SELinux relabeling. 911type GCEPersistentDiskVolumeSource struct { 912 // Unique name of the PD resource in GCE. Used to identify the disk in GCE. 913 // More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk 914 PDName string `json:"pdName" protobuf:"bytes,1,opt,name=pdName"` 915 // Filesystem type of the volume that you want to mount. 916 // Tip: Ensure that the filesystem type is supported by the host operating system. 917 // Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. 918 // More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk 919 // TODO: how do we prevent errors in the filesystem from compromising the machine 920 // +optional 921 FSType string `json:"fsType,omitempty" protobuf:"bytes,2,opt,name=fsType"` 922 // The partition in the volume that you want to mount. 923 // If omitted, the default is to mount by volume name. 924 // Examples: For volume /dev/sda1, you specify the partition as "1". 925 // Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty). 926 // More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk 927 // +optional 928 Partition int32 `json:"partition,omitempty" protobuf:"varint,3,opt,name=partition"` 929 // ReadOnly here will force the ReadOnly setting in VolumeMounts. 930 // Defaults to false. 931 // More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk 932 // +optional 933 ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,4,opt,name=readOnly"` 934} 935 936// Represents a Quobyte mount that lasts the lifetime of a pod. 937// Quobyte volumes do not support ownership management or SELinux relabeling. 938type QuobyteVolumeSource struct { 939 // Registry represents a single or multiple Quobyte Registry services 940 // specified as a string as host:port pair (multiple entries are separated with commas) 941 // which acts as the central registry for volumes 942 Registry string `json:"registry" protobuf:"bytes,1,opt,name=registry"` 943 944 // Volume is a string that references an already created Quobyte volume by name. 945 Volume string `json:"volume" protobuf:"bytes,2,opt,name=volume"` 946 947 // ReadOnly here will force the Quobyte volume to be mounted with read-only permissions. 948 // Defaults to false. 949 // +optional 950 ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,3,opt,name=readOnly"` 951 952 // User to map volume access to 953 // Defaults to serivceaccount user 954 // +optional 955 User string `json:"user,omitempty" protobuf:"bytes,4,opt,name=user"` 956 957 // Group to map volume access to 958 // Default is no group 959 // +optional 960 Group string `json:"group,omitempty" protobuf:"bytes,5,opt,name=group"` 961 962 // Tenant owning the given Quobyte volume in the Backend 963 // Used with dynamically provisioned Quobyte volumes, value is set by the plugin 964 // +optional 965 Tenant string `json:"tenant,omitempty" protobuf:"bytes,6,opt,name=tenant"` 966} 967 968// FlexPersistentVolumeSource represents a generic persistent volume resource that is 969// provisioned/attached using an exec based plugin. 970type FlexPersistentVolumeSource struct { 971 // Driver is the name of the driver to use for this volume. 972 Driver string `json:"driver" protobuf:"bytes,1,opt,name=driver"` 973 // Filesystem type to mount. 974 // Must be a filesystem type supported by the host operating system. 975 // Ex. "ext4", "xfs", "ntfs". The default filesystem depends on FlexVolume script. 976 // +optional 977 FSType string `json:"fsType,omitempty" protobuf:"bytes,2,opt,name=fsType"` 978 // Optional: SecretRef is reference to the secret object containing 979 // sensitive information to pass to the plugin scripts. This may be 980 // empty if no secret object is specified. If the secret object 981 // contains more than one secret, all secrets are passed to the plugin 982 // scripts. 983 // +optional 984 SecretRef *SecretReference `json:"secretRef,omitempty" protobuf:"bytes,3,opt,name=secretRef"` 985 // Optional: Defaults to false (read/write). ReadOnly here will force 986 // the ReadOnly setting in VolumeMounts. 987 // +optional 988 ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,4,opt,name=readOnly"` 989 // Optional: Extra command options if any. 990 // +optional 991 Options map[string]string `json:"options,omitempty" protobuf:"bytes,5,rep,name=options"` 992} 993 994// FlexVolume represents a generic volume resource that is 995// provisioned/attached using an exec based plugin. 996type FlexVolumeSource struct { 997 // Driver is the name of the driver to use for this volume. 998 Driver string `json:"driver" protobuf:"bytes,1,opt,name=driver"` 999 // Filesystem type to mount. 1000 // Must be a filesystem type supported by the host operating system. 1001 // Ex. "ext4", "xfs", "ntfs". The default filesystem depends on FlexVolume script. 1002 // +optional 1003 FSType string `json:"fsType,omitempty" protobuf:"bytes,2,opt,name=fsType"` 1004 // Optional: SecretRef is reference to the secret object containing 1005 // sensitive information to pass to the plugin scripts. This may be 1006 // empty if no secret object is specified. If the secret object 1007 // contains more than one secret, all secrets are passed to the plugin 1008 // scripts. 1009 // +optional 1010 SecretRef *LocalObjectReference `json:"secretRef,omitempty" protobuf:"bytes,3,opt,name=secretRef"` 1011 // Optional: Defaults to false (read/write). ReadOnly here will force 1012 // the ReadOnly setting in VolumeMounts. 1013 // +optional 1014 ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,4,opt,name=readOnly"` 1015 // Optional: Extra command options if any. 1016 // +optional 1017 Options map[string]string `json:"options,omitempty" protobuf:"bytes,5,rep,name=options"` 1018} 1019 1020// Represents a Persistent Disk resource in AWS. 1021// 1022// An AWS EBS disk must exist before mounting to a container. The disk 1023// must also be in the same AWS zone as the kubelet. An AWS EBS disk 1024// can only be mounted as read/write once. AWS EBS volumes support 1025// ownership management and SELinux relabeling. 1026type AWSElasticBlockStoreVolumeSource struct { 1027 // Unique ID of the persistent disk resource in AWS (Amazon EBS volume). 1028 // More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore 1029 VolumeID string `json:"volumeID" protobuf:"bytes,1,opt,name=volumeID"` 1030 // Filesystem type of the volume that you want to mount. 1031 // Tip: Ensure that the filesystem type is supported by the host operating system. 1032 // Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. 1033 // More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore 1034 // TODO: how do we prevent errors in the filesystem from compromising the machine 1035 // +optional 1036 FSType string `json:"fsType,omitempty" protobuf:"bytes,2,opt,name=fsType"` 1037 // The partition in the volume that you want to mount. 1038 // If omitted, the default is to mount by volume name. 1039 // Examples: For volume /dev/sda1, you specify the partition as "1". 1040 // Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty). 1041 // +optional 1042 Partition int32 `json:"partition,omitempty" protobuf:"varint,3,opt,name=partition"` 1043 // Specify "true" to force and set the ReadOnly property in VolumeMounts to "true". 1044 // If omitted, the default is "false". 1045 // More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore 1046 // +optional 1047 ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,4,opt,name=readOnly"` 1048} 1049 1050// Represents a volume that is populated with the contents of a git repository. 1051// Git repo volumes do not support ownership management. 1052// Git repo volumes support SELinux relabeling. 1053// 1054// DEPRECATED: GitRepo is deprecated. To provision a container with a git repo, mount an 1055// EmptyDir into an InitContainer that clones the repo using git, then mount the EmptyDir 1056// into the Pod's container. 1057type GitRepoVolumeSource struct { 1058 // Repository URL 1059 Repository string `json:"repository" protobuf:"bytes,1,opt,name=repository"` 1060 // Commit hash for the specified revision. 1061 // +optional 1062 Revision string `json:"revision,omitempty" protobuf:"bytes,2,opt,name=revision"` 1063 // Target directory name. 1064 // Must not contain or start with '..'. If '.' is supplied, the volume directory will be the 1065 // git repository. Otherwise, if specified, the volume will contain the git repository in 1066 // the subdirectory with the given name. 1067 // +optional 1068 Directory string `json:"directory,omitempty" protobuf:"bytes,3,opt,name=directory"` 1069} 1070 1071// Adapts a Secret into a volume. 1072// 1073// The contents of the target Secret's Data field will be presented in a volume 1074// as files using the keys in the Data field as the file names. 1075// Secret volumes support ownership management and SELinux relabeling. 1076type SecretVolumeSource struct { 1077 // Name of the secret in the pod's namespace to use. 1078 // More info: https://kubernetes.io/docs/concepts/storage/volumes#secret 1079 // +optional 1080 SecretName string `json:"secretName,omitempty" protobuf:"bytes,1,opt,name=secretName"` 1081 // If unspecified, each key-value pair in the Data field of the referenced 1082 // Secret will be projected into the volume as a file whose name is the 1083 // key and content is the value. If specified, the listed keys will be 1084 // projected into the specified paths, and unlisted keys will not be 1085 // present. If a key is specified which is not present in the Secret, 1086 // the volume setup will error unless it is marked optional. Paths must be 1087 // relative and may not contain the '..' path or start with '..'. 1088 // +optional 1089 Items []KeyToPath `json:"items,omitempty" protobuf:"bytes,2,rep,name=items"` 1090 // Optional: mode bits to use on created files by default. Must be a 1091 // value between 0 and 0777. Defaults to 0644. 1092 // Directories within the path are not affected by this setting. 1093 // This might be in conflict with other options that affect the file 1094 // mode, like fsGroup, and the result can be other mode bits set. 1095 // +optional 1096 DefaultMode *int32 `json:"defaultMode,omitempty" protobuf:"bytes,3,opt,name=defaultMode"` 1097 // Specify whether the Secret or it's keys must be defined 1098 // +optional 1099 Optional *bool `json:"optional,omitempty" protobuf:"varint,4,opt,name=optional"` 1100} 1101 1102const ( 1103 SecretVolumeSourceDefaultMode int32 = 0644 1104) 1105 1106// Adapts a secret into a projected volume. 1107// 1108// The contents of the target Secret's Data field will be presented in a 1109// projected volume as files using the keys in the Data field as the file names. 1110// Note that this is identical to a secret volume source without the default 1111// mode. 1112type SecretProjection struct { 1113 LocalObjectReference `json:",inline" protobuf:"bytes,1,opt,name=localObjectReference"` 1114 // If unspecified, each key-value pair in the Data field of the referenced 1115 // Secret will be projected into the volume as a file whose name is the 1116 // key and content is the value. If specified, the listed keys will be 1117 // projected into the specified paths, and unlisted keys will not be 1118 // present. If a key is specified which is not present in the Secret, 1119 // the volume setup will error unless it is marked optional. Paths must be 1120 // relative and may not contain the '..' path or start with '..'. 1121 // +optional 1122 Items []KeyToPath `json:"items,omitempty" protobuf:"bytes,2,rep,name=items"` 1123 // Specify whether the Secret or its key must be defined 1124 // +optional 1125 Optional *bool `json:"optional,omitempty" protobuf:"varint,4,opt,name=optional"` 1126} 1127 1128// Represents an NFS mount that lasts the lifetime of a pod. 1129// NFS volumes do not support ownership management or SELinux relabeling. 1130type NFSVolumeSource struct { 1131 // Server is the hostname or IP address of the NFS server. 1132 // More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs 1133 Server string `json:"server" protobuf:"bytes,1,opt,name=server"` 1134 1135 // Path that is exported by the NFS server. 1136 // More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs 1137 Path string `json:"path" protobuf:"bytes,2,opt,name=path"` 1138 1139 // ReadOnly here will force 1140 // the NFS export to be mounted with read-only permissions. 1141 // Defaults to false. 1142 // More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs 1143 // +optional 1144 ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,3,opt,name=readOnly"` 1145} 1146 1147// Represents an ISCSI disk. 1148// ISCSI volumes can only be mounted as read/write once. 1149// ISCSI volumes support ownership management and SELinux relabeling. 1150type ISCSIVolumeSource struct { 1151 // iSCSI Target Portal. The Portal is either an IP or ip_addr:port if the port 1152 // is other than default (typically TCP ports 860 and 3260). 1153 TargetPortal string `json:"targetPortal" protobuf:"bytes,1,opt,name=targetPortal"` 1154 // Target iSCSI Qualified Name. 1155 IQN string `json:"iqn" protobuf:"bytes,2,opt,name=iqn"` 1156 // iSCSI Target Lun number. 1157 Lun int32 `json:"lun" protobuf:"varint,3,opt,name=lun"` 1158 // iSCSI Interface Name that uses an iSCSI transport. 1159 // Defaults to 'default' (tcp). 1160 // +optional 1161 ISCSIInterface string `json:"iscsiInterface,omitempty" protobuf:"bytes,4,opt,name=iscsiInterface"` 1162 // Filesystem type of the volume that you want to mount. 1163 // Tip: Ensure that the filesystem type is supported by the host operating system. 1164 // Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. 1165 // More info: https://kubernetes.io/docs/concepts/storage/volumes#iscsi 1166 // TODO: how do we prevent errors in the filesystem from compromising the machine 1167 // +optional 1168 FSType string `json:"fsType,omitempty" protobuf:"bytes,5,opt,name=fsType"` 1169 // ReadOnly here will force the ReadOnly setting in VolumeMounts. 1170 // Defaults to false. 1171 // +optional 1172 ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,6,opt,name=readOnly"` 1173 // iSCSI Target Portal List. The portal is either an IP or ip_addr:port if the port 1174 // is other than default (typically TCP ports 860 and 3260). 1175 // +optional 1176 Portals []string `json:"portals,omitempty" protobuf:"bytes,7,opt,name=portals"` 1177 // whether support iSCSI Discovery CHAP authentication 1178 // +optional 1179 DiscoveryCHAPAuth bool `json:"chapAuthDiscovery,omitempty" protobuf:"varint,8,opt,name=chapAuthDiscovery"` 1180 // whether support iSCSI Session CHAP authentication 1181 // +optional 1182 SessionCHAPAuth bool `json:"chapAuthSession,omitempty" protobuf:"varint,11,opt,name=chapAuthSession"` 1183 // CHAP Secret for iSCSI target and initiator authentication 1184 // +optional 1185 SecretRef *LocalObjectReference `json:"secretRef,omitempty" protobuf:"bytes,10,opt,name=secretRef"` 1186 // Custom iSCSI Initiator Name. 1187 // If initiatorName is specified with iscsiInterface simultaneously, new iSCSI interface 1188 // <target portal>:<volume name> will be created for the connection. 1189 // +optional 1190 InitiatorName *string `json:"initiatorName,omitempty" protobuf:"bytes,12,opt,name=initiatorName"` 1191} 1192 1193// ISCSIPersistentVolumeSource represents an ISCSI disk. 1194// ISCSI volumes can only be mounted as read/write once. 1195// ISCSI volumes support ownership management and SELinux relabeling. 1196type ISCSIPersistentVolumeSource struct { 1197 // iSCSI Target Portal. The Portal is either an IP or ip_addr:port if the port 1198 // is other than default (typically TCP ports 860 and 3260). 1199 TargetPortal string `json:"targetPortal" protobuf:"bytes,1,opt,name=targetPortal"` 1200 // Target iSCSI Qualified Name. 1201 IQN string `json:"iqn" protobuf:"bytes,2,opt,name=iqn"` 1202 // iSCSI Target Lun number. 1203 Lun int32 `json:"lun" protobuf:"varint,3,opt,name=lun"` 1204 // iSCSI Interface Name that uses an iSCSI transport. 1205 // Defaults to 'default' (tcp). 1206 // +optional 1207 ISCSIInterface string `json:"iscsiInterface,omitempty" protobuf:"bytes,4,opt,name=iscsiInterface"` 1208 // Filesystem type of the volume that you want to mount. 1209 // Tip: Ensure that the filesystem type is supported by the host operating system. 1210 // Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. 1211 // More info: https://kubernetes.io/docs/concepts/storage/volumes#iscsi 1212 // TODO: how do we prevent errors in the filesystem from compromising the machine 1213 // +optional 1214 FSType string `json:"fsType,omitempty" protobuf:"bytes,5,opt,name=fsType"` 1215 // ReadOnly here will force the ReadOnly setting in VolumeMounts. 1216 // Defaults to false. 1217 // +optional 1218 ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,6,opt,name=readOnly"` 1219 // iSCSI Target Portal List. The Portal is either an IP or ip_addr:port if the port 1220 // is other than default (typically TCP ports 860 and 3260). 1221 // +optional 1222 Portals []string `json:"portals,omitempty" protobuf:"bytes,7,opt,name=portals"` 1223 // whether support iSCSI Discovery CHAP authentication 1224 // +optional 1225 DiscoveryCHAPAuth bool `json:"chapAuthDiscovery,omitempty" protobuf:"varint,8,opt,name=chapAuthDiscovery"` 1226 // whether support iSCSI Session CHAP authentication 1227 // +optional 1228 SessionCHAPAuth bool `json:"chapAuthSession,omitempty" protobuf:"varint,11,opt,name=chapAuthSession"` 1229 // CHAP Secret for iSCSI target and initiator authentication 1230 // +optional 1231 SecretRef *SecretReference `json:"secretRef,omitempty" protobuf:"bytes,10,opt,name=secretRef"` 1232 // Custom iSCSI Initiator Name. 1233 // If initiatorName is specified with iscsiInterface simultaneously, new iSCSI interface 1234 // <target portal>:<volume name> will be created for the connection. 1235 // +optional 1236 InitiatorName *string `json:"initiatorName,omitempty" protobuf:"bytes,12,opt,name=initiatorName"` 1237} 1238 1239// Represents a Fibre Channel volume. 1240// Fibre Channel volumes can only be mounted as read/write once. 1241// Fibre Channel volumes support ownership management and SELinux relabeling. 1242type FCVolumeSource struct { 1243 // Optional: FC target worldwide names (WWNs) 1244 // +optional 1245 TargetWWNs []string `json:"targetWWNs,omitempty" protobuf:"bytes,1,rep,name=targetWWNs"` 1246 // Optional: FC target lun number 1247 // +optional 1248 Lun *int32 `json:"lun,omitempty" protobuf:"varint,2,opt,name=lun"` 1249 // Filesystem type to mount. 1250 // Must be a filesystem type supported by the host operating system. 1251 // Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. 1252 // TODO: how do we prevent errors in the filesystem from compromising the machine 1253 // +optional 1254 FSType string `json:"fsType,omitempty" protobuf:"bytes,3,opt,name=fsType"` 1255 // Optional: Defaults to false (read/write). ReadOnly here will force 1256 // the ReadOnly setting in VolumeMounts. 1257 // +optional 1258 ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,4,opt,name=readOnly"` 1259 // Optional: FC volume world wide identifiers (wwids) 1260 // Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously. 1261 // +optional 1262 WWIDs []string `json:"wwids,omitempty" protobuf:"bytes,5,rep,name=wwids"` 1263} 1264 1265// AzureFile represents an Azure File Service mount on the host and bind mount to the pod. 1266type AzureFileVolumeSource struct { 1267 // the name of secret that contains Azure Storage Account Name and Key 1268 SecretName string `json:"secretName" protobuf:"bytes,1,opt,name=secretName"` 1269 // Share Name 1270 ShareName string `json:"shareName" protobuf:"bytes,2,opt,name=shareName"` 1271 // Defaults to false (read/write). ReadOnly here will force 1272 // the ReadOnly setting in VolumeMounts. 1273 // +optional 1274 ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,3,opt,name=readOnly"` 1275} 1276 1277// AzureFile represents an Azure File Service mount on the host and bind mount to the pod. 1278type AzureFilePersistentVolumeSource struct { 1279 // the name of secret that contains Azure Storage Account Name and Key 1280 SecretName string `json:"secretName" protobuf:"bytes,1,opt,name=secretName"` 1281 // Share Name 1282 ShareName string `json:"shareName" protobuf:"bytes,2,opt,name=shareName"` 1283 // Defaults to false (read/write). ReadOnly here will force 1284 // the ReadOnly setting in VolumeMounts. 1285 // +optional 1286 ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,3,opt,name=readOnly"` 1287 // the namespace of the secret that contains Azure Storage Account Name and Key 1288 // default is the same as the Pod 1289 // +optional 1290 SecretNamespace *string `json:"secretNamespace" protobuf:"bytes,4,opt,name=secretNamespace"` 1291} 1292 1293// Represents a vSphere volume resource. 1294type VsphereVirtualDiskVolumeSource struct { 1295 // Path that identifies vSphere volume vmdk 1296 VolumePath string `json:"volumePath" protobuf:"bytes,1,opt,name=volumePath"` 1297 // Filesystem type to mount. 1298 // Must be a filesystem type supported by the host operating system. 1299 // Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. 1300 // +optional 1301 FSType string `json:"fsType,omitempty" protobuf:"bytes,2,opt,name=fsType"` 1302 // Storage Policy Based Management (SPBM) profile name. 1303 // +optional 1304 StoragePolicyName string `json:"storagePolicyName,omitempty" protobuf:"bytes,3,opt,name=storagePolicyName"` 1305 // Storage Policy Based Management (SPBM) profile ID associated with the StoragePolicyName. 1306 // +optional 1307 StoragePolicyID string `json:"storagePolicyID,omitempty" protobuf:"bytes,4,opt,name=storagePolicyID"` 1308} 1309 1310// Represents a Photon Controller persistent disk resource. 1311type PhotonPersistentDiskVolumeSource struct { 1312 // ID that identifies Photon Controller persistent disk 1313 PdID string `json:"pdID" protobuf:"bytes,1,opt,name=pdID"` 1314 // Filesystem type to mount. 1315 // Must be a filesystem type supported by the host operating system. 1316 // Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. 1317 FSType string `json:"fsType,omitempty" protobuf:"bytes,2,opt,name=fsType"` 1318} 1319 1320type AzureDataDiskCachingMode string 1321type AzureDataDiskKind string 1322 1323const ( 1324 AzureDataDiskCachingNone AzureDataDiskCachingMode = "None" 1325 AzureDataDiskCachingReadOnly AzureDataDiskCachingMode = "ReadOnly" 1326 AzureDataDiskCachingReadWrite AzureDataDiskCachingMode = "ReadWrite" 1327 1328 AzureSharedBlobDisk AzureDataDiskKind = "Shared" 1329 AzureDedicatedBlobDisk AzureDataDiskKind = "Dedicated" 1330 AzureManagedDisk AzureDataDiskKind = "Managed" 1331) 1332 1333// AzureDisk represents an Azure Data Disk mount on the host and bind mount to the pod. 1334type AzureDiskVolumeSource struct { 1335 // The Name of the data disk in the blob storage 1336 DiskName string `json:"diskName" protobuf:"bytes,1,opt,name=diskName"` 1337 // The URI the data disk in the blob storage 1338 DataDiskURI string `json:"diskURI" protobuf:"bytes,2,opt,name=diskURI"` 1339 // Host Caching mode: None, Read Only, Read Write. 1340 // +optional 1341 CachingMode *AzureDataDiskCachingMode `json:"cachingMode,omitempty" protobuf:"bytes,3,opt,name=cachingMode,casttype=AzureDataDiskCachingMode"` 1342 // Filesystem type to mount. 1343 // Must be a filesystem type supported by the host operating system. 1344 // Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. 1345 // +optional 1346 FSType *string `json:"fsType,omitempty" protobuf:"bytes,4,opt,name=fsType"` 1347 // Defaults to false (read/write). ReadOnly here will force 1348 // the ReadOnly setting in VolumeMounts. 1349 // +optional 1350 ReadOnly *bool `json:"readOnly,omitempty" protobuf:"varint,5,opt,name=readOnly"` 1351 // Expected values Shared: multiple blob disks per storage account Dedicated: single blob disk per storage account Managed: azure managed data disk (only in managed availability set). defaults to shared 1352 Kind *AzureDataDiskKind `json:"kind,omitempty" protobuf:"bytes,6,opt,name=kind,casttype=AzureDataDiskKind"` 1353} 1354 1355// PortworxVolumeSource represents a Portworx volume resource. 1356type PortworxVolumeSource struct { 1357 // VolumeID uniquely identifies a Portworx volume 1358 VolumeID string `json:"volumeID" protobuf:"bytes,1,opt,name=volumeID"` 1359 // FSType represents the filesystem type to mount 1360 // Must be a filesystem type supported by the host operating system. 1361 // Ex. "ext4", "xfs". Implicitly inferred to be "ext4" if unspecified. 1362 FSType string `json:"fsType,omitempty" protobuf:"bytes,2,opt,name=fsType"` 1363 // Defaults to false (read/write). ReadOnly here will force 1364 // the ReadOnly setting in VolumeMounts. 1365 // +optional 1366 ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,3,opt,name=readOnly"` 1367} 1368 1369// ScaleIOVolumeSource represents a persistent ScaleIO volume 1370type ScaleIOVolumeSource struct { 1371 // The host address of the ScaleIO API Gateway. 1372 Gateway string `json:"gateway" protobuf:"bytes,1,opt,name=gateway"` 1373 // The name of the storage system as configured in ScaleIO. 1374 System string `json:"system" protobuf:"bytes,2,opt,name=system"` 1375 // SecretRef references to the secret for ScaleIO user and other 1376 // sensitive information. If this is not provided, Login operation will fail. 1377 SecretRef *LocalObjectReference `json:"secretRef" protobuf:"bytes,3,opt,name=secretRef"` 1378 // Flag to enable/disable SSL communication with Gateway, default false 1379 // +optional 1380 SSLEnabled bool `json:"sslEnabled,omitempty" protobuf:"varint,4,opt,name=sslEnabled"` 1381 // The name of the ScaleIO Protection Domain for the configured storage. 1382 // +optional 1383 ProtectionDomain string `json:"protectionDomain,omitempty" protobuf:"bytes,5,opt,name=protectionDomain"` 1384 // The ScaleIO Storage Pool associated with the protection domain. 1385 // +optional 1386 StoragePool string `json:"storagePool,omitempty" protobuf:"bytes,6,opt,name=storagePool"` 1387 // Indicates whether the storage for a volume should be ThickProvisioned or ThinProvisioned. 1388 // Default is ThinProvisioned. 1389 // +optional 1390 StorageMode string `json:"storageMode,omitempty" protobuf:"bytes,7,opt,name=storageMode"` 1391 // The name of a volume already created in the ScaleIO system 1392 // that is associated with this volume source. 1393 VolumeName string `json:"volumeName,omitempty" protobuf:"bytes,8,opt,name=volumeName"` 1394 // Filesystem type to mount. 1395 // Must be a filesystem type supported by the host operating system. 1396 // Ex. "ext4", "xfs", "ntfs". 1397 // Default is "xfs". 1398 // +optional 1399 FSType string `json:"fsType,omitempty" protobuf:"bytes,9,opt,name=fsType"` 1400 // Defaults to false (read/write). ReadOnly here will force 1401 // the ReadOnly setting in VolumeMounts. 1402 // +optional 1403 ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,10,opt,name=readOnly"` 1404} 1405 1406// ScaleIOPersistentVolumeSource represents a persistent ScaleIO volume 1407type ScaleIOPersistentVolumeSource struct { 1408 // The host address of the ScaleIO API Gateway. 1409 Gateway string `json:"gateway" protobuf:"bytes,1,opt,name=gateway"` 1410 // The name of the storage system as configured in ScaleIO. 1411 System string `json:"system" protobuf:"bytes,2,opt,name=system"` 1412 // SecretRef references to the secret for ScaleIO user and other 1413 // sensitive information. If this is not provided, Login operation will fail. 1414 SecretRef *SecretReference `json:"secretRef" protobuf:"bytes,3,opt,name=secretRef"` 1415 // Flag to enable/disable SSL communication with Gateway, default false 1416 // +optional 1417 SSLEnabled bool `json:"sslEnabled,omitempty" protobuf:"varint,4,opt,name=sslEnabled"` 1418 // The name of the ScaleIO Protection Domain for the configured storage. 1419 // +optional 1420 ProtectionDomain string `json:"protectionDomain,omitempty" protobuf:"bytes,5,opt,name=protectionDomain"` 1421 // The ScaleIO Storage Pool associated with the protection domain. 1422 // +optional 1423 StoragePool string `json:"storagePool,omitempty" protobuf:"bytes,6,opt,name=storagePool"` 1424 // Indicates whether the storage for a volume should be ThickProvisioned or ThinProvisioned. 1425 // Default is ThinProvisioned. 1426 // +optional 1427 StorageMode string `json:"storageMode,omitempty" protobuf:"bytes,7,opt,name=storageMode"` 1428 // The name of a volume already created in the ScaleIO system 1429 // that is associated with this volume source. 1430 VolumeName string `json:"volumeName,omitempty" protobuf:"bytes,8,opt,name=volumeName"` 1431 // Filesystem type to mount. 1432 // Must be a filesystem type supported by the host operating system. 1433 // Ex. "ext4", "xfs", "ntfs". 1434 // Default is "xfs" 1435 // +optional 1436 FSType string `json:"fsType,omitempty" protobuf:"bytes,9,opt,name=fsType"` 1437 // Defaults to false (read/write). ReadOnly here will force 1438 // the ReadOnly setting in VolumeMounts. 1439 // +optional 1440 ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,10,opt,name=readOnly"` 1441} 1442 1443// Represents a StorageOS persistent volume resource. 1444type StorageOSVolumeSource struct { 1445 // VolumeName is the human-readable name of the StorageOS volume. Volume 1446 // names are only unique within a namespace. 1447 VolumeName string `json:"volumeName,omitempty" protobuf:"bytes,1,opt,name=volumeName"` 1448 // VolumeNamespace specifies the scope of the volume within StorageOS. If no 1449 // namespace is specified then the Pod's namespace will be used. This allows the 1450 // Kubernetes name scoping to be mirrored within StorageOS for tighter integration. 1451 // Set VolumeName to any name to override the default behaviour. 1452 // Set to "default" if you are not using namespaces within StorageOS. 1453 // Namespaces that do not pre-exist within StorageOS will be created. 1454 // +optional 1455 VolumeNamespace string `json:"volumeNamespace,omitempty" protobuf:"bytes,2,opt,name=volumeNamespace"` 1456 // Filesystem type to mount. 1457 // Must be a filesystem type supported by the host operating system. 1458 // Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. 1459 // +optional 1460 FSType string `json:"fsType,omitempty" protobuf:"bytes,3,opt,name=fsType"` 1461 // Defaults to false (read/write). ReadOnly here will force 1462 // the ReadOnly setting in VolumeMounts. 1463 // +optional 1464 ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,4,opt,name=readOnly"` 1465 // SecretRef specifies the secret to use for obtaining the StorageOS API 1466 // credentials. If not specified, default values will be attempted. 1467 // +optional 1468 SecretRef *LocalObjectReference `json:"secretRef,omitempty" protobuf:"bytes,5,opt,name=secretRef"` 1469} 1470 1471// Represents a StorageOS persistent volume resource. 1472type StorageOSPersistentVolumeSource struct { 1473 // VolumeName is the human-readable name of the StorageOS volume. Volume 1474 // names are only unique within a namespace. 1475 VolumeName string `json:"volumeName,omitempty" protobuf:"bytes,1,opt,name=volumeName"` 1476 // VolumeNamespace specifies the scope of the volume within StorageOS. If no 1477 // namespace is specified then the Pod's namespace will be used. This allows the 1478 // Kubernetes name scoping to be mirrored within StorageOS for tighter integration. 1479 // Set VolumeName to any name to override the default behaviour. 1480 // Set to "default" if you are not using namespaces within StorageOS. 1481 // Namespaces that do not pre-exist within StorageOS will be created. 1482 // +optional 1483 VolumeNamespace string `json:"volumeNamespace,omitempty" protobuf:"bytes,2,opt,name=volumeNamespace"` 1484 // Filesystem type to mount. 1485 // Must be a filesystem type supported by the host operating system. 1486 // Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. 1487 // +optional 1488 FSType string `json:"fsType,omitempty" protobuf:"bytes,3,opt,name=fsType"` 1489 // Defaults to false (read/write). ReadOnly here will force 1490 // the ReadOnly setting in VolumeMounts. 1491 // +optional 1492 ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,4,opt,name=readOnly"` 1493 // SecretRef specifies the secret to use for obtaining the StorageOS API 1494 // credentials. If not specified, default values will be attempted. 1495 // +optional 1496 SecretRef *ObjectReference `json:"secretRef,omitempty" protobuf:"bytes,5,opt,name=secretRef"` 1497} 1498 1499// Adapts a ConfigMap into a volume. 1500// 1501// The contents of the target ConfigMap's Data field will be presented in a 1502// volume as files using the keys in the Data field as the file names, unless 1503// the items element is populated with specific mappings of keys to paths. 1504// ConfigMap volumes support ownership management and SELinux relabeling. 1505type ConfigMapVolumeSource struct { 1506 LocalObjectReference `json:",inline" protobuf:"bytes,1,opt,name=localObjectReference"` 1507 // If unspecified, each key-value pair in the Data field of the referenced 1508 // ConfigMap will be projected into the volume as a file whose name is the 1509 // key and content is the value. If specified, the listed keys will be 1510 // projected into the specified paths, and unlisted keys will not be 1511 // present. If a key is specified which is not present in the ConfigMap, 1512 // the volume setup will error unless it is marked optional. Paths must be 1513 // relative and may not contain the '..' path or start with '..'. 1514 // +optional 1515 Items []KeyToPath `json:"items,omitempty" protobuf:"bytes,2,rep,name=items"` 1516 // Optional: mode bits to use on created files by default. Must be a 1517 // value between 0 and 0777. Defaults to 0644. 1518 // Directories within the path are not affected by this setting. 1519 // This might be in conflict with other options that affect the file 1520 // mode, like fsGroup, and the result can be other mode bits set. 1521 // +optional 1522 DefaultMode *int32 `json:"defaultMode,omitempty" protobuf:"varint,3,opt,name=defaultMode"` 1523 // Specify whether the ConfigMap or it's keys must be defined 1524 // +optional 1525 Optional *bool `json:"optional,omitempty" protobuf:"varint,4,opt,name=optional"` 1526} 1527 1528const ( 1529 ConfigMapVolumeSourceDefaultMode int32 = 0644 1530) 1531 1532// Adapts a ConfigMap into a projected volume. 1533// 1534// The contents of the target ConfigMap's Data field will be presented in a 1535// projected volume as files using the keys in the Data field as the file names, 1536// unless the items element is populated with specific mappings of keys to paths. 1537// Note that this is identical to a configmap volume source without the default 1538// mode. 1539type ConfigMapProjection struct { 1540 LocalObjectReference `json:",inline" protobuf:"bytes,1,opt,name=localObjectReference"` 1541 // If unspecified, each key-value pair in the Data field of the referenced 1542 // ConfigMap will be projected into the volume as a file whose name is the 1543 // key and content is the value. If specified, the listed keys will be 1544 // projected into the specified paths, and unlisted keys will not be 1545 // present. If a key is specified which is not present in the ConfigMap, 1546 // the volume setup will error unless it is marked optional. Paths must be 1547 // relative and may not contain the '..' path or start with '..'. 1548 // +optional 1549 Items []KeyToPath `json:"items,omitempty" protobuf:"bytes,2,rep,name=items"` 1550 // Specify whether the ConfigMap or it's keys must be defined 1551 // +optional 1552 Optional *bool `json:"optional,omitempty" protobuf:"varint,4,opt,name=optional"` 1553} 1554 1555// ServiceAccountTokenProjection represents a projected service account token 1556// volume. This projection can be used to insert a service account token into 1557// the pods runtime filesystem for use against APIs (Kubernetes API Server or 1558// otherwise). 1559type ServiceAccountTokenProjection struct { 1560 // Audience is the intended audience of the token. A recipient of a token 1561 // must identify itself with an identifier specified in the audience of the 1562 // token, and otherwise should reject the token. The audience defaults to the 1563 // identifier of the apiserver. 1564 //+optional 1565 Audience string `json:"audience,omitempty" protobuf:"bytes,1,rep,name=audience"` 1566 // ExpirationSeconds is the requested duration of validity of the service 1567 // account token. As the token approaches expiration, the kubelet volume 1568 // plugin will proactively rotate the service account token. The kubelet will 1569 // start trying to rotate the token if the token is older than 80 percent of 1570 // its time to live or if the token is older than 24 hours.Defaults to 1 hour 1571 // and must be at least 10 minutes. 1572 //+optional 1573 ExpirationSeconds *int64 `json:"expirationSeconds,omitempty" protobuf:"varint,2,opt,name=expirationSeconds"` 1574 // Path is the path relative to the mount point of the file to project the 1575 // token into. 1576 Path string `json:"path" protobuf:"bytes,3,opt,name=path"` 1577} 1578 1579// Represents a projected volume source 1580type ProjectedVolumeSource struct { 1581 // list of volume projections 1582 Sources []VolumeProjection `json:"sources" protobuf:"bytes,1,rep,name=sources"` 1583 // Mode bits to use on created files by default. Must be a value between 1584 // 0 and 0777. 1585 // Directories within the path are not affected by this setting. 1586 // This might be in conflict with other options that affect the file 1587 // mode, like fsGroup, and the result can be other mode bits set. 1588 // +optional 1589 DefaultMode *int32 `json:"defaultMode,omitempty" protobuf:"varint,2,opt,name=defaultMode"` 1590} 1591 1592// Projection that may be projected along with other supported volume types 1593type VolumeProjection struct { 1594 // all types below are the supported types for projection into the same volume 1595 1596 // information about the secret data to project 1597 // +optional 1598 Secret *SecretProjection `json:"secret,omitempty" protobuf:"bytes,1,opt,name=secret"` 1599 // information about the downwardAPI data to project 1600 // +optional 1601 DownwardAPI *DownwardAPIProjection `json:"downwardAPI,omitempty" protobuf:"bytes,2,opt,name=downwardAPI"` 1602 // information about the configMap data to project 1603 // +optional 1604 ConfigMap *ConfigMapProjection `json:"configMap,omitempty" protobuf:"bytes,3,opt,name=configMap"` 1605 // information about the serviceAccountToken data to project 1606 // +optional 1607 ServiceAccountToken *ServiceAccountTokenProjection `json:"serviceAccountToken,omitempty" protobuf:"bytes,4,opt,name=serviceAccountToken"` 1608} 1609 1610const ( 1611 ProjectedVolumeSourceDefaultMode int32 = 0644 1612) 1613 1614// Maps a string key to a path within a volume. 1615type KeyToPath struct { 1616 // The key to project. 1617 Key string `json:"key" protobuf:"bytes,1,opt,name=key"` 1618 1619 // The relative path of the file to map the key to. 1620 // May not be an absolute path. 1621 // May not contain the path element '..'. 1622 // May not start with the string '..'. 1623 Path string `json:"path" protobuf:"bytes,2,opt,name=path"` 1624 // Optional: mode bits to use on this file, must be a value between 0 1625 // and 0777. If not specified, the volume defaultMode will be used. 1626 // This might be in conflict with other options that affect the file 1627 // mode, like fsGroup, and the result can be other mode bits set. 1628 // +optional 1629 Mode *int32 `json:"mode,omitempty" protobuf:"varint,3,opt,name=mode"` 1630} 1631 1632// Local represents directly-attached storage with node affinity (Beta feature) 1633type LocalVolumeSource struct { 1634 // The full path to the volume on the node. 1635 // It can be either a directory or block device (disk, partition, ...). 1636 Path string `json:"path" protobuf:"bytes,1,opt,name=path"` 1637 1638 // Filesystem type to mount. 1639 // It applies only when the Path is a block device. 1640 // Must be a filesystem type supported by the host operating system. 1641 // Ex. "ext4", "xfs", "ntfs". The default value is to auto-select a fileystem if unspecified. 1642 // +optional 1643 FSType *string `json:"fsType,omitempty" protobuf:"bytes,2,opt,name=fsType"` 1644} 1645 1646// Represents storage that is managed by an external CSI volume driver (Beta feature) 1647type CSIPersistentVolumeSource struct { 1648 // Driver is the name of the driver to use for this volume. 1649 // Required. 1650 Driver string `json:"driver" protobuf:"bytes,1,opt,name=driver"` 1651 1652 // VolumeHandle is the unique volume name returned by the CSI volume 1653 // plugin’s CreateVolume to refer to the volume on all subsequent calls. 1654 // Required. 1655 VolumeHandle string `json:"volumeHandle" protobuf:"bytes,2,opt,name=volumeHandle"` 1656 1657 // Optional: The value to pass to ControllerPublishVolumeRequest. 1658 // Defaults to false (read/write). 1659 // +optional 1660 ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,3,opt,name=readOnly"` 1661 1662 // Filesystem type to mount. 1663 // Must be a filesystem type supported by the host operating system. 1664 // Ex. "ext4", "xfs", "ntfs". 1665 // +optional 1666 FSType string `json:"fsType,omitempty" protobuf:"bytes,4,opt,name=fsType"` 1667 1668 // Attributes of the volume to publish. 1669 // +optional 1670 VolumeAttributes map[string]string `json:"volumeAttributes,omitempty" protobuf:"bytes,5,rep,name=volumeAttributes"` 1671 1672 // ControllerPublishSecretRef is a reference to the secret object containing 1673 // sensitive information to pass to the CSI driver to complete the CSI 1674 // ControllerPublishVolume and ControllerUnpublishVolume calls. 1675 // This field is optional, and may be empty if no secret is required. If the 1676 // secret object contains more than one secret, all secrets are passed. 1677 // +optional 1678 ControllerPublishSecretRef *SecretReference `json:"controllerPublishSecretRef,omitempty" protobuf:"bytes,6,opt,name=controllerPublishSecretRef"` 1679 1680 // NodeStageSecretRef is a reference to the secret object containing sensitive 1681 // information to pass to the CSI driver to complete the CSI NodeStageVolume 1682 // and NodeStageVolume and NodeUnstageVolume calls. 1683 // This field is optional, and may be empty if no secret is required. If the 1684 // secret object contains more than one secret, all secrets are passed. 1685 // +optional 1686 NodeStageSecretRef *SecretReference `json:"nodeStageSecretRef,omitempty" protobuf:"bytes,7,opt,name=nodeStageSecretRef"` 1687 1688 // NodePublishSecretRef is a reference to the secret object containing 1689 // sensitive information to pass to the CSI driver to complete the CSI 1690 // NodePublishVolume and NodeUnpublishVolume calls. 1691 // This field is optional, and may be empty if no secret is required. If the 1692 // secret object contains more than one secret, all secrets are passed. 1693 // +optional 1694 NodePublishSecretRef *SecretReference `json:"nodePublishSecretRef,omitempty" protobuf:"bytes,8,opt,name=nodePublishSecretRef"` 1695} 1696 1697// Represents a source location of a volume to mount, managed by an external CSI driver 1698type CSIVolumeSource struct { 1699 // Driver is the name of the CSI driver that handles this volume. 1700 // Consult with your admin for the correct name as registered in the cluster. 1701 Driver string `json:"driver" protobuf:"bytes,1,opt,name=driver"` 1702 1703 // Specifies a read-only configuration for the volume. 1704 // Defaults to false (read/write). 1705 // +optional 1706 ReadOnly *bool `json:"readOnly,omitempty" protobuf:"varint,2,opt,name=readOnly"` 1707 1708 // Filesystem type to mount. Ex. "ext4", "xfs", "ntfs". 1709 // If not provided, the empty value is passed to the associated CSI driver 1710 // which will determine the default filesystem to apply. 1711 // +optional 1712 FSType *string `json:"fsType,omitempty" protobuf:"bytes,3,opt,name=fsType"` 1713 1714 // VolumeAttributes stores driver-specific properties that are passed to the CSI 1715 // driver. Consult your driver's documentation for supported values. 1716 // +optional 1717 VolumeAttributes map[string]string `json:"volumeAttributes,omitempty" protobuf:"bytes,4,rep,name=volumeAttributes"` 1718 1719 // NodePublishSecretRef is a reference to the secret object containing 1720 // sensitive information to pass to the CSI driver to complete the CSI 1721 // NodePublishVolume and NodeUnpublishVolume calls. 1722 // This field is optional, and may be empty if no secret is required. If the 1723 // secret object contains more than one secret, all secret references are passed. 1724 // +optional 1725 NodePublishSecretRef *LocalObjectReference `json:"nodePublishSecretRef,omitempty" protobuf:"bytes,5,opt,name=nodePublishSecretRef"` 1726} 1727 1728// ContainerPort represents a network port in a single container. 1729type ContainerPort struct { 1730 // If specified, this must be an IANA_SVC_NAME and unique within the pod. Each 1731 // named port in a pod must have a unique name. Name for the port that can be 1732 // referred to by services. 1733 // +optional 1734 Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"` 1735 // Number of port to expose on the host. 1736 // If specified, this must be a valid port number, 0 < x < 65536. 1737 // If HostNetwork is specified, this must match ContainerPort. 1738 // Most containers do not need this. 1739 // +optional 1740 HostPort int32 `json:"hostPort,omitempty" protobuf:"varint,2,opt,name=hostPort"` 1741 // Number of port to expose on the pod's IP address. 1742 // This must be a valid port number, 0 < x < 65536. 1743 ContainerPort int32 `json:"containerPort" protobuf:"varint,3,opt,name=containerPort"` 1744 // Protocol for port. Must be UDP, TCP, or SCTP. 1745 // Defaults to "TCP". 1746 // +optional 1747 Protocol Protocol `json:"protocol,omitempty" protobuf:"bytes,4,opt,name=protocol,casttype=Protocol"` 1748 // What host IP to bind the external port to. 1749 // +optional 1750 HostIP string `json:"hostIP,omitempty" protobuf:"bytes,5,opt,name=hostIP"` 1751} 1752 1753// VolumeMount describes a mounting of a Volume within a container. 1754type VolumeMount struct { 1755 // This must match the Name of a Volume. 1756 Name string `json:"name" protobuf:"bytes,1,opt,name=name"` 1757 // Mounted read-only if true, read-write otherwise (false or unspecified). 1758 // Defaults to false. 1759 // +optional 1760 ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,2,opt,name=readOnly"` 1761 // Path within the container at which the volume should be mounted. Must 1762 // not contain ':'. 1763 MountPath string `json:"mountPath" protobuf:"bytes,3,opt,name=mountPath"` 1764 // Path within the volume from which the container's volume should be mounted. 1765 // Defaults to "" (volume's root). 1766 // +optional 1767 SubPath string `json:"subPath,omitempty" protobuf:"bytes,4,opt,name=subPath"` 1768 // mountPropagation determines how mounts are propagated from the host 1769 // to container and the other way around. 1770 // When not set, MountPropagationNone is used. 1771 // This field is beta in 1.10. 1772 // +optional 1773 MountPropagation *MountPropagationMode `json:"mountPropagation,omitempty" protobuf:"bytes,5,opt,name=mountPropagation,casttype=MountPropagationMode"` 1774 // Expanded path within the volume from which the container's volume should be mounted. 1775 // Behaves similarly to SubPath but environment variable references $(VAR_NAME) are expanded using the container's environment. 1776 // Defaults to "" (volume's root). 1777 // SubPathExpr and SubPath are mutually exclusive. 1778 // This field is alpha in 1.14. 1779 // +optional 1780 SubPathExpr string `json:"subPathExpr,omitempty" protobuf:"bytes,6,opt,name=subPathExpr"` 1781} 1782 1783// MountPropagationMode describes mount propagation. 1784type MountPropagationMode string 1785 1786const ( 1787 // MountPropagationNone means that the volume in a container will 1788 // not receive new mounts from the host or other containers, and filesystems 1789 // mounted inside the container won't be propagated to the host or other 1790 // containers. 1791 // Note that this mode corresponds to "private" in Linux terminology. 1792 MountPropagationNone MountPropagationMode = "None" 1793 // MountPropagationHostToContainer means that the volume in a container will 1794 // receive new mounts from the host or other containers, but filesystems 1795 // mounted inside the container won't be propagated to the host or other 1796 // containers. 1797 // Note that this mode is recursively applied to all mounts in the volume 1798 // ("rslave" in Linux terminology). 1799 MountPropagationHostToContainer MountPropagationMode = "HostToContainer" 1800 // MountPropagationBidirectional means that the volume in a container will 1801 // receive new mounts from the host or other containers, and its own mounts 1802 // will be propagated from the container to the host or other containers. 1803 // Note that this mode is recursively applied to all mounts in the volume 1804 // ("rshared" in Linux terminology). 1805 MountPropagationBidirectional MountPropagationMode = "Bidirectional" 1806) 1807 1808// volumeDevice describes a mapping of a raw block device within a container. 1809type VolumeDevice struct { 1810 // name must match the name of a persistentVolumeClaim in the pod 1811 Name string `json:"name" protobuf:"bytes,1,opt,name=name"` 1812 // devicePath is the path inside of the container that the device will be mapped to. 1813 DevicePath string `json:"devicePath" protobuf:"bytes,2,opt,name=devicePath"` 1814} 1815 1816// EnvVar represents an environment variable present in a Container. 1817type EnvVar struct { 1818 // Name of the environment variable. Must be a C_IDENTIFIER. 1819 Name string `json:"name" protobuf:"bytes,1,opt,name=name"` 1820 1821 // Optional: no more than one of the following may be specified. 1822 1823 // Variable references $(VAR_NAME) are expanded 1824 // using the previous defined environment variables in the container and 1825 // any service environment variables. If a variable cannot be resolved, 1826 // the reference in the input string will be unchanged. The $(VAR_NAME) 1827 // syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped 1828 // references will never be expanded, regardless of whether the variable 1829 // exists or not. 1830 // Defaults to "". 1831 // +optional 1832 Value string `json:"value,omitempty" protobuf:"bytes,2,opt,name=value"` 1833 // Source for the environment variable's value. Cannot be used if value is not empty. 1834 // +optional 1835 ValueFrom *EnvVarSource `json:"valueFrom,omitempty" protobuf:"bytes,3,opt,name=valueFrom"` 1836} 1837 1838// EnvVarSource represents a source for the value of an EnvVar. 1839type EnvVarSource struct { 1840 // Selects a field of the pod: supports metadata.name, metadata.namespace, metadata.labels, metadata.annotations, 1841 // spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP. 1842 // +optional 1843 FieldRef *ObjectFieldSelector `json:"fieldRef,omitempty" protobuf:"bytes,1,opt,name=fieldRef"` 1844 // Selects a resource of the container: only resources limits and requests 1845 // (limits.cpu, limits.memory, limits.ephemeral-storage, requests.cpu, requests.memory and requests.ephemeral-storage) are currently supported. 1846 // +optional 1847 ResourceFieldRef *ResourceFieldSelector `json:"resourceFieldRef,omitempty" protobuf:"bytes,2,opt,name=resourceFieldRef"` 1848 // Selects a key of a ConfigMap. 1849 // +optional 1850 ConfigMapKeyRef *ConfigMapKeySelector `json:"configMapKeyRef,omitempty" protobuf:"bytes,3,opt,name=configMapKeyRef"` 1851 // Selects a key of a secret in the pod's namespace 1852 // +optional 1853 SecretKeyRef *SecretKeySelector `json:"secretKeyRef,omitempty" protobuf:"bytes,4,opt,name=secretKeyRef"` 1854} 1855 1856// ObjectFieldSelector selects an APIVersioned field of an object. 1857type ObjectFieldSelector struct { 1858 // Version of the schema the FieldPath is written in terms of, defaults to "v1". 1859 // +optional 1860 APIVersion string `json:"apiVersion,omitempty" protobuf:"bytes,1,opt,name=apiVersion"` 1861 // Path of the field to select in the specified API version. 1862 FieldPath string `json:"fieldPath" protobuf:"bytes,2,opt,name=fieldPath"` 1863} 1864 1865// ResourceFieldSelector represents container resources (cpu, memory) and their output format 1866type ResourceFieldSelector struct { 1867 // Container name: required for volumes, optional for env vars 1868 // +optional 1869 ContainerName string `json:"containerName,omitempty" protobuf:"bytes,1,opt,name=containerName"` 1870 // Required: resource to select 1871 Resource string `json:"resource" protobuf:"bytes,2,opt,name=resource"` 1872 // Specifies the output format of the exposed resources, defaults to "1" 1873 // +optional 1874 Divisor resource.Quantity `json:"divisor,omitempty" protobuf:"bytes,3,opt,name=divisor"` 1875} 1876 1877// Selects a key from a ConfigMap. 1878type ConfigMapKeySelector struct { 1879 // The ConfigMap to select from. 1880 LocalObjectReference `json:",inline" protobuf:"bytes,1,opt,name=localObjectReference"` 1881 // The key to select. 1882 Key string `json:"key" protobuf:"bytes,2,opt,name=key"` 1883 // Specify whether the ConfigMap or it's key must be defined 1884 // +optional 1885 Optional *bool `json:"optional,omitempty" protobuf:"varint,3,opt,name=optional"` 1886} 1887 1888// SecretKeySelector selects a key of a Secret. 1889type SecretKeySelector struct { 1890 // The name of the secret in the pod's namespace to select from. 1891 LocalObjectReference `json:",inline" protobuf:"bytes,1,opt,name=localObjectReference"` 1892 // The key of the secret to select from. Must be a valid secret key. 1893 Key string `json:"key" protobuf:"bytes,2,opt,name=key"` 1894 // Specify whether the Secret or it's key must be defined 1895 // +optional 1896 Optional *bool `json:"optional,omitempty" protobuf:"varint,3,opt,name=optional"` 1897} 1898 1899// EnvFromSource represents the source of a set of ConfigMaps 1900type EnvFromSource struct { 1901 // An optional identifier to prepend to each key in the ConfigMap. Must be a C_IDENTIFIER. 1902 // +optional 1903 Prefix string `json:"prefix,omitempty" protobuf:"bytes,1,opt,name=prefix"` 1904 // The ConfigMap to select from 1905 // +optional 1906 ConfigMapRef *ConfigMapEnvSource `json:"configMapRef,omitempty" protobuf:"bytes,2,opt,name=configMapRef"` 1907 // The Secret to select from 1908 // +optional 1909 SecretRef *SecretEnvSource `json:"secretRef,omitempty" protobuf:"bytes,3,opt,name=secretRef"` 1910} 1911 1912// ConfigMapEnvSource selects a ConfigMap to populate the environment 1913// variables with. 1914// 1915// The contents of the target ConfigMap's Data field will represent the 1916// key-value pairs as environment variables. 1917type ConfigMapEnvSource struct { 1918 // The ConfigMap to select from. 1919 LocalObjectReference `json:",inline" protobuf:"bytes,1,opt,name=localObjectReference"` 1920 // Specify whether the ConfigMap must be defined 1921 // +optional 1922 Optional *bool `json:"optional,omitempty" protobuf:"varint,2,opt,name=optional"` 1923} 1924 1925// SecretEnvSource selects a Secret to populate the environment 1926// variables with. 1927// 1928// The contents of the target Secret's Data field will represent the 1929// key-value pairs as environment variables. 1930type SecretEnvSource struct { 1931 // The Secret to select from. 1932 LocalObjectReference `json:",inline" protobuf:"bytes,1,opt,name=localObjectReference"` 1933 // Specify whether the Secret must be defined 1934 // +optional 1935 Optional *bool `json:"optional,omitempty" protobuf:"varint,2,opt,name=optional"` 1936} 1937 1938// HTTPHeader describes a custom header to be used in HTTP probes 1939type HTTPHeader struct { 1940 // The header field name 1941 Name string `json:"name" protobuf:"bytes,1,opt,name=name"` 1942 // The header field value 1943 Value string `json:"value" protobuf:"bytes,2,opt,name=value"` 1944} 1945 1946// HTTPGetAction describes an action based on HTTP Get requests. 1947type HTTPGetAction struct { 1948 // Path to access on the HTTP server. 1949 // +optional 1950 Path string `json:"path,omitempty" protobuf:"bytes,1,opt,name=path"` 1951 // Name or number of the port to access on the container. 1952 // Number must be in the range 1 to 65535. 1953 // Name must be an IANA_SVC_NAME. 1954 Port intstr.IntOrString `json:"port" protobuf:"bytes,2,opt,name=port"` 1955 // Host name to connect to, defaults to the pod IP. You probably want to set 1956 // "Host" in httpHeaders instead. 1957 // +optional 1958 Host string `json:"host,omitempty" protobuf:"bytes,3,opt,name=host"` 1959 // Scheme to use for connecting to the host. 1960 // Defaults to HTTP. 1961 // +optional 1962 Scheme URIScheme `json:"scheme,omitempty" protobuf:"bytes,4,opt,name=scheme,casttype=URIScheme"` 1963 // Custom headers to set in the request. HTTP allows repeated headers. 1964 // +optional 1965 HTTPHeaders []HTTPHeader `json:"httpHeaders,omitempty" protobuf:"bytes,5,rep,name=httpHeaders"` 1966} 1967 1968// URIScheme identifies the scheme used for connection to a host for Get actions 1969type URIScheme string 1970 1971const ( 1972 // URISchemeHTTP means that the scheme used will be http:// 1973 URISchemeHTTP URIScheme = "HTTP" 1974 // URISchemeHTTPS means that the scheme used will be https:// 1975 URISchemeHTTPS URIScheme = "HTTPS" 1976) 1977 1978// TCPSocketAction describes an action based on opening a socket 1979type TCPSocketAction struct { 1980 // Number or name of the port to access on the container. 1981 // Number must be in the range 1 to 65535. 1982 // Name must be an IANA_SVC_NAME. 1983 Port intstr.IntOrString `json:"port" protobuf:"bytes,1,opt,name=port"` 1984 // Optional: Host name to connect to, defaults to the pod IP. 1985 // +optional 1986 Host string `json:"host,omitempty" protobuf:"bytes,2,opt,name=host"` 1987} 1988 1989// ExecAction describes a "run in container" action. 1990type ExecAction struct { 1991 // Command is the command line to execute inside the container, the working directory for the 1992 // command is root ('/') in the container's filesystem. The command is simply exec'd, it is 1993 // not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use 1994 // a shell, you need to explicitly call out to that shell. 1995 // Exit status of 0 is treated as live/healthy and non-zero is unhealthy. 1996 // +optional 1997 Command []string `json:"command,omitempty" protobuf:"bytes,1,rep,name=command"` 1998} 1999 2000// Probe describes a health check to be performed against a container to determine whether it is 2001// alive or ready to receive traffic. 2002type Probe struct { 2003 // The action taken to determine the health of a container 2004 Handler `json:",inline" protobuf:"bytes,1,opt,name=handler"` 2005 // Number of seconds after the container has started before liveness probes are initiated. 2006 // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes 2007 // +optional 2008 InitialDelaySeconds int32 `json:"initialDelaySeconds,omitempty" protobuf:"varint,2,opt,name=initialDelaySeconds"` 2009 // Number of seconds after which the probe times out. 2010 // Defaults to 1 second. Minimum value is 1. 2011 // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes 2012 // +optional 2013 TimeoutSeconds int32 `json:"timeoutSeconds,omitempty" protobuf:"varint,3,opt,name=timeoutSeconds"` 2014 // How often (in seconds) to perform the probe. 2015 // Default to 10 seconds. Minimum value is 1. 2016 // +optional 2017 PeriodSeconds int32 `json:"periodSeconds,omitempty" protobuf:"varint,4,opt,name=periodSeconds"` 2018 // Minimum consecutive successes for the probe to be considered successful after having failed. 2019 // Defaults to 1. Must be 1 for liveness. Minimum value is 1. 2020 // +optional 2021 SuccessThreshold int32 `json:"successThreshold,omitempty" protobuf:"varint,5,opt,name=successThreshold"` 2022 // Minimum consecutive failures for the probe to be considered failed after having succeeded. 2023 // Defaults to 3. Minimum value is 1. 2024 // +optional 2025 FailureThreshold int32 `json:"failureThreshold,omitempty" protobuf:"varint,6,opt,name=failureThreshold"` 2026} 2027 2028// PullPolicy describes a policy for if/when to pull a container image 2029type PullPolicy string 2030 2031const ( 2032 // PullAlways means that kubelet always attempts to pull the latest image. Container will fail If the pull fails. 2033 PullAlways PullPolicy = "Always" 2034 // PullNever means that kubelet never pulls an image, but only uses a local image. Container will fail if the image isn't present 2035 PullNever PullPolicy = "Never" 2036 // PullIfNotPresent means that kubelet pulls if the image isn't present on disk. Container will fail if the image isn't present and the pull fails. 2037 PullIfNotPresent PullPolicy = "IfNotPresent" 2038) 2039 2040// TerminationMessagePolicy describes how termination messages are retrieved from a container. 2041type TerminationMessagePolicy string 2042 2043const ( 2044 // TerminationMessageReadFile is the default behavior and will set the container status message to 2045 // the contents of the container's terminationMessagePath when the container exits. 2046 TerminationMessageReadFile TerminationMessagePolicy = "File" 2047 // TerminationMessageFallbackToLogsOnError will read the most recent contents of the container logs 2048 // for the container status message when the container exits with an error and the 2049 // terminationMessagePath has no contents. 2050 TerminationMessageFallbackToLogsOnError TerminationMessagePolicy = "FallbackToLogsOnError" 2051) 2052 2053// Capability represent POSIX capabilities type 2054type Capability string 2055 2056// Adds and removes POSIX capabilities from running containers. 2057type Capabilities struct { 2058 // Added capabilities 2059 // +optional 2060 Add []Capability `json:"add,omitempty" protobuf:"bytes,1,rep,name=add,casttype=Capability"` 2061 // Removed capabilities 2062 // +optional 2063 Drop []Capability `json:"drop,omitempty" protobuf:"bytes,2,rep,name=drop,casttype=Capability"` 2064} 2065 2066// ResourceRequirements describes the compute resource requirements. 2067type ResourceRequirements struct { 2068 // Limits describes the maximum amount of compute resources allowed. 2069 // More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/ 2070 // +optional 2071 Limits ResourceList `json:"limits,omitempty" protobuf:"bytes,1,rep,name=limits,casttype=ResourceList,castkey=ResourceName"` 2072 // Requests describes the minimum amount of compute resources required. 2073 // If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, 2074 // otherwise to an implementation-defined value. 2075 // More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/ 2076 // +optional 2077 Requests ResourceList `json:"requests,omitempty" protobuf:"bytes,2,rep,name=requests,casttype=ResourceList,castkey=ResourceName"` 2078} 2079 2080const ( 2081 // TerminationMessagePathDefault means the default path to capture the application termination message running in a container 2082 TerminationMessagePathDefault string = "/dev/termination-log" 2083) 2084 2085// A single application container that you want to run within a pod. 2086type Container struct { 2087 // Name of the container specified as a DNS_LABEL. 2088 // Each container in a pod must have a unique name (DNS_LABEL). 2089 // Cannot be updated. 2090 Name string `json:"name" protobuf:"bytes,1,opt,name=name"` 2091 // Docker image name. 2092 // More info: https://kubernetes.io/docs/concepts/containers/images 2093 // This field is optional to allow higher level config management to default or override 2094 // container images in workload controllers like Deployments and StatefulSets. 2095 // +optional 2096 Image string `json:"image,omitempty" protobuf:"bytes,2,opt,name=image"` 2097 // Entrypoint array. Not executed within a shell. 2098 // The docker image's ENTRYPOINT is used if this is not provided. 2099 // Variable references $(VAR_NAME) are expanded using the container's environment. If a variable 2100 // cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax 2101 // can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, 2102 // regardless of whether the variable exists or not. 2103 // Cannot be updated. 2104 // More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell 2105 // +optional 2106 Command []string `json:"command,omitempty" protobuf:"bytes,3,rep,name=command"` 2107 // Arguments to the entrypoint. 2108 // The docker image's CMD is used if this is not provided. 2109 // Variable references $(VAR_NAME) are expanded using the container's environment. If a variable 2110 // cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax 2111 // can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, 2112 // regardless of whether the variable exists or not. 2113 // Cannot be updated. 2114 // More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell 2115 // +optional 2116 Args []string `json:"args,omitempty" protobuf:"bytes,4,rep,name=args"` 2117 // Container's working directory. 2118 // If not specified, the container runtime's default will be used, which 2119 // might be configured in the container image. 2120 // Cannot be updated. 2121 // +optional 2122 WorkingDir string `json:"workingDir,omitempty" protobuf:"bytes,5,opt,name=workingDir"` 2123 // List of ports to expose from the container. Exposing a port here gives 2124 // the system additional information about the network connections a 2125 // container uses, but is primarily informational. Not specifying a port here 2126 // DOES NOT prevent that port from being exposed. Any port which is 2127 // listening on the default "0.0.0.0" address inside a container will be 2128 // accessible from the network. 2129 // Cannot be updated. 2130 // +optional 2131 // +patchMergeKey=containerPort 2132 // +patchStrategy=merge 2133 // +listType=map 2134 // +listMapKey=containerPort 2135 // +listMapKey=protocol 2136 Ports []ContainerPort `json:"ports,omitempty" patchStrategy:"merge" patchMergeKey:"containerPort" protobuf:"bytes,6,rep,name=ports"` 2137 // List of sources to populate environment variables in the container. 2138 // The keys defined within a source must be a C_IDENTIFIER. All invalid keys 2139 // will be reported as an event when the container is starting. When a key exists in multiple 2140 // sources, the value associated with the last source will take precedence. 2141 // Values defined by an Env with a duplicate key will take precedence. 2142 // Cannot be updated. 2143 // +optional 2144 EnvFrom []EnvFromSource `json:"envFrom,omitempty" protobuf:"bytes,19,rep,name=envFrom"` 2145 // List of environment variables to set in the container. 2146 // Cannot be updated. 2147 // +optional 2148 // +patchMergeKey=name 2149 // +patchStrategy=merge 2150 Env []EnvVar `json:"env,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,7,rep,name=env"` 2151 // Compute Resources required by this container. 2152 // Cannot be updated. 2153 // More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/ 2154 // +optional 2155 Resources ResourceRequirements `json:"resources,omitempty" protobuf:"bytes,8,opt,name=resources"` 2156 // Pod volumes to mount into the container's filesystem. 2157 // Cannot be updated. 2158 // +optional 2159 // +patchMergeKey=mountPath 2160 // +patchStrategy=merge 2161 VolumeMounts []VolumeMount `json:"volumeMounts,omitempty" patchStrategy:"merge" patchMergeKey:"mountPath" protobuf:"bytes,9,rep,name=volumeMounts"` 2162 // volumeDevices is the list of block devices to be used by the container. 2163 // This is a beta feature. 2164 // +patchMergeKey=devicePath 2165 // +patchStrategy=merge 2166 // +optional 2167 VolumeDevices []VolumeDevice `json:"volumeDevices,omitempty" patchStrategy:"merge" patchMergeKey:"devicePath" protobuf:"bytes,21,rep,name=volumeDevices"` 2168 // Periodic probe of container liveness. 2169 // Container will be restarted if the probe fails. 2170 // Cannot be updated. 2171 // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes 2172 // +optional 2173 LivenessProbe *Probe `json:"livenessProbe,omitempty" protobuf:"bytes,10,opt,name=livenessProbe"` 2174 // Periodic probe of container service readiness. 2175 // Container will be removed from service endpoints if the probe fails. 2176 // Cannot be updated. 2177 // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes 2178 // +optional 2179 ReadinessProbe *Probe `json:"readinessProbe,omitempty" protobuf:"bytes,11,opt,name=readinessProbe"` 2180 // Actions that the management system should take in response to container lifecycle events. 2181 // Cannot be updated. 2182 // +optional 2183 Lifecycle *Lifecycle `json:"lifecycle,omitempty" protobuf:"bytes,12,opt,name=lifecycle"` 2184 // Optional: Path at which the file to which the container's termination message 2185 // will be written is mounted into the container's filesystem. 2186 // Message written is intended to be brief final status, such as an assertion failure message. 2187 // Will be truncated by the node if greater than 4096 bytes. The total message length across 2188 // all containers will be limited to 12kb. 2189 // Defaults to /dev/termination-log. 2190 // Cannot be updated. 2191 // +optional 2192 TerminationMessagePath string `json:"terminationMessagePath,omitempty" protobuf:"bytes,13,opt,name=terminationMessagePath"` 2193 // Indicate how the termination message should be populated. File will use the contents of 2194 // terminationMessagePath to populate the container status message on both success and failure. 2195 // FallbackToLogsOnError will use the last chunk of container log output if the termination 2196 // message file is empty and the container exited with an error. 2197 // The log output is limited to 2048 bytes or 80 lines, whichever is smaller. 2198 // Defaults to File. 2199 // Cannot be updated. 2200 // +optional 2201 TerminationMessagePolicy TerminationMessagePolicy `json:"terminationMessagePolicy,omitempty" protobuf:"bytes,20,opt,name=terminationMessagePolicy,casttype=TerminationMessagePolicy"` 2202 // Image pull policy. 2203 // One of Always, Never, IfNotPresent. 2204 // Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. 2205 // Cannot be updated. 2206 // More info: https://kubernetes.io/docs/concepts/containers/images#updating-images 2207 // +optional 2208 ImagePullPolicy PullPolicy `json:"imagePullPolicy,omitempty" protobuf:"bytes,14,opt,name=imagePullPolicy,casttype=PullPolicy"` 2209 // Security options the pod should run with. 2210 // More info: https://kubernetes.io/docs/concepts/policy/security-context/ 2211 // More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ 2212 // +optional 2213 SecurityContext *SecurityContext `json:"securityContext,omitempty" protobuf:"bytes,15,opt,name=securityContext"` 2214 2215 // Variables for interactive containers, these have very specialized use-cases (e.g. debugging) 2216 // and shouldn't be used for general purpose containers. 2217 2218 // Whether this container should allocate a buffer for stdin in the container runtime. If this 2219 // is not set, reads from stdin in the container will always result in EOF. 2220 // Default is false. 2221 // +optional 2222 Stdin bool `json:"stdin,omitempty" protobuf:"varint,16,opt,name=stdin"` 2223 // Whether the container runtime should close the stdin channel after it has been opened by 2224 // a single attach. When stdin is true the stdin stream will remain open across multiple attach 2225 // sessions. If stdinOnce is set to true, stdin is opened on container start, is empty until the 2226 // first client attaches to stdin, and then remains open and accepts data until the client disconnects, 2227 // at which time stdin is closed and remains closed until the container is restarted. If this 2228 // flag is false, a container processes that reads from stdin will never receive an EOF. 2229 // Default is false 2230 // +optional 2231 StdinOnce bool `json:"stdinOnce,omitempty" protobuf:"varint,17,opt,name=stdinOnce"` 2232 // Whether this container should allocate a TTY for itself, also requires 'stdin' to be true. 2233 // Default is false. 2234 // +optional 2235 TTY bool `json:"tty,omitempty" protobuf:"varint,18,opt,name=tty"` 2236} 2237 2238// Handler defines a specific action that should be taken 2239// TODO: pass structured data to these actions, and document that data here. 2240type Handler struct { 2241 // One and only one of the following should be specified. 2242 // Exec specifies the action to take. 2243 // +optional 2244 Exec *ExecAction `json:"exec,omitempty" protobuf:"bytes,1,opt,name=exec"` 2245 // HTTPGet specifies the http request to perform. 2246 // +optional 2247 HTTPGet *HTTPGetAction `json:"httpGet,omitempty" protobuf:"bytes,2,opt,name=httpGet"` 2248 // TCPSocket specifies an action involving a TCP port. 2249 // TCP hooks not yet supported 2250 // TODO: implement a realistic TCP lifecycle hook 2251 // +optional 2252 TCPSocket *TCPSocketAction `json:"tcpSocket,omitempty" protobuf:"bytes,3,opt,name=tcpSocket"` 2253} 2254 2255// Lifecycle describes actions that the management system should take in response to container lifecycle 2256// events. For the PostStart and PreStop lifecycle handlers, management of the container blocks 2257// until the action is complete, unless the container process fails, in which case the handler is aborted. 2258type Lifecycle struct { 2259 // PostStart is called immediately after a container is created. If the handler fails, 2260 // the container is terminated and restarted according to its restart policy. 2261 // Other management of the container blocks until the hook completes. 2262 // More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks 2263 // +optional 2264 PostStart *Handler `json:"postStart,omitempty" protobuf:"bytes,1,opt,name=postStart"` 2265 // PreStop is called immediately before a container is terminated due to an 2266 // API request or management event such as liveness probe failure, 2267 // preemption, resource contention, etc. The handler is not called if the 2268 // container crashes or exits. The reason for termination is passed to the 2269 // handler. The Pod's termination grace period countdown begins before the 2270 // PreStop hooked is executed. Regardless of the outcome of the handler, the 2271 // container will eventually terminate within the Pod's termination grace 2272 // period. Other management of the container blocks until the hook completes 2273 // or until the termination grace period is reached. 2274 // More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks 2275 // +optional 2276 PreStop *Handler `json:"preStop,omitempty" protobuf:"bytes,2,opt,name=preStop"` 2277} 2278 2279type ConditionStatus string 2280 2281// These are valid condition statuses. "ConditionTrue" means a resource is in the condition. 2282// "ConditionFalse" means a resource is not in the condition. "ConditionUnknown" means kubernetes 2283// can't decide if a resource is in the condition or not. In the future, we could add other 2284// intermediate conditions, e.g. ConditionDegraded. 2285const ( 2286 ConditionTrue ConditionStatus = "True" 2287 ConditionFalse ConditionStatus = "False" 2288 ConditionUnknown ConditionStatus = "Unknown" 2289) 2290 2291// ContainerStateWaiting is a waiting state of a container. 2292type ContainerStateWaiting struct { 2293 // (brief) reason the container is not yet running. 2294 // +optional 2295 Reason string `json:"reason,omitempty" protobuf:"bytes,1,opt,name=reason"` 2296 // Message regarding why the container is not yet running. 2297 // +optional 2298 Message string `json:"message,omitempty" protobuf:"bytes,2,opt,name=message"` 2299} 2300 2301// ContainerStateRunning is a running state of a container. 2302type ContainerStateRunning struct { 2303 // Time at which the container was last (re-)started 2304 // +optional 2305 StartedAt metav1.Time `json:"startedAt,omitempty" protobuf:"bytes,1,opt,name=startedAt"` 2306} 2307 2308// ContainerStateTerminated is a terminated state of a container. 2309type ContainerStateTerminated struct { 2310 // Exit status from the last termination of the container 2311 ExitCode int32 `json:"exitCode" protobuf:"varint,1,opt,name=exitCode"` 2312 // Signal from the last termination of the container 2313 // +optional 2314 Signal int32 `json:"signal,omitempty" protobuf:"varint,2,opt,name=signal"` 2315 // (brief) reason from the last termination of the container 2316 // +optional 2317 Reason string `json:"reason,omitempty" protobuf:"bytes,3,opt,name=reason"` 2318 // Message regarding the last termination of the container 2319 // +optional 2320 Message string `json:"message,omitempty" protobuf:"bytes,4,opt,name=message"` 2321 // Time at which previous execution of the container started 2322 // +optional 2323 StartedAt metav1.Time `json:"startedAt,omitempty" protobuf:"bytes,5,opt,name=startedAt"` 2324 // Time at which the container last terminated 2325 // +optional 2326 FinishedAt metav1.Time `json:"finishedAt,omitempty" protobuf:"bytes,6,opt,name=finishedAt"` 2327 // Container's ID in the format 'docker://<container_id>' 2328 // +optional 2329 ContainerID string `json:"containerID,omitempty" protobuf:"bytes,7,opt,name=containerID"` 2330} 2331 2332// ContainerState holds a possible state of container. 2333// Only one of its members may be specified. 2334// If none of them is specified, the default one is ContainerStateWaiting. 2335type ContainerState struct { 2336 // Details about a waiting container 2337 // +optional 2338 Waiting *ContainerStateWaiting `json:"waiting,omitempty" protobuf:"bytes,1,opt,name=waiting"` 2339 // Details about a running container 2340 // +optional 2341 Running *ContainerStateRunning `json:"running,omitempty" protobuf:"bytes,2,opt,name=running"` 2342 // Details about a terminated container 2343 // +optional 2344 Terminated *ContainerStateTerminated `json:"terminated,omitempty" protobuf:"bytes,3,opt,name=terminated"` 2345} 2346 2347// ContainerStatus contains details for the current status of this container. 2348type ContainerStatus struct { 2349 // This must be a DNS_LABEL. Each container in a pod must have a unique name. 2350 // Cannot be updated. 2351 Name string `json:"name" protobuf:"bytes,1,opt,name=name"` 2352 // Details about the container's current condition. 2353 // +optional 2354 State ContainerState `json:"state,omitempty" protobuf:"bytes,2,opt,name=state"` 2355 // Details about the container's last termination condition. 2356 // +optional 2357 LastTerminationState ContainerState `json:"lastState,omitempty" protobuf:"bytes,3,opt,name=lastState"` 2358 // Specifies whether the container has passed its readiness probe. 2359 Ready bool `json:"ready" protobuf:"varint,4,opt,name=ready"` 2360 // The number of times the container has been restarted, currently based on 2361 // the number of dead containers that have not yet been removed. 2362 // Note that this is calculated from dead containers. But those containers are subject to 2363 // garbage collection. This value will get capped at 5 by GC. 2364 RestartCount int32 `json:"restartCount" protobuf:"varint,5,opt,name=restartCount"` 2365 // The image the container is running. 2366 // More info: https://kubernetes.io/docs/concepts/containers/images 2367 // TODO(dchen1107): Which image the container is running with? 2368 Image string `json:"image" protobuf:"bytes,6,opt,name=image"` 2369 // ImageID of the container's image. 2370 ImageID string `json:"imageID" protobuf:"bytes,7,opt,name=imageID"` 2371 // Container's ID in the format 'docker://<container_id>'. 2372 // +optional 2373 ContainerID string `json:"containerID,omitempty" protobuf:"bytes,8,opt,name=containerID"` 2374} 2375 2376// PodPhase is a label for the condition of a pod at the current time. 2377type PodPhase string 2378 2379// These are the valid statuses of pods. 2380const ( 2381 // PodPending means the pod has been accepted by the system, but one or more of the containers 2382 // has not been started. This includes time before being bound to a node, as well as time spent 2383 // pulling images onto the host. 2384 PodPending PodPhase = "Pending" 2385 // PodRunning means the pod has been bound to a node and all of the containers have been started. 2386 // At least one container is still running or is in the process of being restarted. 2387 PodRunning PodPhase = "Running" 2388 // PodSucceeded means that all containers in the pod have voluntarily terminated 2389 // with a container exit code of 0, and the system is not going to restart any of these containers. 2390 PodSucceeded PodPhase = "Succeeded" 2391 // PodFailed means that all containers in the pod have terminated, and at least one container has 2392 // terminated in a failure (exited with a non-zero exit code or was stopped by the system). 2393 PodFailed PodPhase = "Failed" 2394 // PodUnknown means that for some reason the state of the pod could not be obtained, typically due 2395 // to an error in communicating with the host of the pod. 2396 PodUnknown PodPhase = "Unknown" 2397) 2398 2399// PodConditionType is a valid value for PodCondition.Type 2400type PodConditionType string 2401 2402// These are valid conditions of pod. 2403const ( 2404 // PodScheduled represents status of the scheduling process for this pod. 2405 PodScheduled PodConditionType = "PodScheduled" 2406 // PodReady means the pod is able to service requests and should be added to the 2407 // load balancing pools of all matching services. 2408 PodReady PodConditionType = "Ready" 2409 // PodInitialized means that all init containers in the pod have started successfully. 2410 PodInitialized PodConditionType = "Initialized" 2411 // PodReasonUnschedulable reason in PodScheduled PodCondition means that the scheduler 2412 // can't schedule the pod right now, for example due to insufficient resources in the cluster. 2413 PodReasonUnschedulable = "Unschedulable" 2414 // ContainersReady indicates whether all containers in the pod are ready. 2415 ContainersReady PodConditionType = "ContainersReady" 2416) 2417 2418// PodCondition contains details for the current condition of this pod. 2419type PodCondition struct { 2420 // Type is the type of the condition. 2421 // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions 2422 Type PodConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=PodConditionType"` 2423 // Status is the status of the condition. 2424 // Can be True, False, Unknown. 2425 // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions 2426 Status ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=ConditionStatus"` 2427 // Last time we probed the condition. 2428 // +optional 2429 LastProbeTime metav1.Time `json:"lastProbeTime,omitempty" protobuf:"bytes,3,opt,name=lastProbeTime"` 2430 // Last time the condition transitioned from one status to another. 2431 // +optional 2432 LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,4,opt,name=lastTransitionTime"` 2433 // Unique, one-word, CamelCase reason for the condition's last transition. 2434 // +optional 2435 Reason string `json:"reason,omitempty" protobuf:"bytes,5,opt,name=reason"` 2436 // Human-readable message indicating details about last transition. 2437 // +optional 2438 Message string `json:"message,omitempty" protobuf:"bytes,6,opt,name=message"` 2439} 2440 2441// RestartPolicy describes how the container should be restarted. 2442// Only one of the following restart policies may be specified. 2443// If none of the following policies is specified, the default one 2444// is RestartPolicyAlways. 2445type RestartPolicy string 2446 2447const ( 2448 RestartPolicyAlways RestartPolicy = "Always" 2449 RestartPolicyOnFailure RestartPolicy = "OnFailure" 2450 RestartPolicyNever RestartPolicy = "Never" 2451) 2452 2453// DNSPolicy defines how a pod's DNS will be configured. 2454type DNSPolicy string 2455 2456const ( 2457 // DNSClusterFirstWithHostNet indicates that the pod should use cluster DNS 2458 // first, if it is available, then fall back on the default 2459 // (as determined by kubelet) DNS settings. 2460 DNSClusterFirstWithHostNet DNSPolicy = "ClusterFirstWithHostNet" 2461 2462 // DNSClusterFirst indicates that the pod should use cluster DNS 2463 // first unless hostNetwork is true, if it is available, then 2464 // fall back on the default (as determined by kubelet) DNS settings. 2465 DNSClusterFirst DNSPolicy = "ClusterFirst" 2466 2467 // DNSDefault indicates that the pod should use the default (as 2468 // determined by kubelet) DNS settings. 2469 DNSDefault DNSPolicy = "Default" 2470 2471 // DNSNone indicates that the pod should use empty DNS settings. DNS 2472 // parameters such as nameservers and search paths should be defined via 2473 // DNSConfig. 2474 DNSNone DNSPolicy = "None" 2475) 2476 2477const ( 2478 // DefaultTerminationGracePeriodSeconds indicates the default duration in 2479 // seconds a pod needs to terminate gracefully. 2480 DefaultTerminationGracePeriodSeconds = 30 2481) 2482 2483// A node selector represents the union of the results of one or more label queries 2484// over a set of nodes; that is, it represents the OR of the selectors represented 2485// by the node selector terms. 2486type NodeSelector struct { 2487 //Required. A list of node selector terms. The terms are ORed. 2488 NodeSelectorTerms []NodeSelectorTerm `json:"nodeSelectorTerms" protobuf:"bytes,1,rep,name=nodeSelectorTerms"` 2489} 2490 2491// A null or empty node selector term matches no objects. The requirements of 2492// them are ANDed. 2493// The TopologySelectorTerm type implements a subset of the NodeSelectorTerm. 2494type NodeSelectorTerm struct { 2495 // A list of node selector requirements by node's labels. 2496 // +optional 2497 MatchExpressions []NodeSelectorRequirement `json:"matchExpressions,omitempty" protobuf:"bytes,1,rep,name=matchExpressions"` 2498 // A list of node selector requirements by node's fields. 2499 // +optional 2500 MatchFields []NodeSelectorRequirement `json:"matchFields,omitempty" protobuf:"bytes,2,rep,name=matchFields"` 2501} 2502 2503// A node selector requirement is a selector that contains values, a key, and an operator 2504// that relates the key and values. 2505type NodeSelectorRequirement struct { 2506 // The label key that the selector applies to. 2507 Key string `json:"key" protobuf:"bytes,1,opt,name=key"` 2508 // Represents a key's relationship to a set of values. 2509 // Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. 2510 Operator NodeSelectorOperator `json:"operator" protobuf:"bytes,2,opt,name=operator,casttype=NodeSelectorOperator"` 2511 // An array of string values. If the operator is In or NotIn, 2512 // the values array must be non-empty. If the operator is Exists or DoesNotExist, 2513 // the values array must be empty. If the operator is Gt or Lt, the values 2514 // array must have a single element, which will be interpreted as an integer. 2515 // This array is replaced during a strategic merge patch. 2516 // +optional 2517 Values []string `json:"values,omitempty" protobuf:"bytes,3,rep,name=values"` 2518} 2519 2520// A node selector operator is the set of operators that can be used in 2521// a node selector requirement. 2522type NodeSelectorOperator string 2523 2524const ( 2525 NodeSelectorOpIn NodeSelectorOperator = "In" 2526 NodeSelectorOpNotIn NodeSelectorOperator = "NotIn" 2527 NodeSelectorOpExists NodeSelectorOperator = "Exists" 2528 NodeSelectorOpDoesNotExist NodeSelectorOperator = "DoesNotExist" 2529 NodeSelectorOpGt NodeSelectorOperator = "Gt" 2530 NodeSelectorOpLt NodeSelectorOperator = "Lt" 2531) 2532 2533// A topology selector term represents the result of label queries. 2534// A null or empty topology selector term matches no objects. 2535// The requirements of them are ANDed. 2536// It provides a subset of functionality as NodeSelectorTerm. 2537// This is an alpha feature and may change in the future. 2538type TopologySelectorTerm struct { 2539 // A list of topology selector requirements by labels. 2540 // +optional 2541 MatchLabelExpressions []TopologySelectorLabelRequirement `json:"matchLabelExpressions,omitempty" protobuf:"bytes,1,rep,name=matchLabelExpressions"` 2542} 2543 2544// A topology selector requirement is a selector that matches given label. 2545// This is an alpha feature and may change in the future. 2546type TopologySelectorLabelRequirement struct { 2547 // The label key that the selector applies to. 2548 Key string `json:"key" protobuf:"bytes,1,opt,name=key"` 2549 // An array of string values. One value must match the label to be selected. 2550 // Each entry in Values is ORed. 2551 Values []string `json:"values" protobuf:"bytes,2,rep,name=values"` 2552} 2553 2554// Affinity is a group of affinity scheduling rules. 2555type Affinity struct { 2556 // Describes node affinity scheduling rules for the pod. 2557 // +optional 2558 NodeAffinity *NodeAffinity `json:"nodeAffinity,omitempty" protobuf:"bytes,1,opt,name=nodeAffinity"` 2559 // Describes pod affinity scheduling rules (e.g. co-locate this pod in the same node, zone, etc. as some other pod(s)). 2560 // +optional 2561 PodAffinity *PodAffinity `json:"podAffinity,omitempty" protobuf:"bytes,2,opt,name=podAffinity"` 2562 // Describes pod anti-affinity scheduling rules (e.g. avoid putting this pod in the same node, zone, etc. as some other pod(s)). 2563 // +optional 2564 PodAntiAffinity *PodAntiAffinity `json:"podAntiAffinity,omitempty" protobuf:"bytes,3,opt,name=podAntiAffinity"` 2565} 2566 2567// Pod affinity is a group of inter pod affinity scheduling rules. 2568type PodAffinity struct { 2569 // NOT YET IMPLEMENTED. TODO: Uncomment field once it is implemented. 2570 // If the affinity requirements specified by this field are not met at 2571 // scheduling time, the pod will not be scheduled onto the node. 2572 // If the affinity requirements specified by this field cease to be met 2573 // at some point during pod execution (e.g. due to a pod label update), the 2574 // system will try to eventually evict the pod from its node. 2575 // When there are multiple elements, the lists of nodes corresponding to each 2576 // podAffinityTerm are intersected, i.e. all terms must be satisfied. 2577 // +optional 2578 // RequiredDuringSchedulingRequiredDuringExecution []PodAffinityTerm `json:"requiredDuringSchedulingRequiredDuringExecution,omitempty"` 2579 2580 // If the affinity requirements specified by this field are not met at 2581 // scheduling time, the pod will not be scheduled onto the node. 2582 // If the affinity requirements specified by this field cease to be met 2583 // at some point during pod execution (e.g. due to a pod label update), the 2584 // system may or may not try to eventually evict the pod from its node. 2585 // When there are multiple elements, the lists of nodes corresponding to each 2586 // podAffinityTerm are intersected, i.e. all terms must be satisfied. 2587 // +optional 2588 RequiredDuringSchedulingIgnoredDuringExecution []PodAffinityTerm `json:"requiredDuringSchedulingIgnoredDuringExecution,omitempty" protobuf:"bytes,1,rep,name=requiredDuringSchedulingIgnoredDuringExecution"` 2589 // The scheduler will prefer to schedule pods to nodes that satisfy 2590 // the affinity expressions specified by this field, but it may choose 2591 // a node that violates one or more of the expressions. The node that is 2592 // most preferred is the one with the greatest sum of weights, i.e. 2593 // for each node that meets all of the scheduling requirements (resource 2594 // request, requiredDuringScheduling affinity expressions, etc.), 2595 // compute a sum by iterating through the elements of this field and adding 2596 // "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the 2597 // node(s) with the highest sum are the most preferred. 2598 // +optional 2599 PreferredDuringSchedulingIgnoredDuringExecution []WeightedPodAffinityTerm `json:"preferredDuringSchedulingIgnoredDuringExecution,omitempty" protobuf:"bytes,2,rep,name=preferredDuringSchedulingIgnoredDuringExecution"` 2600} 2601 2602// Pod anti affinity is a group of inter pod anti affinity scheduling rules. 2603type PodAntiAffinity struct { 2604 // NOT YET IMPLEMENTED. TODO: Uncomment field once it is implemented. 2605 // If the anti-affinity requirements specified by this field are not met at 2606 // scheduling time, the pod will not be scheduled onto the node. 2607 // If the anti-affinity requirements specified by this field cease to be met 2608 // at some point during pod execution (e.g. due to a pod label update), the 2609 // system will try to eventually evict the pod from its node. 2610 // When there are multiple elements, the lists of nodes corresponding to each 2611 // podAffinityTerm are intersected, i.e. all terms must be satisfied. 2612 // +optional 2613 // RequiredDuringSchedulingRequiredDuringExecution []PodAffinityTerm `json:"requiredDuringSchedulingRequiredDuringExecution,omitempty"` 2614 2615 // If the anti-affinity requirements specified by this field are not met at 2616 // scheduling time, the pod will not be scheduled onto the node. 2617 // If the anti-affinity requirements specified by this field cease to be met 2618 // at some point during pod execution (e.g. due to a pod label update), the 2619 // system may or may not try to eventually evict the pod from its node. 2620 // When there are multiple elements, the lists of nodes corresponding to each 2621 // podAffinityTerm are intersected, i.e. all terms must be satisfied. 2622 // +optional 2623 RequiredDuringSchedulingIgnoredDuringExecution []PodAffinityTerm `json:"requiredDuringSchedulingIgnoredDuringExecution,omitempty" protobuf:"bytes,1,rep,name=requiredDuringSchedulingIgnoredDuringExecution"` 2624 // The scheduler will prefer to schedule pods to nodes that satisfy 2625 // the anti-affinity expressions specified by this field, but it may choose 2626 // a node that violates one or more of the expressions. The node that is 2627 // most preferred is the one with the greatest sum of weights, i.e. 2628 // for each node that meets all of the scheduling requirements (resource 2629 // request, requiredDuringScheduling anti-affinity expressions, etc.), 2630 // compute a sum by iterating through the elements of this field and adding 2631 // "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the 2632 // node(s) with the highest sum are the most preferred. 2633 // +optional 2634 PreferredDuringSchedulingIgnoredDuringExecution []WeightedPodAffinityTerm `json:"preferredDuringSchedulingIgnoredDuringExecution,omitempty" protobuf:"bytes,2,rep,name=preferredDuringSchedulingIgnoredDuringExecution"` 2635} 2636 2637// The weights of all of the matched WeightedPodAffinityTerm fields are added per-node to find the most preferred node(s) 2638type WeightedPodAffinityTerm struct { 2639 // weight associated with matching the corresponding podAffinityTerm, 2640 // in the range 1-100. 2641 Weight int32 `json:"weight" protobuf:"varint,1,opt,name=weight"` 2642 // Required. A pod affinity term, associated with the corresponding weight. 2643 PodAffinityTerm PodAffinityTerm `json:"podAffinityTerm" protobuf:"bytes,2,opt,name=podAffinityTerm"` 2644} 2645 2646// Defines a set of pods (namely those matching the labelSelector 2647// relative to the given namespace(s)) that this pod should be 2648// co-located (affinity) or not co-located (anti-affinity) with, 2649// where co-located is defined as running on a node whose value of 2650// the label with key <topologyKey> matches that of any node on which 2651// a pod of the set of pods is running 2652type PodAffinityTerm struct { 2653 // A label query over a set of resources, in this case pods. 2654 // +optional 2655 LabelSelector *metav1.LabelSelector `json:"labelSelector,omitempty" protobuf:"bytes,1,opt,name=labelSelector"` 2656 // namespaces specifies which namespaces the labelSelector applies to (matches against); 2657 // null or empty list means "this pod's namespace" 2658 // +optional 2659 Namespaces []string `json:"namespaces,omitempty" protobuf:"bytes,2,rep,name=namespaces"` 2660 // This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching 2661 // the labelSelector in the specified namespaces, where co-located is defined as running on a node 2662 // whose value of the label with key topologyKey matches that of any node on which any of the 2663 // selected pods is running. 2664 // Empty topologyKey is not allowed. 2665 TopologyKey string `json:"topologyKey" protobuf:"bytes,3,opt,name=topologyKey"` 2666} 2667 2668// Node affinity is a group of node affinity scheduling rules. 2669type NodeAffinity struct { 2670 // NOT YET IMPLEMENTED. TODO: Uncomment field once it is implemented. 2671 // If the affinity requirements specified by this field are not met at 2672 // scheduling time, the pod will not be scheduled onto the node. 2673 // If the affinity requirements specified by this field cease to be met 2674 // at some point during pod execution (e.g. due to an update), the system 2675 // will try to eventually evict the pod from its node. 2676 // +optional 2677 // RequiredDuringSchedulingRequiredDuringExecution *NodeSelector `json:"requiredDuringSchedulingRequiredDuringExecution,omitempty"` 2678 2679 // If the affinity requirements specified by this field are not met at 2680 // scheduling time, the pod will not be scheduled onto the node. 2681 // If the affinity requirements specified by this field cease to be met 2682 // at some point during pod execution (e.g. due to an update), the system 2683 // may or may not try to eventually evict the pod from its node. 2684 // +optional 2685 RequiredDuringSchedulingIgnoredDuringExecution *NodeSelector `json:"requiredDuringSchedulingIgnoredDuringExecution,omitempty" protobuf:"bytes,1,opt,name=requiredDuringSchedulingIgnoredDuringExecution"` 2686 // The scheduler will prefer to schedule pods to nodes that satisfy 2687 // the affinity expressions specified by this field, but it may choose 2688 // a node that violates one or more of the expressions. The node that is 2689 // most preferred is the one with the greatest sum of weights, i.e. 2690 // for each node that meets all of the scheduling requirements (resource 2691 // request, requiredDuringScheduling affinity expressions, etc.), 2692 // compute a sum by iterating through the elements of this field and adding 2693 // "weight" to the sum if the node matches the corresponding matchExpressions; the 2694 // node(s) with the highest sum are the most preferred. 2695 // +optional 2696 PreferredDuringSchedulingIgnoredDuringExecution []PreferredSchedulingTerm `json:"preferredDuringSchedulingIgnoredDuringExecution,omitempty" protobuf:"bytes,2,rep,name=preferredDuringSchedulingIgnoredDuringExecution"` 2697} 2698 2699// An empty preferred scheduling term matches all objects with implicit weight 0 2700// (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op). 2701type PreferredSchedulingTerm struct { 2702 // Weight associated with matching the corresponding nodeSelectorTerm, in the range 1-100. 2703 Weight int32 `json:"weight" protobuf:"varint,1,opt,name=weight"` 2704 // A node selector term, associated with the corresponding weight. 2705 Preference NodeSelectorTerm `json:"preference" protobuf:"bytes,2,opt,name=preference"` 2706} 2707 2708// The node this Taint is attached to has the "effect" on 2709// any pod that does not tolerate the Taint. 2710type Taint struct { 2711 // Required. The taint key to be applied to a node. 2712 Key string `json:"key" protobuf:"bytes,1,opt,name=key"` 2713 // Required. The taint value corresponding to the taint key. 2714 // +optional 2715 Value string `json:"value,omitempty" protobuf:"bytes,2,opt,name=value"` 2716 // Required. The effect of the taint on pods 2717 // that do not tolerate the taint. 2718 // Valid effects are NoSchedule, PreferNoSchedule and NoExecute. 2719 Effect TaintEffect `json:"effect" protobuf:"bytes,3,opt,name=effect,casttype=TaintEffect"` 2720 // TimeAdded represents the time at which the taint was added. 2721 // It is only written for NoExecute taints. 2722 // +optional 2723 TimeAdded *metav1.Time `json:"timeAdded,omitempty" protobuf:"bytes,4,opt,name=timeAdded"` 2724} 2725 2726type TaintEffect string 2727 2728const ( 2729 // Do not allow new pods to schedule onto the node unless they tolerate the taint, 2730 // but allow all pods submitted to Kubelet without going through the scheduler 2731 // to start, and allow all already-running pods to continue running. 2732 // Enforced by the scheduler. 2733 TaintEffectNoSchedule TaintEffect = "NoSchedule" 2734 // Like TaintEffectNoSchedule, but the scheduler tries not to schedule 2735 // new pods onto the node, rather than prohibiting new pods from scheduling 2736 // onto the node entirely. Enforced by the scheduler. 2737 TaintEffectPreferNoSchedule TaintEffect = "PreferNoSchedule" 2738 // NOT YET IMPLEMENTED. TODO: Uncomment field once it is implemented. 2739 // Like TaintEffectNoSchedule, but additionally do not allow pods submitted to 2740 // Kubelet without going through the scheduler to start. 2741 // Enforced by Kubelet and the scheduler. 2742 // TaintEffectNoScheduleNoAdmit TaintEffect = "NoScheduleNoAdmit" 2743 2744 // Evict any already-running pods that do not tolerate the taint. 2745 // Currently enforced by NodeController. 2746 TaintEffectNoExecute TaintEffect = "NoExecute" 2747) 2748 2749// The pod this Toleration is attached to tolerates any taint that matches 2750// the triple <key,value,effect> using the matching operator <operator>. 2751type Toleration struct { 2752 // Key is the taint key that the toleration applies to. Empty means match all taint keys. 2753 // If the key is empty, operator must be Exists; this combination means to match all values and all keys. 2754 // +optional 2755 Key string `json:"key,omitempty" protobuf:"bytes,1,opt,name=key"` 2756 // Operator represents a key's relationship to the value. 2757 // Valid operators are Exists and Equal. Defaults to Equal. 2758 // Exists is equivalent to wildcard for value, so that a pod can 2759 // tolerate all taints of a particular category. 2760 // +optional 2761 Operator TolerationOperator `json:"operator,omitempty" protobuf:"bytes,2,opt,name=operator,casttype=TolerationOperator"` 2762 // Value is the taint value the toleration matches to. 2763 // If the operator is Exists, the value should be empty, otherwise just a regular string. 2764 // +optional 2765 Value string `json:"value,omitempty" protobuf:"bytes,3,opt,name=value"` 2766 // Effect indicates the taint effect to match. Empty means match all taint effects. 2767 // When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute. 2768 // +optional 2769 Effect TaintEffect `json:"effect,omitempty" protobuf:"bytes,4,opt,name=effect,casttype=TaintEffect"` 2770 // TolerationSeconds represents the period of time the toleration (which must be 2771 // of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, 2772 // it is not set, which means tolerate the taint forever (do not evict). Zero and 2773 // negative values will be treated as 0 (evict immediately) by the system. 2774 // +optional 2775 TolerationSeconds *int64 `json:"tolerationSeconds,omitempty" protobuf:"varint,5,opt,name=tolerationSeconds"` 2776} 2777 2778// A toleration operator is the set of operators that can be used in a toleration. 2779type TolerationOperator string 2780 2781const ( 2782 TolerationOpExists TolerationOperator = "Exists" 2783 TolerationOpEqual TolerationOperator = "Equal" 2784) 2785 2786// PodReadinessGate contains the reference to a pod condition 2787type PodReadinessGate struct { 2788 // ConditionType refers to a condition in the pod's condition list with matching type. 2789 ConditionType PodConditionType `json:"conditionType" protobuf:"bytes,1,opt,name=conditionType,casttype=PodConditionType"` 2790} 2791 2792// PodSpec is a description of a pod. 2793type PodSpec struct { 2794 // List of volumes that can be mounted by containers belonging to the pod. 2795 // More info: https://kubernetes.io/docs/concepts/storage/volumes 2796 // +optional 2797 // +patchMergeKey=name 2798 // +patchStrategy=merge,retainKeys 2799 Volumes []Volume `json:"volumes,omitempty" patchStrategy:"merge,retainKeys" patchMergeKey:"name" protobuf:"bytes,1,rep,name=volumes"` 2800 // List of initialization containers belonging to the pod. 2801 // Init containers are executed in order prior to containers being started. If any 2802 // init container fails, the pod is considered to have failed and is handled according 2803 // to its restartPolicy. The name for an init container or normal container must be 2804 // unique among all containers. 2805 // Init containers may not have Lifecycle actions, Readiness probes, or Liveness probes. 2806 // The resourceRequirements of an init container are taken into account during scheduling 2807 // by finding the highest request/limit for each resource type, and then using the max of 2808 // of that value or the sum of the normal containers. Limits are applied to init containers 2809 // in a similar fashion. 2810 // Init containers cannot currently be added or removed. 2811 // Cannot be updated. 2812 // More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/ 2813 // +patchMergeKey=name 2814 // +patchStrategy=merge 2815 InitContainers []Container `json:"initContainers,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,20,rep,name=initContainers"` 2816 // List of containers belonging to the pod. 2817 // Containers cannot currently be added or removed. 2818 // There must be at least one container in a Pod. 2819 // Cannot be updated. 2820 // +patchMergeKey=name 2821 // +patchStrategy=merge 2822 Containers []Container `json:"containers" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,2,rep,name=containers"` 2823 // Restart policy for all containers within the pod. 2824 // One of Always, OnFailure, Never. 2825 // Default to Always. 2826 // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy 2827 // +optional 2828 RestartPolicy RestartPolicy `json:"restartPolicy,omitempty" protobuf:"bytes,3,opt,name=restartPolicy,casttype=RestartPolicy"` 2829 // Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request. 2830 // Value must be non-negative integer. The value zero indicates delete immediately. 2831 // If this value is nil, the default grace period will be used instead. 2832 // The grace period is the duration in seconds after the processes running in the pod are sent 2833 // a termination signal and the time when the processes are forcibly halted with a kill signal. 2834 // Set this value longer than the expected cleanup time for your process. 2835 // Defaults to 30 seconds. 2836 // +optional 2837 TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty" protobuf:"varint,4,opt,name=terminationGracePeriodSeconds"` 2838 // Optional duration in seconds the pod may be active on the node relative to 2839 // StartTime before the system will actively try to mark it failed and kill associated containers. 2840 // Value must be a positive integer. 2841 // +optional 2842 ActiveDeadlineSeconds *int64 `json:"activeDeadlineSeconds,omitempty" protobuf:"varint,5,opt,name=activeDeadlineSeconds"` 2843 // Set DNS policy for the pod. 2844 // Defaults to "ClusterFirst". 2845 // Valid values are 'ClusterFirstWithHostNet', 'ClusterFirst', 'Default' or 'None'. 2846 // DNS parameters given in DNSConfig will be merged with the policy selected with DNSPolicy. 2847 // To have DNS options set along with hostNetwork, you have to specify DNS policy 2848 // explicitly to 'ClusterFirstWithHostNet'. 2849 // +optional 2850 DNSPolicy DNSPolicy `json:"dnsPolicy,omitempty" protobuf:"bytes,6,opt,name=dnsPolicy,casttype=DNSPolicy"` 2851 // NodeSelector is a selector which must be true for the pod to fit on a node. 2852 // Selector which must match a node's labels for the pod to be scheduled on that node. 2853 // More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ 2854 // +optional 2855 NodeSelector map[string]string `json:"nodeSelector,omitempty" protobuf:"bytes,7,rep,name=nodeSelector"` 2856 2857 // ServiceAccountName is the name of the ServiceAccount to use to run this pod. 2858 // More info: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/ 2859 // +optional 2860 ServiceAccountName string `json:"serviceAccountName,omitempty" protobuf:"bytes,8,opt,name=serviceAccountName"` 2861 // DeprecatedServiceAccount is a depreciated alias for ServiceAccountName. 2862 // Deprecated: Use serviceAccountName instead. 2863 // +k8s:conversion-gen=false 2864 // +optional 2865 DeprecatedServiceAccount string `json:"serviceAccount,omitempty" protobuf:"bytes,9,opt,name=serviceAccount"` 2866 // AutomountServiceAccountToken indicates whether a service account token should be automatically mounted. 2867 // +optional 2868 AutomountServiceAccountToken *bool `json:"automountServiceAccountToken,omitempty" protobuf:"varint,21,opt,name=automountServiceAccountToken"` 2869 2870 // NodeName is a request to schedule this pod onto a specific node. If it is non-empty, 2871 // the scheduler simply schedules this pod onto that node, assuming that it fits resource 2872 // requirements. 2873 // +optional 2874 NodeName string `json:"nodeName,omitempty" protobuf:"bytes,10,opt,name=nodeName"` 2875 // Host networking requested for this pod. Use the host's network namespace. 2876 // If this option is set, the ports that will be used must be specified. 2877 // Default to false. 2878 // +k8s:conversion-gen=false 2879 // +optional 2880 HostNetwork bool `json:"hostNetwork,omitempty" protobuf:"varint,11,opt,name=hostNetwork"` 2881 // Use the host's pid namespace. 2882 // Optional: Default to false. 2883 // +k8s:conversion-gen=false 2884 // +optional 2885 HostPID bool `json:"hostPID,omitempty" protobuf:"varint,12,opt,name=hostPID"` 2886 // Use the host's ipc namespace. 2887 // Optional: Default to false. 2888 // +k8s:conversion-gen=false 2889 // +optional 2890 HostIPC bool `json:"hostIPC,omitempty" protobuf:"varint,13,opt,name=hostIPC"` 2891 // Share a single process namespace between all of the containers in a pod. 2892 // When this is set containers will be able to view and signal processes from other containers 2893 // in the same pod, and the first process in each container will not be assigned PID 1. 2894 // HostPID and ShareProcessNamespace cannot both be set. 2895 // Optional: Default to false. 2896 // This field is beta-level and may be disabled with the PodShareProcessNamespace feature. 2897 // +k8s:conversion-gen=false 2898 // +optional 2899 ShareProcessNamespace *bool `json:"shareProcessNamespace,omitempty" protobuf:"varint,27,opt,name=shareProcessNamespace"` 2900 // SecurityContext holds pod-level security attributes and common container settings. 2901 // Optional: Defaults to empty. See type description for default values of each field. 2902 // +optional 2903 SecurityContext *PodSecurityContext `json:"securityContext,omitempty" protobuf:"bytes,14,opt,name=securityContext"` 2904 // ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images used by this PodSpec. 2905 // If specified, these secrets will be passed to individual puller implementations for them to use. For example, 2906 // in the case of docker, only DockerConfig type secrets are honored. 2907 // More info: https://kubernetes.io/docs/concepts/containers/images#specifying-imagepullsecrets-on-a-pod 2908 // +optional 2909 // +patchMergeKey=name 2910 // +patchStrategy=merge 2911 ImagePullSecrets []LocalObjectReference `json:"imagePullSecrets,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,15,rep,name=imagePullSecrets"` 2912 // Specifies the hostname of the Pod 2913 // If not specified, the pod's hostname will be set to a system-defined value. 2914 // +optional 2915 Hostname string `json:"hostname,omitempty" protobuf:"bytes,16,opt,name=hostname"` 2916 // If specified, the fully qualified Pod hostname will be "<hostname>.<subdomain>.<pod namespace>.svc.<cluster domain>". 2917 // If not specified, the pod will not have a domainname at all. 2918 // +optional 2919 Subdomain string `json:"subdomain,omitempty" protobuf:"bytes,17,opt,name=subdomain"` 2920 // If specified, the pod's scheduling constraints 2921 // +optional 2922 Affinity *Affinity `json:"affinity,omitempty" protobuf:"bytes,18,opt,name=affinity"` 2923 // If specified, the pod will be dispatched by specified scheduler. 2924 // If not specified, the pod will be dispatched by default scheduler. 2925 // +optional 2926 SchedulerName string `json:"schedulerName,omitempty" protobuf:"bytes,19,opt,name=schedulerName"` 2927 // If specified, the pod's tolerations. 2928 // +optional 2929 Tolerations []Toleration `json:"tolerations,omitempty" protobuf:"bytes,22,opt,name=tolerations"` 2930 // HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts 2931 // file if specified. This is only valid for non-hostNetwork pods. 2932 // +optional 2933 // +patchMergeKey=ip 2934 // +patchStrategy=merge 2935 HostAliases []HostAlias `json:"hostAliases,omitempty" patchStrategy:"merge" patchMergeKey:"ip" protobuf:"bytes,23,rep,name=hostAliases"` 2936 // If specified, indicates the pod's priority. "system-node-critical" and 2937 // "system-cluster-critical" are two special keywords which indicate the 2938 // highest priorities with the former being the highest priority. Any other 2939 // name must be defined by creating a PriorityClass object with that name. 2940 // If not specified, the pod priority will be default or zero if there is no 2941 // default. 2942 // +optional 2943 PriorityClassName string `json:"priorityClassName,omitempty" protobuf:"bytes,24,opt,name=priorityClassName"` 2944 // The priority value. Various system components use this field to find the 2945 // priority of the pod. When Priority Admission Controller is enabled, it 2946 // prevents users from setting this field. The admission controller populates 2947 // this field from PriorityClassName. 2948 // The higher the value, the higher the priority. 2949 // +optional 2950 Priority *int32 `json:"priority,omitempty" protobuf:"bytes,25,opt,name=priority"` 2951 // Specifies the DNS parameters of a pod. 2952 // Parameters specified here will be merged to the generated DNS 2953 // configuration based on DNSPolicy. 2954 // +optional 2955 DNSConfig *PodDNSConfig `json:"dnsConfig,omitempty" protobuf:"bytes,26,opt,name=dnsConfig"` 2956 2957 // If specified, all readiness gates will be evaluated for pod readiness. 2958 // A pod is ready when all its containers are ready AND 2959 // all conditions specified in the readiness gates have status equal to "True" 2960 // More info: https://git.k8s.io/enhancements/keps/sig-network/0007-pod-ready%2B%2B.md 2961 // +optional 2962 ReadinessGates []PodReadinessGate `json:"readinessGates,omitempty" protobuf:"bytes,28,opt,name=readinessGates"` 2963 // RuntimeClassName refers to a RuntimeClass object in the node.k8s.io group, which should be used 2964 // to run this pod. If no RuntimeClass resource matches the named class, the pod will not be run. 2965 // If unset or empty, the "legacy" RuntimeClass will be used, which is an implicit class with an 2966 // empty definition that uses the default runtime handler. 2967 // More info: https://git.k8s.io/enhancements/keps/sig-node/runtime-class.md 2968 // This is an alpha feature and may change in the future. 2969 // +optional 2970 RuntimeClassName *string `json:"runtimeClassName,omitempty" protobuf:"bytes,29,opt,name=runtimeClassName"` 2971 // EnableServiceLinks indicates whether information about services should be injected into pod's 2972 // environment variables, matching the syntax of Docker links. 2973 // Optional: Defaults to true. 2974 // +optional 2975 EnableServiceLinks *bool `json:"enableServiceLinks,omitempty" protobuf:"varint,30,opt,name=enableServiceLinks"` 2976} 2977 2978const ( 2979 // The default value for enableServiceLinks attribute. 2980 DefaultEnableServiceLinks = true 2981) 2982 2983// HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the 2984// pod's hosts file. 2985type HostAlias struct { 2986 // IP address of the host file entry. 2987 IP string `json:"ip,omitempty" protobuf:"bytes,1,opt,name=ip"` 2988 // Hostnames for the above IP address. 2989 Hostnames []string `json:"hostnames,omitempty" protobuf:"bytes,2,rep,name=hostnames"` 2990} 2991 2992// PodSecurityContext holds pod-level security attributes and common container settings. 2993// Some fields are also present in container.securityContext. Field values of 2994// container.securityContext take precedence over field values of PodSecurityContext. 2995type PodSecurityContext struct { 2996 // The SELinux context to be applied to all containers. 2997 // If unspecified, the container runtime will allocate a random SELinux context for each 2998 // container. May also be set in SecurityContext. If set in 2999 // both SecurityContext and PodSecurityContext, the value specified in SecurityContext 3000 // takes precedence for that container. 3001 // +optional 3002 SELinuxOptions *SELinuxOptions `json:"seLinuxOptions,omitempty" protobuf:"bytes,1,opt,name=seLinuxOptions"` 3003 // The UID to run the entrypoint of the container process. 3004 // Defaults to user specified in image metadata if unspecified. 3005 // May also be set in SecurityContext. If set in both SecurityContext and 3006 // PodSecurityContext, the value specified in SecurityContext takes precedence 3007 // for that container. 3008 // +optional 3009 RunAsUser *int64 `json:"runAsUser,omitempty" protobuf:"varint,2,opt,name=runAsUser"` 3010 // The GID to run the entrypoint of the container process. 3011 // Uses runtime default if unset. 3012 // May also be set in SecurityContext. If set in both SecurityContext and 3013 // PodSecurityContext, the value specified in SecurityContext takes precedence 3014 // for that container. 3015 // +optional 3016 RunAsGroup *int64 `json:"runAsGroup,omitempty" protobuf:"varint,6,opt,name=runAsGroup"` 3017 // Indicates that the container must run as a non-root user. 3018 // If true, the Kubelet will validate the image at runtime to ensure that it 3019 // does not run as UID 0 (root) and fail to start the container if it does. 3020 // If unset or false, no such validation will be performed. 3021 // May also be set in SecurityContext. If set in both SecurityContext and 3022 // PodSecurityContext, the value specified in SecurityContext takes precedence. 3023 // +optional 3024 RunAsNonRoot *bool `json:"runAsNonRoot,omitempty" protobuf:"varint,3,opt,name=runAsNonRoot"` 3025 // A list of groups applied to the first process run in each container, in addition 3026 // to the container's primary GID. If unspecified, no groups will be added to 3027 // any container. 3028 // +optional 3029 SupplementalGroups []int64 `json:"supplementalGroups,omitempty" protobuf:"varint,4,rep,name=supplementalGroups"` 3030 // A special supplemental group that applies to all containers in a pod. 3031 // Some volume types allow the Kubelet to change the ownership of that volume 3032 // to be owned by the pod: 3033 // 3034 // 1. The owning GID will be the FSGroup 3035 // 2. The setgid bit is set (new files created in the volume will be owned by FSGroup) 3036 // 3. The permission bits are OR'd with rw-rw---- 3037 // 3038 // If unset, the Kubelet will not modify the ownership and permissions of any volume. 3039 // +optional 3040 FSGroup *int64 `json:"fsGroup,omitempty" protobuf:"varint,5,opt,name=fsGroup"` 3041 // Sysctls hold a list of namespaced sysctls used for the pod. Pods with unsupported 3042 // sysctls (by the container runtime) might fail to launch. 3043 // +optional 3044 Sysctls []Sysctl `json:"sysctls,omitempty" protobuf:"bytes,7,rep,name=sysctls"` 3045} 3046 3047// PodQOSClass defines the supported qos classes of Pods. 3048type PodQOSClass string 3049 3050const ( 3051 // PodQOSGuaranteed is the Guaranteed qos class. 3052 PodQOSGuaranteed PodQOSClass = "Guaranteed" 3053 // PodQOSBurstable is the Burstable qos class. 3054 PodQOSBurstable PodQOSClass = "Burstable" 3055 // PodQOSBestEffort is the BestEffort qos class. 3056 PodQOSBestEffort PodQOSClass = "BestEffort" 3057) 3058 3059// PodDNSConfig defines the DNS parameters of a pod in addition to 3060// those generated from DNSPolicy. 3061type PodDNSConfig struct { 3062 // A list of DNS name server IP addresses. 3063 // This will be appended to the base nameservers generated from DNSPolicy. 3064 // Duplicated nameservers will be removed. 3065 // +optional 3066 Nameservers []string `json:"nameservers,omitempty" protobuf:"bytes,1,rep,name=nameservers"` 3067 // A list of DNS search domains for host-name lookup. 3068 // This will be appended to the base search paths generated from DNSPolicy. 3069 // Duplicated search paths will be removed. 3070 // +optional 3071 Searches []string `json:"searches,omitempty" protobuf:"bytes,2,rep,name=searches"` 3072 // A list of DNS resolver options. 3073 // This will be merged with the base options generated from DNSPolicy. 3074 // Duplicated entries will be removed. Resolution options given in Options 3075 // will override those that appear in the base DNSPolicy. 3076 // +optional 3077 Options []PodDNSConfigOption `json:"options,omitempty" protobuf:"bytes,3,rep,name=options"` 3078} 3079 3080// PodDNSConfigOption defines DNS resolver options of a pod. 3081type PodDNSConfigOption struct { 3082 // Required. 3083 Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"` 3084 // +optional 3085 Value *string `json:"value,omitempty" protobuf:"bytes,2,opt,name=value"` 3086} 3087 3088// PodStatus represents information about the status of a pod. Status may trail the actual 3089// state of a system, especially if the node that hosts the pod cannot contact the control 3090// plane. 3091type PodStatus struct { 3092 // The phase of a Pod is a simple, high-level summary of where the Pod is in its lifecycle. 3093 // The conditions array, the reason and message fields, and the individual container status 3094 // arrays contain more detail about the pod's status. 3095 // There are five possible phase values: 3096 // 3097 // Pending: The pod has been accepted by the Kubernetes system, but one or more of the 3098 // container images has not been created. This includes time before being scheduled as 3099 // well as time spent downloading images over the network, which could take a while. 3100 // Running: The pod has been bound to a node, and all of the containers have been created. 3101 // At least one container is still running, or is in the process of starting or restarting. 3102 // Succeeded: All containers in the pod have terminated in success, and will not be restarted. 3103 // Failed: All containers in the pod have terminated, and at least one container has 3104 // terminated in failure. The container either exited with non-zero status or was terminated 3105 // by the system. 3106 // Unknown: For some reason the state of the pod could not be obtained, typically due to an 3107 // error in communicating with the host of the pod. 3108 // 3109 // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-phase 3110 // +optional 3111 Phase PodPhase `json:"phase,omitempty" protobuf:"bytes,1,opt,name=phase,casttype=PodPhase"` 3112 // Current service state of pod. 3113 // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions 3114 // +optional 3115 // +patchMergeKey=type 3116 // +patchStrategy=merge 3117 Conditions []PodCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,2,rep,name=conditions"` 3118 // A human readable message indicating details about why the pod is in this condition. 3119 // +optional 3120 Message string `json:"message,omitempty" protobuf:"bytes,3,opt,name=message"` 3121 // A brief CamelCase message indicating details about why the pod is in this state. 3122 // e.g. 'Evicted' 3123 // +optional 3124 Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"` 3125 // nominatedNodeName is set only when this pod preempts other pods on the node, but it cannot be 3126 // scheduled right away as preemption victims receive their graceful termination periods. 3127 // This field does not guarantee that the pod will be scheduled on this node. Scheduler may decide 3128 // to place the pod elsewhere if other nodes become available sooner. Scheduler may also decide to 3129 // give the resources on this node to a higher priority pod that is created after preemption. 3130 // As a result, this field may be different than PodSpec.nodeName when the pod is 3131 // scheduled. 3132 // +optional 3133 NominatedNodeName string `json:"nominatedNodeName,omitempty" protobuf:"bytes,11,opt,name=nominatedNodeName"` 3134 3135 // IP address of the host to which the pod is assigned. Empty if not yet scheduled. 3136 // +optional 3137 HostIP string `json:"hostIP,omitempty" protobuf:"bytes,5,opt,name=hostIP"` 3138 // IP address allocated to the pod. Routable at least within the cluster. 3139 // Empty if not yet allocated. 3140 // +optional 3141 PodIP string `json:"podIP,omitempty" protobuf:"bytes,6,opt,name=podIP"` 3142 3143 // RFC 3339 date and time at which the object was acknowledged by the Kubelet. 3144 // This is before the Kubelet pulled the container image(s) for the pod. 3145 // +optional 3146 StartTime *metav1.Time `json:"startTime,omitempty" protobuf:"bytes,7,opt,name=startTime"` 3147 3148 // The list has one entry per init container in the manifest. The most recent successful 3149 // init container will have ready = true, the most recently started container will have 3150 // startTime set. 3151 // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-and-container-status 3152 InitContainerStatuses []ContainerStatus `json:"initContainerStatuses,omitempty" protobuf:"bytes,10,rep,name=initContainerStatuses"` 3153 3154 // The list has one entry per container in the manifest. Each entry is currently the output 3155 // of `docker inspect`. 3156 // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-and-container-status 3157 // +optional 3158 ContainerStatuses []ContainerStatus `json:"containerStatuses,omitempty" protobuf:"bytes,8,rep,name=containerStatuses"` 3159 // The Quality of Service (QOS) classification assigned to the pod based on resource requirements 3160 // See PodQOSClass type for available QOS classes 3161 // More info: https://git.k8s.io/community/contributors/design-proposals/node/resource-qos.md 3162 // +optional 3163 QOSClass PodQOSClass `json:"qosClass,omitempty" protobuf:"bytes,9,rep,name=qosClass"` 3164} 3165 3166// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 3167 3168// PodStatusResult is a wrapper for PodStatus returned by kubelet that can be encode/decoded 3169type PodStatusResult struct { 3170 metav1.TypeMeta `json:",inline"` 3171 // Standard object's metadata. 3172 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata 3173 // +optional 3174 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 3175 // Most recently observed status of the pod. 3176 // This data may not be up to date. 3177 // Populated by the system. 3178 // Read-only. 3179 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status 3180 // +optional 3181 Status PodStatus `json:"status,omitempty" protobuf:"bytes,2,opt,name=status"` 3182} 3183 3184// +genclient 3185// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 3186 3187// Pod is a collection of containers that can run on a host. This resource is created 3188// by clients and scheduled onto hosts. 3189type Pod struct { 3190 metav1.TypeMeta `json:",inline"` 3191 // Standard object's metadata. 3192 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata 3193 // +optional 3194 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 3195 3196 // Specification of the desired behavior of the pod. 3197 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status 3198 // +optional 3199 Spec PodSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` 3200 3201 // Most recently observed status of the pod. 3202 // This data may not be up to date. 3203 // Populated by the system. 3204 // Read-only. 3205 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status 3206 // +optional 3207 Status PodStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` 3208} 3209 3210// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 3211 3212// PodList is a list of Pods. 3213type PodList struct { 3214 metav1.TypeMeta `json:",inline"` 3215 // Standard list metadata. 3216 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds 3217 // +optional 3218 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 3219 3220 // List of pods. 3221 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md 3222 Items []Pod `json:"items" protobuf:"bytes,2,rep,name=items"` 3223} 3224 3225// PodTemplateSpec describes the data a pod should have when created from a template 3226type PodTemplateSpec struct { 3227 // Standard object's metadata. 3228 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata 3229 // +optional 3230 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 3231 3232 // Specification of the desired behavior of the pod. 3233 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status 3234 // +optional 3235 Spec PodSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` 3236} 3237 3238// +genclient 3239// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 3240 3241// PodTemplate describes a template for creating copies of a predefined pod. 3242type PodTemplate struct { 3243 metav1.TypeMeta `json:",inline"` 3244 // Standard object's metadata. 3245 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata 3246 // +optional 3247 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 3248 3249 // Template defines the pods that will be created from this pod template. 3250 // https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status 3251 // +optional 3252 Template PodTemplateSpec `json:"template,omitempty" protobuf:"bytes,2,opt,name=template"` 3253} 3254 3255// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 3256 3257// PodTemplateList is a list of PodTemplates. 3258type PodTemplateList struct { 3259 metav1.TypeMeta `json:",inline"` 3260 // Standard list metadata. 3261 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds 3262 // +optional 3263 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 3264 3265 // List of pod templates 3266 Items []PodTemplate `json:"items" protobuf:"bytes,2,rep,name=items"` 3267} 3268 3269// ReplicationControllerSpec is the specification of a replication controller. 3270type ReplicationControllerSpec struct { 3271 // Replicas is the number of desired replicas. 3272 // This is a pointer to distinguish between explicit zero and unspecified. 3273 // Defaults to 1. 3274 // More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#what-is-a-replicationcontroller 3275 // +optional 3276 Replicas *int32 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"` 3277 3278 // Minimum number of seconds for which a newly created pod should be ready 3279 // without any of its container crashing, for it to be considered available. 3280 // Defaults to 0 (pod will be considered available as soon as it is ready) 3281 // +optional 3282 MinReadySeconds int32 `json:"minReadySeconds,omitempty" protobuf:"varint,4,opt,name=minReadySeconds"` 3283 3284 // Selector is a label query over pods that should match the Replicas count. 3285 // If Selector is empty, it is defaulted to the labels present on the Pod template. 3286 // Label keys and values that must match in order to be controlled by this replication 3287 // controller, if empty defaulted to labels on Pod template. 3288 // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors 3289 // +optional 3290 Selector map[string]string `json:"selector,omitempty" protobuf:"bytes,2,rep,name=selector"` 3291 3292 // TemplateRef is a reference to an object that describes the pod that will be created if 3293 // insufficient replicas are detected. 3294 // Reference to an object that describes the pod that will be created if insufficient replicas are detected. 3295 // +optional 3296 // TemplateRef *ObjectReference `json:"templateRef,omitempty"` 3297 3298 // Template is the object that describes the pod that will be created if 3299 // insufficient replicas are detected. This takes precedence over a TemplateRef. 3300 // More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-template 3301 // +optional 3302 Template *PodTemplateSpec `json:"template,omitempty" protobuf:"bytes,3,opt,name=template"` 3303} 3304 3305// ReplicationControllerStatus represents the current status of a replication 3306// controller. 3307type ReplicationControllerStatus struct { 3308 // Replicas is the most recently oberved number of replicas. 3309 // More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#what-is-a-replicationcontroller 3310 Replicas int32 `json:"replicas" protobuf:"varint,1,opt,name=replicas"` 3311 3312 // The number of pods that have labels matching the labels of the pod template of the replication controller. 3313 // +optional 3314 FullyLabeledReplicas int32 `json:"fullyLabeledReplicas,omitempty" protobuf:"varint,2,opt,name=fullyLabeledReplicas"` 3315 3316 // The number of ready replicas for this replication controller. 3317 // +optional 3318 ReadyReplicas int32 `json:"readyReplicas,omitempty" protobuf:"varint,4,opt,name=readyReplicas"` 3319 3320 // The number of available replicas (ready for at least minReadySeconds) for this replication controller. 3321 // +optional 3322 AvailableReplicas int32 `json:"availableReplicas,omitempty" protobuf:"varint,5,opt,name=availableReplicas"` 3323 3324 // ObservedGeneration reflects the generation of the most recently observed replication controller. 3325 // +optional 3326 ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,3,opt,name=observedGeneration"` 3327 3328 // Represents the latest available observations of a replication controller's current state. 3329 // +optional 3330 // +patchMergeKey=type 3331 // +patchStrategy=merge 3332 Conditions []ReplicationControllerCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,6,rep,name=conditions"` 3333} 3334 3335type ReplicationControllerConditionType string 3336 3337// These are valid conditions of a replication controller. 3338const ( 3339 // ReplicationControllerReplicaFailure is added in a replication controller when one of its pods 3340 // fails to be created due to insufficient quota, limit ranges, pod security policy, node selectors, 3341 // etc. or deleted due to kubelet being down or finalizers are failing. 3342 ReplicationControllerReplicaFailure ReplicationControllerConditionType = "ReplicaFailure" 3343) 3344 3345// ReplicationControllerCondition describes the state of a replication controller at a certain point. 3346type ReplicationControllerCondition struct { 3347 // Type of replication controller condition. 3348 Type ReplicationControllerConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=ReplicationControllerConditionType"` 3349 // Status of the condition, one of True, False, Unknown. 3350 Status ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=ConditionStatus"` 3351 // The last time the condition transitioned from one status to another. 3352 // +optional 3353 LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,3,opt,name=lastTransitionTime"` 3354 // The reason for the condition's last transition. 3355 // +optional 3356 Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"` 3357 // A human readable message indicating details about the transition. 3358 // +optional 3359 Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"` 3360} 3361 3362// +genclient 3363// +genclient:method=GetScale,verb=get,subresource=scale,result=k8s.io/api/autoscaling/v1.Scale 3364// +genclient:method=UpdateScale,verb=update,subresource=scale,input=k8s.io/api/autoscaling/v1.Scale,result=k8s.io/api/autoscaling/v1.Scale 3365// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 3366 3367// ReplicationController represents the configuration of a replication controller. 3368type ReplicationController struct { 3369 metav1.TypeMeta `json:",inline"` 3370 3371 // If the Labels of a ReplicationController are empty, they are defaulted to 3372 // be the same as the Pod(s) that the replication controller manages. 3373 // Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata 3374 // +optional 3375 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 3376 3377 // Spec defines the specification of the desired behavior of the replication controller. 3378 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status 3379 // +optional 3380 Spec ReplicationControllerSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` 3381 3382 // Status is the most recently observed status of the replication controller. 3383 // This data may be out of date by some window of time. 3384 // Populated by the system. 3385 // Read-only. 3386 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status 3387 // +optional 3388 Status ReplicationControllerStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` 3389} 3390 3391// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 3392 3393// ReplicationControllerList is a collection of replication controllers. 3394type ReplicationControllerList struct { 3395 metav1.TypeMeta `json:",inline"` 3396 // Standard list metadata. 3397 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds 3398 // +optional 3399 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 3400 3401 // List of replication controllers. 3402 // More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller 3403 Items []ReplicationController `json:"items" protobuf:"bytes,2,rep,name=items"` 3404} 3405 3406// Session Affinity Type string 3407type ServiceAffinity string 3408 3409const ( 3410 // ServiceAffinityClientIP is the Client IP based. 3411 ServiceAffinityClientIP ServiceAffinity = "ClientIP" 3412 3413 // ServiceAffinityNone - no session affinity. 3414 ServiceAffinityNone ServiceAffinity = "None" 3415) 3416 3417const DefaultClientIPServiceAffinitySeconds int32 = 10800 3418 3419// SessionAffinityConfig represents the configurations of session affinity. 3420type SessionAffinityConfig struct { 3421 // clientIP contains the configurations of Client IP based session affinity. 3422 // +optional 3423 ClientIP *ClientIPConfig `json:"clientIP,omitempty" protobuf:"bytes,1,opt,name=clientIP"` 3424} 3425 3426// ClientIPConfig represents the configurations of Client IP based session affinity. 3427type ClientIPConfig struct { 3428 // timeoutSeconds specifies the seconds of ClientIP type session sticky time. 3429 // The value must be >0 && <=86400(for 1 day) if ServiceAffinity == "ClientIP". 3430 // Default value is 10800(for 3 hours). 3431 // +optional 3432 TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty" protobuf:"varint,1,opt,name=timeoutSeconds"` 3433} 3434 3435// Service Type string describes ingress methods for a service 3436type ServiceType string 3437 3438const ( 3439 // ServiceTypeClusterIP means a service will only be accessible inside the 3440 // cluster, via the cluster IP. 3441 ServiceTypeClusterIP ServiceType = "ClusterIP" 3442 3443 // ServiceTypeNodePort means a service will be exposed on one port of 3444 // every node, in addition to 'ClusterIP' type. 3445 ServiceTypeNodePort ServiceType = "NodePort" 3446 3447 // ServiceTypeLoadBalancer means a service will be exposed via an 3448 // external load balancer (if the cloud provider supports it), in addition 3449 // to 'NodePort' type. 3450 ServiceTypeLoadBalancer ServiceType = "LoadBalancer" 3451 3452 // ServiceTypeExternalName means a service consists of only a reference to 3453 // an external name that kubedns or equivalent will return as a CNAME 3454 // record, with no exposing or proxying of any pods involved. 3455 ServiceTypeExternalName ServiceType = "ExternalName" 3456) 3457 3458// Service External Traffic Policy Type string 3459type ServiceExternalTrafficPolicyType string 3460 3461const ( 3462 // ServiceExternalTrafficPolicyTypeLocal specifies node-local endpoints behavior. 3463 ServiceExternalTrafficPolicyTypeLocal ServiceExternalTrafficPolicyType = "Local" 3464 // ServiceExternalTrafficPolicyTypeCluster specifies node-global (legacy) behavior. 3465 ServiceExternalTrafficPolicyTypeCluster ServiceExternalTrafficPolicyType = "Cluster" 3466) 3467 3468// ServiceStatus represents the current status of a service. 3469type ServiceStatus struct { 3470 // LoadBalancer contains the current status of the load-balancer, 3471 // if one is present. 3472 // +optional 3473 LoadBalancer LoadBalancerStatus `json:"loadBalancer,omitempty" protobuf:"bytes,1,opt,name=loadBalancer"` 3474} 3475 3476// LoadBalancerStatus represents the status of a load-balancer. 3477type LoadBalancerStatus struct { 3478 // Ingress is a list containing ingress points for the load-balancer. 3479 // Traffic intended for the service should be sent to these ingress points. 3480 // +optional 3481 Ingress []LoadBalancerIngress `json:"ingress,omitempty" protobuf:"bytes,1,rep,name=ingress"` 3482} 3483 3484// LoadBalancerIngress represents the status of a load-balancer ingress point: 3485// traffic intended for the service should be sent to an ingress point. 3486type LoadBalancerIngress struct { 3487 // IP is set for load-balancer ingress points that are IP based 3488 // (typically GCE or OpenStack load-balancers) 3489 // +optional 3490 IP string `json:"ip,omitempty" protobuf:"bytes,1,opt,name=ip"` 3491 3492 // Hostname is set for load-balancer ingress points that are DNS based 3493 // (typically AWS load-balancers) 3494 // +optional 3495 Hostname string `json:"hostname,omitempty" protobuf:"bytes,2,opt,name=hostname"` 3496} 3497 3498// ServiceSpec describes the attributes that a user creates on a service. 3499type ServiceSpec struct { 3500 // The list of ports that are exposed by this service. 3501 // More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies 3502 // +patchMergeKey=port 3503 // +patchStrategy=merge 3504 // +listType=map 3505 // +listMapKey=port 3506 // +listMapKey=protocol 3507 Ports []ServicePort `json:"ports,omitempty" patchStrategy:"merge" patchMergeKey:"port" protobuf:"bytes,1,rep,name=ports"` 3508 3509 // Route service traffic to pods with label keys and values matching this 3510 // selector. If empty or not present, the service is assumed to have an 3511 // external process managing its endpoints, which Kubernetes will not 3512 // modify. Only applies to types ClusterIP, NodePort, and LoadBalancer. 3513 // Ignored if type is ExternalName. 3514 // More info: https://kubernetes.io/docs/concepts/services-networking/service/ 3515 // +optional 3516 Selector map[string]string `json:"selector,omitempty" protobuf:"bytes,2,rep,name=selector"` 3517 3518 // clusterIP is the IP address of the service and is usually assigned 3519 // randomly by the master. If an address is specified manually and is not in 3520 // use by others, it will be allocated to the service; otherwise, creation 3521 // of the service will fail. This field can not be changed through updates. 3522 // Valid values are "None", empty string (""), or a valid IP address. "None" 3523 // can be specified for headless services when proxying is not required. 3524 // Only applies to types ClusterIP, NodePort, and LoadBalancer. Ignored if 3525 // type is ExternalName. 3526 // More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies 3527 // +optional 3528 ClusterIP string `json:"clusterIP,omitempty" protobuf:"bytes,3,opt,name=clusterIP"` 3529 3530 // type determines how the Service is exposed. Defaults to ClusterIP. Valid 3531 // options are ExternalName, ClusterIP, NodePort, and LoadBalancer. 3532 // "ExternalName" maps to the specified externalName. 3533 // "ClusterIP" allocates a cluster-internal IP address for load-balancing to 3534 // endpoints. Endpoints are determined by the selector or if that is not 3535 // specified, by manual construction of an Endpoints object. If clusterIP is 3536 // "None", no virtual IP is allocated and the endpoints are published as a 3537 // set of endpoints rather than a stable IP. 3538 // "NodePort" builds on ClusterIP and allocates a port on every node which 3539 // routes to the clusterIP. 3540 // "LoadBalancer" builds on NodePort and creates an 3541 // external load-balancer (if supported in the current cloud) which routes 3542 // to the clusterIP. 3543 // More info: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types 3544 // +optional 3545 Type ServiceType `json:"type,omitempty" protobuf:"bytes,4,opt,name=type,casttype=ServiceType"` 3546 3547 // externalIPs is a list of IP addresses for which nodes in the cluster 3548 // will also accept traffic for this service. These IPs are not managed by 3549 // Kubernetes. The user is responsible for ensuring that traffic arrives 3550 // at a node with this IP. A common example is external load-balancers 3551 // that are not part of the Kubernetes system. 3552 // +optional 3553 ExternalIPs []string `json:"externalIPs,omitempty" protobuf:"bytes,5,rep,name=externalIPs"` 3554 3555 // Supports "ClientIP" and "None". Used to maintain session affinity. 3556 // Enable client IP based session affinity. 3557 // Must be ClientIP or None. 3558 // Defaults to None. 3559 // More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies 3560 // +optional 3561 SessionAffinity ServiceAffinity `json:"sessionAffinity,omitempty" protobuf:"bytes,7,opt,name=sessionAffinity,casttype=ServiceAffinity"` 3562 3563 // Only applies to Service Type: LoadBalancer 3564 // LoadBalancer will get created with the IP specified in this field. 3565 // This feature depends on whether the underlying cloud-provider supports specifying 3566 // the loadBalancerIP when a load balancer is created. 3567 // This field will be ignored if the cloud-provider does not support the feature. 3568 // +optional 3569 LoadBalancerIP string `json:"loadBalancerIP,omitempty" protobuf:"bytes,8,opt,name=loadBalancerIP"` 3570 3571 // If specified and supported by the platform, this will restrict traffic through the cloud-provider 3572 // load-balancer will be restricted to the specified client IPs. This field will be ignored if the 3573 // cloud-provider does not support the feature." 3574 // More info: https://kubernetes.io/docs/tasks/access-application-cluster/configure-cloud-provider-firewall/ 3575 // +optional 3576 LoadBalancerSourceRanges []string `json:"loadBalancerSourceRanges,omitempty" protobuf:"bytes,9,opt,name=loadBalancerSourceRanges"` 3577 3578 // externalName is the external reference that kubedns or equivalent will 3579 // return as a CNAME record for this service. No proxying will be involved. 3580 // Must be a valid RFC-1123 hostname (https://tools.ietf.org/html/rfc1123) 3581 // and requires Type to be ExternalName. 3582 // +optional 3583 ExternalName string `json:"externalName,omitempty" protobuf:"bytes,10,opt,name=externalName"` 3584 3585 // externalTrafficPolicy denotes if this Service desires to route external 3586 // traffic to node-local or cluster-wide endpoints. "Local" preserves the 3587 // client source IP and avoids a second hop for LoadBalancer and Nodeport 3588 // type services, but risks potentially imbalanced traffic spreading. 3589 // "Cluster" obscures the client source IP and may cause a second hop to 3590 // another node, but should have good overall load-spreading. 3591 // +optional 3592 ExternalTrafficPolicy ServiceExternalTrafficPolicyType `json:"externalTrafficPolicy,omitempty" protobuf:"bytes,11,opt,name=externalTrafficPolicy"` 3593 3594 // healthCheckNodePort specifies the healthcheck nodePort for the service. 3595 // If not specified, HealthCheckNodePort is created by the service api 3596 // backend with the allocated nodePort. Will use user-specified nodePort value 3597 // if specified by the client. Only effects when Type is set to LoadBalancer 3598 // and ExternalTrafficPolicy is set to Local. 3599 // +optional 3600 HealthCheckNodePort int32 `json:"healthCheckNodePort,omitempty" protobuf:"bytes,12,opt,name=healthCheckNodePort"` 3601 3602 // publishNotReadyAddresses, when set to true, indicates that DNS implementations 3603 // must publish the notReadyAddresses of subsets for the Endpoints associated with 3604 // the Service. The default value is false. 3605 // The primary use case for setting this field is to use a StatefulSet's Headless Service 3606 // to propagate SRV records for its Pods without respect to their readiness for purpose 3607 // of peer discovery. 3608 // +optional 3609 PublishNotReadyAddresses bool `json:"publishNotReadyAddresses,omitempty" protobuf:"varint,13,opt,name=publishNotReadyAddresses"` 3610 // sessionAffinityConfig contains the configurations of session affinity. 3611 // +optional 3612 SessionAffinityConfig *SessionAffinityConfig `json:"sessionAffinityConfig,omitempty" protobuf:"bytes,14,opt,name=sessionAffinityConfig"` 3613} 3614 3615// ServicePort contains information on service's port. 3616type ServicePort struct { 3617 // The name of this port within the service. This must be a DNS_LABEL. 3618 // All ports within a ServiceSpec must have unique names. This maps to 3619 // the 'Name' field in EndpointPort objects. 3620 // Optional if only one ServicePort is defined on this service. 3621 // +optional 3622 Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"` 3623 3624 // The IP protocol for this port. Supports "TCP", "UDP", and "SCTP". 3625 // Default is TCP. 3626 // +optional 3627 Protocol Protocol `json:"protocol,omitempty" protobuf:"bytes,2,opt,name=protocol,casttype=Protocol"` 3628 3629 // The port that will be exposed by this service. 3630 Port int32 `json:"port" protobuf:"varint,3,opt,name=port"` 3631 3632 // Number or name of the port to access on the pods targeted by the service. 3633 // Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. 3634 // If this is a string, it will be looked up as a named port in the 3635 // target Pod's container ports. If this is not specified, the value 3636 // of the 'port' field is used (an identity map). 3637 // This field is ignored for services with clusterIP=None, and should be 3638 // omitted or set equal to the 'port' field. 3639 // More info: https://kubernetes.io/docs/concepts/services-networking/service/#defining-a-service 3640 // +optional 3641 TargetPort intstr.IntOrString `json:"targetPort,omitempty" protobuf:"bytes,4,opt,name=targetPort"` 3642 3643 // The port on each node on which this service is exposed when type=NodePort or LoadBalancer. 3644 // Usually assigned by the system. If specified, it will be allocated to the service 3645 // if unused or else creation of the service will fail. 3646 // Default is to auto-allocate a port if the ServiceType of this Service requires one. 3647 // More info: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport 3648 // +optional 3649 NodePort int32 `json:"nodePort,omitempty" protobuf:"varint,5,opt,name=nodePort"` 3650} 3651 3652// +genclient 3653// +genclient:skipVerbs=deleteCollection 3654// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 3655 3656// Service is a named abstraction of software service (for example, mysql) consisting of local port 3657// (for example 3306) that the proxy listens on, and the selector that determines which pods 3658// will answer requests sent through the proxy. 3659type Service struct { 3660 metav1.TypeMeta `json:",inline"` 3661 // Standard object's metadata. 3662 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata 3663 // +optional 3664 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 3665 3666 // Spec defines the behavior of a service. 3667 // https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status 3668 // +optional 3669 Spec ServiceSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` 3670 3671 // Most recently observed status of the service. 3672 // Populated by the system. 3673 // Read-only. 3674 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status 3675 // +optional 3676 Status ServiceStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` 3677} 3678 3679const ( 3680 // ClusterIPNone - do not assign a cluster IP 3681 // no proxying required and no environment variables should be created for pods 3682 ClusterIPNone = "None" 3683) 3684 3685// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 3686 3687// ServiceList holds a list of services. 3688type ServiceList struct { 3689 metav1.TypeMeta `json:",inline"` 3690 // Standard list metadata. 3691 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds 3692 // +optional 3693 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 3694 3695 // List of services 3696 Items []Service `json:"items" protobuf:"bytes,2,rep,name=items"` 3697} 3698 3699// +genclient 3700// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 3701 3702// ServiceAccount binds together: 3703// * a name, understood by users, and perhaps by peripheral systems, for an identity 3704// * a principal that can be authenticated and authorized 3705// * a set of secrets 3706type ServiceAccount struct { 3707 metav1.TypeMeta `json:",inline"` 3708 // Standard object's metadata. 3709 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata 3710 // +optional 3711 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 3712 3713 // Secrets is the list of secrets allowed to be used by pods running using this ServiceAccount. 3714 // More info: https://kubernetes.io/docs/concepts/configuration/secret 3715 // +optional 3716 // +patchMergeKey=name 3717 // +patchStrategy=merge 3718 Secrets []ObjectReference `json:"secrets,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,2,rep,name=secrets"` 3719 3720 // ImagePullSecrets is a list of references to secrets in the same namespace to use for pulling any images 3721 // in pods that reference this ServiceAccount. ImagePullSecrets are distinct from Secrets because Secrets 3722 // can be mounted in the pod, but ImagePullSecrets are only accessed by the kubelet. 3723 // More info: https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod 3724 // +optional 3725 ImagePullSecrets []LocalObjectReference `json:"imagePullSecrets,omitempty" protobuf:"bytes,3,rep,name=imagePullSecrets"` 3726 3727 // AutomountServiceAccountToken indicates whether pods running as this service account should have an API token automatically mounted. 3728 // Can be overridden at the pod level. 3729 // +optional 3730 AutomountServiceAccountToken *bool `json:"automountServiceAccountToken,omitempty" protobuf:"varint,4,opt,name=automountServiceAccountToken"` 3731} 3732 3733// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 3734 3735// ServiceAccountList is a list of ServiceAccount objects 3736type ServiceAccountList struct { 3737 metav1.TypeMeta `json:",inline"` 3738 // Standard list metadata. 3739 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds 3740 // +optional 3741 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 3742 3743 // List of ServiceAccounts. 3744 // More info: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/ 3745 Items []ServiceAccount `json:"items" protobuf:"bytes,2,rep,name=items"` 3746} 3747 3748// +genclient 3749// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 3750 3751// Endpoints is a collection of endpoints that implement the actual service. Example: 3752// Name: "mysvc", 3753// Subsets: [ 3754// { 3755// Addresses: [{"ip": "10.10.1.1"}, {"ip": "10.10.2.2"}], 3756// Ports: [{"name": "a", "port": 8675}, {"name": "b", "port": 309}] 3757// }, 3758// { 3759// Addresses: [{"ip": "10.10.3.3"}], 3760// Ports: [{"name": "a", "port": 93}, {"name": "b", "port": 76}] 3761// }, 3762// ] 3763type Endpoints struct { 3764 metav1.TypeMeta `json:",inline"` 3765 // Standard object's metadata. 3766 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata 3767 // +optional 3768 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 3769 3770 // The set of all endpoints is the union of all subsets. Addresses are placed into 3771 // subsets according to the IPs they share. A single address with multiple ports, 3772 // some of which are ready and some of which are not (because they come from 3773 // different containers) will result in the address being displayed in different 3774 // subsets for the different ports. No address will appear in both Addresses and 3775 // NotReadyAddresses in the same subset. 3776 // Sets of addresses and ports that comprise a service. 3777 // +optional 3778 Subsets []EndpointSubset `json:"subsets,omitempty" protobuf:"bytes,2,rep,name=subsets"` 3779} 3780 3781// EndpointSubset is a group of addresses with a common set of ports. The 3782// expanded set of endpoints is the Cartesian product of Addresses x Ports. 3783// For example, given: 3784// { 3785// Addresses: [{"ip": "10.10.1.1"}, {"ip": "10.10.2.2"}], 3786// Ports: [{"name": "a", "port": 8675}, {"name": "b", "port": 309}] 3787// } 3788// The resulting set of endpoints can be viewed as: 3789// a: [ 10.10.1.1:8675, 10.10.2.2:8675 ], 3790// b: [ 10.10.1.1:309, 10.10.2.2:309 ] 3791type EndpointSubset struct { 3792 // IP addresses which offer the related ports that are marked as ready. These endpoints 3793 // should be considered safe for load balancers and clients to utilize. 3794 // +optional 3795 Addresses []EndpointAddress `json:"addresses,omitempty" protobuf:"bytes,1,rep,name=addresses"` 3796 // IP addresses which offer the related ports but are not currently marked as ready 3797 // because they have not yet finished starting, have recently failed a readiness check, 3798 // or have recently failed a liveness check. 3799 // +optional 3800 NotReadyAddresses []EndpointAddress `json:"notReadyAddresses,omitempty" protobuf:"bytes,2,rep,name=notReadyAddresses"` 3801 // Port numbers available on the related IP addresses. 3802 // +optional 3803 Ports []EndpointPort `json:"ports,omitempty" protobuf:"bytes,3,rep,name=ports"` 3804} 3805 3806// EndpointAddress is a tuple that describes single IP address. 3807type EndpointAddress struct { 3808 // The IP of this endpoint. 3809 // May not be loopback (127.0.0.0/8), link-local (169.254.0.0/16), 3810 // or link-local multicast ((224.0.0.0/24). 3811 // IPv6 is also accepted but not fully supported on all platforms. Also, certain 3812 // kubernetes components, like kube-proxy, are not IPv6 ready. 3813 // TODO: This should allow hostname or IP, See #4447. 3814 IP string `json:"ip" protobuf:"bytes,1,opt,name=ip"` 3815 // The Hostname of this endpoint 3816 // +optional 3817 Hostname string `json:"hostname,omitempty" protobuf:"bytes,3,opt,name=hostname"` 3818 // Optional: Node hosting this endpoint. This can be used to determine endpoints local to a node. 3819 // +optional 3820 NodeName *string `json:"nodeName,omitempty" protobuf:"bytes,4,opt,name=nodeName"` 3821 // Reference to object providing the endpoint. 3822 // +optional 3823 TargetRef *ObjectReference `json:"targetRef,omitempty" protobuf:"bytes,2,opt,name=targetRef"` 3824} 3825 3826// EndpointPort is a tuple that describes a single port. 3827type EndpointPort struct { 3828 // The name of this port (corresponds to ServicePort.Name). 3829 // Must be a DNS_LABEL. 3830 // Optional only if one port is defined. 3831 // +optional 3832 Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"` 3833 3834 // The port number of the endpoint. 3835 Port int32 `json:"port" protobuf:"varint,2,opt,name=port"` 3836 3837 // The IP protocol for this port. 3838 // Must be UDP, TCP, or SCTP. 3839 // Default is TCP. 3840 // +optional 3841 Protocol Protocol `json:"protocol,omitempty" protobuf:"bytes,3,opt,name=protocol,casttype=Protocol"` 3842} 3843 3844// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 3845 3846// EndpointsList is a list of endpoints. 3847type EndpointsList struct { 3848 metav1.TypeMeta `json:",inline"` 3849 // Standard list metadata. 3850 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds 3851 // +optional 3852 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 3853 3854 // List of endpoints. 3855 Items []Endpoints `json:"items" protobuf:"bytes,2,rep,name=items"` 3856} 3857 3858// NodeSpec describes the attributes that a node is created with. 3859type NodeSpec struct { 3860 // PodCIDR represents the pod IP range assigned to the node. 3861 // +optional 3862 PodCIDR string `json:"podCIDR,omitempty" protobuf:"bytes,1,opt,name=podCIDR"` 3863 // ID of the node assigned by the cloud provider in the format: <ProviderName>://<ProviderSpecificNodeID> 3864 // +optional 3865 ProviderID string `json:"providerID,omitempty" protobuf:"bytes,3,opt,name=providerID"` 3866 // Unschedulable controls node schedulability of new pods. By default, node is schedulable. 3867 // More info: https://kubernetes.io/docs/concepts/nodes/node/#manual-node-administration 3868 // +optional 3869 Unschedulable bool `json:"unschedulable,omitempty" protobuf:"varint,4,opt,name=unschedulable"` 3870 // If specified, the node's taints. 3871 // +optional 3872 Taints []Taint `json:"taints,omitempty" protobuf:"bytes,5,opt,name=taints"` 3873 // If specified, the source to get node configuration from 3874 // The DynamicKubeletConfig feature gate must be enabled for the Kubelet to use this field 3875 // +optional 3876 ConfigSource *NodeConfigSource `json:"configSource,omitempty" protobuf:"bytes,6,opt,name=configSource"` 3877 3878 // Deprecated. Not all kubelets will set this field. Remove field after 1.13. 3879 // see: https://issues.k8s.io/61966 3880 // +optional 3881 DoNotUse_ExternalID string `json:"externalID,omitempty" protobuf:"bytes,2,opt,name=externalID"` 3882} 3883 3884// NodeConfigSource specifies a source of node configuration. Exactly one subfield (excluding metadata) must be non-nil. 3885type NodeConfigSource struct { 3886 // For historical context, regarding the below kind, apiVersion, and configMapRef deprecation tags: 3887 // 1. kind/apiVersion were used by the kubelet to persist this struct to disk (they had no protobuf tags) 3888 // 2. configMapRef and proto tag 1 were used by the API to refer to a configmap, 3889 // but used a generic ObjectReference type that didn't really have the fields we needed 3890 // All uses/persistence of the NodeConfigSource struct prior to 1.11 were gated by alpha feature flags, 3891 // so there was no persisted data for these fields that needed to be migrated/handled. 3892 3893 // +k8s:deprecated=kind 3894 // +k8s:deprecated=apiVersion 3895 // +k8s:deprecated=configMapRef,protobuf=1 3896 3897 // ConfigMap is a reference to a Node's ConfigMap 3898 ConfigMap *ConfigMapNodeConfigSource `json:"configMap,omitempty" protobuf:"bytes,2,opt,name=configMap"` 3899} 3900 3901// ConfigMapNodeConfigSource contains the information to reference a ConfigMap as a config source for the Node. 3902type ConfigMapNodeConfigSource struct { 3903 // Namespace is the metadata.namespace of the referenced ConfigMap. 3904 // This field is required in all cases. 3905 Namespace string `json:"namespace" protobuf:"bytes,1,opt,name=namespace"` 3906 3907 // Name is the metadata.name of the referenced ConfigMap. 3908 // This field is required in all cases. 3909 Name string `json:"name" protobuf:"bytes,2,opt,name=name"` 3910 3911 // UID is the metadata.UID of the referenced ConfigMap. 3912 // This field is forbidden in Node.Spec, and required in Node.Status. 3913 // +optional 3914 UID types.UID `json:"uid,omitempty" protobuf:"bytes,3,opt,name=uid"` 3915 3916 // ResourceVersion is the metadata.ResourceVersion of the referenced ConfigMap. 3917 // This field is forbidden in Node.Spec, and required in Node.Status. 3918 // +optional 3919 ResourceVersion string `json:"resourceVersion,omitempty" protobuf:"bytes,4,opt,name=resourceVersion"` 3920 3921 // KubeletConfigKey declares which key of the referenced ConfigMap corresponds to the KubeletConfiguration structure 3922 // This field is required in all cases. 3923 KubeletConfigKey string `json:"kubeletConfigKey" protobuf:"bytes,5,opt,name=kubeletConfigKey"` 3924} 3925 3926// DaemonEndpoint contains information about a single Daemon endpoint. 3927type DaemonEndpoint struct { 3928 /* 3929 The port tag was not properly in quotes in earlier releases, so it must be 3930 uppercased for backwards compat (since it was falling back to var name of 3931 'Port'). 3932 */ 3933 3934 // Port number of the given endpoint. 3935 Port int32 `json:"Port" protobuf:"varint,1,opt,name=Port"` 3936} 3937 3938// NodeDaemonEndpoints lists ports opened by daemons running on the Node. 3939type NodeDaemonEndpoints struct { 3940 // Endpoint on which Kubelet is listening. 3941 // +optional 3942 KubeletEndpoint DaemonEndpoint `json:"kubeletEndpoint,omitempty" protobuf:"bytes,1,opt,name=kubeletEndpoint"` 3943} 3944 3945// NodeSystemInfo is a set of ids/uuids to uniquely identify the node. 3946type NodeSystemInfo struct { 3947 // MachineID reported by the node. For unique machine identification 3948 // in the cluster this field is preferred. Learn more from man(5) 3949 // machine-id: http://man7.org/linux/man-pages/man5/machine-id.5.html 3950 MachineID string `json:"machineID" protobuf:"bytes,1,opt,name=machineID"` 3951 // SystemUUID reported by the node. For unique machine identification 3952 // MachineID is preferred. This field is specific to Red Hat hosts 3953 // https://access.redhat.com/documentation/en-US/Red_Hat_Subscription_Management/1/html/RHSM/getting-system-uuid.html 3954 SystemUUID string `json:"systemUUID" protobuf:"bytes,2,opt,name=systemUUID"` 3955 // Boot ID reported by the node. 3956 BootID string `json:"bootID" protobuf:"bytes,3,opt,name=bootID"` 3957 // Kernel Version reported by the node from 'uname -r' (e.g. 3.16.0-0.bpo.4-amd64). 3958 KernelVersion string `json:"kernelVersion" protobuf:"bytes,4,opt,name=kernelVersion"` 3959 // OS Image reported by the node from /etc/os-release (e.g. Debian GNU/Linux 7 (wheezy)). 3960 OSImage string `json:"osImage" protobuf:"bytes,5,opt,name=osImage"` 3961 // ContainerRuntime Version reported by the node through runtime remote API (e.g. docker://1.5.0). 3962 ContainerRuntimeVersion string `json:"containerRuntimeVersion" protobuf:"bytes,6,opt,name=containerRuntimeVersion"` 3963 // Kubelet Version reported by the node. 3964 KubeletVersion string `json:"kubeletVersion" protobuf:"bytes,7,opt,name=kubeletVersion"` 3965 // KubeProxy Version reported by the node. 3966 KubeProxyVersion string `json:"kubeProxyVersion" protobuf:"bytes,8,opt,name=kubeProxyVersion"` 3967 // The Operating System reported by the node 3968 OperatingSystem string `json:"operatingSystem" protobuf:"bytes,9,opt,name=operatingSystem"` 3969 // The Architecture reported by the node 3970 Architecture string `json:"architecture" protobuf:"bytes,10,opt,name=architecture"` 3971} 3972 3973// NodeConfigStatus describes the status of the config assigned by Node.Spec.ConfigSource. 3974type NodeConfigStatus struct { 3975 // Assigned reports the checkpointed config the node will try to use. 3976 // When Node.Spec.ConfigSource is updated, the node checkpoints the associated 3977 // config payload to local disk, along with a record indicating intended 3978 // config. The node refers to this record to choose its config checkpoint, and 3979 // reports this record in Assigned. Assigned only updates in the status after 3980 // the record has been checkpointed to disk. When the Kubelet is restarted, 3981 // it tries to make the Assigned config the Active config by loading and 3982 // validating the checkpointed payload identified by Assigned. 3983 // +optional 3984 Assigned *NodeConfigSource `json:"assigned,omitempty" protobuf:"bytes,1,opt,name=assigned"` 3985 // Active reports the checkpointed config the node is actively using. 3986 // Active will represent either the current version of the Assigned config, 3987 // or the current LastKnownGood config, depending on whether attempting to use the 3988 // Assigned config results in an error. 3989 // +optional 3990 Active *NodeConfigSource `json:"active,omitempty" protobuf:"bytes,2,opt,name=active"` 3991 // LastKnownGood reports the checkpointed config the node will fall back to 3992 // when it encounters an error attempting to use the Assigned config. 3993 // The Assigned config becomes the LastKnownGood config when the node determines 3994 // that the Assigned config is stable and correct. 3995 // This is currently implemented as a 10-minute soak period starting when the local 3996 // record of Assigned config is updated. If the Assigned config is Active at the end 3997 // of this period, it becomes the LastKnownGood. Note that if Spec.ConfigSource is 3998 // reset to nil (use local defaults), the LastKnownGood is also immediately reset to nil, 3999 // because the local default config is always assumed good. 4000 // You should not make assumptions about the node's method of determining config stability 4001 // and correctness, as this may change or become configurable in the future. 4002 // +optional 4003 LastKnownGood *NodeConfigSource `json:"lastKnownGood,omitempty" protobuf:"bytes,3,opt,name=lastKnownGood"` 4004 // Error describes any problems reconciling the Spec.ConfigSource to the Active config. 4005 // Errors may occur, for example, attempting to checkpoint Spec.ConfigSource to the local Assigned 4006 // record, attempting to checkpoint the payload associated with Spec.ConfigSource, attempting 4007 // to load or validate the Assigned config, etc. 4008 // Errors may occur at different points while syncing config. Earlier errors (e.g. download or 4009 // checkpointing errors) will not result in a rollback to LastKnownGood, and may resolve across 4010 // Kubelet retries. Later errors (e.g. loading or validating a checkpointed config) will result in 4011 // a rollback to LastKnownGood. In the latter case, it is usually possible to resolve the error 4012 // by fixing the config assigned in Spec.ConfigSource. 4013 // You can find additional information for debugging by searching the error message in the Kubelet log. 4014 // Error is a human-readable description of the error state; machines can check whether or not Error 4015 // is empty, but should not rely on the stability of the Error text across Kubelet versions. 4016 // +optional 4017 Error string `json:"error,omitempty" protobuf:"bytes,4,opt,name=error"` 4018} 4019 4020// NodeStatus is information about the current status of a node. 4021type NodeStatus struct { 4022 // Capacity represents the total resources of a node. 4023 // More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#capacity 4024 // +optional 4025 Capacity ResourceList `json:"capacity,omitempty" protobuf:"bytes,1,rep,name=capacity,casttype=ResourceList,castkey=ResourceName"` 4026 // Allocatable represents the resources of a node that are available for scheduling. 4027 // Defaults to Capacity. 4028 // +optional 4029 Allocatable ResourceList `json:"allocatable,omitempty" protobuf:"bytes,2,rep,name=allocatable,casttype=ResourceList,castkey=ResourceName"` 4030 // NodePhase is the recently observed lifecycle phase of the node. 4031 // More info: https://kubernetes.io/docs/concepts/nodes/node/#phase 4032 // The field is never populated, and now is deprecated. 4033 // +optional 4034 Phase NodePhase `json:"phase,omitempty" protobuf:"bytes,3,opt,name=phase,casttype=NodePhase"` 4035 // Conditions is an array of current observed node conditions. 4036 // More info: https://kubernetes.io/docs/concepts/nodes/node/#condition 4037 // +optional 4038 // +patchMergeKey=type 4039 // +patchStrategy=merge 4040 Conditions []NodeCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,4,rep,name=conditions"` 4041 // List of addresses reachable to the node. 4042 // Queried from cloud provider, if available. 4043 // More info: https://kubernetes.io/docs/concepts/nodes/node/#addresses 4044 // +optional 4045 // +patchMergeKey=type 4046 // +patchStrategy=merge 4047 Addresses []NodeAddress `json:"addresses,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,5,rep,name=addresses"` 4048 // Endpoints of daemons running on the Node. 4049 // +optional 4050 DaemonEndpoints NodeDaemonEndpoints `json:"daemonEndpoints,omitempty" protobuf:"bytes,6,opt,name=daemonEndpoints"` 4051 // Set of ids/uuids to uniquely identify the node. 4052 // More info: https://kubernetes.io/docs/concepts/nodes/node/#info 4053 // +optional 4054 NodeInfo NodeSystemInfo `json:"nodeInfo,omitempty" protobuf:"bytes,7,opt,name=nodeInfo"` 4055 // List of container images on this node 4056 // +optional 4057 Images []ContainerImage `json:"images,omitempty" protobuf:"bytes,8,rep,name=images"` 4058 // List of attachable volumes in use (mounted) by the node. 4059 // +optional 4060 VolumesInUse []UniqueVolumeName `json:"volumesInUse,omitempty" protobuf:"bytes,9,rep,name=volumesInUse"` 4061 // List of volumes that are attached to the node. 4062 // +optional 4063 VolumesAttached []AttachedVolume `json:"volumesAttached,omitempty" protobuf:"bytes,10,rep,name=volumesAttached"` 4064 // Status of the config assigned to the node via the dynamic Kubelet config feature. 4065 // +optional 4066 Config *NodeConfigStatus `json:"config,omitempty" protobuf:"bytes,11,opt,name=config"` 4067} 4068 4069type UniqueVolumeName string 4070 4071// AttachedVolume describes a volume attached to a node 4072type AttachedVolume struct { 4073 // Name of the attached volume 4074 Name UniqueVolumeName `json:"name" protobuf:"bytes,1,rep,name=name"` 4075 4076 // DevicePath represents the device path where the volume should be available 4077 DevicePath string `json:"devicePath" protobuf:"bytes,2,rep,name=devicePath"` 4078} 4079 4080// AvoidPods describes pods that should avoid this node. This is the value for a 4081// Node annotation with key scheduler.alpha.kubernetes.io/preferAvoidPods and 4082// will eventually become a field of NodeStatus. 4083type AvoidPods struct { 4084 // Bounded-sized list of signatures of pods that should avoid this node, sorted 4085 // in timestamp order from oldest to newest. Size of the slice is unspecified. 4086 // +optional 4087 PreferAvoidPods []PreferAvoidPodsEntry `json:"preferAvoidPods,omitempty" protobuf:"bytes,1,rep,name=preferAvoidPods"` 4088} 4089 4090// Describes a class of pods that should avoid this node. 4091type PreferAvoidPodsEntry struct { 4092 // The class of pods. 4093 PodSignature PodSignature `json:"podSignature" protobuf:"bytes,1,opt,name=podSignature"` 4094 // Time at which this entry was added to the list. 4095 // +optional 4096 EvictionTime metav1.Time `json:"evictionTime,omitempty" protobuf:"bytes,2,opt,name=evictionTime"` 4097 // (brief) reason why this entry was added to the list. 4098 // +optional 4099 Reason string `json:"reason,omitempty" protobuf:"bytes,3,opt,name=reason"` 4100 // Human readable message indicating why this entry was added to the list. 4101 // +optional 4102 Message string `json:"message,omitempty" protobuf:"bytes,4,opt,name=message"` 4103} 4104 4105// Describes the class of pods that should avoid this node. 4106// Exactly one field should be set. 4107type PodSignature struct { 4108 // Reference to controller whose pods should avoid this node. 4109 // +optional 4110 PodController *metav1.OwnerReference `json:"podController,omitempty" protobuf:"bytes,1,opt,name=podController"` 4111} 4112 4113// Describe a container image 4114type ContainerImage struct { 4115 // Names by which this image is known. 4116 // e.g. ["k8s.gcr.io/hyperkube:v1.0.7", "dockerhub.io/google_containers/hyperkube:v1.0.7"] 4117 Names []string `json:"names" protobuf:"bytes,1,rep,name=names"` 4118 // The size of the image in bytes. 4119 // +optional 4120 SizeBytes int64 `json:"sizeBytes,omitempty" protobuf:"varint,2,opt,name=sizeBytes"` 4121} 4122 4123type NodePhase string 4124 4125// These are the valid phases of node. 4126const ( 4127 // NodePending means the node has been created/added by the system, but not configured. 4128 NodePending NodePhase = "Pending" 4129 // NodeRunning means the node has been configured and has Kubernetes components running. 4130 NodeRunning NodePhase = "Running" 4131 // NodeTerminated means the node has been removed from the cluster. 4132 NodeTerminated NodePhase = "Terminated" 4133) 4134 4135type NodeConditionType string 4136 4137// These are valid conditions of node. Currently, we don't have enough information to decide 4138// node condition. In the future, we will add more. The proposed set of conditions are: 4139// NodeReachable, NodeLive, NodeReady, NodeSchedulable, NodeRunnable. 4140const ( 4141 // NodeReady means kubelet is healthy and ready to accept pods. 4142 NodeReady NodeConditionType = "Ready" 4143 // NodeOutOfDisk means the kubelet will not accept new pods due to insufficient free disk 4144 // space on the node. 4145 NodeOutOfDisk NodeConditionType = "OutOfDisk" 4146 // NodeMemoryPressure means the kubelet is under pressure due to insufficient available memory. 4147 NodeMemoryPressure NodeConditionType = "MemoryPressure" 4148 // NodeDiskPressure means the kubelet is under pressure due to insufficient available disk. 4149 NodeDiskPressure NodeConditionType = "DiskPressure" 4150 // NodePIDPressure means the kubelet is under pressure due to insufficient available PID. 4151 NodePIDPressure NodeConditionType = "PIDPressure" 4152 // NodeNetworkUnavailable means that network for the node is not correctly configured. 4153 NodeNetworkUnavailable NodeConditionType = "NetworkUnavailable" 4154) 4155 4156// NodeCondition contains condition information for a node. 4157type NodeCondition struct { 4158 // Type of node condition. 4159 Type NodeConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=NodeConditionType"` 4160 // Status of the condition, one of True, False, Unknown. 4161 Status ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=ConditionStatus"` 4162 // Last time we got an update on a given condition. 4163 // +optional 4164 LastHeartbeatTime metav1.Time `json:"lastHeartbeatTime,omitempty" protobuf:"bytes,3,opt,name=lastHeartbeatTime"` 4165 // Last time the condition transit from one status to another. 4166 // +optional 4167 LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,4,opt,name=lastTransitionTime"` 4168 // (brief) reason for the condition's last transition. 4169 // +optional 4170 Reason string `json:"reason,omitempty" protobuf:"bytes,5,opt,name=reason"` 4171 // Human readable message indicating details about last transition. 4172 // +optional 4173 Message string `json:"message,omitempty" protobuf:"bytes,6,opt,name=message"` 4174} 4175 4176type NodeAddressType string 4177 4178// These are valid address type of node. 4179const ( 4180 NodeHostName NodeAddressType = "Hostname" 4181 NodeExternalIP NodeAddressType = "ExternalIP" 4182 NodeInternalIP NodeAddressType = "InternalIP" 4183 NodeExternalDNS NodeAddressType = "ExternalDNS" 4184 NodeInternalDNS NodeAddressType = "InternalDNS" 4185) 4186 4187// NodeAddress contains information for the node's address. 4188type NodeAddress struct { 4189 // Node address type, one of Hostname, ExternalIP or InternalIP. 4190 Type NodeAddressType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=NodeAddressType"` 4191 // The node address. 4192 Address string `json:"address" protobuf:"bytes,2,opt,name=address"` 4193} 4194 4195// ResourceName is the name identifying various resources in a ResourceList. 4196type ResourceName string 4197 4198// Resource names must be not more than 63 characters, consisting of upper- or lower-case alphanumeric characters, 4199// with the -, _, and . characters allowed anywhere, except the first or last character. 4200// The default convention, matching that for annotations, is to use lower-case names, with dashes, rather than 4201// camel case, separating compound words. 4202// Fully-qualified resource typenames are constructed from a DNS-style subdomain, followed by a slash `/` and a name. 4203const ( 4204 // CPU, in cores. (500m = .5 cores) 4205 ResourceCPU ResourceName = "cpu" 4206 // Memory, in bytes. (500Gi = 500GiB = 500 * 1024 * 1024 * 1024) 4207 ResourceMemory ResourceName = "memory" 4208 // Volume size, in bytes (e,g. 5Gi = 5GiB = 5 * 1024 * 1024 * 1024) 4209 ResourceStorage ResourceName = "storage" 4210 // Local ephemeral storage, in bytes. (500Gi = 500GiB = 500 * 1024 * 1024 * 1024) 4211 // The resource name for ResourceEphemeralStorage is alpha and it can change across releases. 4212 ResourceEphemeralStorage ResourceName = "ephemeral-storage" 4213) 4214 4215const ( 4216 // Default namespace prefix. 4217 ResourceDefaultNamespacePrefix = "kubernetes.io/" 4218 // Name prefix for huge page resources (alpha). 4219 ResourceHugePagesPrefix = "hugepages-" 4220 // Name prefix for storage resource limits 4221 ResourceAttachableVolumesPrefix = "attachable-volumes-" 4222) 4223 4224// ResourceList is a set of (resource name, quantity) pairs. 4225type ResourceList map[ResourceName]resource.Quantity 4226 4227// +genclient 4228// +genclient:nonNamespaced 4229// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 4230 4231// Node is a worker node in Kubernetes. 4232// Each node will have a unique identifier in the cache (i.e. in etcd). 4233type Node struct { 4234 metav1.TypeMeta `json:",inline"` 4235 // Standard object's metadata. 4236 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata 4237 // +optional 4238 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 4239 4240 // Spec defines the behavior of a node. 4241 // https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status 4242 // +optional 4243 Spec NodeSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` 4244 4245 // Most recently observed status of the node. 4246 // Populated by the system. 4247 // Read-only. 4248 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status 4249 // +optional 4250 Status NodeStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` 4251} 4252 4253// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 4254 4255// NodeList is the whole list of all Nodes which have been registered with master. 4256type NodeList struct { 4257 metav1.TypeMeta `json:",inline"` 4258 // Standard list metadata. 4259 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds 4260 // +optional 4261 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 4262 4263 // List of nodes 4264 Items []Node `json:"items" protobuf:"bytes,2,rep,name=items"` 4265} 4266 4267// FinalizerName is the name identifying a finalizer during namespace lifecycle. 4268type FinalizerName string 4269 4270// These are internal finalizer values to Kubernetes, must be qualified name unless defined here or 4271// in metav1. 4272const ( 4273 FinalizerKubernetes FinalizerName = "kubernetes" 4274) 4275 4276// NamespaceSpec describes the attributes on a Namespace. 4277type NamespaceSpec struct { 4278 // Finalizers is an opaque list of values that must be empty to permanently remove object from storage. 4279 // More info: https://kubernetes.io/docs/tasks/administer-cluster/namespaces/ 4280 // +optional 4281 Finalizers []FinalizerName `json:"finalizers,omitempty" protobuf:"bytes,1,rep,name=finalizers,casttype=FinalizerName"` 4282} 4283 4284// NamespaceStatus is information about the current status of a Namespace. 4285type NamespaceStatus struct { 4286 // Phase is the current lifecycle phase of the namespace. 4287 // More info: https://kubernetes.io/docs/tasks/administer-cluster/namespaces/ 4288 // +optional 4289 Phase NamespacePhase `json:"phase,omitempty" protobuf:"bytes,1,opt,name=phase,casttype=NamespacePhase"` 4290} 4291 4292type NamespacePhase string 4293 4294// These are the valid phases of a namespace. 4295const ( 4296 // NamespaceActive means the namespace is available for use in the system 4297 NamespaceActive NamespacePhase = "Active" 4298 // NamespaceTerminating means the namespace is undergoing graceful termination 4299 NamespaceTerminating NamespacePhase = "Terminating" 4300) 4301 4302// +genclient 4303// +genclient:nonNamespaced 4304// +genclient:skipVerbs=deleteCollection 4305// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 4306 4307// Namespace provides a scope for Names. 4308// Use of multiple namespaces is optional. 4309type Namespace struct { 4310 metav1.TypeMeta `json:",inline"` 4311 // Standard object's metadata. 4312 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata 4313 // +optional 4314 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 4315 4316 // Spec defines the behavior of the Namespace. 4317 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status 4318 // +optional 4319 Spec NamespaceSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` 4320 4321 // Status describes the current status of a Namespace. 4322 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status 4323 // +optional 4324 Status NamespaceStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` 4325} 4326 4327// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 4328 4329// NamespaceList is a list of Namespaces. 4330type NamespaceList struct { 4331 metav1.TypeMeta `json:",inline"` 4332 // Standard list metadata. 4333 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds 4334 // +optional 4335 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 4336 4337 // Items is the list of Namespace objects in the list. 4338 // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ 4339 Items []Namespace `json:"items" protobuf:"bytes,2,rep,name=items"` 4340} 4341 4342// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 4343 4344// Binding ties one object to another; for example, a pod is bound to a node by a scheduler. 4345// Deprecated in 1.7, please use the bindings subresource of pods instead. 4346type Binding struct { 4347 metav1.TypeMeta `json:",inline"` 4348 // Standard object's metadata. 4349 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata 4350 // +optional 4351 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 4352 4353 // The target object that you want to bind to the standard object. 4354 Target ObjectReference `json:"target" protobuf:"bytes,2,opt,name=target"` 4355} 4356 4357// Preconditions must be fulfilled before an operation (update, delete, etc.) is carried out. 4358// +k8s:openapi-gen=false 4359type Preconditions struct { 4360 // Specifies the target UID. 4361 // +optional 4362 UID *types.UID `json:"uid,omitempty" protobuf:"bytes,1,opt,name=uid,casttype=k8s.io/apimachinery/pkg/types.UID"` 4363} 4364 4365// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 4366 4367// PodLogOptions is the query options for a Pod's logs REST call. 4368type PodLogOptions struct { 4369 metav1.TypeMeta `json:",inline"` 4370 4371 // The container for which to stream logs. Defaults to only container if there is one container in the pod. 4372 // +optional 4373 Container string `json:"container,omitempty" protobuf:"bytes,1,opt,name=container"` 4374 // Follow the log stream of the pod. Defaults to false. 4375 // +optional 4376 Follow bool `json:"follow,omitempty" protobuf:"varint,2,opt,name=follow"` 4377 // Return previous terminated container logs. Defaults to false. 4378 // +optional 4379 Previous bool `json:"previous,omitempty" protobuf:"varint,3,opt,name=previous"` 4380 // A relative time in seconds before the current time from which to show logs. If this value 4381 // precedes the time a pod was started, only logs since the pod start will be returned. 4382 // If this value is in the future, no logs will be returned. 4383 // Only one of sinceSeconds or sinceTime may be specified. 4384 // +optional 4385 SinceSeconds *int64 `json:"sinceSeconds,omitempty" protobuf:"varint,4,opt,name=sinceSeconds"` 4386 // An RFC3339 timestamp from which to show logs. If this value 4387 // precedes the time a pod was started, only logs since the pod start will be returned. 4388 // If this value is in the future, no logs will be returned. 4389 // Only one of sinceSeconds or sinceTime may be specified. 4390 // +optional 4391 SinceTime *metav1.Time `json:"sinceTime,omitempty" protobuf:"bytes,5,opt,name=sinceTime"` 4392 // If true, add an RFC3339 or RFC3339Nano timestamp at the beginning of every line 4393 // of log output. Defaults to false. 4394 // +optional 4395 Timestamps bool `json:"timestamps,omitempty" protobuf:"varint,6,opt,name=timestamps"` 4396 // If set, the number of lines from the end of the logs to show. If not specified, 4397 // logs are shown from the creation of the container or sinceSeconds or sinceTime 4398 // +optional 4399 TailLines *int64 `json:"tailLines,omitempty" protobuf:"varint,7,opt,name=tailLines"` 4400 // If set, the number of bytes to read from the server before terminating the 4401 // log output. This may not display a complete final line of logging, and may return 4402 // slightly more or slightly less than the specified limit. 4403 // +optional 4404 LimitBytes *int64 `json:"limitBytes,omitempty" protobuf:"varint,8,opt,name=limitBytes"` 4405} 4406 4407// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 4408 4409// PodAttachOptions is the query options to a Pod's remote attach call. 4410// --- 4411// TODO: merge w/ PodExecOptions below for stdin, stdout, etc 4412// and also when we cut V2, we should export a "StreamOptions" or somesuch that contains Stdin, Stdout, Stder and TTY 4413type PodAttachOptions struct { 4414 metav1.TypeMeta `json:",inline"` 4415 4416 // Stdin if true, redirects the standard input stream of the pod for this call. 4417 // Defaults to false. 4418 // +optional 4419 Stdin bool `json:"stdin,omitempty" protobuf:"varint,1,opt,name=stdin"` 4420 4421 // Stdout if true indicates that stdout is to be redirected for the attach call. 4422 // Defaults to true. 4423 // +optional 4424 Stdout bool `json:"stdout,omitempty" protobuf:"varint,2,opt,name=stdout"` 4425 4426 // Stderr if true indicates that stderr is to be redirected for the attach call. 4427 // Defaults to true. 4428 // +optional 4429 Stderr bool `json:"stderr,omitempty" protobuf:"varint,3,opt,name=stderr"` 4430 4431 // TTY if true indicates that a tty will be allocated for the attach call. 4432 // This is passed through the container runtime so the tty 4433 // is allocated on the worker node by the container runtime. 4434 // Defaults to false. 4435 // +optional 4436 TTY bool `json:"tty,omitempty" protobuf:"varint,4,opt,name=tty"` 4437 4438 // The container in which to execute the command. 4439 // Defaults to only container if there is only one container in the pod. 4440 // +optional 4441 Container string `json:"container,omitempty" protobuf:"bytes,5,opt,name=container"` 4442} 4443 4444// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 4445 4446// PodExecOptions is the query options to a Pod's remote exec call. 4447// --- 4448// TODO: This is largely identical to PodAttachOptions above, make sure they stay in sync and see about merging 4449// and also when we cut V2, we should export a "StreamOptions" or somesuch that contains Stdin, Stdout, Stder and TTY 4450type PodExecOptions struct { 4451 metav1.TypeMeta `json:",inline"` 4452 4453 // Redirect the standard input stream of the pod for this call. 4454 // Defaults to false. 4455 // +optional 4456 Stdin bool `json:"stdin,omitempty" protobuf:"varint,1,opt,name=stdin"` 4457 4458 // Redirect the standard output stream of the pod for this call. 4459 // Defaults to true. 4460 // +optional 4461 Stdout bool `json:"stdout,omitempty" protobuf:"varint,2,opt,name=stdout"` 4462 4463 // Redirect the standard error stream of the pod for this call. 4464 // Defaults to true. 4465 // +optional 4466 Stderr bool `json:"stderr,omitempty" protobuf:"varint,3,opt,name=stderr"` 4467 4468 // TTY if true indicates that a tty will be allocated for the exec call. 4469 // Defaults to false. 4470 // +optional 4471 TTY bool `json:"tty,omitempty" protobuf:"varint,4,opt,name=tty"` 4472 4473 // Container in which to execute the command. 4474 // Defaults to only container if there is only one container in the pod. 4475 // +optional 4476 Container string `json:"container,omitempty" protobuf:"bytes,5,opt,name=container"` 4477 4478 // Command is the remote command to execute. argv array. Not executed within a shell. 4479 Command []string `json:"command" protobuf:"bytes,6,rep,name=command"` 4480} 4481 4482// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 4483 4484// PodPortForwardOptions is the query options to a Pod's port forward call 4485// when using WebSockets. 4486// The `port` query parameter must specify the port or 4487// ports (comma separated) to forward over. 4488// Port forwarding over SPDY does not use these options. It requires the port 4489// to be passed in the `port` header as part of request. 4490type PodPortForwardOptions struct { 4491 metav1.TypeMeta `json:",inline"` 4492 4493 // List of ports to forward 4494 // Required when using WebSockets 4495 // +optional 4496 Ports []int32 `json:"ports,omitempty" protobuf:"varint,1,rep,name=ports"` 4497} 4498 4499// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 4500 4501// PodProxyOptions is the query options to a Pod's proxy call. 4502type PodProxyOptions struct { 4503 metav1.TypeMeta `json:",inline"` 4504 4505 // Path is the URL path to use for the current proxy request to pod. 4506 // +optional 4507 Path string `json:"path,omitempty" protobuf:"bytes,1,opt,name=path"` 4508} 4509 4510// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 4511 4512// NodeProxyOptions is the query options to a Node's proxy call. 4513type NodeProxyOptions struct { 4514 metav1.TypeMeta `json:",inline"` 4515 4516 // Path is the URL path to use for the current proxy request to node. 4517 // +optional 4518 Path string `json:"path,omitempty" protobuf:"bytes,1,opt,name=path"` 4519} 4520 4521// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 4522 4523// ServiceProxyOptions is the query options to a Service's proxy call. 4524type ServiceProxyOptions struct { 4525 metav1.TypeMeta `json:",inline"` 4526 4527 // Path is the part of URLs that include service endpoints, suffixes, 4528 // and parameters to use for the current proxy request to service. 4529 // For example, the whole request URL is 4530 // http://localhost/api/v1/namespaces/kube-system/services/elasticsearch-logging/_search?q=user:kimchy. 4531 // Path is _search?q=user:kimchy. 4532 // +optional 4533 Path string `json:"path,omitempty" protobuf:"bytes,1,opt,name=path"` 4534} 4535 4536// ObjectReference contains enough information to let you inspect or modify the referred object. 4537// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 4538type ObjectReference struct { 4539 // Kind of the referent. 4540 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds 4541 // +optional 4542 Kind string `json:"kind,omitempty" protobuf:"bytes,1,opt,name=kind"` 4543 // Namespace of the referent. 4544 // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ 4545 // +optional 4546 Namespace string `json:"namespace,omitempty" protobuf:"bytes,2,opt,name=namespace"` 4547 // Name of the referent. 4548 // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names 4549 // +optional 4550 Name string `json:"name,omitempty" protobuf:"bytes,3,opt,name=name"` 4551 // UID of the referent. 4552 // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids 4553 // +optional 4554 UID types.UID `json:"uid,omitempty" protobuf:"bytes,4,opt,name=uid,casttype=k8s.io/apimachinery/pkg/types.UID"` 4555 // API version of the referent. 4556 // +optional 4557 APIVersion string `json:"apiVersion,omitempty" protobuf:"bytes,5,opt,name=apiVersion"` 4558 // Specific resourceVersion to which this reference is made, if any. 4559 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency 4560 // +optional 4561 ResourceVersion string `json:"resourceVersion,omitempty" protobuf:"bytes,6,opt,name=resourceVersion"` 4562 4563 // If referring to a piece of an object instead of an entire object, this string 4564 // should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. 4565 // For example, if the object reference is to a container within a pod, this would take on a value like: 4566 // "spec.containers{name}" (where "name" refers to the name of the container that triggered 4567 // the event) or if no container name is specified "spec.containers[2]" (container with 4568 // index 2 in this pod). This syntax is chosen only to have some well-defined way of 4569 // referencing a part of an object. 4570 // TODO: this design is not final and this field is subject to change in the future. 4571 // +optional 4572 FieldPath string `json:"fieldPath,omitempty" protobuf:"bytes,7,opt,name=fieldPath"` 4573} 4574 4575// LocalObjectReference contains enough information to let you locate the 4576// referenced object inside the same namespace. 4577type LocalObjectReference struct { 4578 // Name of the referent. 4579 // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names 4580 // TODO: Add other useful fields. apiVersion, kind, uid? 4581 // +optional 4582 Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"` 4583} 4584 4585// TypedLocalObjectReference contains enough information to let you locate the 4586// typed referenced object inside the same namespace. 4587type TypedLocalObjectReference struct { 4588 // APIGroup is the group for the resource being referenced. 4589 // If APIGroup is not specified, the specified Kind must be in the core API group. 4590 // For any other third-party types, APIGroup is required. 4591 // +optional 4592 APIGroup *string `json:"apiGroup" protobuf:"bytes,1,opt,name=apiGroup"` 4593 // Kind is the type of resource being referenced 4594 Kind string `json:"kind" protobuf:"bytes,2,opt,name=kind"` 4595 // Name is the name of resource being referenced 4596 Name string `json:"name" protobuf:"bytes,3,opt,name=name"` 4597} 4598 4599// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 4600 4601// SerializedReference is a reference to serialized object. 4602type SerializedReference struct { 4603 metav1.TypeMeta `json:",inline"` 4604 // The reference to an object in the system. 4605 // +optional 4606 Reference ObjectReference `json:"reference,omitempty" protobuf:"bytes,1,opt,name=reference"` 4607} 4608 4609// EventSource contains information for an event. 4610type EventSource struct { 4611 // Component from which the event is generated. 4612 // +optional 4613 Component string `json:"component,omitempty" protobuf:"bytes,1,opt,name=component"` 4614 // Node name on which the event is generated. 4615 // +optional 4616 Host string `json:"host,omitempty" protobuf:"bytes,2,opt,name=host"` 4617} 4618 4619// Valid values for event types (new types could be added in future) 4620const ( 4621 // Information only and will not cause any problems 4622 EventTypeNormal string = "Normal" 4623 // These events are to warn that something might go wrong 4624 EventTypeWarning string = "Warning" 4625) 4626 4627// +genclient 4628// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 4629 4630// Event is a report of an event somewhere in the cluster. 4631type Event struct { 4632 metav1.TypeMeta `json:",inline"` 4633 // Standard object's metadata. 4634 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata 4635 metav1.ObjectMeta `json:"metadata" protobuf:"bytes,1,opt,name=metadata"` 4636 4637 // The object that this event is about. 4638 InvolvedObject ObjectReference `json:"involvedObject" protobuf:"bytes,2,opt,name=involvedObject"` 4639 4640 // This should be a short, machine understandable string that gives the reason 4641 // for the transition into the object's current status. 4642 // TODO: provide exact specification for format. 4643 // +optional 4644 Reason string `json:"reason,omitempty" protobuf:"bytes,3,opt,name=reason"` 4645 4646 // A human-readable description of the status of this operation. 4647 // TODO: decide on maximum length. 4648 // +optional 4649 Message string `json:"message,omitempty" protobuf:"bytes,4,opt,name=message"` 4650 4651 // The component reporting this event. Should be a short machine understandable string. 4652 // +optional 4653 Source EventSource `json:"source,omitempty" protobuf:"bytes,5,opt,name=source"` 4654 4655 // The time at which the event was first recorded. (Time of server receipt is in TypeMeta.) 4656 // +optional 4657 FirstTimestamp metav1.Time `json:"firstTimestamp,omitempty" protobuf:"bytes,6,opt,name=firstTimestamp"` 4658 4659 // The time at which the most recent occurrence of this event was recorded. 4660 // +optional 4661 LastTimestamp metav1.Time `json:"lastTimestamp,omitempty" protobuf:"bytes,7,opt,name=lastTimestamp"` 4662 4663 // The number of times this event has occurred. 4664 // +optional 4665 Count int32 `json:"count,omitempty" protobuf:"varint,8,opt,name=count"` 4666 4667 // Type of this event (Normal, Warning), new types could be added in the future 4668 // +optional 4669 Type string `json:"type,omitempty" protobuf:"bytes,9,opt,name=type"` 4670 4671 // Time when this Event was first observed. 4672 // +optional 4673 EventTime metav1.MicroTime `json:"eventTime,omitempty" protobuf:"bytes,10,opt,name=eventTime"` 4674 4675 // Data about the Event series this event represents or nil if it's a singleton Event. 4676 // +optional 4677 Series *EventSeries `json:"series,omitempty" protobuf:"bytes,11,opt,name=series"` 4678 4679 // What action was taken/failed regarding to the Regarding object. 4680 // +optional 4681 Action string `json:"action,omitempty" protobuf:"bytes,12,opt,name=action"` 4682 4683 // Optional secondary object for more complex actions. 4684 // +optional 4685 Related *ObjectReference `json:"related,omitempty" protobuf:"bytes,13,opt,name=related"` 4686 4687 // Name of the controller that emitted this Event, e.g. `kubernetes.io/kubelet`. 4688 // +optional 4689 ReportingController string `json:"reportingComponent" protobuf:"bytes,14,opt,name=reportingComponent"` 4690 4691 // ID of the controller instance, e.g. `kubelet-xyzf`. 4692 // +optional 4693 ReportingInstance string `json:"reportingInstance" protobuf:"bytes,15,opt,name=reportingInstance"` 4694} 4695 4696// EventSeries contain information on series of events, i.e. thing that was/is happening 4697// continuously for some time. 4698type EventSeries struct { 4699 // Number of occurrences in this series up to the last heartbeat time 4700 Count int32 `json:"count,omitempty" protobuf:"varint,1,name=count"` 4701 // Time of the last occurrence observed 4702 LastObservedTime metav1.MicroTime `json:"lastObservedTime,omitempty" protobuf:"bytes,2,name=lastObservedTime"` 4703 // State of this Series: Ongoing or Finished 4704 State EventSeriesState `json:"state,omitempty" protobuf:"bytes,3,name=state"` 4705} 4706 4707type EventSeriesState string 4708 4709const ( 4710 EventSeriesStateOngoing EventSeriesState = "Ongoing" 4711 EventSeriesStateFinished EventSeriesState = "Finished" 4712 EventSeriesStateUnknown EventSeriesState = "Unknown" 4713) 4714 4715// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 4716 4717// EventList is a list of events. 4718type EventList struct { 4719 metav1.TypeMeta `json:",inline"` 4720 // Standard list metadata. 4721 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds 4722 // +optional 4723 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 4724 4725 // List of events 4726 Items []Event `json:"items" protobuf:"bytes,2,rep,name=items"` 4727} 4728 4729// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 4730 4731// List holds a list of objects, which may not be known by the server. 4732type List metav1.List 4733 4734// LimitType is a type of object that is limited 4735type LimitType string 4736 4737const ( 4738 // Limit that applies to all pods in a namespace 4739 LimitTypePod LimitType = "Pod" 4740 // Limit that applies to all containers in a namespace 4741 LimitTypeContainer LimitType = "Container" 4742 // Limit that applies to all persistent volume claims in a namespace 4743 LimitTypePersistentVolumeClaim LimitType = "PersistentVolumeClaim" 4744) 4745 4746// LimitRangeItem defines a min/max usage limit for any resource that matches on kind. 4747type LimitRangeItem struct { 4748 // Type of resource that this limit applies to. 4749 // +optional 4750 Type LimitType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type,casttype=LimitType"` 4751 // Max usage constraints on this kind by resource name. 4752 // +optional 4753 Max ResourceList `json:"max,omitempty" protobuf:"bytes,2,rep,name=max,casttype=ResourceList,castkey=ResourceName"` 4754 // Min usage constraints on this kind by resource name. 4755 // +optional 4756 Min ResourceList `json:"min,omitempty" protobuf:"bytes,3,rep,name=min,casttype=ResourceList,castkey=ResourceName"` 4757 // Default resource requirement limit value by resource name if resource limit is omitted. 4758 // +optional 4759 Default ResourceList `json:"default,omitempty" protobuf:"bytes,4,rep,name=default,casttype=ResourceList,castkey=ResourceName"` 4760 // DefaultRequest is the default resource requirement request value by resource name if resource request is omitted. 4761 // +optional 4762 DefaultRequest ResourceList `json:"defaultRequest,omitempty" protobuf:"bytes,5,rep,name=defaultRequest,casttype=ResourceList,castkey=ResourceName"` 4763 // MaxLimitRequestRatio if specified, the named resource must have a request and limit that are both non-zero where limit divided by request is less than or equal to the enumerated value; this represents the max burst for the named resource. 4764 // +optional 4765 MaxLimitRequestRatio ResourceList `json:"maxLimitRequestRatio,omitempty" protobuf:"bytes,6,rep,name=maxLimitRequestRatio,casttype=ResourceList,castkey=ResourceName"` 4766} 4767 4768// LimitRangeSpec defines a min/max usage limit for resources that match on kind. 4769type LimitRangeSpec struct { 4770 // Limits is the list of LimitRangeItem objects that are enforced. 4771 Limits []LimitRangeItem `json:"limits" protobuf:"bytes,1,rep,name=limits"` 4772} 4773 4774// +genclient 4775// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 4776 4777// LimitRange sets resource usage limits for each kind of resource in a Namespace. 4778type LimitRange struct { 4779 metav1.TypeMeta `json:",inline"` 4780 // Standard object's metadata. 4781 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata 4782 // +optional 4783 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 4784 4785 // Spec defines the limits enforced. 4786 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status 4787 // +optional 4788 Spec LimitRangeSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` 4789} 4790 4791// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 4792 4793// LimitRangeList is a list of LimitRange items. 4794type LimitRangeList struct { 4795 metav1.TypeMeta `json:",inline"` 4796 // Standard list metadata. 4797 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds 4798 // +optional 4799 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 4800 4801 // Items is a list of LimitRange objects. 4802 // More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/ 4803 Items []LimitRange `json:"items" protobuf:"bytes,2,rep,name=items"` 4804} 4805 4806// The following identify resource constants for Kubernetes object types 4807const ( 4808 // Pods, number 4809 ResourcePods ResourceName = "pods" 4810 // Services, number 4811 ResourceServices ResourceName = "services" 4812 // ReplicationControllers, number 4813 ResourceReplicationControllers ResourceName = "replicationcontrollers" 4814 // ResourceQuotas, number 4815 ResourceQuotas ResourceName = "resourcequotas" 4816 // ResourceSecrets, number 4817 ResourceSecrets ResourceName = "secrets" 4818 // ResourceConfigMaps, number 4819 ResourceConfigMaps ResourceName = "configmaps" 4820 // ResourcePersistentVolumeClaims, number 4821 ResourcePersistentVolumeClaims ResourceName = "persistentvolumeclaims" 4822 // ResourceServicesNodePorts, number 4823 ResourceServicesNodePorts ResourceName = "services.nodeports" 4824 // ResourceServicesLoadBalancers, number 4825 ResourceServicesLoadBalancers ResourceName = "services.loadbalancers" 4826 // CPU request, in cores. (500m = .5 cores) 4827 ResourceRequestsCPU ResourceName = "requests.cpu" 4828 // Memory request, in bytes. (500Gi = 500GiB = 500 * 1024 * 1024 * 1024) 4829 ResourceRequestsMemory ResourceName = "requests.memory" 4830 // Storage request, in bytes 4831 ResourceRequestsStorage ResourceName = "requests.storage" 4832 // Local ephemeral storage request, in bytes. (500Gi = 500GiB = 500 * 1024 * 1024 * 1024) 4833 ResourceRequestsEphemeralStorage ResourceName = "requests.ephemeral-storage" 4834 // CPU limit, in cores. (500m = .5 cores) 4835 ResourceLimitsCPU ResourceName = "limits.cpu" 4836 // Memory limit, in bytes. (500Gi = 500GiB = 500 * 1024 * 1024 * 1024) 4837 ResourceLimitsMemory ResourceName = "limits.memory" 4838 // Local ephemeral storage limit, in bytes. (500Gi = 500GiB = 500 * 1024 * 1024 * 1024) 4839 ResourceLimitsEphemeralStorage ResourceName = "limits.ephemeral-storage" 4840) 4841 4842// The following identify resource prefix for Kubernetes object types 4843const ( 4844 // HugePages request, in bytes. (500Gi = 500GiB = 500 * 1024 * 1024 * 1024) 4845 // As burst is not supported for HugePages, we would only quota its request, and ignore the limit. 4846 ResourceRequestsHugePagesPrefix = "requests.hugepages-" 4847 // Default resource requests prefix 4848 DefaultResourceRequestsPrefix = "requests." 4849) 4850 4851// A ResourceQuotaScope defines a filter that must match each object tracked by a quota 4852type ResourceQuotaScope string 4853 4854const ( 4855 // Match all pod objects where spec.activeDeadlineSeconds 4856 ResourceQuotaScopeTerminating ResourceQuotaScope = "Terminating" 4857 // Match all pod objects where !spec.activeDeadlineSeconds 4858 ResourceQuotaScopeNotTerminating ResourceQuotaScope = "NotTerminating" 4859 // Match all pod objects that have best effort quality of service 4860 ResourceQuotaScopeBestEffort ResourceQuotaScope = "BestEffort" 4861 // Match all pod objects that do not have best effort quality of service 4862 ResourceQuotaScopeNotBestEffort ResourceQuotaScope = "NotBestEffort" 4863 // Match all pod objects that have priority class mentioned 4864 ResourceQuotaScopePriorityClass ResourceQuotaScope = "PriorityClass" 4865) 4866 4867// ResourceQuotaSpec defines the desired hard limits to enforce for Quota. 4868type ResourceQuotaSpec struct { 4869 // hard is the set of desired hard limits for each named resource. 4870 // More info: https://kubernetes.io/docs/concepts/policy/resource-quotas/ 4871 // +optional 4872 Hard ResourceList `json:"hard,omitempty" protobuf:"bytes,1,rep,name=hard,casttype=ResourceList,castkey=ResourceName"` 4873 // A collection of filters that must match each object tracked by a quota. 4874 // If not specified, the quota matches all objects. 4875 // +optional 4876 Scopes []ResourceQuotaScope `json:"scopes,omitempty" protobuf:"bytes,2,rep,name=scopes,casttype=ResourceQuotaScope"` 4877 // scopeSelector is also a collection of filters like scopes that must match each object tracked by a quota 4878 // but expressed using ScopeSelectorOperator in combination with possible values. 4879 // For a resource to match, both scopes AND scopeSelector (if specified in spec), must be matched. 4880 // +optional 4881 ScopeSelector *ScopeSelector `json:"scopeSelector,omitempty" protobuf:"bytes,3,opt,name=scopeSelector"` 4882} 4883 4884// A scope selector represents the AND of the selectors represented 4885// by the scoped-resource selector requirements. 4886type ScopeSelector struct { 4887 // A list of scope selector requirements by scope of the resources. 4888 // +optional 4889 MatchExpressions []ScopedResourceSelectorRequirement `json:"matchExpressions,omitempty" protobuf:"bytes,1,rep,name=matchExpressions"` 4890} 4891 4892// A scoped-resource selector requirement is a selector that contains values, a scope name, and an operator 4893// that relates the scope name and values. 4894type ScopedResourceSelectorRequirement struct { 4895 // The name of the scope that the selector applies to. 4896 ScopeName ResourceQuotaScope `json:"scopeName" protobuf:"bytes,1,opt,name=scopeName"` 4897 // Represents a scope's relationship to a set of values. 4898 // Valid operators are In, NotIn, Exists, DoesNotExist. 4899 Operator ScopeSelectorOperator `json:"operator" protobuf:"bytes,2,opt,name=operator,casttype=ScopedResourceSelectorOperator"` 4900 // An array of string values. If the operator is In or NotIn, 4901 // the values array must be non-empty. If the operator is Exists or DoesNotExist, 4902 // the values array must be empty. 4903 // This array is replaced during a strategic merge patch. 4904 // +optional 4905 Values []string `json:"values,omitempty" protobuf:"bytes,3,rep,name=values"` 4906} 4907 4908// A scope selector operator is the set of operators that can be used in 4909// a scope selector requirement. 4910type ScopeSelectorOperator string 4911 4912const ( 4913 ScopeSelectorOpIn ScopeSelectorOperator = "In" 4914 ScopeSelectorOpNotIn ScopeSelectorOperator = "NotIn" 4915 ScopeSelectorOpExists ScopeSelectorOperator = "Exists" 4916 ScopeSelectorOpDoesNotExist ScopeSelectorOperator = "DoesNotExist" 4917) 4918 4919// ResourceQuotaStatus defines the enforced hard limits and observed use. 4920type ResourceQuotaStatus struct { 4921 // Hard is the set of enforced hard limits for each named resource. 4922 // More info: https://kubernetes.io/docs/concepts/policy/resource-quotas/ 4923 // +optional 4924 Hard ResourceList `json:"hard,omitempty" protobuf:"bytes,1,rep,name=hard,casttype=ResourceList,castkey=ResourceName"` 4925 // Used is the current observed total usage of the resource in the namespace. 4926 // +optional 4927 Used ResourceList `json:"used,omitempty" protobuf:"bytes,2,rep,name=used,casttype=ResourceList,castkey=ResourceName"` 4928} 4929 4930// +genclient 4931// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 4932 4933// ResourceQuota sets aggregate quota restrictions enforced per namespace 4934type ResourceQuota struct { 4935 metav1.TypeMeta `json:",inline"` 4936 // Standard object's metadata. 4937 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata 4938 // +optional 4939 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 4940 4941 // Spec defines the desired quota. 4942 // https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status 4943 // +optional 4944 Spec ResourceQuotaSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` 4945 4946 // Status defines the actual enforced quota and its current usage. 4947 // https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status 4948 // +optional 4949 Status ResourceQuotaStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` 4950} 4951 4952// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 4953 4954// ResourceQuotaList is a list of ResourceQuota items. 4955type ResourceQuotaList struct { 4956 metav1.TypeMeta `json:",inline"` 4957 // Standard list metadata. 4958 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds 4959 // +optional 4960 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 4961 4962 // Items is a list of ResourceQuota objects. 4963 // More info: https://kubernetes.io/docs/concepts/policy/resource-quotas/ 4964 Items []ResourceQuota `json:"items" protobuf:"bytes,2,rep,name=items"` 4965} 4966 4967// +genclient 4968// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 4969 4970// Secret holds secret data of a certain type. The total bytes of the values in 4971// the Data field must be less than MaxSecretSize bytes. 4972type Secret struct { 4973 metav1.TypeMeta `json:",inline"` 4974 // Standard object's metadata. 4975 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata 4976 // +optional 4977 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 4978 4979 // Data contains the secret data. Each key must consist of alphanumeric 4980 // characters, '-', '_' or '.'. The serialized form of the secret data is a 4981 // base64 encoded string, representing the arbitrary (possibly non-string) 4982 // data value here. Described in https://tools.ietf.org/html/rfc4648#section-4 4983 // +optional 4984 Data map[string][]byte `json:"data,omitempty" protobuf:"bytes,2,rep,name=data"` 4985 4986 // stringData allows specifying non-binary secret data in string form. 4987 // It is provided as a write-only convenience method. 4988 // All keys and values are merged into the data field on write, overwriting any existing values. 4989 // It is never output when reading from the API. 4990 // +k8s:conversion-gen=false 4991 // +optional 4992 StringData map[string]string `json:"stringData,omitempty" protobuf:"bytes,4,rep,name=stringData"` 4993 4994 // Used to facilitate programmatic handling of secret data. 4995 // +optional 4996 Type SecretType `json:"type,omitempty" protobuf:"bytes,3,opt,name=type,casttype=SecretType"` 4997} 4998 4999const MaxSecretSize = 1 * 1024 * 1024 5000 5001type SecretType string 5002 5003const ( 5004 // SecretTypeOpaque is the default. Arbitrary user-defined data 5005 SecretTypeOpaque SecretType = "Opaque" 5006 5007 // SecretTypeServiceAccountToken contains a token that identifies a service account to the API 5008 // 5009 // Required fields: 5010 // - Secret.Annotations["kubernetes.io/service-account.name"] - the name of the ServiceAccount the token identifies 5011 // - Secret.Annotations["kubernetes.io/service-account.uid"] - the UID of the ServiceAccount the token identifies 5012 // - Secret.Data["token"] - a token that identifies the service account to the API 5013 SecretTypeServiceAccountToken SecretType = "kubernetes.io/service-account-token" 5014 5015 // ServiceAccountNameKey is the key of the required annotation for SecretTypeServiceAccountToken secrets 5016 ServiceAccountNameKey = "kubernetes.io/service-account.name" 5017 // ServiceAccountUIDKey is the key of the required annotation for SecretTypeServiceAccountToken secrets 5018 ServiceAccountUIDKey = "kubernetes.io/service-account.uid" 5019 // ServiceAccountTokenKey is the key of the required data for SecretTypeServiceAccountToken secrets 5020 ServiceAccountTokenKey = "token" 5021 // ServiceAccountKubeconfigKey is the key of the optional kubeconfig data for SecretTypeServiceAccountToken secrets 5022 ServiceAccountKubeconfigKey = "kubernetes.kubeconfig" 5023 // ServiceAccountRootCAKey is the key of the optional root certificate authority for SecretTypeServiceAccountToken secrets 5024 ServiceAccountRootCAKey = "ca.crt" 5025 // ServiceAccountNamespaceKey is the key of the optional namespace to use as the default for namespaced API calls 5026 ServiceAccountNamespaceKey = "namespace" 5027 5028 // SecretTypeDockercfg contains a dockercfg file that follows the same format rules as ~/.dockercfg 5029 // 5030 // Required fields: 5031 // - Secret.Data[".dockercfg"] - a serialized ~/.dockercfg file 5032 SecretTypeDockercfg SecretType = "kubernetes.io/dockercfg" 5033 5034 // DockerConfigKey is the key of the required data for SecretTypeDockercfg secrets 5035 DockerConfigKey = ".dockercfg" 5036 5037 // SecretTypeDockerConfigJson contains a dockercfg file that follows the same format rules as ~/.docker/config.json 5038 // 5039 // Required fields: 5040 // - Secret.Data[".dockerconfigjson"] - a serialized ~/.docker/config.json file 5041 SecretTypeDockerConfigJson SecretType = "kubernetes.io/dockerconfigjson" 5042 5043 // DockerConfigJsonKey is the key of the required data for SecretTypeDockerConfigJson secrets 5044 DockerConfigJsonKey = ".dockerconfigjson" 5045 5046 // SecretTypeBasicAuth contains data needed for basic authentication. 5047 // 5048 // Required at least one of fields: 5049 // - Secret.Data["username"] - username used for authentication 5050 // - Secret.Data["password"] - password or token needed for authentication 5051 SecretTypeBasicAuth SecretType = "kubernetes.io/basic-auth" 5052 5053 // BasicAuthUsernameKey is the key of the username for SecretTypeBasicAuth secrets 5054 BasicAuthUsernameKey = "username" 5055 // BasicAuthPasswordKey is the key of the password or token for SecretTypeBasicAuth secrets 5056 BasicAuthPasswordKey = "password" 5057 5058 // SecretTypeSSHAuth contains data needed for SSH authetication. 5059 // 5060 // Required field: 5061 // - Secret.Data["ssh-privatekey"] - private SSH key needed for authentication 5062 SecretTypeSSHAuth SecretType = "kubernetes.io/ssh-auth" 5063 5064 // SSHAuthPrivateKey is the key of the required SSH private key for SecretTypeSSHAuth secrets 5065 SSHAuthPrivateKey = "ssh-privatekey" 5066 // SecretTypeTLS contains information about a TLS client or server secret. It 5067 // is primarily used with TLS termination of the Ingress resource, but may be 5068 // used in other types. 5069 // 5070 // Required fields: 5071 // - Secret.Data["tls.key"] - TLS private key. 5072 // Secret.Data["tls.crt"] - TLS certificate. 5073 // TODO: Consider supporting different formats, specifying CA/destinationCA. 5074 SecretTypeTLS SecretType = "kubernetes.io/tls" 5075 5076 // TLSCertKey is the key for tls certificates in a TLS secert. 5077 TLSCertKey = "tls.crt" 5078 // TLSPrivateKeyKey is the key for the private key field in a TLS secret. 5079 TLSPrivateKeyKey = "tls.key" 5080 // SecretTypeBootstrapToken is used during the automated bootstrap process (first 5081 // implemented by kubeadm). It stores tokens that are used to sign well known 5082 // ConfigMaps. They are used for authn. 5083 SecretTypeBootstrapToken SecretType = "bootstrap.kubernetes.io/token" 5084) 5085 5086// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 5087 5088// SecretList is a list of Secret. 5089type SecretList struct { 5090 metav1.TypeMeta `json:",inline"` 5091 // Standard list metadata. 5092 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds 5093 // +optional 5094 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 5095 5096 // Items is a list of secret objects. 5097 // More info: https://kubernetes.io/docs/concepts/configuration/secret 5098 Items []Secret `json:"items" protobuf:"bytes,2,rep,name=items"` 5099} 5100 5101// +genclient 5102// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 5103 5104// ConfigMap holds configuration data for pods to consume. 5105type ConfigMap struct { 5106 metav1.TypeMeta `json:",inline"` 5107 // Standard object's metadata. 5108 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata 5109 // +optional 5110 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 5111 5112 // Data contains the configuration data. 5113 // Each key must consist of alphanumeric characters, '-', '_' or '.'. 5114 // Values with non-UTF-8 byte sequences must use the BinaryData field. 5115 // The keys stored in Data must not overlap with the keys in 5116 // the BinaryData field, this is enforced during validation process. 5117 // +optional 5118 Data map[string]string `json:"data,omitempty" protobuf:"bytes,2,rep,name=data"` 5119 5120 // BinaryData contains the binary data. 5121 // Each key must consist of alphanumeric characters, '-', '_' or '.'. 5122 // BinaryData can contain byte sequences that are not in the UTF-8 range. 5123 // The keys stored in BinaryData must not overlap with the ones in 5124 // the Data field, this is enforced during validation process. 5125 // Using this field will require 1.10+ apiserver and 5126 // kubelet. 5127 // +optional 5128 BinaryData map[string][]byte `json:"binaryData,omitempty" protobuf:"bytes,3,rep,name=binaryData"` 5129} 5130 5131// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 5132 5133// ConfigMapList is a resource containing a list of ConfigMap objects. 5134type ConfigMapList struct { 5135 metav1.TypeMeta `json:",inline"` 5136 5137 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata 5138 // +optional 5139 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 5140 5141 // Items is the list of ConfigMaps. 5142 Items []ConfigMap `json:"items" protobuf:"bytes,2,rep,name=items"` 5143} 5144 5145// Type and constants for component health validation. 5146type ComponentConditionType string 5147 5148// These are the valid conditions for the component. 5149const ( 5150 ComponentHealthy ComponentConditionType = "Healthy" 5151) 5152 5153// Information about the condition of a component. 5154type ComponentCondition struct { 5155 // Type of condition for a component. 5156 // Valid value: "Healthy" 5157 Type ComponentConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=ComponentConditionType"` 5158 // Status of the condition for a component. 5159 // Valid values for "Healthy": "True", "False", or "Unknown". 5160 Status ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=ConditionStatus"` 5161 // Message about the condition for a component. 5162 // For example, information about a health check. 5163 // +optional 5164 Message string `json:"message,omitempty" protobuf:"bytes,3,opt,name=message"` 5165 // Condition error code for a component. 5166 // For example, a health check error code. 5167 // +optional 5168 Error string `json:"error,omitempty" protobuf:"bytes,4,opt,name=error"` 5169} 5170 5171// +genclient 5172// +genclient:nonNamespaced 5173// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 5174 5175// ComponentStatus (and ComponentStatusList) holds the cluster validation info. 5176type ComponentStatus struct { 5177 metav1.TypeMeta `json:",inline"` 5178 // Standard object's metadata. 5179 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata 5180 // +optional 5181 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 5182 5183 // List of component conditions observed 5184 // +optional 5185 // +patchMergeKey=type 5186 // +patchStrategy=merge 5187 Conditions []ComponentCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,2,rep,name=conditions"` 5188} 5189 5190// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 5191 5192// Status of all the conditions for the component as a list of ComponentStatus objects. 5193type ComponentStatusList struct { 5194 metav1.TypeMeta `json:",inline"` 5195 // Standard list metadata. 5196 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds 5197 // +optional 5198 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 5199 5200 // List of ComponentStatus objects. 5201 Items []ComponentStatus `json:"items" protobuf:"bytes,2,rep,name=items"` 5202} 5203 5204// DownwardAPIVolumeSource represents a volume containing downward API info. 5205// Downward API volumes support ownership management and SELinux relabeling. 5206type DownwardAPIVolumeSource struct { 5207 // Items is a list of downward API volume file 5208 // +optional 5209 Items []DownwardAPIVolumeFile `json:"items,omitempty" protobuf:"bytes,1,rep,name=items"` 5210 // Optional: mode bits to use on created files by default. Must be a 5211 // value between 0 and 0777. Defaults to 0644. 5212 // Directories within the path are not affected by this setting. 5213 // This might be in conflict with other options that affect the file 5214 // mode, like fsGroup, and the result can be other mode bits set. 5215 // +optional 5216 DefaultMode *int32 `json:"defaultMode,omitempty" protobuf:"varint,2,opt,name=defaultMode"` 5217} 5218 5219const ( 5220 DownwardAPIVolumeSourceDefaultMode int32 = 0644 5221) 5222 5223// DownwardAPIVolumeFile represents information to create the file containing the pod field 5224type DownwardAPIVolumeFile struct { 5225 // Required: Path is the relative path name of the file to be created. Must not be absolute or contain the '..' path. Must be utf-8 encoded. The first item of the relative path must not start with '..' 5226 Path string `json:"path" protobuf:"bytes,1,opt,name=path"` 5227 // Required: Selects a field of the pod: only annotations, labels, name and namespace are supported. 5228 // +optional 5229 FieldRef *ObjectFieldSelector `json:"fieldRef,omitempty" protobuf:"bytes,2,opt,name=fieldRef"` 5230 // Selects a resource of the container: only resources limits and requests 5231 // (limits.cpu, limits.memory, requests.cpu and requests.memory) are currently supported. 5232 // +optional 5233 ResourceFieldRef *ResourceFieldSelector `json:"resourceFieldRef,omitempty" protobuf:"bytes,3,opt,name=resourceFieldRef"` 5234 // Optional: mode bits to use on this file, must be a value between 0 5235 // and 0777. If not specified, the volume defaultMode will be used. 5236 // This might be in conflict with other options that affect the file 5237 // mode, like fsGroup, and the result can be other mode bits set. 5238 // +optional 5239 Mode *int32 `json:"mode,omitempty" protobuf:"varint,4,opt,name=mode"` 5240} 5241 5242// Represents downward API info for projecting into a projected volume. 5243// Note that this is identical to a downwardAPI volume source without the default 5244// mode. 5245type DownwardAPIProjection struct { 5246 // Items is a list of DownwardAPIVolume file 5247 // +optional 5248 Items []DownwardAPIVolumeFile `json:"items,omitempty" protobuf:"bytes,1,rep,name=items"` 5249} 5250 5251// SecurityContext holds security configuration that will be applied to a container. 5252// Some fields are present in both SecurityContext and PodSecurityContext. When both 5253// are set, the values in SecurityContext take precedence. 5254type SecurityContext struct { 5255 // The capabilities to add/drop when running containers. 5256 // Defaults to the default set of capabilities granted by the container runtime. 5257 // +optional 5258 Capabilities *Capabilities `json:"capabilities,omitempty" protobuf:"bytes,1,opt,name=capabilities"` 5259 // Run container in privileged mode. 5260 // Processes in privileged containers are essentially equivalent to root on the host. 5261 // Defaults to false. 5262 // +optional 5263 Privileged *bool `json:"privileged,omitempty" protobuf:"varint,2,opt,name=privileged"` 5264 // The SELinux context to be applied to the container. 5265 // If unspecified, the container runtime will allocate a random SELinux context for each 5266 // container. May also be set in PodSecurityContext. If set in both SecurityContext and 5267 // PodSecurityContext, the value specified in SecurityContext takes precedence. 5268 // +optional 5269 SELinuxOptions *SELinuxOptions `json:"seLinuxOptions,omitempty" protobuf:"bytes,3,opt,name=seLinuxOptions"` 5270 // The UID to run the entrypoint of the container process. 5271 // Defaults to user specified in image metadata if unspecified. 5272 // May also be set in PodSecurityContext. If set in both SecurityContext and 5273 // PodSecurityContext, the value specified in SecurityContext takes precedence. 5274 // +optional 5275 RunAsUser *int64 `json:"runAsUser,omitempty" protobuf:"varint,4,opt,name=runAsUser"` 5276 // The GID to run the entrypoint of the container process. 5277 // Uses runtime default if unset. 5278 // May also be set in PodSecurityContext. If set in both SecurityContext and 5279 // PodSecurityContext, the value specified in SecurityContext takes precedence. 5280 // +optional 5281 RunAsGroup *int64 `json:"runAsGroup,omitempty" protobuf:"varint,8,opt,name=runAsGroup"` 5282 // Indicates that the container must run as a non-root user. 5283 // If true, the Kubelet will validate the image at runtime to ensure that it 5284 // does not run as UID 0 (root) and fail to start the container if it does. 5285 // If unset or false, no such validation will be performed. 5286 // May also be set in PodSecurityContext. If set in both SecurityContext and 5287 // PodSecurityContext, the value specified in SecurityContext takes precedence. 5288 // +optional 5289 RunAsNonRoot *bool `json:"runAsNonRoot,omitempty" protobuf:"varint,5,opt,name=runAsNonRoot"` 5290 // Whether this container has a read-only root filesystem. 5291 // Default is false. 5292 // +optional 5293 ReadOnlyRootFilesystem *bool `json:"readOnlyRootFilesystem,omitempty" protobuf:"varint,6,opt,name=readOnlyRootFilesystem"` 5294 // AllowPrivilegeEscalation controls whether a process can gain more 5295 // privileges than its parent process. This bool directly controls if 5296 // the no_new_privs flag will be set on the container process. 5297 // AllowPrivilegeEscalation is true always when the container is: 5298 // 1) run as Privileged 5299 // 2) has CAP_SYS_ADMIN 5300 // +optional 5301 AllowPrivilegeEscalation *bool `json:"allowPrivilegeEscalation,omitempty" protobuf:"varint,7,opt,name=allowPrivilegeEscalation"` 5302 // procMount denotes the type of proc mount to use for the containers. 5303 // The default is DefaultProcMount which uses the container runtime defaults for 5304 // readonly paths and masked paths. 5305 // This requires the ProcMountType feature flag to be enabled. 5306 // +optional 5307 ProcMount *ProcMountType `json:"procMount,omitempty" protobuf:"bytes,9,opt,name=procMount"` 5308} 5309 5310type ProcMountType string 5311 5312const ( 5313 // DefaultProcMount uses the container runtime defaults for readonly and masked 5314 // paths for /proc. Most container runtimes mask certain paths in /proc to avoid 5315 // accidental security exposure of special devices or information. 5316 DefaultProcMount ProcMountType = "Default" 5317 5318 // UnmaskedProcMount bypasses the default masking behavior of the container 5319 // runtime and ensures the newly created /proc the container stays in tact with 5320 // no modifications. 5321 UnmaskedProcMount ProcMountType = "Unmasked" 5322) 5323 5324// SELinuxOptions are the labels to be applied to the container 5325type SELinuxOptions struct { 5326 // User is a SELinux user label that applies to the container. 5327 // +optional 5328 User string `json:"user,omitempty" protobuf:"bytes,1,opt,name=user"` 5329 // Role is a SELinux role label that applies to the container. 5330 // +optional 5331 Role string `json:"role,omitempty" protobuf:"bytes,2,opt,name=role"` 5332 // Type is a SELinux type label that applies to the container. 5333 // +optional 5334 Type string `json:"type,omitempty" protobuf:"bytes,3,opt,name=type"` 5335 // Level is SELinux level label that applies to the container. 5336 // +optional 5337 Level string `json:"level,omitempty" protobuf:"bytes,4,opt,name=level"` 5338} 5339 5340// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 5341 5342// RangeAllocation is not a public type. 5343type RangeAllocation struct { 5344 metav1.TypeMeta `json:",inline"` 5345 // Standard object's metadata. 5346 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata 5347 // +optional 5348 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 5349 5350 // Range is string that identifies the range represented by 'data'. 5351 Range string `json:"range" protobuf:"bytes,2,opt,name=range"` 5352 // Data is a bit array containing all allocated addresses in the previous segment. 5353 Data []byte `json:"data" protobuf:"bytes,3,opt,name=data"` 5354} 5355 5356const ( 5357 // "default-scheduler" is the name of default scheduler. 5358 DefaultSchedulerName = "default-scheduler" 5359 5360 // RequiredDuringScheduling affinity is not symmetric, but there is an implicit PreferredDuringScheduling affinity rule 5361 // corresponding to every RequiredDuringScheduling affinity rule. 5362 // When the --hard-pod-affinity-weight scheduler flag is not specified, 5363 // DefaultHardPodAffinityWeight defines the weight of the implicit PreferredDuringScheduling affinity rule. 5364 DefaultHardPodAffinitySymmetricWeight int32 = 1 5365) 5366 5367// Sysctl defines a kernel parameter to be set 5368type Sysctl struct { 5369 // Name of a property to set 5370 Name string `json:"name" protobuf:"bytes,1,opt,name=name"` 5371 // Value of a property to set 5372 Value string `json:"value" protobuf:"bytes,2,opt,name=value"` 5373} 5374 5375// NodeResources is an object for conveying resource information about a node. 5376// see http://releases.k8s.io/HEAD/docs/design/resources.md for more details. 5377type NodeResources struct { 5378 // Capacity represents the available resources of a node 5379 Capacity ResourceList `protobuf:"bytes,1,rep,name=capacity,casttype=ResourceList,castkey=ResourceName"` 5380} 5381 5382const ( 5383 // Enable stdin for remote command execution 5384 ExecStdinParam = "input" 5385 // Enable stdout for remote command execution 5386 ExecStdoutParam = "output" 5387 // Enable stderr for remote command execution 5388 ExecStderrParam = "error" 5389 // Enable TTY for remote command execution 5390 ExecTTYParam = "tty" 5391 // Command to run for remote command execution 5392 ExecCommandParam = "command" 5393 5394 // Name of header that specifies stream type 5395 StreamType = "streamType" 5396 // Value for streamType header for stdin stream 5397 StreamTypeStdin = "stdin" 5398 // Value for streamType header for stdout stream 5399 StreamTypeStdout = "stdout" 5400 // Value for streamType header for stderr stream 5401 StreamTypeStderr = "stderr" 5402 // Value for streamType header for data stream 5403 StreamTypeData = "data" 5404 // Value for streamType header for error stream 5405 StreamTypeError = "error" 5406 // Value for streamType header for terminal resize stream 5407 StreamTypeResize = "resize" 5408 5409 // Name of header that specifies the port being forwarded 5410 PortHeader = "port" 5411 // Name of header that specifies a request ID used to associate the error 5412 // and data streams for a single forwarded connection 5413 PortForwardRequestIDHeader = "requestID" 5414) 5415