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