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