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"
34 // ScaleSpec describes the attributes of a scale subresource
35 type ScaleSpec struct {
36 // desired number of instances for the scaled object.
38 Replicas int32 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"`
41 // ScaleStatus represents the current status of a scale subresource.
42 type ScaleStatus struct {
43 // actual number of observed instances of the scaled object.
44 Replicas int32 `json:"replicas" protobuf:"varint,1,opt,name=replicas"`
46 // label query over pods that should match the replicas count. More info: http://kubernetes.io/docs/user-guide/labels#label-selectors
48 Selector map[string]string `json:"selector,omitempty" protobuf:"bytes,2,rep,name=selector"`
50 // label selector for pods that should match the replicas count. This is a serializated
51 // version of both map-based and more expressive set-based selectors. This is done to
52 // avoid introspection in the clients. The string will be in the same format as the
53 // query-param syntax. If the target type only supports map-based selectors, both this
54 // field and map-based selector field are populated.
55 // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors
57 TargetSelector string `json:"targetSelector,omitempty" protobuf:"bytes,3,opt,name=targetSelector"`
60 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
62 // Scale represents a scaling request for a resource.
64 metav1.TypeMeta `json:",inline"`
65 // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata.
67 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
69 // defines the behavior of the scale. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status.
71 Spec ScaleSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
73 // current status of the scale. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status. Read-only.
75 Status ScaleStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
79 // +genclient:method=GetScale,verb=get,subresource=scale,result=Scale
80 // +genclient:method=UpdateScale,verb=update,subresource=scale,input=Scale,result=Scale
81 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
83 // DEPRECATED - This group version of StatefulSet is deprecated by apps/v1/StatefulSet. See the release notes for
85 // StatefulSet represents a set of pods with consistent identities.
86 // Identities are defined as:
87 // - Network: A single stable DNS and hostname.
88 // - Storage: As many VolumeClaims as requested.
89 // The StatefulSet guarantees that a given network identity will always
90 // map to the same storage identity.
91 type StatefulSet struct {
92 metav1.TypeMeta `json:",inline"`
94 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
96 // Spec defines the desired identities of pods in this set.
98 Spec StatefulSetSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
100 // Status is the current status of Pods in this StatefulSet. This data
101 // may be out of date by some window of time.
103 Status StatefulSetStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
106 // PodManagementPolicyType defines the policy for creating pods under a stateful set.
107 type PodManagementPolicyType string
110 // OrderedReadyPodManagement will create pods in strictly increasing order on
111 // scale up and strictly decreasing order on scale down, progressing only when
112 // the previous pod is ready or terminated. At most one pod will be changed
114 OrderedReadyPodManagement PodManagementPolicyType = "OrderedReady"
115 // ParallelPodManagement will create and delete pods as soon as the stateful set
116 // replica count is changed, and will not wait for pods to be ready or complete
118 ParallelPodManagement = "Parallel"
121 // StatefulSetUpdateStrategy indicates the strategy that the StatefulSet
122 // controller will use to perform updates. It includes any additional parameters
123 // necessary to perform the update for the indicated strategy.
124 type StatefulSetUpdateStrategy struct {
125 // Type indicates the type of the StatefulSetUpdateStrategy.
126 // Default is RollingUpdate.
128 Type StatefulSetUpdateStrategyType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type,casttype=StatefulSetStrategyType"`
129 // RollingUpdate is used to communicate parameters when Type is RollingUpdateStatefulSetStrategyType.
131 RollingUpdate *RollingUpdateStatefulSetStrategy `json:"rollingUpdate,omitempty" protobuf:"bytes,2,opt,name=rollingUpdate"`
134 // StatefulSetUpdateStrategyType is a string enumeration type that enumerates
135 // all possible update strategies for the StatefulSet controller.
136 type StatefulSetUpdateStrategyType string
139 // RollingUpdateStatefulSetStrategyType indicates that update will be
140 // applied to all Pods in the StatefulSet with respect to the StatefulSet
141 // ordering constraints. When a scale operation is performed with this
142 // strategy, new Pods will be created from the specification version indicated
143 // by the StatefulSet's updateRevision.
144 RollingUpdateStatefulSetStrategyType = "RollingUpdate"
145 // OnDeleteStatefulSetStrategyType triggers the legacy behavior. Version
146 // tracking and ordered rolling restarts are disabled. Pods are recreated
147 // from the StatefulSetSpec when they are manually deleted. When a scale
148 // operation is performed with this strategy,specification version indicated
149 // by the StatefulSet's currentRevision.
150 OnDeleteStatefulSetStrategyType = "OnDelete"
153 // RollingUpdateStatefulSetStrategy is used to communicate parameter for RollingUpdateStatefulSetStrategyType.
154 type RollingUpdateStatefulSetStrategy struct {
155 // Partition indicates the ordinal at which the StatefulSet should be
157 // Default value is 0.
159 Partition *int32 `json:"partition,omitempty" protobuf:"varint,1,opt,name=partition"`
162 // A StatefulSetSpec is the specification of a StatefulSet.
163 type StatefulSetSpec struct {
164 // replicas is the desired number of replicas of the given Template.
165 // These are replicas in the sense that they are instantiations of the
166 // same Template, but individual replicas also have a consistent identity.
167 // If unspecified, defaults to 1.
168 // TODO: Consider a rename of this field.
170 Replicas *int32 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"`
172 // selector is a label query over pods that should match the replica count.
173 // It must match the pod template's labels.
174 // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors
175 Selector *metav1.LabelSelector `json:"selector" protobuf:"bytes,2,opt,name=selector"`
177 // template is the object that describes the pod that will be created if
178 // insufficient replicas are detected. Each pod stamped out by the StatefulSet
179 // will fulfill this Template, but have a unique identity from the rest
180 // of the StatefulSet.
181 Template v1.PodTemplateSpec `json:"template" protobuf:"bytes,3,opt,name=template"`
183 // volumeClaimTemplates is a list of claims that pods are allowed to reference.
184 // The StatefulSet controller is responsible for mapping network identities to
185 // claims in a way that maintains the identity of a pod. Every claim in
186 // this list must have at least one matching (by name) volumeMount in one
187 // container in the template. A claim in this list takes precedence over
188 // any volumes in the template, with the same name.
189 // TODO: Define the behavior if a claim already exists with the same name.
191 VolumeClaimTemplates []v1.PersistentVolumeClaim `json:"volumeClaimTemplates,omitempty" protobuf:"bytes,4,rep,name=volumeClaimTemplates"`
193 // serviceName is the name of the service that governs this StatefulSet.
194 // This service must exist before the StatefulSet, and is responsible for
195 // the network identity of the set. Pods get DNS/hostnames that follow the
196 // pattern: pod-specific-string.serviceName.default.svc.cluster.local
197 // where "pod-specific-string" is managed by the StatefulSet controller.
198 ServiceName string `json:"serviceName" protobuf:"bytes,5,opt,name=serviceName"`
200 // podManagementPolicy controls how pods are created during initial scale up,
201 // when replacing pods on nodes, or when scaling down. The default policy is
202 // `OrderedReady`, where pods are created in increasing order (pod-0, then
203 // pod-1, etc) and the controller will wait until each pod is ready before
204 // continuing. When scaling down, the pods are removed in the opposite order.
205 // The alternative policy is `Parallel` which will create pods in parallel
206 // to match the desired scale without waiting, and on scale down will delete
209 PodManagementPolicy PodManagementPolicyType `json:"podManagementPolicy,omitempty" protobuf:"bytes,6,opt,name=podManagementPolicy,casttype=PodManagementPolicyType"`
211 // updateStrategy indicates the StatefulSetUpdateStrategy that will be
212 // employed to update Pods in the StatefulSet when a revision is made to
214 UpdateStrategy StatefulSetUpdateStrategy `json:"updateStrategy,omitempty" protobuf:"bytes,7,opt,name=updateStrategy"`
216 // revisionHistoryLimit is the maximum number of revisions that will
217 // be maintained in the StatefulSet's revision history. The revision history
218 // consists of all revisions not represented by a currently applied
219 // StatefulSetSpec version. The default value is 10.
220 RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty" protobuf:"varint,8,opt,name=revisionHistoryLimit"`
223 // StatefulSetStatus represents the current state of a StatefulSet.
224 type StatefulSetStatus struct {
225 // observedGeneration is the most recent generation observed for this StatefulSet. It corresponds to the
226 // StatefulSet's generation, which is updated on mutation by the API Server.
228 ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,1,opt,name=observedGeneration"`
230 // replicas is the number of Pods created by the StatefulSet controller.
231 Replicas int32 `json:"replicas" protobuf:"varint,2,opt,name=replicas"`
233 // readyReplicas is the number of Pods created by the StatefulSet controller that have a Ready Condition.
234 ReadyReplicas int32 `json:"readyReplicas,omitempty" protobuf:"varint,3,opt,name=readyReplicas"`
236 // currentReplicas is the number of Pods created by the StatefulSet controller from the StatefulSet version
237 // indicated by currentRevision.
238 CurrentReplicas int32 `json:"currentReplicas,omitempty" protobuf:"varint,4,opt,name=currentReplicas"`
240 // updatedReplicas is the number of Pods created by the StatefulSet controller from the StatefulSet version
241 // indicated by updateRevision.
242 UpdatedReplicas int32 `json:"updatedReplicas,omitempty" protobuf:"varint,5,opt,name=updatedReplicas"`
244 // currentRevision, if not empty, indicates the version of the StatefulSet used to generate Pods in the
245 // sequence [0,currentReplicas).
246 CurrentRevision string `json:"currentRevision,omitempty" protobuf:"bytes,6,opt,name=currentRevision"`
248 // updateRevision, if not empty, indicates the version of the StatefulSet used to generate Pods in the sequence
249 // [replicas-updatedReplicas,replicas)
250 UpdateRevision string `json:"updateRevision,omitempty" protobuf:"bytes,7,opt,name=updateRevision"`
252 // collisionCount is the count of hash collisions for the StatefulSet. The StatefulSet controller
253 // uses this field as a collision avoidance mechanism when it needs to create the name for the
254 // newest ControllerRevision.
256 CollisionCount *int32 `json:"collisionCount,omitempty" protobuf:"varint,9,opt,name=collisionCount"`
258 // Represents the latest available observations of a statefulset's current state.
260 // +patchMergeKey=type
261 // +patchStrategy=merge
262 Conditions []StatefulSetCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,10,rep,name=conditions"`
265 type StatefulSetConditionType string
267 // StatefulSetCondition describes the state of a statefulset at a certain point.
268 type StatefulSetCondition struct {
269 // Type of statefulset condition.
270 Type StatefulSetConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=StatefulSetConditionType"`
271 // Status of the condition, one of True, False, Unknown.
272 Status v1.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"`
273 // Last time the condition transitioned from one status to another.
275 LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,3,opt,name=lastTransitionTime"`
276 // The reason for the condition's last transition.
278 Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"`
279 // A human readable message indicating details about the transition.
281 Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"`
284 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
286 // StatefulSetList is a collection of StatefulSets.
287 type StatefulSetList struct {
288 metav1.TypeMeta `json:",inline"`
290 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
291 Items []StatefulSet `json:"items" protobuf:"bytes,2,rep,name=items"`
295 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
297 // DEPRECATED - This group version of Deployment is deprecated by apps/v1/Deployment. See the release notes for
299 // Deployment enables declarative updates for Pods and ReplicaSets.
300 type Deployment struct {
301 metav1.TypeMeta `json:",inline"`
302 // Standard object metadata.
304 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
306 // Specification of the desired behavior of the Deployment.
308 Spec DeploymentSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
310 // Most recently observed status of the Deployment.
312 Status DeploymentStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
315 // DeploymentSpec is the specification of the desired behavior of the Deployment.
316 type DeploymentSpec struct {
317 // Number of desired pods. This is a pointer to distinguish between explicit
318 // zero and not specified. Defaults to 1.
320 Replicas *int32 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"`
322 // Label selector for pods. Existing ReplicaSets whose pods are
323 // selected by this will be the ones affected by this deployment.
324 // It must match the pod template's labels.
325 Selector *metav1.LabelSelector `json:"selector" protobuf:"bytes,2,opt,name=selector"`
327 // Template describes the pods that will be created.
328 Template v1.PodTemplateSpec `json:"template" protobuf:"bytes,3,opt,name=template"`
330 // The deployment strategy to use to replace existing pods with new ones.
332 // +patchStrategy=retainKeys
333 Strategy DeploymentStrategy `json:"strategy,omitempty" patchStrategy:"retainKeys" protobuf:"bytes,4,opt,name=strategy"`
335 // Minimum number of seconds for which a newly created pod should be ready
336 // without any of its container crashing, for it to be considered available.
337 // Defaults to 0 (pod will be considered available as soon as it is ready)
339 MinReadySeconds int32 `json:"minReadySeconds,omitempty" protobuf:"varint,5,opt,name=minReadySeconds"`
341 // The number of old ReplicaSets to retain to allow rollback.
342 // This is a pointer to distinguish between explicit zero and not specified.
345 RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty" protobuf:"varint,6,opt,name=revisionHistoryLimit"`
347 // Indicates that the deployment is paused.
349 Paused bool `json:"paused,omitempty" protobuf:"varint,7,opt,name=paused"`
351 // The maximum time in seconds for a deployment to make progress before it
352 // is considered to be failed. The deployment controller will continue to
353 // process failed deployments and a condition with a ProgressDeadlineExceeded
354 // reason will be surfaced in the deployment status. Note that progress will
355 // not be estimated during the time a deployment is paused. Defaults to 600s.
356 ProgressDeadlineSeconds *int32 `json:"progressDeadlineSeconds,omitempty" protobuf:"varint,9,opt,name=progressDeadlineSeconds"`
360 // DefaultDeploymentUniqueLabelKey is the default key of the selector that is added
361 // to existing ReplicaSets (and label key that is added to its pods) to prevent the existing ReplicaSets
362 // to select new pods (and old pods being select by new ReplicaSet).
363 DefaultDeploymentUniqueLabelKey string = "pod-template-hash"
366 // DeploymentStrategy describes how to replace existing pods with new ones.
367 type DeploymentStrategy struct {
368 // Type of deployment. Can be "Recreate" or "RollingUpdate". Default is RollingUpdate.
370 Type DeploymentStrategyType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type,casttype=DeploymentStrategyType"`
372 // Rolling update config params. Present only if DeploymentStrategyType =
375 // TODO: Update this to follow our convention for oneOf, whatever we decide it
378 RollingUpdate *RollingUpdateDeployment `json:"rollingUpdate,omitempty" protobuf:"bytes,2,opt,name=rollingUpdate"`
381 type DeploymentStrategyType string
384 // Kill all existing pods before creating new ones.
385 RecreateDeploymentStrategyType DeploymentStrategyType = "Recreate"
387 // Replace the old ReplicaSets by new one using rolling update i.e gradually scale down the old ReplicaSets and scale up the new one.
388 RollingUpdateDeploymentStrategyType DeploymentStrategyType = "RollingUpdate"
391 // Spec to control the desired behavior of rolling update.
392 type RollingUpdateDeployment struct {
393 // The maximum number of pods that can be unavailable during the update.
394 // Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%).
395 // Absolute number is calculated from percentage by rounding down.
396 // This can not be 0 if MaxSurge is 0.
398 // Example: when this is set to 30%, the old ReplicaSet can be scaled down to 70% of desired pods
399 // immediately when the rolling update starts. Once new pods are ready, old ReplicaSet
400 // can be scaled down further, followed by scaling up the new ReplicaSet, ensuring
401 // that the total number of pods available at all times during the update is at
402 // least 70% of desired pods.
404 MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty" protobuf:"bytes,1,opt,name=maxUnavailable"`
406 // The maximum number of pods that can be scheduled above the desired number of
408 // Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%).
409 // This can not be 0 if MaxUnavailable is 0.
410 // Absolute number is calculated from percentage by rounding up.
412 // Example: when this is set to 30%, the new ReplicaSet can be scaled up immediately when
413 // the rolling update starts, such that the total number of old and new pods do not exceed
414 // 130% of desired pods. Once old pods have been killed,
415 // new ReplicaSet can be scaled up further, ensuring that total number of pods running
416 // at any time during the update is atmost 130% of desired pods.
418 MaxSurge *intstr.IntOrString `json:"maxSurge,omitempty" protobuf:"bytes,2,opt,name=maxSurge"`
421 // DeploymentStatus is the most recently observed status of the Deployment.
422 type DeploymentStatus struct {
423 // The generation observed by the deployment controller.
425 ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,1,opt,name=observedGeneration"`
427 // Total number of non-terminated pods targeted by this deployment (their labels match the selector).
429 Replicas int32 `json:"replicas,omitempty" protobuf:"varint,2,opt,name=replicas"`
431 // Total number of non-terminated pods targeted by this deployment that have the desired template spec.
433 UpdatedReplicas int32 `json:"updatedReplicas,omitempty" protobuf:"varint,3,opt,name=updatedReplicas"`
435 // Total number of ready pods targeted by this deployment.
437 ReadyReplicas int32 `json:"readyReplicas,omitempty" protobuf:"varint,7,opt,name=readyReplicas"`
439 // Total number of available pods (ready for at least minReadySeconds) targeted by this deployment.
441 AvailableReplicas int32 `json:"availableReplicas,omitempty" protobuf:"varint,4,opt,name=availableReplicas"`
443 // Total number of unavailable pods targeted by this deployment. This is the total number of
444 // pods that are still required for the deployment to have 100% available capacity. They may
445 // either be pods that are running but not yet available or pods that still have not been created.
447 UnavailableReplicas int32 `json:"unavailableReplicas,omitempty" protobuf:"varint,5,opt,name=unavailableReplicas"`
449 // Represents the latest available observations of a deployment's current state.
450 // +patchMergeKey=type
451 // +patchStrategy=merge
452 Conditions []DeploymentCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,6,rep,name=conditions"`
454 // Count of hash collisions for the Deployment. The Deployment controller uses this
455 // field as a collision avoidance mechanism when it needs to create the name for the
456 // newest ReplicaSet.
458 CollisionCount *int32 `json:"collisionCount,omitempty" protobuf:"varint,8,opt,name=collisionCount"`
461 type DeploymentConditionType string
463 // These are valid conditions of a deployment.
465 // Available means the deployment is available, ie. at least the minimum available
466 // replicas required are up and running for at least minReadySeconds.
467 DeploymentAvailable DeploymentConditionType = "Available"
468 // Progressing means the deployment is progressing. Progress for a deployment is
469 // considered when a new replica set is created or adopted, and when new pods scale
470 // up or old pods scale down. Progress is not estimated for paused deployments or
471 // when progressDeadlineSeconds is not specified.
472 DeploymentProgressing DeploymentConditionType = "Progressing"
473 // ReplicaFailure is added in a deployment when one of its pods fails to be created
475 DeploymentReplicaFailure DeploymentConditionType = "ReplicaFailure"
478 // DeploymentCondition describes the state of a deployment at a certain point.
479 type DeploymentCondition struct {
480 // Type of deployment condition.
481 Type DeploymentConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=DeploymentConditionType"`
482 // Status of the condition, one of True, False, Unknown.
483 Status v1.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"`
484 // The last time this condition was updated.
485 LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty" protobuf:"bytes,6,opt,name=lastUpdateTime"`
486 // Last time the condition transitioned from one status to another.
487 LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,7,opt,name=lastTransitionTime"`
488 // The reason for the condition's last transition.
489 Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"`
490 // A human readable message indicating details about the transition.
491 Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"`
494 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
496 // DeploymentList is a list of Deployments.
497 type DeploymentList struct {
498 metav1.TypeMeta `json:",inline"`
499 // Standard list metadata.
501 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
503 // Items is the list of Deployments.
504 Items []Deployment `json:"items" protobuf:"bytes,2,rep,name=items"`
507 // DaemonSetUpdateStrategy is a struct used to control the update strategy for a DaemonSet.
508 type DaemonSetUpdateStrategy struct {
509 // Type of daemon set update. Can be "RollingUpdate" or "OnDelete". Default is RollingUpdate.
511 Type DaemonSetUpdateStrategyType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type"`
513 // Rolling update config params. Present only if type = "RollingUpdate".
515 // TODO: Update this to follow our convention for oneOf, whatever we decide it
516 // to be. Same as Deployment `strategy.rollingUpdate`.
517 // See https://github.com/kubernetes/kubernetes/issues/35345
519 RollingUpdate *RollingUpdateDaemonSet `json:"rollingUpdate,omitempty" protobuf:"bytes,2,opt,name=rollingUpdate"`
522 type DaemonSetUpdateStrategyType string
525 // Replace the old daemons by new ones using rolling update i.e replace them on each node one after the other.
526 RollingUpdateDaemonSetStrategyType DaemonSetUpdateStrategyType = "RollingUpdate"
528 // Replace the old daemons only when it's killed
529 OnDeleteDaemonSetStrategyType DaemonSetUpdateStrategyType = "OnDelete"
532 // Spec to control the desired behavior of daemon set rolling update.
533 type RollingUpdateDaemonSet struct {
534 // The maximum number of DaemonSet pods that can be unavailable during the
535 // update. Value can be an absolute number (ex: 5) or a percentage of total
536 // number of DaemonSet pods at the start of the update (ex: 10%). Absolute
537 // number is calculated from percentage by rounding up.
539 // Default value is 1.
540 // Example: when this is set to 30%, at most 30% of the total number of nodes
541 // that should be running the daemon pod (i.e. status.desiredNumberScheduled)
542 // can have their pods stopped for an update at any given
543 // time. The update starts by stopping at most 30% of those DaemonSet pods
544 // and then brings up new DaemonSet pods in their place. Once the new pods
545 // are available, it then proceeds onto other DaemonSet pods, thus ensuring
546 // that at least 70% of original number of DaemonSet pods are available at
547 // all times during the update.
549 MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty" protobuf:"bytes,1,opt,name=maxUnavailable"`
552 // DaemonSetSpec is the specification of a daemon set.
553 type DaemonSetSpec struct {
554 // A label query over pods that are managed by the daemon set.
555 // Must match in order to be controlled.
556 // It must match the pod template's labels.
557 // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors
558 Selector *metav1.LabelSelector `json:"selector" protobuf:"bytes,1,opt,name=selector"`
560 // An object that describes the pod that will be created.
561 // The DaemonSet will create exactly one copy of this pod on every node
562 // that matches the template's node selector (or on every node if no node
563 // selector is specified).
564 // More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-template
565 Template v1.PodTemplateSpec `json:"template" protobuf:"bytes,2,opt,name=template"`
567 // An update strategy to replace existing DaemonSet pods with new pods.
569 UpdateStrategy DaemonSetUpdateStrategy `json:"updateStrategy,omitempty" protobuf:"bytes,3,opt,name=updateStrategy"`
571 // The minimum number of seconds for which a newly created DaemonSet pod should
572 // be ready without any of its container crashing, for it to be considered
573 // available. Defaults to 0 (pod will be considered available as soon as it
576 MinReadySeconds int32 `json:"minReadySeconds,omitempty" protobuf:"varint,4,opt,name=minReadySeconds"`
578 // The number of old history to retain to allow rollback.
579 // This is a pointer to distinguish between explicit zero and not specified.
582 RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty" protobuf:"varint,6,opt,name=revisionHistoryLimit"`
585 // DaemonSetStatus represents the current status of a daemon set.
586 type DaemonSetStatus struct {
587 // The number of nodes that are running at least 1
588 // daemon pod and are supposed to run the daemon pod.
589 // More info: https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/
590 CurrentNumberScheduled int32 `json:"currentNumberScheduled" protobuf:"varint,1,opt,name=currentNumberScheduled"`
592 // The number of nodes that are running the daemon pod, but are
593 // not supposed to run the daemon pod.
594 // More info: https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/
595 NumberMisscheduled int32 `json:"numberMisscheduled" protobuf:"varint,2,opt,name=numberMisscheduled"`
597 // The total number of nodes that should be running the daemon
598 // pod (including nodes correctly running the daemon pod).
599 // More info: https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/
600 DesiredNumberScheduled int32 `json:"desiredNumberScheduled" protobuf:"varint,3,opt,name=desiredNumberScheduled"`
602 // The number of nodes that should be running the daemon pod and have one
603 // or more of the daemon pod running and ready.
604 NumberReady int32 `json:"numberReady" protobuf:"varint,4,opt,name=numberReady"`
606 // The most recent generation observed by the daemon set controller.
608 ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,5,opt,name=observedGeneration"`
610 // The total number of nodes that are running updated daemon pod
612 UpdatedNumberScheduled int32 `json:"updatedNumberScheduled,omitempty" protobuf:"varint,6,opt,name=updatedNumberScheduled"`
614 // The number of nodes that should be running the
615 // daemon pod and have one or more of the daemon pod running and
616 // available (ready for at least spec.minReadySeconds)
618 NumberAvailable int32 `json:"numberAvailable,omitempty" protobuf:"varint,7,opt,name=numberAvailable"`
620 // The number of nodes that should be running the
621 // daemon pod and have none of the daemon pod running and available
622 // (ready for at least spec.minReadySeconds)
624 NumberUnavailable int32 `json:"numberUnavailable,omitempty" protobuf:"varint,8,opt,name=numberUnavailable"`
626 // Count of hash collisions for the DaemonSet. The DaemonSet controller
627 // uses this field as a collision avoidance mechanism when it needs to
628 // create the name for the newest ControllerRevision.
630 CollisionCount *int32 `json:"collisionCount,omitempty" protobuf:"varint,9,opt,name=collisionCount"`
632 // Represents the latest available observations of a DaemonSet's current state.
634 // +patchMergeKey=type
635 // +patchStrategy=merge
636 Conditions []DaemonSetCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,10,rep,name=conditions"`
639 type DaemonSetConditionType string
641 // TODO: Add valid condition types of a DaemonSet.
643 // DaemonSetCondition describes the state of a DaemonSet at a certain point.
644 type DaemonSetCondition struct {
645 // Type of DaemonSet condition.
646 Type DaemonSetConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=DaemonSetConditionType"`
647 // Status of the condition, one of True, False, Unknown.
648 Status v1.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"`
649 // Last time the condition transitioned from one status to another.
651 LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,3,opt,name=lastTransitionTime"`
652 // The reason for the condition's last transition.
654 Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"`
655 // A human readable message indicating details about the transition.
657 Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"`
661 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
663 // DEPRECATED - This group version of DaemonSet is deprecated by apps/v1/DaemonSet. See the release notes for
665 // DaemonSet represents the configuration of a daemon set.
666 type DaemonSet struct {
667 metav1.TypeMeta `json:",inline"`
668 // Standard object's metadata.
669 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
671 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
673 // The desired behavior of this daemon set.
674 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status
676 Spec DaemonSetSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
678 // The current status of this daemon set. This data may be
679 // out of date by some window of time.
680 // Populated by the system.
682 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status
684 Status DaemonSetStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
688 // DefaultDaemonSetUniqueLabelKey is the default label key that is added
689 // to existing DaemonSet pods to distinguish between old and new
690 // DaemonSet pods during DaemonSet template updates.
691 DefaultDaemonSetUniqueLabelKey = ControllerRevisionHashLabelKey
694 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
696 // DaemonSetList is a collection of daemon sets.
697 type DaemonSetList struct {
698 metav1.TypeMeta `json:",inline"`
699 // Standard list metadata.
700 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
702 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
704 // A list of daemon sets.
705 Items []DaemonSet `json:"items" protobuf:"bytes,2,rep,name=items"`
709 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
711 // DEPRECATED - This group version of ReplicaSet is deprecated by apps/v1/ReplicaSet. See the release notes for
713 // ReplicaSet ensures that a specified number of pod replicas are running at any given time.
714 type ReplicaSet struct {
715 metav1.TypeMeta `json:",inline"`
717 // If the Labels of a ReplicaSet are empty, they are defaulted to
718 // be the same as the Pod(s) that the ReplicaSet manages.
719 // Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
721 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
723 // Spec defines the specification of the desired behavior of the ReplicaSet.
724 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status
726 Spec ReplicaSetSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
728 // Status is the most recently observed status of the ReplicaSet.
729 // This data may be out of date by some window of time.
730 // Populated by the system.
732 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status
734 Status ReplicaSetStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
737 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
739 // ReplicaSetList is a collection of ReplicaSets.
740 type ReplicaSetList struct {
741 metav1.TypeMeta `json:",inline"`
742 // Standard list metadata.
743 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds
745 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
747 // List of ReplicaSets.
748 // More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller
749 Items []ReplicaSet `json:"items" protobuf:"bytes,2,rep,name=items"`
752 // ReplicaSetSpec is the specification of a ReplicaSet.
753 type ReplicaSetSpec struct {
754 // Replicas is the number of desired replicas.
755 // This is a pointer to distinguish between explicit zero and unspecified.
757 // More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller/#what-is-a-replicationcontroller
759 Replicas *int32 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"`
761 // Minimum number of seconds for which a newly created pod should be ready
762 // without any of its container crashing, for it to be considered available.
763 // Defaults to 0 (pod will be considered available as soon as it is ready)
765 MinReadySeconds int32 `json:"minReadySeconds,omitempty" protobuf:"varint,4,opt,name=minReadySeconds"`
767 // Selector is a label query over pods that should match the replica count.
768 // Label keys and values that must match in order to be controlled by this replica set.
769 // It must match the pod template's labels.
770 // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors
771 Selector *metav1.LabelSelector `json:"selector" protobuf:"bytes,2,opt,name=selector"`
773 // Template is the object that describes the pod that will be created if
774 // insufficient replicas are detected.
775 // More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-template
777 Template v1.PodTemplateSpec `json:"template,omitempty" protobuf:"bytes,3,opt,name=template"`
780 // ReplicaSetStatus represents the current status of a ReplicaSet.
781 type ReplicaSetStatus struct {
782 // Replicas is the most recently oberved number of replicas.
783 // More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller/#what-is-a-replicationcontroller
784 Replicas int32 `json:"replicas" protobuf:"varint,1,opt,name=replicas"`
786 // The number of pods that have labels matching the labels of the pod template of the replicaset.
788 FullyLabeledReplicas int32 `json:"fullyLabeledReplicas,omitempty" protobuf:"varint,2,opt,name=fullyLabeledReplicas"`
790 // The number of ready replicas for this replica set.
792 ReadyReplicas int32 `json:"readyReplicas,omitempty" protobuf:"varint,4,opt,name=readyReplicas"`
794 // The number of available replicas (ready for at least minReadySeconds) for this replica set.
796 AvailableReplicas int32 `json:"availableReplicas,omitempty" protobuf:"varint,5,opt,name=availableReplicas"`
798 // ObservedGeneration reflects the generation of the most recently observed ReplicaSet.
800 ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,3,opt,name=observedGeneration"`
802 // Represents the latest available observations of a replica set's current state.
804 // +patchMergeKey=type
805 // +patchStrategy=merge
806 Conditions []ReplicaSetCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,6,rep,name=conditions"`
809 type ReplicaSetConditionType string
811 // These are valid conditions of a replica set.
813 // ReplicaSetReplicaFailure is added in a replica set when one of its pods fails to be created
814 // due to insufficient quota, limit ranges, pod security policy, node selectors, etc. or deleted
815 // due to kubelet being down or finalizers are failing.
816 ReplicaSetReplicaFailure ReplicaSetConditionType = "ReplicaFailure"
819 // ReplicaSetCondition describes the state of a replica set at a certain point.
820 type ReplicaSetCondition struct {
821 // Type of replica set condition.
822 Type ReplicaSetConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=ReplicaSetConditionType"`
823 // Status of the condition, one of True, False, Unknown.
824 Status v1.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"`
825 // The last time the condition transitioned from one status to another.
827 LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,3,opt,name=lastTransitionTime"`
828 // The reason for the condition's last transition.
830 Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"`
831 // A human readable message indicating details about the transition.
833 Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"`
837 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
839 // DEPRECATED - This group version of ControllerRevision is deprecated by apps/v1/ControllerRevision. See the
840 // release notes for more information.
841 // ControllerRevision implements an immutable snapshot of state data. Clients
842 // are responsible for serializing and deserializing the objects that contain
843 // their internal state.
844 // Once a ControllerRevision has been successfully created, it can not be updated.
845 // The API Server will fail validation of all requests that attempt to mutate
846 // the Data field. ControllerRevisions may, however, be deleted. Note that, due to its use by both
847 // the DaemonSet and StatefulSet controllers for update and rollback, this object is beta. However,
848 // it may be subject to name and representation changes in future releases, and clients should not
849 // depend on its stability. It is primarily for internal use by controllers.
850 type ControllerRevision struct {
851 metav1.TypeMeta `json:",inline"`
852 // Standard object's metadata.
853 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
855 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
857 // Data is the serialized representation of the state.
858 Data runtime.RawExtension `json:"data,omitempty" protobuf:"bytes,2,opt,name=data"`
860 // Revision indicates the revision of the state represented by Data.
861 Revision int64 `json:"revision" protobuf:"varint,3,opt,name=revision"`
864 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
866 // ControllerRevisionList is a resource containing a list of ControllerRevision objects.
867 type ControllerRevisionList struct {
868 metav1.TypeMeta `json:",inline"`
870 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
872 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
874 // Items is the list of ControllerRevisions
875 Items []ControllerRevision `json:"items" protobuf:"bytes,2,rep,name=items"`