1 /* 2 Copyright 2017 The Kubernetes Authors. 3 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 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 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. 15 */ 16 17 package v1 18 19 import ( 20 v1 "k8s.io/api/core/v1" 21 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 22 runtime "k8s.io/apimachinery/pkg/runtime" 23 "k8s.io/apimachinery/pkg/util/intstr" 24 ) 25 26 const ( 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" 32 PodIndexLabel = "apps.kubernetes.io/pod-index" 33 ) 34 35 // +genclient 36 // +genclient:method=GetScale,verb=get,subresource=scale,result=k8s.io/api/autoscaling/v1.Scale 37 // +genclient:method=UpdateScale,verb=update,subresource=scale,input=k8s.io/api/autoscaling/v1.Scale,result=k8s.io/api/autoscaling/v1.Scale 38 // +genclient:method=ApplyScale,verb=apply,subresource=scale,input=k8s.io/api/autoscaling/v1.Scale,result=k8s.io/api/autoscaling/v1.Scale 39 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 40 41 // StatefulSet represents a set of pods with consistent identities. 42 // Identities are defined as: 43 // - Network: A single stable DNS and hostname. 44 // - Storage: As many VolumeClaims as requested. 45 // 46 // The StatefulSet guarantees that a given network identity will always 47 // map to the same storage identity. 48 type StatefulSet struct { 49 metav1.TypeMeta `json:",inline"` 50 // Standard object's metadata. 51 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata 52 // +optional 53 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 54 55 // Spec defines the desired identities of pods in this set. 56 // +optional 57 Spec StatefulSetSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` 58 59 // Status is the current status of Pods in this StatefulSet. This data 60 // may be out of date by some window of time. 61 // +optional 62 Status StatefulSetStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` 63 } 64 65 // PodManagementPolicyType defines the policy for creating pods under a stateful set. 66 // +enum 67 type PodManagementPolicyType string 68 69 const ( 70 // OrderedReadyPodManagement will create pods in strictly increasing order on 71 // scale up and strictly decreasing order on scale down, progressing only when 72 // the previous pod is ready or terminated. At most one pod will be changed 73 // at any time. 74 OrderedReadyPodManagement PodManagementPolicyType = "OrderedReady" 75 // ParallelPodManagement will create and delete pods as soon as the stateful set 76 // replica count is changed, and will not wait for pods to be ready or complete 77 // termination. 78 ParallelPodManagement PodManagementPolicyType = "Parallel" 79 ) 80 81 // StatefulSetUpdateStrategy indicates the strategy that the StatefulSet 82 // controller will use to perform updates. It includes any additional parameters 83 // necessary to perform the update for the indicated strategy. 84 type StatefulSetUpdateStrategy struct { 85 // Type indicates the type of the StatefulSetUpdateStrategy. 86 // Default is RollingUpdate. 87 // +optional 88 Type StatefulSetUpdateStrategyType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type,casttype=StatefulSetStrategyType"` 89 // RollingUpdate is used to communicate parameters when Type is RollingUpdateStatefulSetStrategyType. 90 // +optional 91 RollingUpdate *RollingUpdateStatefulSetStrategy `json:"rollingUpdate,omitempty" protobuf:"bytes,2,opt,name=rollingUpdate"` 92 } 93 94 // StatefulSetUpdateStrategyType is a string enumeration type that enumerates 95 // all possible update strategies for the StatefulSet controller. 96 // +enum 97 type StatefulSetUpdateStrategyType string 98 99 const ( 100 // RollingUpdateStatefulSetStrategyType indicates that update will be 101 // applied to all Pods in the StatefulSet with respect to the StatefulSet 102 // ordering constraints. When a scale operation is performed with this 103 // strategy, new Pods will be created from the specification version indicated 104 // by the StatefulSet's updateRevision. 105 RollingUpdateStatefulSetStrategyType StatefulSetUpdateStrategyType = "RollingUpdate" 106 // OnDeleteStatefulSetStrategyType triggers the legacy behavior. Version 107 // tracking and ordered rolling restarts are disabled. Pods are recreated 108 // from the StatefulSetSpec when they are manually deleted. When a scale 109 // operation is performed with this strategy,specification version indicated 110 // by the StatefulSet's currentRevision. 111 OnDeleteStatefulSetStrategyType StatefulSetUpdateStrategyType = "OnDelete" 112 ) 113 114 // RollingUpdateStatefulSetStrategy is used to communicate parameter for RollingUpdateStatefulSetStrategyType. 115 type RollingUpdateStatefulSetStrategy struct { 116 // Partition indicates the ordinal at which the StatefulSet should be partitioned 117 // for updates. During a rolling update, all pods from ordinal Replicas-1 to 118 // Partition are updated. All pods from ordinal Partition-1 to 0 remain untouched. 119 // This is helpful in being able to do a canary based deployment. The default value is 0. 120 // +optional 121 Partition *int32 `json:"partition,omitempty" protobuf:"varint,1,opt,name=partition"` 122 // The maximum number of pods that can be unavailable during the update. 123 // Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). 124 // Absolute number is calculated from percentage by rounding up. This can not be 0. 125 // Defaults to 1. This field is alpha-level and is only honored by servers that enable the 126 // MaxUnavailableStatefulSet feature. The field applies to all pods in the range 0 to 127 // Replicas-1. That means if there is any unavailable pod in the range 0 to Replicas-1, it 128 // will be counted towards MaxUnavailable. 129 // +optional 130 MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty" protobuf:"varint,2,opt,name=maxUnavailable"` 131 } 132 133 // PersistentVolumeClaimRetentionPolicyType is a string enumeration of the policies that will determine 134 // when volumes from the VolumeClaimTemplates will be deleted when the controlling StatefulSet is 135 // deleted or scaled down. 136 type PersistentVolumeClaimRetentionPolicyType string 137 138 const ( 139 // RetainPersistentVolumeClaimRetentionPolicyType is the default 140 // PersistentVolumeClaimRetentionPolicy and specifies that 141 // PersistentVolumeClaims associated with StatefulSet VolumeClaimTemplates 142 // will not be deleted. 143 RetainPersistentVolumeClaimRetentionPolicyType PersistentVolumeClaimRetentionPolicyType = "Retain" 144 // RetentionPersistentVolumeClaimRetentionPolicyType specifies that 145 // PersistentVolumeClaims associated with StatefulSet VolumeClaimTemplates 146 // will be deleted in the scenario specified in 147 // StatefulSetPersistentVolumeClaimRetentionPolicy. 148 DeletePersistentVolumeClaimRetentionPolicyType PersistentVolumeClaimRetentionPolicyType = "Delete" 149 ) 150 151 // StatefulSetPersistentVolumeClaimRetentionPolicy describes the policy used for PVCs 152 // created from the StatefulSet VolumeClaimTemplates. 153 type StatefulSetPersistentVolumeClaimRetentionPolicy struct { 154 // WhenDeleted specifies what happens to PVCs created from StatefulSet 155 // VolumeClaimTemplates when the StatefulSet is deleted. The default policy 156 // of `Retain` causes PVCs to not be affected by StatefulSet deletion. The 157 // `Delete` policy causes those PVCs to be deleted. 158 WhenDeleted PersistentVolumeClaimRetentionPolicyType `json:"whenDeleted,omitempty" protobuf:"bytes,1,opt,name=whenDeleted,casttype=PersistentVolumeClaimRetentionPolicyType"` 159 // WhenScaled specifies what happens to PVCs created from StatefulSet 160 // VolumeClaimTemplates when the StatefulSet is scaled down. The default 161 // policy of `Retain` causes PVCs to not be affected by a scaledown. The 162 // `Delete` policy causes the associated PVCs for any excess pods above 163 // the replica count to be deleted. 164 WhenScaled PersistentVolumeClaimRetentionPolicyType `json:"whenScaled,omitempty" protobuf:"bytes,2,opt,name=whenScaled,casttype=PersistentVolumeClaimRetentionPolicyType"` 165 } 166 167 // StatefulSetOrdinals describes the policy used for replica ordinal assignment 168 // in this StatefulSet. 169 type StatefulSetOrdinals struct { 170 // start is the number representing the first replica's index. It may be used 171 // to number replicas from an alternate index (eg: 1-indexed) over the default 172 // 0-indexed names, or to orchestrate progressive movement of replicas from 173 // one StatefulSet to another. 174 // If set, replica indices will be in the range: 175 // [.spec.ordinals.start, .spec.ordinals.start + .spec.replicas). 176 // If unset, defaults to 0. Replica indices will be in the range: 177 // [0, .spec.replicas). 178 // +optional 179 Start int32 `json:"start" protobuf:"varint,1,opt,name=start"` 180 } 181 182 // A StatefulSetSpec is the specification of a StatefulSet. 183 type StatefulSetSpec struct { 184 // replicas is the desired number of replicas of the given Template. 185 // These are replicas in the sense that they are instantiations of the 186 // same Template, but individual replicas also have a consistent identity. 187 // If unspecified, defaults to 1. 188 // TODO: Consider a rename of this field. 189 // +optional 190 Replicas *int32 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"` 191 192 // selector is a label query over pods that should match the replica count. 193 // It must match the pod template's labels. 194 // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors 195 Selector *metav1.LabelSelector `json:"selector" protobuf:"bytes,2,opt,name=selector"` 196 197 // template is the object that describes the pod that will be created if 198 // insufficient replicas are detected. Each pod stamped out by the StatefulSet 199 // will fulfill this Template, but have a unique identity from the rest 200 // of the StatefulSet. Each pod will be named with the format 201 // <statefulsetname>-<podindex>. For example, a pod in a StatefulSet named 202 // "web" with index number "3" would be named "web-3". 203 // The only allowed template.spec.restartPolicy value is "Always". 204 Template v1.PodTemplateSpec `json:"template" protobuf:"bytes,3,opt,name=template"` 205 206 // volumeClaimTemplates is a list of claims that pods are allowed to reference. 207 // The StatefulSet controller is responsible for mapping network identities to 208 // claims in a way that maintains the identity of a pod. Every claim in 209 // this list must have at least one matching (by name) volumeMount in one 210 // container in the template. A claim in this list takes precedence over 211 // any volumes in the template, with the same name. 212 // TODO: Define the behavior if a claim already exists with the same name. 213 // +optional 214 // +listType=atomic 215 VolumeClaimTemplates []v1.PersistentVolumeClaim `json:"volumeClaimTemplates,omitempty" protobuf:"bytes,4,rep,name=volumeClaimTemplates"` 216 217 // serviceName is the name of the service that governs this StatefulSet. 218 // This service must exist before the StatefulSet, and is responsible for 219 // the network identity of the set. Pods get DNS/hostnames that follow the 220 // pattern: pod-specific-string.serviceName.default.svc.cluster.local 221 // where "pod-specific-string" is managed by the StatefulSet controller. 222 ServiceName string `json:"serviceName" protobuf:"bytes,5,opt,name=serviceName"` 223 224 // podManagementPolicy controls how pods are created during initial scale up, 225 // when replacing pods on nodes, or when scaling down. The default policy is 226 // `OrderedReady`, where pods are created in increasing order (pod-0, then 227 // pod-1, etc) and the controller will wait until each pod is ready before 228 // continuing. When scaling down, the pods are removed in the opposite order. 229 // The alternative policy is `Parallel` which will create pods in parallel 230 // to match the desired scale without waiting, and on scale down will delete 231 // all pods at once. 232 // +optional 233 PodManagementPolicy PodManagementPolicyType `json:"podManagementPolicy,omitempty" protobuf:"bytes,6,opt,name=podManagementPolicy,casttype=PodManagementPolicyType"` 234 235 // updateStrategy indicates the StatefulSetUpdateStrategy that will be 236 // employed to update Pods in the StatefulSet when a revision is made to 237 // Template. 238 UpdateStrategy StatefulSetUpdateStrategy `json:"updateStrategy,omitempty" protobuf:"bytes,7,opt,name=updateStrategy"` 239 240 // revisionHistoryLimit is the maximum number of revisions that will 241 // be maintained in the StatefulSet's revision history. The revision history 242 // consists of all revisions not represented by a currently applied 243 // StatefulSetSpec version. The default value is 10. 244 RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty" protobuf:"varint,8,opt,name=revisionHistoryLimit"` 245 246 // Minimum number of seconds for which a newly created pod should be ready 247 // without any of its container crashing for it to be considered available. 248 // Defaults to 0 (pod will be considered available as soon as it is ready) 249 // +optional 250 MinReadySeconds int32 `json:"minReadySeconds,omitempty" protobuf:"varint,9,opt,name=minReadySeconds"` 251 252 // persistentVolumeClaimRetentionPolicy describes the lifecycle of persistent 253 // volume claims created from volumeClaimTemplates. By default, all persistent 254 // volume claims are created as needed and retained until manually deleted. This 255 // policy allows the lifecycle to be altered, for example by deleting persistent 256 // volume claims when their stateful set is deleted, or when their pod is scaled 257 // down. This requires the StatefulSetAutoDeletePVC feature gate to be enabled, 258 // which is alpha. +optional 259 PersistentVolumeClaimRetentionPolicy *StatefulSetPersistentVolumeClaimRetentionPolicy `json:"persistentVolumeClaimRetentionPolicy,omitempty" protobuf:"bytes,10,opt,name=persistentVolumeClaimRetentionPolicy"` 260 261 // ordinals controls the numbering of replica indices in a StatefulSet. The 262 // default ordinals behavior assigns a "0" index to the first replica and 263 // increments the index by one for each additional replica requested. Using 264 // the ordinals field requires the StatefulSetStartOrdinal feature gate to be 265 // enabled, which is beta. 266 // +optional 267 Ordinals *StatefulSetOrdinals `json:"ordinals,omitempty" protobuf:"bytes,11,opt,name=ordinals"` 268 } 269 270 // StatefulSetStatus represents the current state of a StatefulSet. 271 type StatefulSetStatus struct { 272 // observedGeneration is the most recent generation observed for this StatefulSet. It corresponds to the 273 // StatefulSet's generation, which is updated on mutation by the API Server. 274 // +optional 275 ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,1,opt,name=observedGeneration"` 276 277 // replicas is the number of Pods created by the StatefulSet controller. 278 Replicas int32 `json:"replicas" protobuf:"varint,2,opt,name=replicas"` 279 280 // readyReplicas is the number of pods created for this StatefulSet with a Ready Condition. 281 ReadyReplicas int32 `json:"readyReplicas,omitempty" protobuf:"varint,3,opt,name=readyReplicas"` 282 283 // currentReplicas is the number of Pods created by the StatefulSet controller from the StatefulSet version 284 // indicated by currentRevision. 285 CurrentReplicas int32 `json:"currentReplicas,omitempty" protobuf:"varint,4,opt,name=currentReplicas"` 286 287 // updatedReplicas is the number of Pods created by the StatefulSet controller from the StatefulSet version 288 // indicated by updateRevision. 289 UpdatedReplicas int32 `json:"updatedReplicas,omitempty" protobuf:"varint,5,opt,name=updatedReplicas"` 290 291 // currentRevision, if not empty, indicates the version of the StatefulSet used to generate Pods in the 292 // sequence [0,currentReplicas). 293 CurrentRevision string `json:"currentRevision,omitempty" protobuf:"bytes,6,opt,name=currentRevision"` 294 295 // updateRevision, if not empty, indicates the version of the StatefulSet used to generate Pods in the sequence 296 // [replicas-updatedReplicas,replicas) 297 UpdateRevision string `json:"updateRevision,omitempty" protobuf:"bytes,7,opt,name=updateRevision"` 298 299 // collisionCount is the count of hash collisions for the StatefulSet. The StatefulSet controller 300 // uses this field as a collision avoidance mechanism when it needs to create the name for the 301 // newest ControllerRevision. 302 // +optional 303 CollisionCount *int32 `json:"collisionCount,omitempty" protobuf:"varint,9,opt,name=collisionCount"` 304 305 // Represents the latest available observations of a statefulset's current state. 306 // +optional 307 // +patchMergeKey=type 308 // +patchStrategy=merge 309 // +listType=map 310 // +listMapKey=type 311 Conditions []StatefulSetCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,10,rep,name=conditions"` 312 313 // Total number of available pods (ready for at least minReadySeconds) targeted by this statefulset. 314 // +optional 315 AvailableReplicas int32 `json:"availableReplicas" protobuf:"varint,11,opt,name=availableReplicas"` 316 } 317 318 type StatefulSetConditionType string 319 320 // StatefulSetCondition describes the state of a statefulset at a certain point. 321 type StatefulSetCondition struct { 322 // Type of statefulset condition. 323 Type StatefulSetConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=StatefulSetConditionType"` 324 // Status of the condition, one of True, False, Unknown. 325 Status v1.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"` 326 // Last time the condition transitioned from one status to another. 327 // +optional 328 LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,3,opt,name=lastTransitionTime"` 329 // The reason for the condition's last transition. 330 // +optional 331 Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"` 332 // A human readable message indicating details about the transition. 333 // +optional 334 Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"` 335 } 336 337 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 338 339 // StatefulSetList is a collection of StatefulSets. 340 type StatefulSetList struct { 341 metav1.TypeMeta `json:",inline"` 342 // Standard list's metadata. 343 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata 344 // +optional 345 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 346 347 // Items is the list of stateful sets. 348 Items []StatefulSet `json:"items" protobuf:"bytes,2,rep,name=items"` 349 } 350 351 // +genclient 352 // +genclient:method=GetScale,verb=get,subresource=scale,result=k8s.io/api/autoscaling/v1.Scale 353 // +genclient:method=UpdateScale,verb=update,subresource=scale,input=k8s.io/api/autoscaling/v1.Scale,result=k8s.io/api/autoscaling/v1.Scale 354 // +genclient:method=ApplyScale,verb=apply,subresource=scale,input=k8s.io/api/autoscaling/v1.Scale,result=k8s.io/api/autoscaling/v1.Scale 355 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 356 357 // Deployment enables declarative updates for Pods and ReplicaSets. 358 type Deployment struct { 359 metav1.TypeMeta `json:",inline"` 360 // Standard object's metadata. 361 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata 362 // +optional 363 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 364 365 // Specification of the desired behavior of the Deployment. 366 // +optional 367 Spec DeploymentSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` 368 369 // Most recently observed status of the Deployment. 370 // +optional 371 Status DeploymentStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` 372 } 373 374 // DeploymentSpec is the specification of the desired behavior of the Deployment. 375 type DeploymentSpec struct { 376 // Number of desired pods. This is a pointer to distinguish between explicit 377 // zero and not specified. Defaults to 1. 378 // +optional 379 Replicas *int32 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"` 380 381 // Label selector for pods. Existing ReplicaSets whose pods are 382 // selected by this will be the ones affected by this deployment. 383 // It must match the pod template's labels. 384 Selector *metav1.LabelSelector `json:"selector" protobuf:"bytes,2,opt,name=selector"` 385 386 // Template describes the pods that will be created. 387 // The only allowed template.spec.restartPolicy value is "Always". 388 Template v1.PodTemplateSpec `json:"template" protobuf:"bytes,3,opt,name=template"` 389 390 // The deployment strategy to use to replace existing pods with new ones. 391 // +optional 392 // +patchStrategy=retainKeys 393 Strategy DeploymentStrategy `json:"strategy,omitempty" patchStrategy:"retainKeys" protobuf:"bytes,4,opt,name=strategy"` 394 395 // Minimum number of seconds for which a newly created pod should be ready 396 // without any of its container crashing, for it to be considered available. 397 // Defaults to 0 (pod will be considered available as soon as it is ready) 398 // +optional 399 MinReadySeconds int32 `json:"minReadySeconds,omitempty" protobuf:"varint,5,opt,name=minReadySeconds"` 400 401 // The number of old ReplicaSets to retain to allow rollback. 402 // This is a pointer to distinguish between explicit zero and not specified. 403 // Defaults to 10. 404 // +optional 405 RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty" protobuf:"varint,6,opt,name=revisionHistoryLimit"` 406 407 // Indicates that the deployment is paused. 408 // +optional 409 Paused bool `json:"paused,omitempty" protobuf:"varint,7,opt,name=paused"` 410 411 // The maximum time in seconds for a deployment to make progress before it 412 // is considered to be failed. The deployment controller will continue to 413 // process failed deployments and a condition with a ProgressDeadlineExceeded 414 // reason will be surfaced in the deployment status. Note that progress will 415 // not be estimated during the time a deployment is paused. Defaults to 600s. 416 ProgressDeadlineSeconds *int32 `json:"progressDeadlineSeconds,omitempty" protobuf:"varint,9,opt,name=progressDeadlineSeconds"` 417 } 418 419 const ( 420 // DefaultDeploymentUniqueLabelKey is the default key of the selector that is added 421 // to existing ReplicaSets (and label key that is added to its pods) to prevent the existing ReplicaSets 422 // to select new pods (and old pods being select by new ReplicaSet). 423 DefaultDeploymentUniqueLabelKey string = "pod-template-hash" 424 ) 425 426 // DeploymentStrategy describes how to replace existing pods with new ones. 427 type DeploymentStrategy struct { 428 // Type of deployment. Can be "Recreate" or "RollingUpdate". Default is RollingUpdate. 429 // +optional 430 Type DeploymentStrategyType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type,casttype=DeploymentStrategyType"` 431 432 // Rolling update config params. Present only if DeploymentStrategyType = 433 // RollingUpdate. 434 //--- 435 // TODO: Update this to follow our convention for oneOf, whatever we decide it 436 // to be. 437 // +optional 438 RollingUpdate *RollingUpdateDeployment `json:"rollingUpdate,omitempty" protobuf:"bytes,2,opt,name=rollingUpdate"` 439 } 440 441 // +enum 442 type DeploymentStrategyType string 443 444 const ( 445 // Kill all existing pods before creating new ones. 446 RecreateDeploymentStrategyType DeploymentStrategyType = "Recreate" 447 448 // Replace the old ReplicaSets by new one using rolling update i.e gradually scale down the old ReplicaSets and scale up the new one. 449 RollingUpdateDeploymentStrategyType DeploymentStrategyType = "RollingUpdate" 450 ) 451 452 // Spec to control the desired behavior of rolling update. 453 type RollingUpdateDeployment struct { 454 // The maximum number of pods that can be unavailable during the update. 455 // Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). 456 // Absolute number is calculated from percentage by rounding down. 457 // This can not be 0 if MaxSurge is 0. 458 // Defaults to 25%. 459 // Example: when this is set to 30%, the old ReplicaSet can be scaled down to 70% of desired pods 460 // immediately when the rolling update starts. Once new pods are ready, old ReplicaSet 461 // can be scaled down further, followed by scaling up the new ReplicaSet, ensuring 462 // that the total number of pods available at all times during the update is at 463 // least 70% of desired pods. 464 // +optional 465 MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty" protobuf:"bytes,1,opt,name=maxUnavailable"` 466 467 // The maximum number of pods that can be scheduled above the desired number of 468 // pods. 469 // Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). 470 // This can not be 0 if MaxUnavailable is 0. 471 // Absolute number is calculated from percentage by rounding up. 472 // Defaults to 25%. 473 // Example: when this is set to 30%, the new ReplicaSet can be scaled up immediately when 474 // the rolling update starts, such that the total number of old and new pods do not exceed 475 // 130% of desired pods. Once old pods have been killed, 476 // new ReplicaSet can be scaled up further, ensuring that total number of pods running 477 // at any time during the update is at most 130% of desired pods. 478 // +optional 479 MaxSurge *intstr.IntOrString `json:"maxSurge,omitempty" protobuf:"bytes,2,opt,name=maxSurge"` 480 } 481 482 // DeploymentStatus is the most recently observed status of the Deployment. 483 type DeploymentStatus struct { 484 // The generation observed by the deployment controller. 485 // +optional 486 ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,1,opt,name=observedGeneration"` 487 488 // Total number of non-terminated pods targeted by this deployment (their labels match the selector). 489 // +optional 490 Replicas int32 `json:"replicas,omitempty" protobuf:"varint,2,opt,name=replicas"` 491 492 // Total number of non-terminated pods targeted by this deployment that have the desired template spec. 493 // +optional 494 UpdatedReplicas int32 `json:"updatedReplicas,omitempty" protobuf:"varint,3,opt,name=updatedReplicas"` 495 496 // readyReplicas is the number of pods targeted by this Deployment with a Ready Condition. 497 // +optional 498 ReadyReplicas int32 `json:"readyReplicas,omitempty" protobuf:"varint,7,opt,name=readyReplicas"` 499 500 // Total number of available pods (ready for at least minReadySeconds) targeted by this deployment. 501 // +optional 502 AvailableReplicas int32 `json:"availableReplicas,omitempty" protobuf:"varint,4,opt,name=availableReplicas"` 503 504 // Total number of unavailable pods targeted by this deployment. This is the total number of 505 // pods that are still required for the deployment to have 100% available capacity. They may 506 // either be pods that are running but not yet available or pods that still have not been created. 507 // +optional 508 UnavailableReplicas int32 `json:"unavailableReplicas,omitempty" protobuf:"varint,5,opt,name=unavailableReplicas"` 509 510 // Represents the latest available observations of a deployment's current state. 511 // +patchMergeKey=type 512 // +patchStrategy=merge 513 // +listType=map 514 // +listMapKey=type 515 Conditions []DeploymentCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,6,rep,name=conditions"` 516 517 // Count of hash collisions for the Deployment. The Deployment controller uses this 518 // field as a collision avoidance mechanism when it needs to create the name for the 519 // newest ReplicaSet. 520 // +optional 521 CollisionCount *int32 `json:"collisionCount,omitempty" protobuf:"varint,8,opt,name=collisionCount"` 522 } 523 524 type DeploymentConditionType string 525 526 // These are valid conditions of a deployment. 527 const ( 528 // Available means the deployment is available, ie. at least the minimum available 529 // replicas required are up and running for at least minReadySeconds. 530 DeploymentAvailable DeploymentConditionType = "Available" 531 // Progressing means the deployment is progressing. Progress for a deployment is 532 // considered when a new replica set is created or adopted, and when new pods scale 533 // up or old pods scale down. Progress is not estimated for paused deployments or 534 // when progressDeadlineSeconds is not specified. 535 DeploymentProgressing DeploymentConditionType = "Progressing" 536 // ReplicaFailure is added in a deployment when one of its pods fails to be created 537 // or deleted. 538 DeploymentReplicaFailure DeploymentConditionType = "ReplicaFailure" 539 ) 540 541 // DeploymentCondition describes the state of a deployment at a certain point. 542 type DeploymentCondition struct { 543 // Type of deployment condition. 544 Type DeploymentConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=DeploymentConditionType"` 545 // Status of the condition, one of True, False, Unknown. 546 Status v1.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"` 547 // The last time this condition was updated. 548 LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty" protobuf:"bytes,6,opt,name=lastUpdateTime"` 549 // Last time the condition transitioned from one status to another. 550 LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,7,opt,name=lastTransitionTime"` 551 // The reason for the condition's last transition. 552 Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"` 553 // A human readable message indicating details about the transition. 554 Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"` 555 } 556 557 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 558 559 // DeploymentList is a list of Deployments. 560 type DeploymentList struct { 561 metav1.TypeMeta `json:",inline"` 562 // Standard list metadata. 563 // +optional 564 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 565 566 // Items is the list of Deployments. 567 Items []Deployment `json:"items" protobuf:"bytes,2,rep,name=items"` 568 } 569 570 // DaemonSetUpdateStrategy is a struct used to control the update strategy for a DaemonSet. 571 type DaemonSetUpdateStrategy struct { 572 // Type of daemon set update. Can be "RollingUpdate" or "OnDelete". Default is RollingUpdate. 573 // +optional 574 Type DaemonSetUpdateStrategyType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type"` 575 576 // Rolling update config params. Present only if type = "RollingUpdate". 577 //--- 578 // TODO: Update this to follow our convention for oneOf, whatever we decide it 579 // to be. Same as Deployment `strategy.rollingUpdate`. 580 // See https://github.com/kubernetes/kubernetes/issues/35345 581 // +optional 582 RollingUpdate *RollingUpdateDaemonSet `json:"rollingUpdate,omitempty" protobuf:"bytes,2,opt,name=rollingUpdate"` 583 } 584 585 // +enum 586 type DaemonSetUpdateStrategyType string 587 588 const ( 589 // Replace the old daemons by new ones using rolling update i.e replace them on each node one after the other. 590 RollingUpdateDaemonSetStrategyType DaemonSetUpdateStrategyType = "RollingUpdate" 591 592 // Replace the old daemons only when it's killed 593 OnDeleteDaemonSetStrategyType DaemonSetUpdateStrategyType = "OnDelete" 594 ) 595 596 // Spec to control the desired behavior of daemon set rolling update. 597 type RollingUpdateDaemonSet struct { 598 // The maximum number of DaemonSet pods that can be unavailable during the 599 // update. Value can be an absolute number (ex: 5) or a percentage of total 600 // number of DaemonSet pods at the start of the update (ex: 10%). Absolute 601 // number is calculated from percentage by rounding up. 602 // This cannot be 0 if MaxSurge is 0 603 // Default value is 1. 604 // Example: when this is set to 30%, at most 30% of the total number of nodes 605 // that should be running the daemon pod (i.e. status.desiredNumberScheduled) 606 // can have their pods stopped for an update at any given time. The update 607 // starts by stopping at most 30% of those DaemonSet pods and then brings 608 // up new DaemonSet pods in their place. Once the new pods are available, 609 // it then proceeds onto other DaemonSet pods, thus ensuring that at least 610 // 70% of original number of DaemonSet pods are available at all times during 611 // the update. 612 // +optional 613 MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty" protobuf:"bytes,1,opt,name=maxUnavailable"` 614 615 // The maximum number of nodes with an existing available DaemonSet pod that 616 // can have an updated DaemonSet pod during during an update. 617 // Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). 618 // This can not be 0 if MaxUnavailable is 0. 619 // Absolute number is calculated from percentage by rounding up to a minimum of 1. 620 // Default value is 0. 621 // Example: when this is set to 30%, at most 30% of the total number of nodes 622 // that should be running the daemon pod (i.e. status.desiredNumberScheduled) 623 // can have their a new pod created before the old pod is marked as deleted. 624 // The update starts by launching new pods on 30% of nodes. Once an updated 625 // pod is available (Ready for at least minReadySeconds) the old DaemonSet pod 626 // on that node is marked deleted. If the old pod becomes unavailable for any 627 // reason (Ready transitions to false, is evicted, or is drained) an updated 628 // pod is immediatedly created on that node without considering surge limits. 629 // Allowing surge implies the possibility that the resources consumed by the 630 // daemonset on any given node can double if the readiness check fails, and 631 // so resource intensive daemonsets should take into account that they may 632 // cause evictions during disruption. 633 // +optional 634 MaxSurge *intstr.IntOrString `json:"maxSurge,omitempty" protobuf:"bytes,2,opt,name=maxSurge"` 635 } 636 637 // DaemonSetSpec is the specification of a daemon set. 638 type DaemonSetSpec struct { 639 // A label query over pods that are managed by the daemon set. 640 // Must match in order to be controlled. 641 // It must match the pod template's labels. 642 // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors 643 Selector *metav1.LabelSelector `json:"selector" protobuf:"bytes,1,opt,name=selector"` 644 645 // An object that describes the pod that will be created. 646 // The DaemonSet will create exactly one copy of this pod on every node 647 // that matches the template's node selector (or on every node if no node 648 // selector is specified). 649 // The only allowed template.spec.restartPolicy value is "Always". 650 // More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-template 651 Template v1.PodTemplateSpec `json:"template" protobuf:"bytes,2,opt,name=template"` 652 653 // An update strategy to replace existing DaemonSet pods with new pods. 654 // +optional 655 UpdateStrategy DaemonSetUpdateStrategy `json:"updateStrategy,omitempty" protobuf:"bytes,3,opt,name=updateStrategy"` 656 657 // The minimum number of seconds for which a newly created DaemonSet pod should 658 // be ready without any of its container crashing, for it to be considered 659 // available. Defaults to 0 (pod will be considered available as soon as it 660 // is ready). 661 // +optional 662 MinReadySeconds int32 `json:"minReadySeconds,omitempty" protobuf:"varint,4,opt,name=minReadySeconds"` 663 664 // The number of old history to retain to allow rollback. 665 // This is a pointer to distinguish between explicit zero and not specified. 666 // Defaults to 10. 667 // +optional 668 RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty" protobuf:"varint,6,opt,name=revisionHistoryLimit"` 669 } 670 671 // DaemonSetStatus represents the current status of a daemon set. 672 type DaemonSetStatus struct { 673 // The number of nodes that are running at least 1 674 // daemon pod and are supposed to run the daemon pod. 675 // More info: https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/ 676 CurrentNumberScheduled int32 `json:"currentNumberScheduled" protobuf:"varint,1,opt,name=currentNumberScheduled"` 677 678 // The number of nodes that are running the daemon pod, but are 679 // not supposed to run the daemon pod. 680 // More info: https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/ 681 NumberMisscheduled int32 `json:"numberMisscheduled" protobuf:"varint,2,opt,name=numberMisscheduled"` 682 683 // The total number of nodes that should be running the daemon 684 // pod (including nodes correctly running the daemon pod). 685 // More info: https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/ 686 DesiredNumberScheduled int32 `json:"desiredNumberScheduled" protobuf:"varint,3,opt,name=desiredNumberScheduled"` 687 688 // numberReady is the number of nodes that should be running the daemon pod and have one 689 // or more of the daemon pod running with a Ready Condition. 690 NumberReady int32 `json:"numberReady" protobuf:"varint,4,opt,name=numberReady"` 691 692 // The most recent generation observed by the daemon set controller. 693 // +optional 694 ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,5,opt,name=observedGeneration"` 695 696 // The total number of nodes that are running updated daemon pod 697 // +optional 698 UpdatedNumberScheduled int32 `json:"updatedNumberScheduled,omitempty" protobuf:"varint,6,opt,name=updatedNumberScheduled"` 699 700 // The number of nodes that should be running the 701 // daemon pod and have one or more of the daemon pod running and 702 // available (ready for at least spec.minReadySeconds) 703 // +optional 704 NumberAvailable int32 `json:"numberAvailable,omitempty" protobuf:"varint,7,opt,name=numberAvailable"` 705 706 // The number of nodes that should be running the 707 // daemon pod and have none of the daemon pod running and available 708 // (ready for at least spec.minReadySeconds) 709 // +optional 710 NumberUnavailable int32 `json:"numberUnavailable,omitempty" protobuf:"varint,8,opt,name=numberUnavailable"` 711 712 // Count of hash collisions for the DaemonSet. The DaemonSet controller 713 // uses this field as a collision avoidance mechanism when it needs to 714 // create the name for the newest ControllerRevision. 715 // +optional 716 CollisionCount *int32 `json:"collisionCount,omitempty" protobuf:"varint,9,opt,name=collisionCount"` 717 718 // Represents the latest available observations of a DaemonSet's current state. 719 // +optional 720 // +patchMergeKey=type 721 // +patchStrategy=merge 722 // +listType=map 723 // +listMapKey=type 724 Conditions []DaemonSetCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,10,rep,name=conditions"` 725 } 726 727 type DaemonSetConditionType string 728 729 // TODO: Add valid condition types of a DaemonSet. 730 731 // DaemonSetCondition describes the state of a DaemonSet at a certain point. 732 type DaemonSetCondition struct { 733 // Type of DaemonSet condition. 734 Type DaemonSetConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=DaemonSetConditionType"` 735 // Status of the condition, one of True, False, Unknown. 736 Status v1.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"` 737 // Last time the condition transitioned from one status to another. 738 // +optional 739 LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,3,opt,name=lastTransitionTime"` 740 // The reason for the condition's last transition. 741 // +optional 742 Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"` 743 // A human readable message indicating details about the transition. 744 // +optional 745 Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"` 746 } 747 748 // +genclient 749 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 750 751 // DaemonSet represents the configuration of a daemon set. 752 type DaemonSet struct { 753 metav1.TypeMeta `json:",inline"` 754 // Standard object's metadata. 755 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata 756 // +optional 757 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 758 759 // The desired behavior of this daemon set. 760 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status 761 // +optional 762 Spec DaemonSetSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` 763 764 // The current status of this daemon set. This data may be 765 // out of date by some window of time. 766 // Populated by the system. 767 // Read-only. 768 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status 769 // +optional 770 Status DaemonSetStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` 771 } 772 773 const ( 774 // DefaultDaemonSetUniqueLabelKey is the default label key that is added 775 // to existing DaemonSet pods to distinguish between old and new 776 // DaemonSet pods during DaemonSet template updates. 777 DefaultDaemonSetUniqueLabelKey = ControllerRevisionHashLabelKey 778 ) 779 780 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 781 782 // DaemonSetList is a collection of daemon sets. 783 type DaemonSetList struct { 784 metav1.TypeMeta `json:",inline"` 785 // Standard list metadata. 786 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata 787 // +optional 788 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 789 790 // A list of daemon sets. 791 Items []DaemonSet `json:"items" protobuf:"bytes,2,rep,name=items"` 792 } 793 794 // +genclient 795 // +genclient:method=GetScale,verb=get,subresource=scale,result=k8s.io/api/autoscaling/v1.Scale 796 // +genclient:method=UpdateScale,verb=update,subresource=scale,input=k8s.io/api/autoscaling/v1.Scale,result=k8s.io/api/autoscaling/v1.Scale 797 // +genclient:method=ApplyScale,verb=apply,subresource=scale,input=k8s.io/api/autoscaling/v1.Scale,result=k8s.io/api/autoscaling/v1.Scale 798 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 799 800 // ReplicaSet ensures that a specified number of pod replicas are running at any given time. 801 type ReplicaSet struct { 802 metav1.TypeMeta `json:",inline"` 803 804 // If the Labels of a ReplicaSet are empty, they are defaulted to 805 // be the same as the Pod(s) that the ReplicaSet manages. 806 // Standard object's metadata. 807 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata 808 // +optional 809 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 810 811 // Spec defines the specification of the desired behavior of the ReplicaSet. 812 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status 813 // +optional 814 Spec ReplicaSetSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` 815 816 // Status is the most recently observed status of the ReplicaSet. 817 // This data may be out of date by some window of time. 818 // Populated by the system. 819 // Read-only. 820 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status 821 // +optional 822 Status ReplicaSetStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` 823 } 824 825 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 826 827 // ReplicaSetList is a collection of ReplicaSets. 828 type ReplicaSetList struct { 829 metav1.TypeMeta `json:",inline"` 830 // Standard list metadata. 831 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds 832 // +optional 833 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 834 835 // List of ReplicaSets. 836 // More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller 837 Items []ReplicaSet `json:"items" protobuf:"bytes,2,rep,name=items"` 838 } 839 840 // ReplicaSetSpec is the specification of a ReplicaSet. 841 type ReplicaSetSpec struct { 842 // Replicas is the number of desired replicas. 843 // This is a pointer to distinguish between explicit zero and unspecified. 844 // Defaults to 1. 845 // More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller/#what-is-a-replicationcontroller 846 // +optional 847 Replicas *int32 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"` 848 849 // Minimum number of seconds for which a newly created pod should be ready 850 // without any of its container crashing, for it to be considered available. 851 // Defaults to 0 (pod will be considered available as soon as it is ready) 852 // +optional 853 MinReadySeconds int32 `json:"minReadySeconds,omitempty" protobuf:"varint,4,opt,name=minReadySeconds"` 854 855 // Selector is a label query over pods that should match the replica count. 856 // Label keys and values that must match in order to be controlled by this replica set. 857 // It must match the pod template's labels. 858 // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors 859 Selector *metav1.LabelSelector `json:"selector" protobuf:"bytes,2,opt,name=selector"` 860 861 // Template is the object that describes the pod that will be created if 862 // insufficient replicas are detected. 863 // More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-template 864 // +optional 865 Template v1.PodTemplateSpec `json:"template,omitempty" protobuf:"bytes,3,opt,name=template"` 866 } 867 868 // ReplicaSetStatus represents the current status of a ReplicaSet. 869 type ReplicaSetStatus struct { 870 // Replicas is the most recently observed number of replicas. 871 // More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller/#what-is-a-replicationcontroller 872 Replicas int32 `json:"replicas" protobuf:"varint,1,opt,name=replicas"` 873 874 // The number of pods that have labels matching the labels of the pod template of the replicaset. 875 // +optional 876 FullyLabeledReplicas int32 `json:"fullyLabeledReplicas,omitempty" protobuf:"varint,2,opt,name=fullyLabeledReplicas"` 877 878 // readyReplicas is the number of pods targeted by this ReplicaSet with a Ready Condition. 879 // +optional 880 ReadyReplicas int32 `json:"readyReplicas,omitempty" protobuf:"varint,4,opt,name=readyReplicas"` 881 882 // The number of available replicas (ready for at least minReadySeconds) for this replica set. 883 // +optional 884 AvailableReplicas int32 `json:"availableReplicas,omitempty" protobuf:"varint,5,opt,name=availableReplicas"` 885 886 // ObservedGeneration reflects the generation of the most recently observed ReplicaSet. 887 // +optional 888 ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,3,opt,name=observedGeneration"` 889 890 // Represents the latest available observations of a replica set's current state. 891 // +optional 892 // +patchMergeKey=type 893 // +patchStrategy=merge 894 // +listType=map 895 // +listMapKey=type 896 Conditions []ReplicaSetCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,6,rep,name=conditions"` 897 } 898 899 type ReplicaSetConditionType string 900 901 // These are valid conditions of a replica set. 902 const ( 903 // ReplicaSetReplicaFailure is added in a replica set when one of its pods fails to be created 904 // due to insufficient quota, limit ranges, pod security policy, node selectors, etc. or deleted 905 // due to kubelet being down or finalizers are failing. 906 ReplicaSetReplicaFailure ReplicaSetConditionType = "ReplicaFailure" 907 ) 908 909 // ReplicaSetCondition describes the state of a replica set at a certain point. 910 type ReplicaSetCondition struct { 911 // Type of replica set condition. 912 Type ReplicaSetConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=ReplicaSetConditionType"` 913 // Status of the condition, one of True, False, Unknown. 914 Status v1.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"` 915 // The last time the condition transitioned from one status to another. 916 // +optional 917 LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,3,opt,name=lastTransitionTime"` 918 // The reason for the condition's last transition. 919 // +optional 920 Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"` 921 // A human readable message indicating details about the transition. 922 // +optional 923 Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"` 924 } 925 926 // +genclient 927 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 928 929 // ControllerRevision implements an immutable snapshot of state data. Clients 930 // are responsible for serializing and deserializing the objects that contain 931 // their internal state. 932 // Once a ControllerRevision has been successfully created, it can not be updated. 933 // The API Server will fail validation of all requests that attempt to mutate 934 // the Data field. ControllerRevisions may, however, be deleted. Note that, due to its use by both 935 // the DaemonSet and StatefulSet controllers for update and rollback, this object is beta. However, 936 // it may be subject to name and representation changes in future releases, and clients should not 937 // depend on its stability. It is primarily for internal use by controllers. 938 type ControllerRevision struct { 939 metav1.TypeMeta `json:",inline"` 940 // Standard object's metadata. 941 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata 942 // +optional 943 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 944 945 // Data is the serialized representation of the state. 946 Data runtime.RawExtension `json:"data,omitempty" protobuf:"bytes,2,opt,name=data"` 947 948 // Revision indicates the revision of the state represented by Data. 949 Revision int64 `json:"revision" protobuf:"varint,3,opt,name=revision"` 950 } 951 952 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 953 954 // ControllerRevisionList is a resource containing a list of ControllerRevision objects. 955 type ControllerRevisionList struct { 956 metav1.TypeMeta `json:",inline"` 957 958 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata 959 // +optional 960 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 961 962 // Items is the list of ControllerRevisions 963 Items []ControllerRevision `json:"items" protobuf:"bytes,2,rep,name=items"` 964 } 965