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