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