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