blob: 1f4a292f5164110df7f2b1fe8d44e5edd3b92a4e [file] [log] [blame]
Matteo Scandoloa4285862020-12-01 18:10:10 -08001/*
2Copyright 2016 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 v1beta1
18
19import (
20 v1 "k8s.io/api/core/v1"
21 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
22 "k8s.io/apimachinery/pkg/runtime"
23 "k8s.io/apimachinery/pkg/util/intstr"
24)
25
26const (
27 ControllerRevisionHashLabelKey = "controller-revision-hash"
28 StatefulSetRevisionLabel = ControllerRevisionHashLabelKey
29 StatefulSetPodNameLabel = "statefulset.kubernetes.io/pod-name"
30)
31
32// ScaleSpec describes the attributes of a scale subresource
33type ScaleSpec struct {
34 // desired number of instances for the scaled object.
35 // +optional
36 Replicas int32 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"`
37}
38
39// ScaleStatus represents the current status of a scale subresource.
40type ScaleStatus struct {
41 // actual number of observed instances of the scaled object.
42 Replicas int32 `json:"replicas" protobuf:"varint,1,opt,name=replicas"`
43
44 // label query over pods that should match the replicas count. More info: http://kubernetes.io/docs/user-guide/labels#label-selectors
45 // +optional
46 Selector map[string]string `json:"selector,omitempty" protobuf:"bytes,2,rep,name=selector"`
47
48 // label selector for pods that should match the replicas count. This is a serializated
49 // version of both map-based and more expressive set-based selectors. This is done to
50 // avoid introspection in the clients. The string will be in the same format as the
51 // query-param syntax. If the target type only supports map-based selectors, both this
52 // field and map-based selector field are populated.
53 // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors
54 // +optional
55 TargetSelector string `json:"targetSelector,omitempty" protobuf:"bytes,3,opt,name=targetSelector"`
56}
57
58// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
59// +k8s:prerelease-lifecycle-gen:introduced=1.6
60// +k8s:prerelease-lifecycle-gen:deprecated=1.8
61// +k8s:prerelease-lifecycle-gen:removed=1.18
62// +k8s:prerelease-lifecycle-gen:replacement=autoscaling,v1,Scale
63
64// Scale represents a scaling request for a resource.
65type Scale struct {
66 metav1.TypeMeta `json:",inline"`
67 // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.
68 // +optional
69 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
70
71 // defines the behavior of the scale. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status.
72 // +optional
73 Spec ScaleSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
74
75 // current status of the scale. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status. Read-only.
76 // +optional
77 Status ScaleStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
78}
79
80// +genclient
81// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
82// +k8s:prerelease-lifecycle-gen:introduced=1.5
83// +k8s:prerelease-lifecycle-gen:deprecated=1.8
84// +k8s:prerelease-lifecycle-gen:removed=1.18
85// +k8s:prerelease-lifecycle-gen:replacement=apps,v1,StatefulSet
86
87// DEPRECATED - This group version of StatefulSet is deprecated by apps/v1beta2/StatefulSet. See the release notes for
88// more information.
89// StatefulSet represents a set of pods with consistent identities.
90// Identities are defined as:
91// - Network: A single stable DNS and hostname.
92// - Storage: As many VolumeClaims as requested.
93// The StatefulSet guarantees that a given network identity will always
94// map to the same storage identity.
95type StatefulSet struct {
96 metav1.TypeMeta `json:",inline"`
97 // +optional
98 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
99
100 // Spec defines the desired identities of pods in this set.
101 // +optional
102 Spec StatefulSetSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
103
104 // Status is the current status of Pods in this StatefulSet. This data
105 // may be out of date by some window of time.
106 // +optional
107 Status StatefulSetStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
108}
109
110// PodManagementPolicyType defines the policy for creating pods under a stateful set.
111type PodManagementPolicyType string
112
113const (
114 // OrderedReadyPodManagement will create pods in strictly increasing order on
115 // scale up and strictly decreasing order on scale down, progressing only when
116 // the previous pod is ready or terminated. At most one pod will be changed
117 // at any time.
118 OrderedReadyPodManagement PodManagementPolicyType = "OrderedReady"
119 // ParallelPodManagement will create and delete pods as soon as the stateful set
120 // replica count is changed, and will not wait for pods to be ready or complete
121 // termination.
122 ParallelPodManagement PodManagementPolicyType = "Parallel"
123)
124
125// StatefulSetUpdateStrategy indicates the strategy that the StatefulSet
126// controller will use to perform updates. It includes any additional parameters
127// necessary to perform the update for the indicated strategy.
128type StatefulSetUpdateStrategy struct {
129 // Type indicates the type of the StatefulSetUpdateStrategy.
130 Type StatefulSetUpdateStrategyType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type,casttype=StatefulSetStrategyType"`
131 // RollingUpdate is used to communicate parameters when Type is RollingUpdateStatefulSetStrategyType.
132 RollingUpdate *RollingUpdateStatefulSetStrategy `json:"rollingUpdate,omitempty" protobuf:"bytes,2,opt,name=rollingUpdate"`
133}
134
135// StatefulSetUpdateStrategyType is a string enumeration type that enumerates
136// all possible update strategies for the StatefulSet controller.
137type StatefulSetUpdateStrategyType string
138
139const (
140 // RollingUpdateStatefulSetStrategyType indicates that update will be
141 // applied to all Pods in the StatefulSet with respect to the StatefulSet
142 // ordering constraints. When a scale operation is performed with this
143 // strategy, new Pods will be created from the specification version indicated
144 // by the StatefulSet's updateRevision.
145 RollingUpdateStatefulSetStrategyType StatefulSetUpdateStrategyType = "RollingUpdate"
146 // OnDeleteStatefulSetStrategyType triggers the legacy behavior. Version
147 // tracking and ordered rolling restarts are disabled. Pods are recreated
148 // from the StatefulSetSpec when they are manually deleted. When a scale
149 // operation is performed with this strategy,specification version indicated
150 // by the StatefulSet's currentRevision.
151 OnDeleteStatefulSetStrategyType StatefulSetUpdateStrategyType = "OnDelete"
152)
153
154// RollingUpdateStatefulSetStrategy is used to communicate parameter for RollingUpdateStatefulSetStrategyType.
155type RollingUpdateStatefulSetStrategy struct {
156 // Partition indicates the ordinal at which the StatefulSet should be
157 // partitioned.
158 Partition *int32 `json:"partition,omitempty" protobuf:"varint,1,opt,name=partition"`
159}
160
161// A StatefulSetSpec is the specification of a StatefulSet.
162type StatefulSetSpec struct {
163 // replicas is the desired number of replicas of the given Template.
164 // These are replicas in the sense that they are instantiations of the
165 // same Template, but individual replicas also have a consistent identity.
166 // If unspecified, defaults to 1.
167 // TODO: Consider a rename of this field.
168 // +optional
169 Replicas *int32 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"`
170
171 // selector is a label query over pods that should match the replica count.
172 // If empty, defaulted to labels on the pod template.
173 // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors
174 // +optional
175 Selector *metav1.LabelSelector `json:"selector,omitempty" protobuf:"bytes,2,opt,name=selector"`
176
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"`
182
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.
190 // +optional
191 VolumeClaimTemplates []v1.PersistentVolumeClaim `json:"volumeClaimTemplates,omitempty" protobuf:"bytes,4,rep,name=volumeClaimTemplates"`
192
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"`
199
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
207 // all pods at once.
208 // +optional
209 PodManagementPolicy PodManagementPolicyType `json:"podManagementPolicy,omitempty" protobuf:"bytes,6,opt,name=podManagementPolicy,casttype=PodManagementPolicyType"`
210
211 // updateStrategy indicates the StatefulSetUpdateStrategy that will be
212 // employed to update Pods in the StatefulSet when a revision is made to
213 // Template.
214 UpdateStrategy StatefulSetUpdateStrategy `json:"updateStrategy,omitempty" protobuf:"bytes,7,opt,name=updateStrategy"`
215
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"`
221}
222
223// StatefulSetStatus represents the current state of a StatefulSet.
224type 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.
227 // +optional
228 ObservedGeneration *int64 `json:"observedGeneration,omitempty" protobuf:"varint,1,opt,name=observedGeneration"`
229
230 // replicas is the number of Pods created by the StatefulSet controller.
231 Replicas int32 `json:"replicas" protobuf:"varint,2,opt,name=replicas"`
232
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"`
235
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"`
239
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"`
243
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"`
247
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"`
251
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.
255 // +optional
256 CollisionCount *int32 `json:"collisionCount,omitempty" protobuf:"varint,9,opt,name=collisionCount"`
257
258 // Represents the latest available observations of a statefulset's current state.
259 // +optional
260 // +patchMergeKey=type
261 // +patchStrategy=merge
262 Conditions []StatefulSetCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,10,rep,name=conditions"`
263}
264
265type StatefulSetConditionType string
266
267// StatefulSetCondition describes the state of a statefulset at a certain point.
268type 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.
274 // +optional
275 LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,3,opt,name=lastTransitionTime"`
276 // The reason for the condition's last transition.
277 // +optional
278 Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"`
279 // A human readable message indicating details about the transition.
280 // +optional
281 Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"`
282}
283
284// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
285// +k8s:prerelease-lifecycle-gen:introduced=1.5
286// +k8s:prerelease-lifecycle-gen:deprecated=1.8
287// +k8s:prerelease-lifecycle-gen:removed=1.18
288// +k8s:prerelease-lifecycle-gen:replacement=apps,v1,StatefulSetList
289
290// StatefulSetList is a collection of StatefulSets.
291type StatefulSetList struct {
292 metav1.TypeMeta `json:",inline"`
293 // +optional
294 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
295 Items []StatefulSet `json:"items" protobuf:"bytes,2,rep,name=items"`
296}
297
298// +genclient
299// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
300// +k8s:prerelease-lifecycle-gen:introduced=1.6
301// +k8s:prerelease-lifecycle-gen:deprecated=1.8
302// +k8s:prerelease-lifecycle-gen:removed=1.18
303// +k8s:prerelease-lifecycle-gen:replacement=apps,v1,Deployment
304
305// DEPRECATED - This group version of Deployment is deprecated by apps/v1beta2/Deployment. See the release notes for
306// more information.
307// Deployment enables declarative updates for Pods and ReplicaSets.
308type Deployment struct {
309 metav1.TypeMeta `json:",inline"`
310 // Standard object metadata.
311 // +optional
312 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
313
314 // Specification of the desired behavior of the Deployment.
315 // +optional
316 Spec DeploymentSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
317
318 // Most recently observed status of the Deployment.
319 // +optional
320 Status DeploymentStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
321}
322
323// DeploymentSpec is the specification of the desired behavior of the Deployment.
324type DeploymentSpec struct {
325 // Number of desired pods. This is a pointer to distinguish between explicit
326 // zero and not specified. Defaults to 1.
327 // +optional
328 Replicas *int32 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"`
329
330 // Label selector for pods. Existing ReplicaSets whose pods are
331 // selected by this will be the ones affected by this deployment.
332 // +optional
333 Selector *metav1.LabelSelector `json:"selector,omitempty" protobuf:"bytes,2,opt,name=selector"`
334
335 // Template describes the pods that will be created.
336 Template v1.PodTemplateSpec `json:"template" protobuf:"bytes,3,opt,name=template"`
337
338 // The deployment strategy to use to replace existing pods with new ones.
339 // +optional
340 // +patchStrategy=retainKeys
341 Strategy DeploymentStrategy `json:"strategy,omitempty" patchStrategy:"retainKeys" protobuf:"bytes,4,opt,name=strategy"`
342
343 // Minimum number of seconds for which a newly created pod should be ready
344 // without any of its container crashing, for it to be considered available.
345 // Defaults to 0 (pod will be considered available as soon as it is ready)
346 // +optional
347 MinReadySeconds int32 `json:"minReadySeconds,omitempty" protobuf:"varint,5,opt,name=minReadySeconds"`
348
349 // The number of old ReplicaSets to retain to allow rollback.
350 // This is a pointer to distinguish between explicit zero and not specified.
351 // Defaults to 2.
352 // +optional
353 RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty" protobuf:"varint,6,opt,name=revisionHistoryLimit"`
354
355 // Indicates that the deployment is paused.
356 // +optional
357 Paused bool `json:"paused,omitempty" protobuf:"varint,7,opt,name=paused"`
358
359 // DEPRECATED.
360 // The config this deployment is rolling back to. Will be cleared after rollback is done.
361 // +optional
362 RollbackTo *RollbackConfig `json:"rollbackTo,omitempty" protobuf:"bytes,8,opt,name=rollbackTo"`
363
364 // The maximum time in seconds for a deployment to make progress before it
365 // is considered to be failed. The deployment controller will continue to
366 // process failed deployments and a condition with a ProgressDeadlineExceeded
367 // reason will be surfaced in the deployment status. Note that progress will
368 // not be estimated during the time a deployment is paused. Defaults to 600s.
369 // +optional
370 ProgressDeadlineSeconds *int32 `json:"progressDeadlineSeconds,omitempty" protobuf:"varint,9,opt,name=progressDeadlineSeconds"`
371}
372
373// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
374// +k8s:prerelease-lifecycle-gen:introduced=1.6
375// +k8s:prerelease-lifecycle-gen:deprecated=1.8
376// +k8s:prerelease-lifecycle-gen:removed=1.18
377// +k8s:prerelease-lifecycle-gen:replacement=apps,v1,DeploymentRollback
378
379// DEPRECATED.
380// DeploymentRollback stores the information required to rollback a deployment.
381type DeploymentRollback struct {
382 metav1.TypeMeta `json:",inline"`
383 // Required: This must match the Name of a deployment.
384 Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
385 // The annotations to be updated to a deployment
386 // +optional
387 UpdatedAnnotations map[string]string `json:"updatedAnnotations,omitempty" protobuf:"bytes,2,rep,name=updatedAnnotations"`
388 // The config of this deployment rollback.
389 RollbackTo RollbackConfig `json:"rollbackTo" protobuf:"bytes,3,opt,name=rollbackTo"`
390}
391
392// DEPRECATED.
393type RollbackConfig struct {
394 // The revision to rollback to. If set to 0, rollback to the last revision.
395 // +optional
396 Revision int64 `json:"revision,omitempty" protobuf:"varint,1,opt,name=revision"`
397}
398
399const (
400 // DefaultDeploymentUniqueLabelKey is the default key of the selector that is added
401 // to existing ReplicaSets (and label key that is added to its pods) to prevent the existing ReplicaSets
402 // to select new pods (and old pods being select by new ReplicaSet).
403 DefaultDeploymentUniqueLabelKey string = "pod-template-hash"
404)
405
406// DeploymentStrategy describes how to replace existing pods with new ones.
407type DeploymentStrategy struct {
408 // Type of deployment. Can be "Recreate" or "RollingUpdate". Default is RollingUpdate.
409 // +optional
410 Type DeploymentStrategyType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type,casttype=DeploymentStrategyType"`
411
412 // Rolling update config params. Present only if DeploymentStrategyType =
413 // RollingUpdate.
414 //---
415 // TODO: Update this to follow our convention for oneOf, whatever we decide it
416 // to be.
417 // +optional
418 RollingUpdate *RollingUpdateDeployment `json:"rollingUpdate,omitempty" protobuf:"bytes,2,opt,name=rollingUpdate"`
419}
420
421type DeploymentStrategyType string
422
423const (
424 // Kill all existing pods before creating new ones.
425 RecreateDeploymentStrategyType DeploymentStrategyType = "Recreate"
426
427 // Replace the old ReplicaSets by new one using rolling update i.e gradually scale down the old ReplicaSets and scale up the new one.
428 RollingUpdateDeploymentStrategyType DeploymentStrategyType = "RollingUpdate"
429)
430
431// Spec to control the desired behavior of rolling update.
432type RollingUpdateDeployment struct {
433 // The maximum number of pods that can be unavailable during the update.
434 // Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%).
435 // Absolute number is calculated from percentage by rounding down.
436 // This can not be 0 if MaxSurge is 0.
437 // Defaults to 25%.
438 // Example: when this is set to 30%, the old ReplicaSet can be scaled down to 70% of desired pods
439 // immediately when the rolling update starts. Once new pods are ready, old ReplicaSet
440 // can be scaled down further, followed by scaling up the new ReplicaSet, ensuring
441 // that the total number of pods available at all times during the update is at
442 // least 70% of desired pods.
443 // +optional
444 MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty" protobuf:"bytes,1,opt,name=maxUnavailable"`
445
446 // The maximum number of pods that can be scheduled above the desired number of
447 // pods.
448 // Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%).
449 // This can not be 0 if MaxUnavailable is 0.
450 // Absolute number is calculated from percentage by rounding up.
451 // Defaults to 25%.
452 // Example: when this is set to 30%, the new ReplicaSet can be scaled up immediately when
453 // the rolling update starts, such that the total number of old and new pods do not exceed
454 // 130% of desired pods. Once old pods have been killed,
455 // new ReplicaSet can be scaled up further, ensuring that total number of pods running
456 // at any time during the update is at most 130% of desired pods.
457 // +optional
458 MaxSurge *intstr.IntOrString `json:"maxSurge,omitempty" protobuf:"bytes,2,opt,name=maxSurge"`
459}
460
461// DeploymentStatus is the most recently observed status of the Deployment.
462type DeploymentStatus struct {
463 // The generation observed by the deployment controller.
464 // +optional
465 ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,1,opt,name=observedGeneration"`
466
467 // Total number of non-terminated pods targeted by this deployment (their labels match the selector).
468 // +optional
469 Replicas int32 `json:"replicas,omitempty" protobuf:"varint,2,opt,name=replicas"`
470
471 // Total number of non-terminated pods targeted by this deployment that have the desired template spec.
472 // +optional
473 UpdatedReplicas int32 `json:"updatedReplicas,omitempty" protobuf:"varint,3,opt,name=updatedReplicas"`
474
475 // Total number of ready pods targeted by this deployment.
476 // +optional
477 ReadyReplicas int32 `json:"readyReplicas,omitempty" protobuf:"varint,7,opt,name=readyReplicas"`
478
479 // Total number of available pods (ready for at least minReadySeconds) targeted by this deployment.
480 // +optional
481 AvailableReplicas int32 `json:"availableReplicas,omitempty" protobuf:"varint,4,opt,name=availableReplicas"`
482
483 // Total number of unavailable pods targeted by this deployment. This is the total number of
484 // pods that are still required for the deployment to have 100% available capacity. They may
485 // either be pods that are running but not yet available or pods that still have not been created.
486 // +optional
487 UnavailableReplicas int32 `json:"unavailableReplicas,omitempty" protobuf:"varint,5,opt,name=unavailableReplicas"`
488
489 // Represents the latest available observations of a deployment's current state.
490 // +patchMergeKey=type
491 // +patchStrategy=merge
492 Conditions []DeploymentCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,6,rep,name=conditions"`
493
494 // Count of hash collisions for the Deployment. The Deployment controller uses this
495 // field as a collision avoidance mechanism when it needs to create the name for the
496 // newest ReplicaSet.
497 // +optional
498 CollisionCount *int32 `json:"collisionCount,omitempty" protobuf:"varint,8,opt,name=collisionCount"`
499}
500
501type DeploymentConditionType string
502
503// These are valid conditions of a deployment.
504const (
505 // Available means the deployment is available, ie. at least the minimum available
506 // replicas required are up and running for at least minReadySeconds.
507 DeploymentAvailable DeploymentConditionType = "Available"
508 // Progressing means the deployment is progressing. Progress for a deployment is
509 // considered when a new replica set is created or adopted, and when new pods scale
510 // up or old pods scale down. Progress is not estimated for paused deployments or
511 // when progressDeadlineSeconds is not specified.
512 DeploymentProgressing DeploymentConditionType = "Progressing"
513 // ReplicaFailure is added in a deployment when one of its pods fails to be created
514 // or deleted.
515 DeploymentReplicaFailure DeploymentConditionType = "ReplicaFailure"
516)
517
518// DeploymentCondition describes the state of a deployment at a certain point.
519type DeploymentCondition struct {
520 // Type of deployment condition.
521 Type DeploymentConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=DeploymentConditionType"`
522 // Status of the condition, one of True, False, Unknown.
523 Status v1.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"`
524 // The last time this condition was updated.
525 LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty" protobuf:"bytes,6,opt,name=lastUpdateTime"`
526 // Last time the condition transitioned from one status to another.
527 LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,7,opt,name=lastTransitionTime"`
528 // The reason for the condition's last transition.
529 Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"`
530 // A human readable message indicating details about the transition.
531 Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"`
532}
533
534// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
535// +k8s:prerelease-lifecycle-gen:introduced=1.6
536// +k8s:prerelease-lifecycle-gen:deprecated=1.8
537// +k8s:prerelease-lifecycle-gen:removed=1.18
538// +k8s:prerelease-lifecycle-gen:replacement=apps,v1,DeploymentList
539
540// DeploymentList is a list of Deployments.
541type DeploymentList struct {
542 metav1.TypeMeta `json:",inline"`
543 // Standard list metadata.
544 // +optional
545 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
546
547 // Items is the list of Deployments.
548 Items []Deployment `json:"items" protobuf:"bytes,2,rep,name=items"`
549}
550
551// +genclient
552// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
553// +k8s:prerelease-lifecycle-gen:introduced=1.7
554// +k8s:prerelease-lifecycle-gen:deprecated=1.8
555// +k8s:prerelease-lifecycle-gen:removed=1.18
556// +k8s:prerelease-lifecycle-gen:replacement=apps,v1,ControllerRevision
557
558// DEPRECATED - This group version of ControllerRevision is deprecated by apps/v1beta2/ControllerRevision. See the
559// release notes for more information.
560// ControllerRevision implements an immutable snapshot of state data. Clients
561// are responsible for serializing and deserializing the objects that contain
562// their internal state.
563// Once a ControllerRevision has been successfully created, it can not be updated.
564// The API Server will fail validation of all requests that attempt to mutate
565// the Data field. ControllerRevisions may, however, be deleted. Note that, due to its use by both
566// the DaemonSet and StatefulSet controllers for update and rollback, this object is beta. However,
567// it may be subject to name and representation changes in future releases, and clients should not
568// depend on its stability. It is primarily for internal use by controllers.
569type ControllerRevision struct {
570 metav1.TypeMeta `json:",inline"`
571 // Standard object's metadata.
572 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
573 // +optional
574 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
575
576 // Data is the serialized representation of the state.
577 Data runtime.RawExtension `json:"data,omitempty" protobuf:"bytes,2,opt,name=data"`
578
579 // Revision indicates the revision of the state represented by Data.
580 Revision int64 `json:"revision" protobuf:"varint,3,opt,name=revision"`
581}
582
583// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
584// +k8s:prerelease-lifecycle-gen:introduced=1.7
585// +k8s:prerelease-lifecycle-gen:deprecated=1.8
586// +k8s:prerelease-lifecycle-gen:removed=1.18
587// +k8s:prerelease-lifecycle-gen:replacement=apps,v1,ControllerRevisionList
588
589// ControllerRevisionList is a resource containing a list of ControllerRevision objects.
590type ControllerRevisionList struct {
591 metav1.TypeMeta `json:",inline"`
592
593 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
594 // +optional
595 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
596
597 // Items is the list of ControllerRevisions
598 Items []ControllerRevision `json:"items" protobuf:"bytes,2,rep,name=items"`
599}