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