2 Copyright 2017 The Kubernetes Authors.
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
8 http://www.apache.org/licenses/LICENSE-2.0
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
21 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
22 runtime "k8s.io/apimachinery/pkg/runtime"
23 "k8s.io/apimachinery/pkg/util/intstr"
27 ControllerRevisionHashLabelKey = "controller-revision-hash"
28 StatefulSetRevisionLabel = ControllerRevisionHashLabelKey
29 DeprecatedRollbackTo = "deprecated.deployment.rollback.to"
30 DeprecatedTemplateGeneration = "deprecated.daemonset.template.generation"
31 StatefulSetPodNameLabel = "statefulset.kubernetes.io/pod-name"
35 // +genclient:method=GetScale,verb=get,subresource=scale,result=k8s.io/api/autoscaling/v1.Scale
36 // +genclient:method=UpdateScale,verb=update,subresource=scale,input=k8s.io/api/autoscaling/v1.Scale,result=k8s.io/api/autoscaling/v1.Scale
37 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
39 // StatefulSet represents a set of pods with consistent identities.
40 // Identities are defined as:
41 // - Network: A single stable DNS and hostname.
42 // - Storage: As many VolumeClaims as requested.
43 // The StatefulSet guarantees that a given network identity will always
44 // map to the same storage identity.
45 type StatefulSet struct {
46 metav1.TypeMeta `json:",inline"`
48 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
50 // Spec defines the desired identities of pods in this set.
52 Spec StatefulSetSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
54 // Status is the current status of Pods in this StatefulSet. This data
55 // may be out of date by some window of time.
57 Status StatefulSetStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
60 // PodManagementPolicyType defines the policy for creating pods under a stateful set.
61 type PodManagementPolicyType string
64 // OrderedReadyPodManagement will create pods in strictly increasing order on
65 // scale up and strictly decreasing order on scale down, progressing only when
66 // the previous pod is ready or terminated. At most one pod will be changed
68 OrderedReadyPodManagement PodManagementPolicyType = "OrderedReady"
69 // ParallelPodManagement will create and delete pods as soon as the stateful set
70 // replica count is changed, and will not wait for pods to be ready or complete
72 ParallelPodManagement = "Parallel"
75 // StatefulSetUpdateStrategy indicates the strategy that the StatefulSet
76 // controller will use to perform updates. It includes any additional parameters
77 // necessary to perform the update for the indicated strategy.
78 type StatefulSetUpdateStrategy struct {
79 // Type indicates the type of the StatefulSetUpdateStrategy.
80 // Default is RollingUpdate.
82 Type StatefulSetUpdateStrategyType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type,casttype=StatefulSetStrategyType"`
83 // RollingUpdate is used to communicate parameters when Type is RollingUpdateStatefulSetStrategyType.
85 RollingUpdate *RollingUpdateStatefulSetStrategy `json:"rollingUpdate,omitempty" protobuf:"bytes,2,opt,name=rollingUpdate"`
88 // StatefulSetUpdateStrategyType is a string enumeration type that enumerates
89 // all possible update strategies for the StatefulSet controller.
90 type StatefulSetUpdateStrategyType string
93 // RollingUpdateStatefulSetStrategyType indicates that update will be
94 // applied to all Pods in the StatefulSet with respect to the StatefulSet
95 // ordering constraints. When a scale operation is performed with this
96 // strategy, new Pods will be created from the specification version indicated
97 // by the StatefulSet's updateRevision.
98 RollingUpdateStatefulSetStrategyType = "RollingUpdate"
99 // OnDeleteStatefulSetStrategyType triggers the legacy behavior. Version
100 // tracking and ordered rolling restarts are disabled. Pods are recreated
101 // from the StatefulSetSpec when they are manually deleted. When a scale
102 // operation is performed with this strategy,specification version indicated
103 // by the StatefulSet's currentRevision.
104 OnDeleteStatefulSetStrategyType = "OnDelete"
107 // RollingUpdateStatefulSetStrategy is used to communicate parameter for RollingUpdateStatefulSetStrategyType.
108 type RollingUpdateStatefulSetStrategy struct {
109 // Partition indicates the ordinal at which the StatefulSet should be
111 // Default value is 0.
113 Partition *int32 `json:"partition,omitempty" protobuf:"varint,1,opt,name=partition"`
116 // A StatefulSetSpec is the specification of a StatefulSet.
117 type StatefulSetSpec struct {
118 // replicas is the desired number of replicas of the given Template.
119 // These are replicas in the sense that they are instantiations of the
120 // same Template, but individual replicas also have a consistent identity.
121 // If unspecified, defaults to 1.
122 // TODO: Consider a rename of this field.
124 Replicas *int32 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"`
126 // selector is a label query over pods that should match the replica count.
127 // It must match the pod template's labels.
128 // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors
129 Selector *metav1.LabelSelector `json:"selector" protobuf:"bytes,2,opt,name=selector"`
131 // template is the object that describes the pod that will be created if
132 // insufficient replicas are detected. Each pod stamped out by the StatefulSet
133 // will fulfill this Template, but have a unique identity from the rest
134 // of the StatefulSet.
135 Template v1.PodTemplateSpec `json:"template" protobuf:"bytes,3,opt,name=template"`
137 // volumeClaimTemplates is a list of claims that pods are allowed to reference.
138 // The StatefulSet controller is responsible for mapping network identities to
139 // claims in a way that maintains the identity of a pod. Every claim in
140 // this list must have at least one matching (by name) volumeMount in one
141 // container in the template. A claim in this list takes precedence over
142 // any volumes in the template, with the same name.
143 // TODO: Define the behavior if a claim already exists with the same name.
145 VolumeClaimTemplates []v1.PersistentVolumeClaim `json:"volumeClaimTemplates,omitempty" protobuf:"bytes,4,rep,name=volumeClaimTemplates"`
147 // serviceName is the name of the service that governs this StatefulSet.
148 // This service must exist before the StatefulSet, and is responsible for
149 // the network identity of the set. Pods get DNS/hostnames that follow the
150 // pattern: pod-specific-string.serviceName.default.svc.cluster.local
151 // where "pod-specific-string" is managed by the StatefulSet controller.
152 ServiceName string `json:"serviceName" protobuf:"bytes,5,opt,name=serviceName"`
154 // podManagementPolicy controls how pods are created during initial scale up,
155 // when replacing pods on nodes, or when scaling down. The default policy is
156 // `OrderedReady`, where pods are created in increasing order (pod-0, then
157 // pod-1, etc) and the controller will wait until each pod is ready before
158 // continuing. When scaling down, the pods are removed in the opposite order.
159 // The alternative policy is `Parallel` which will create pods in parallel
160 // to match the desired scale without waiting, and on scale down will delete
163 PodManagementPolicy PodManagementPolicyType `json:"podManagementPolicy,omitempty" protobuf:"bytes,6,opt,name=podManagementPolicy,casttype=PodManagementPolicyType"`
165 // updateStrategy indicates the StatefulSetUpdateStrategy that will be
166 // employed to update Pods in the StatefulSet when a revision is made to
168 UpdateStrategy StatefulSetUpdateStrategy `json:"updateStrategy,omitempty" protobuf:"bytes,7,opt,name=updateStrategy"`
170 // revisionHistoryLimit is the maximum number of revisions that will
171 // be maintained in the StatefulSet's revision history. The revision history
172 // consists of all revisions not represented by a currently applied
173 // StatefulSetSpec version. The default value is 10.
174 RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty" protobuf:"varint,8,opt,name=revisionHistoryLimit"`
177 // StatefulSetStatus represents the current state of a StatefulSet.
178 type StatefulSetStatus struct {
179 // observedGeneration is the most recent generation observed for this StatefulSet. It corresponds to the
180 // StatefulSet's generation, which is updated on mutation by the API Server.
182 ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,1,opt,name=observedGeneration"`
184 // replicas is the number of Pods created by the StatefulSet controller.
185 Replicas int32 `json:"replicas" protobuf:"varint,2,opt,name=replicas"`
187 // readyReplicas is the number of Pods created by the StatefulSet controller that have a Ready Condition.
188 ReadyReplicas int32 `json:"readyReplicas,omitempty" protobuf:"varint,3,opt,name=readyReplicas"`
190 // currentReplicas is the number of Pods created by the StatefulSet controller from the StatefulSet version
191 // indicated by currentRevision.
192 CurrentReplicas int32 `json:"currentReplicas,omitempty" protobuf:"varint,4,opt,name=currentReplicas"`
194 // updatedReplicas is the number of Pods created by the StatefulSet controller from the StatefulSet version
195 // indicated by updateRevision.
196 UpdatedReplicas int32 `json:"updatedReplicas,omitempty" protobuf:"varint,5,opt,name=updatedReplicas"`
198 // currentRevision, if not empty, indicates the version of the StatefulSet used to generate Pods in the
199 // sequence [0,currentReplicas).
200 CurrentRevision string `json:"currentRevision,omitempty" protobuf:"bytes,6,opt,name=currentRevision"`
202 // updateRevision, if not empty, indicates the version of the StatefulSet used to generate Pods in the sequence
203 // [replicas-updatedReplicas,replicas)
204 UpdateRevision string `json:"updateRevision,omitempty" protobuf:"bytes,7,opt,name=updateRevision"`
206 // collisionCount is the count of hash collisions for the StatefulSet. The StatefulSet controller
207 // uses this field as a collision avoidance mechanism when it needs to create the name for the
208 // newest ControllerRevision.
210 CollisionCount *int32 `json:"collisionCount,omitempty" protobuf:"varint,9,opt,name=collisionCount"`
212 // Represents the latest available observations of a statefulset's current state.
214 // +patchMergeKey=type
215 // +patchStrategy=merge
216 Conditions []StatefulSetCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,10,rep,name=conditions"`
219 type StatefulSetConditionType string
221 // StatefulSetCondition describes the state of a statefulset at a certain point.
222 type StatefulSetCondition struct {
223 // Type of statefulset condition.
224 Type StatefulSetConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=StatefulSetConditionType"`
225 // Status of the condition, one of True, False, Unknown.
226 Status v1.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"`
227 // Last time the condition transitioned from one status to another.
229 LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,3,opt,name=lastTransitionTime"`
230 // The reason for the condition's last transition.
232 Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"`
233 // A human readable message indicating details about the transition.
235 Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"`
238 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
240 // StatefulSetList is a collection of StatefulSets.
241 type StatefulSetList struct {
242 metav1.TypeMeta `json:",inline"`
244 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
245 Items []StatefulSet `json:"items" protobuf:"bytes,2,rep,name=items"`
249 // +genclient:method=GetScale,verb=get,subresource=scale,result=k8s.io/api/autoscaling/v1.Scale
250 // +genclient:method=UpdateScale,verb=update,subresource=scale,input=k8s.io/api/autoscaling/v1.Scale,result=k8s.io/api/autoscaling/v1.Scale
251 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
253 // Deployment enables declarative updates for Pods and ReplicaSets.
254 type Deployment struct {
255 metav1.TypeMeta `json:",inline"`
256 // Standard object metadata.
258 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
260 // Specification of the desired behavior of the Deployment.
262 Spec DeploymentSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
264 // Most recently observed status of the Deployment.
266 Status DeploymentStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
269 // DeploymentSpec is the specification of the desired behavior of the Deployment.
270 type DeploymentSpec struct {
271 // Number of desired pods. This is a pointer to distinguish between explicit
272 // zero and not specified. Defaults to 1.
274 Replicas *int32 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"`
276 // Label selector for pods. Existing ReplicaSets whose pods are
277 // selected by this will be the ones affected by this deployment.
278 // It must match the pod template's labels.
279 Selector *metav1.LabelSelector `json:"selector" protobuf:"bytes,2,opt,name=selector"`
281 // Template describes the pods that will be created.
282 Template v1.PodTemplateSpec `json:"template" protobuf:"bytes,3,opt,name=template"`
284 // The deployment strategy to use to replace existing pods with new ones.
286 // +patchStrategy=retainKeys
287 Strategy DeploymentStrategy `json:"strategy,omitempty" patchStrategy:"retainKeys" protobuf:"bytes,4,opt,name=strategy"`
289 // Minimum number of seconds for which a newly created pod should be ready
290 // without any of its container crashing, for it to be considered available.
291 // Defaults to 0 (pod will be considered available as soon as it is ready)
293 MinReadySeconds int32 `json:"minReadySeconds,omitempty" protobuf:"varint,5,opt,name=minReadySeconds"`
295 // The number of old ReplicaSets to retain to allow rollback.
296 // This is a pointer to distinguish between explicit zero and not specified.
299 RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty" protobuf:"varint,6,opt,name=revisionHistoryLimit"`
301 // Indicates that the deployment is paused.
303 Paused bool `json:"paused,omitempty" protobuf:"varint,7,opt,name=paused"`
305 // The maximum time in seconds for a deployment to make progress before it
306 // is considered to be failed. The deployment controller will continue to
307 // process failed deployments and a condition with a ProgressDeadlineExceeded
308 // reason will be surfaced in the deployment status. Note that progress will
309 // not be estimated during the time a deployment is paused. Defaults to 600s.
310 ProgressDeadlineSeconds *int32 `json:"progressDeadlineSeconds,omitempty" protobuf:"varint,9,opt,name=progressDeadlineSeconds"`
314 // DefaultDeploymentUniqueLabelKey is the default key of the selector that is added
315 // to existing ReplicaSets (and label key that is added to its pods) to prevent the existing ReplicaSets
316 // to select new pods (and old pods being select by new ReplicaSet).
317 DefaultDeploymentUniqueLabelKey string = "pod-template-hash"
320 // DeploymentStrategy describes how to replace existing pods with new ones.
321 type DeploymentStrategy struct {
322 // Type of deployment. Can be "Recreate" or "RollingUpdate". Default is RollingUpdate.
324 Type DeploymentStrategyType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type,casttype=DeploymentStrategyType"`
326 // Rolling update config params. Present only if DeploymentStrategyType =
329 // TODO: Update this to follow our convention for oneOf, whatever we decide it
332 RollingUpdate *RollingUpdateDeployment `json:"rollingUpdate,omitempty" protobuf:"bytes,2,opt,name=rollingUpdate"`
335 type DeploymentStrategyType string
338 // Kill all existing pods before creating new ones.
339 RecreateDeploymentStrategyType DeploymentStrategyType = "Recreate"
341 // Replace the old ReplicaSets by new one using rolling update i.e gradually scale down the old ReplicaSets and scale up the new one.
342 RollingUpdateDeploymentStrategyType DeploymentStrategyType = "RollingUpdate"
345 // Spec to control the desired behavior of rolling update.
346 type RollingUpdateDeployment struct {
347 // The maximum number of pods that can be unavailable during the update.
348 // Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%).
349 // Absolute number is calculated from percentage by rounding down.
350 // This can not be 0 if MaxSurge is 0.
352 // Example: when this is set to 30%, the old ReplicaSet can be scaled down to 70% of desired pods
353 // immediately when the rolling update starts. Once new pods are ready, old ReplicaSet
354 // can be scaled down further, followed by scaling up the new ReplicaSet, ensuring
355 // that the total number of pods available at all times during the update is at
356 // least 70% of desired pods.
358 MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty" protobuf:"bytes,1,opt,name=maxUnavailable"`
360 // The maximum number of pods that can be scheduled above the desired number of
362 // Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%).
363 // This can not be 0 if MaxUnavailable is 0.
364 // Absolute number is calculated from percentage by rounding up.
366 // Example: when this is set to 30%, the new ReplicaSet can be scaled up immediately when
367 // the rolling update starts, such that the total number of old and new pods do not exceed
368 // 130% of desired pods. Once old pods have been killed,
369 // new ReplicaSet can be scaled up further, ensuring that total number of pods running
370 // at any time during the update is at most 130% of desired pods.
372 MaxSurge *intstr.IntOrString `json:"maxSurge,omitempty" protobuf:"bytes,2,opt,name=maxSurge"`
375 // DeploymentStatus is the most recently observed status of the Deployment.
376 type DeploymentStatus struct {
377 // The generation observed by the deployment controller.
379 ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,1,opt,name=observedGeneration"`
381 // Total number of non-terminated pods targeted by this deployment (their labels match the selector).
383 Replicas int32 `json:"replicas,omitempty" protobuf:"varint,2,opt,name=replicas"`
385 // Total number of non-terminated pods targeted by this deployment that have the desired template spec.
387 UpdatedReplicas int32 `json:"updatedReplicas,omitempty" protobuf:"varint,3,opt,name=updatedReplicas"`
389 // Total number of ready pods targeted by this deployment.
391 ReadyReplicas int32 `json:"readyReplicas,omitempty" protobuf:"varint,7,opt,name=readyReplicas"`
393 // Total number of available pods (ready for at least minReadySeconds) targeted by this deployment.
395 AvailableReplicas int32 `json:"availableReplicas,omitempty" protobuf:"varint,4,opt,name=availableReplicas"`
397 // Total number of unavailable pods targeted by this deployment. This is the total number of
398 // pods that are still required for the deployment to have 100% available capacity. They may
399 // either be pods that are running but not yet available or pods that still have not been created.
401 UnavailableReplicas int32 `json:"unavailableReplicas,omitempty" protobuf:"varint,5,opt,name=unavailableReplicas"`
403 // Represents the latest available observations of a deployment's current state.
404 // +patchMergeKey=type
405 // +patchStrategy=merge
406 Conditions []DeploymentCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,6,rep,name=conditions"`
408 // Count of hash collisions for the Deployment. The Deployment controller uses this
409 // field as a collision avoidance mechanism when it needs to create the name for the
410 // newest ReplicaSet.
412 CollisionCount *int32 `json:"collisionCount,omitempty" protobuf:"varint,8,opt,name=collisionCount"`
415 type DeploymentConditionType string
417 // These are valid conditions of a deployment.
419 // Available means the deployment is available, ie. at least the minimum available
420 // replicas required are up and running for at least minReadySeconds.
421 DeploymentAvailable DeploymentConditionType = "Available"
422 // Progressing means the deployment is progressing. Progress for a deployment is
423 // considered when a new replica set is created or adopted, and when new pods scale
424 // up or old pods scale down. Progress is not estimated for paused deployments or
425 // when progressDeadlineSeconds is not specified.
426 DeploymentProgressing DeploymentConditionType = "Progressing"
427 // ReplicaFailure is added in a deployment when one of its pods fails to be created
429 DeploymentReplicaFailure DeploymentConditionType = "ReplicaFailure"
432 // DeploymentCondition describes the state of a deployment at a certain point.
433 type DeploymentCondition struct {
434 // Type of deployment condition.
435 Type DeploymentConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=DeploymentConditionType"`
436 // Status of the condition, one of True, False, Unknown.
437 Status v1.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"`
438 // The last time this condition was updated.
439 LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty" protobuf:"bytes,6,opt,name=lastUpdateTime"`
440 // Last time the condition transitioned from one status to another.
441 LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,7,opt,name=lastTransitionTime"`
442 // The reason for the condition's last transition.
443 Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"`
444 // A human readable message indicating details about the transition.
445 Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"`
448 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
450 // DeploymentList is a list of Deployments.
451 type DeploymentList struct {
452 metav1.TypeMeta `json:",inline"`
453 // Standard list metadata.
455 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
457 // Items is the list of Deployments.
458 Items []Deployment `json:"items" protobuf:"bytes,2,rep,name=items"`
461 // DaemonSetUpdateStrategy is a struct used to control the update strategy for a DaemonSet.
462 type DaemonSetUpdateStrategy struct {
463 // Type of daemon set update. Can be "RollingUpdate" or "OnDelete". Default is RollingUpdate.
465 Type DaemonSetUpdateStrategyType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type"`
467 // Rolling update config params. Present only if type = "RollingUpdate".
469 // TODO: Update this to follow our convention for oneOf, whatever we decide it
470 // to be. Same as Deployment `strategy.rollingUpdate`.
471 // See https://github.com/kubernetes/kubernetes/issues/35345
473 RollingUpdate *RollingUpdateDaemonSet `json:"rollingUpdate,omitempty" protobuf:"bytes,2,opt,name=rollingUpdate"`
476 type DaemonSetUpdateStrategyType string
479 // Replace the old daemons by new ones using rolling update i.e replace them on each node one after the other.
480 RollingUpdateDaemonSetStrategyType DaemonSetUpdateStrategyType = "RollingUpdate"
482 // Replace the old daemons only when it's killed
483 OnDeleteDaemonSetStrategyType DaemonSetUpdateStrategyType = "OnDelete"
486 // Spec to control the desired behavior of daemon set rolling update.
487 type RollingUpdateDaemonSet struct {
488 // The maximum number of DaemonSet pods that can be unavailable during the
489 // update. Value can be an absolute number (ex: 5) or a percentage of total
490 // number of DaemonSet pods at the start of the update (ex: 10%). Absolute
491 // number is calculated from percentage by rounding up.
493 // Default value is 1.
494 // Example: when this is set to 30%, at most 30% of the total number of nodes
495 // that should be running the daemon pod (i.e. status.desiredNumberScheduled)
496 // can have their pods stopped for an update at any given
497 // time. The update starts by stopping at most 30% of those DaemonSet pods
498 // and then brings up new DaemonSet pods in their place. Once the new pods
499 // are available, it then proceeds onto other DaemonSet pods, thus ensuring
500 // that at least 70% of original number of DaemonSet pods are available at
501 // all times during the update.
503 MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty" protobuf:"bytes,1,opt,name=maxUnavailable"`
506 // DaemonSetSpec is the specification of a daemon set.
507 type DaemonSetSpec struct {
508 // A label query over pods that are managed by the daemon set.
509 // Must match in order to be controlled.
510 // It must match the pod template's labels.
511 // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors
512 Selector *metav1.LabelSelector `json:"selector" protobuf:"bytes,1,opt,name=selector"`
514 // An object that describes the pod that will be created.
515 // The DaemonSet will create exactly one copy of this pod on every node
516 // that matches the template's node selector (or on every node if no node
517 // selector is specified).
518 // More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-template
519 Template v1.PodTemplateSpec `json:"template" protobuf:"bytes,2,opt,name=template"`
521 // An update strategy to replace existing DaemonSet pods with new pods.
523 UpdateStrategy DaemonSetUpdateStrategy `json:"updateStrategy,omitempty" protobuf:"bytes,3,opt,name=updateStrategy"`
525 // The minimum number of seconds for which a newly created DaemonSet pod should
526 // be ready without any of its container crashing, for it to be considered
527 // available. Defaults to 0 (pod will be considered available as soon as it
530 MinReadySeconds int32 `json:"minReadySeconds,omitempty" protobuf:"varint,4,opt,name=minReadySeconds"`
532 // The number of old history to retain to allow rollback.
533 // This is a pointer to distinguish between explicit zero and not specified.
536 RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty" protobuf:"varint,6,opt,name=revisionHistoryLimit"`
539 // DaemonSetStatus represents the current status of a daemon set.
540 type DaemonSetStatus struct {
541 // The number of nodes that are running at least 1
542 // daemon pod and are supposed to run the daemon pod.
543 // More info: https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/
544 CurrentNumberScheduled int32 `json:"currentNumberScheduled" protobuf:"varint,1,opt,name=currentNumberScheduled"`
546 // The number of nodes that are running the daemon pod, but are
547 // not supposed to run the daemon pod.
548 // More info: https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/
549 NumberMisscheduled int32 `json:"numberMisscheduled" protobuf:"varint,2,opt,name=numberMisscheduled"`
551 // The total number of nodes that should be running the daemon
552 // pod (including nodes correctly running the daemon pod).
553 // More info: https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/
554 DesiredNumberScheduled int32 `json:"desiredNumberScheduled" protobuf:"varint,3,opt,name=desiredNumberScheduled"`
556 // The number of nodes that should be running the daemon pod and have one
557 // or more of the daemon pod running and ready.
558 NumberReady int32 `json:"numberReady" protobuf:"varint,4,opt,name=numberReady"`
560 // The most recent generation observed by the daemon set controller.
562 ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,5,opt,name=observedGeneration"`
564 // The total number of nodes that are running updated daemon pod
566 UpdatedNumberScheduled int32 `json:"updatedNumberScheduled,omitempty" protobuf:"varint,6,opt,name=updatedNumberScheduled"`
568 // The number of nodes that should be running the
569 // daemon pod and have one or more of the daemon pod running and
570 // available (ready for at least spec.minReadySeconds)
572 NumberAvailable int32 `json:"numberAvailable,omitempty" protobuf:"varint,7,opt,name=numberAvailable"`
574 // The number of nodes that should be running the
575 // daemon pod and have none of the daemon pod running and available
576 // (ready for at least spec.minReadySeconds)
578 NumberUnavailable int32 `json:"numberUnavailable,omitempty" protobuf:"varint,8,opt,name=numberUnavailable"`
580 // Count of hash collisions for the DaemonSet. The DaemonSet controller
581 // uses this field as a collision avoidance mechanism when it needs to
582 // create the name for the newest ControllerRevision.
584 CollisionCount *int32 `json:"collisionCount,omitempty" protobuf:"varint,9,opt,name=collisionCount"`
586 // Represents the latest available observations of a DaemonSet's current state.
588 // +patchMergeKey=type
589 // +patchStrategy=merge
590 Conditions []DaemonSetCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,10,rep,name=conditions"`
593 type DaemonSetConditionType string
595 // TODO: Add valid condition types of a DaemonSet.
597 // DaemonSetCondition describes the state of a DaemonSet at a certain point.
598 type DaemonSetCondition struct {
599 // Type of DaemonSet condition.
600 Type DaemonSetConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=DaemonSetConditionType"`
601 // Status of the condition, one of True, False, Unknown.
602 Status v1.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"`
603 // Last time the condition transitioned from one status to another.
605 LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,3,opt,name=lastTransitionTime"`
606 // The reason for the condition's last transition.
608 Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"`
609 // A human readable message indicating details about the transition.
611 Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"`
615 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
617 // DaemonSet represents the configuration of a daemon set.
618 type DaemonSet struct {
619 metav1.TypeMeta `json:",inline"`
620 // Standard object's metadata.
621 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
623 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
625 // The desired behavior of this daemon set.
626 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status
628 Spec DaemonSetSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
630 // The current status of this daemon set. This data may be
631 // out of date by some window of time.
632 // Populated by the system.
634 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status
636 Status DaemonSetStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
640 // DefaultDaemonSetUniqueLabelKey is the default label key that is added
641 // to existing DaemonSet pods to distinguish between old and new
642 // DaemonSet pods during DaemonSet template updates.
643 DefaultDaemonSetUniqueLabelKey = ControllerRevisionHashLabelKey
646 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
648 // DaemonSetList is a collection of daemon sets.
649 type DaemonSetList struct {
650 metav1.TypeMeta `json:",inline"`
651 // Standard list metadata.
652 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
654 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
656 // A list of daemon sets.
657 Items []DaemonSet `json:"items" protobuf:"bytes,2,rep,name=items"`
661 // +genclient:method=GetScale,verb=get,subresource=scale,result=k8s.io/api/autoscaling/v1.Scale
662 // +genclient:method=UpdateScale,verb=update,subresource=scale,input=k8s.io/api/autoscaling/v1.Scale,result=k8s.io/api/autoscaling/v1.Scale
663 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
665 // ReplicaSet ensures that a specified number of pod replicas are running at any given time.
666 type ReplicaSet struct {
667 metav1.TypeMeta `json:",inline"`
669 // If the Labels of a ReplicaSet are empty, they are defaulted to
670 // be the same as the Pod(s) that the ReplicaSet manages.
671 // Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
673 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
675 // Spec defines the specification of the desired behavior of the ReplicaSet.
676 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status
678 Spec ReplicaSetSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
680 // Status is the most recently observed status of the ReplicaSet.
681 // This data may be out of date by some window of time.
682 // Populated by the system.
684 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status
686 Status ReplicaSetStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
689 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
691 // ReplicaSetList is a collection of ReplicaSets.
692 type ReplicaSetList struct {
693 metav1.TypeMeta `json:",inline"`
694 // Standard list metadata.
695 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds
697 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
699 // List of ReplicaSets.
700 // More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller
701 Items []ReplicaSet `json:"items" protobuf:"bytes,2,rep,name=items"`
704 // ReplicaSetSpec is the specification of a ReplicaSet.
705 type ReplicaSetSpec struct {
706 // Replicas is the number of desired replicas.
707 // This is a pointer to distinguish between explicit zero and unspecified.
709 // More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller/#what-is-a-replicationcontroller
711 Replicas *int32 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"`
713 // Minimum number of seconds for which a newly created pod should be ready
714 // without any of its container crashing, for it to be considered available.
715 // Defaults to 0 (pod will be considered available as soon as it is ready)
717 MinReadySeconds int32 `json:"minReadySeconds,omitempty" protobuf:"varint,4,opt,name=minReadySeconds"`
719 // Selector is a label query over pods that should match the replica count.
720 // Label keys and values that must match in order to be controlled by this replica set.
721 // It must match the pod template's labels.
722 // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors
723 Selector *metav1.LabelSelector `json:"selector" protobuf:"bytes,2,opt,name=selector"`
725 // Template is the object that describes the pod that will be created if
726 // insufficient replicas are detected.
727 // More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-template
729 Template v1.PodTemplateSpec `json:"template,omitempty" protobuf:"bytes,3,opt,name=template"`
732 // ReplicaSetStatus represents the current status of a ReplicaSet.
733 type ReplicaSetStatus struct {
734 // Replicas is the most recently oberved number of replicas.
735 // More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller/#what-is-a-replicationcontroller
736 Replicas int32 `json:"replicas" protobuf:"varint,1,opt,name=replicas"`
738 // The number of pods that have labels matching the labels of the pod template of the replicaset.
740 FullyLabeledReplicas int32 `json:"fullyLabeledReplicas,omitempty" protobuf:"varint,2,opt,name=fullyLabeledReplicas"`
742 // The number of ready replicas for this replica set.
744 ReadyReplicas int32 `json:"readyReplicas,omitempty" protobuf:"varint,4,opt,name=readyReplicas"`
746 // The number of available replicas (ready for at least minReadySeconds) for this replica set.
748 AvailableReplicas int32 `json:"availableReplicas,omitempty" protobuf:"varint,5,opt,name=availableReplicas"`
750 // ObservedGeneration reflects the generation of the most recently observed ReplicaSet.
752 ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,3,opt,name=observedGeneration"`
754 // Represents the latest available observations of a replica set's current state.
756 // +patchMergeKey=type
757 // +patchStrategy=merge
758 Conditions []ReplicaSetCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,6,rep,name=conditions"`
761 type ReplicaSetConditionType string
763 // These are valid conditions of a replica set.
765 // ReplicaSetReplicaFailure is added in a replica set when one of its pods fails to be created
766 // due to insufficient quota, limit ranges, pod security policy, node selectors, etc. or deleted
767 // due to kubelet being down or finalizers are failing.
768 ReplicaSetReplicaFailure ReplicaSetConditionType = "ReplicaFailure"
771 // ReplicaSetCondition describes the state of a replica set at a certain point.
772 type ReplicaSetCondition struct {
773 // Type of replica set condition.
774 Type ReplicaSetConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=ReplicaSetConditionType"`
775 // Status of the condition, one of True, False, Unknown.
776 Status v1.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"`
777 // The last time the condition transitioned from one status to another.
779 LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,3,opt,name=lastTransitionTime"`
780 // The reason for the condition's last transition.
782 Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"`
783 // A human readable message indicating details about the transition.
785 Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"`
789 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
791 // ControllerRevision implements an immutable snapshot of state data. Clients
792 // are responsible for serializing and deserializing the objects that contain
793 // their internal state.
794 // Once a ControllerRevision has been successfully created, it can not be updated.
795 // The API Server will fail validation of all requests that attempt to mutate
796 // the Data field. ControllerRevisions may, however, be deleted. Note that, due to its use by both
797 // the DaemonSet and StatefulSet controllers for update and rollback, this object is beta. However,
798 // it may be subject to name and representation changes in future releases, and clients should not
799 // depend on its stability. It is primarily for internal use by controllers.
800 type ControllerRevision struct {
801 metav1.TypeMeta `json:",inline"`
802 // Standard object's metadata.
803 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
805 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
807 // Data is the serialized representation of the state.
808 Data runtime.RawExtension `json:"data,omitempty" protobuf:"bytes,2,opt,name=data"`
810 // Revision indicates the revision of the state represented by Data.
811 Revision int64 `json:"revision" protobuf:"varint,3,opt,name=revision"`
814 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
816 // ControllerRevisionList is a resource containing a list of ControllerRevision objects.
817 type ControllerRevisionList struct {
818 metav1.TypeMeta `json:",inline"`
820 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
822 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
824 // Items is the list of ControllerRevisions
825 Items []ControllerRevision `json:"items" protobuf:"bytes,2,rep,name=items"`