19
19
- [ Design Details] ( #design-details )
20
20
- [ Deployment Behavior Changes] ( #deployment-behavior-changes )
21
21
- [ ReplicaSet Status and Deployment Status Changes] ( #replicaset-status-and-deployment-status-changes )
22
+ - [ Deployment Completion and Progress Changes] ( #deployment-completion-and-progress-changes )
22
23
- [ Deployment Scaling Changes and a New Annotation for ReplicaSets] ( #deployment-scaling-changes-and-a-new-annotation-for-replicasets )
23
24
- [ kubectl Changes] ( #kubectl-changes )
24
25
- [ API] ( #api )
@@ -279,6 +280,20 @@ To satisfy the requirement for tracking terminating pods, and for implementation
279
280
we propose a new field ` .status.terminatingReplicas ` to the ReplicaSet's and Deployment's
280
281
status.
281
282
283
+ ### Deployment Completion and Progress Changes
284
+
285
+ Currently, when the latest ReplicaSet is fully saturated and all of its pods become available, the
286
+ Deployment is declared complete. However, there may still be old terminating pods. These pods can
287
+ still be ready and hold/accept connections, meaning that the transition to the latest revision is
288
+ not fully complete.
289
+
290
+ To avoid unexpected behavior, we should not declare the deployment complete until all of its
291
+ terminating replicas have been fully terminated. We will therefore delay setting a ` NewRSAvailable `
292
+ reason to the ` DeploymentProgressing ` condition, when ` TerminationComplete ` policy is used.
293
+
294
+ We will also update the ` LastUpdateTime ` of the ` DeploymentProgressing ` condition when the number of
295
+ terminating pods decreases to reset the progress deadline.
296
+
282
297
### Deployment Scaling Changes and a New Annotation for ReplicaSets
283
298
284
299
Currently, scaling is done proportionally over all ReplicaSets to mitigate the risk of losing
@@ -383,14 +398,17 @@ See [kubectl Skew](#kubectl-skew) for more details.
383
398
type DeploymentPodReplacementPolicy string
384
399
const (
385
400
// TerminationStarted policy creates replacement Pods when the old Pods start
386
- // terminating (has a .metadata.deletionTimestamp). The total number of
387
- // Deployment Pods can be greater than specified by the Deployment's
401
+ // terminating (have a non-null .metadata.deletionTimestamp). The total number
402
+ // of Deployment Pods can be greater than specified by the Deployment's
388
403
// .spec.replicas and the DeploymentStrategy.
389
404
TerminationStarted DeploymentPodReplacementPolicy = " TerminationStarted"
390
405
// TerminationComplete policy creates replacement Pods only when the old Pods
391
406
// are fully terminated (reach Succeeded or Failed phase). The old Pods are
392
407
// subsequently removed. The total number of the Deployment Pods is
393
408
// limited by the Deployment's .spec.replicas and the DeploymentStrategy.
409
+ //
410
+ // This policy will also delay declaring the deployment as complete until all
411
+ // of its terminating replicas have been fully terminated.
394
412
TerminationComplete DeploymentPodReplacementPolicy = " TerminationComplete"
395
413
)
396
414
```
@@ -401,13 +419,15 @@ type DeploymentSpec struct {
401
419
// podReplacementPolicy specifies when to create replacement Pods.
402
420
// Possible values are:
403
421
// - TerminationStarted policy creates replacement Pods when the old Pods start
404
- // terminating (has a .metadata.deletionTimestamp). The total number of
405
- // Deployment Pods can be greater than specified by the Deployment's
422
+ // terminating (have a non-null .metadata.deletionTimestamp). The total number
423
+ // of Deployment Pods can be greater than specified by the Deployment's
406
424
// .spec.replicas and the DeploymentStrategy.
407
425
// - TerminationComplete policy creates replacement Pods only when the old Pods
408
426
// are fully terminated (reach Succeeded or Failed phase). The old Pods are
409
427
// subsequently removed. The total number of the Deployment Pods is
410
428
// limited by the Deployment's .spec.replicas and the DeploymentStrategy.
429
+ // This policy will also delay declaring the deployment as complete until all
430
+ // of its terminating replicas have been fully terminated.
411
431
//
412
432
// The default behavior when the policy is not specified depends on the DeploymentStrategy:
413
433
// - Recreate strategy uses TerminationComplete behavior when recreating the deployment,
@@ -442,11 +462,11 @@ type ReplicaSetStatus struct {
442
462
// +optional
443
463
AvailableReplicas int32 ` json:"availableReplicas,omitempty" protobuf:"varint,5,opt,name=availableReplicas"`
444
464
445
- // The number of terminating replicas (have .metadata.deletionTimestamp) for this replica set.
465
+ // The number of terminating pods (have a non-null .metadata.deletionTimestamp) for this replica set.
446
466
//
447
467
// This is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field.
448
468
// +optional
449
- TerminatingReplicas int32 ` json:"terminatingReplicas,omitempty" protobuf:"varint,7,opt,name=terminatingReplicas"`
469
+ TerminatingReplicas * int32 ` json:"terminatingReplicas,omitempty" protobuf:"varint,7,opt,name=terminatingReplicas"`
450
470
...
451
471
}
452
472
```
@@ -476,11 +496,11 @@ type DeploymentStatus struct {
476
496
// +optional
477
497
UnavailableReplicas int32 ` json:"unavailableReplicas,omitempty" protobuf:"varint,5,opt,name=unavailableReplicas"`
478
498
479
- // Total number of terminating pods (have .metadata.deletionTimestamp) targeted by this deployment.
499
+ // Total number of terminating pods (have a non-null .metadata.deletionTimestamp) targeted by this deployment.
480
500
//
481
501
// This is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field.
482
502
// +optional
483
- TerminatingReplicas int32 ` json:"terminatingReplicas,omitempty" protobuf:"varint,9,opt,name=terminatingReplicas"`
503
+ TerminatingReplicas * int32 ` json:"terminatingReplicas,omitempty" protobuf:"varint,9,opt,name=terminatingReplicas"`
484
504
...
485
505
}
486
506
```
@@ -929,6 +949,7 @@ deployment and replicaset controllers.
929
949
- 2023-05-01: First version of the KEP opened (https://github.com/kubernetes/enhancements/pull/3974 ).
930
950
- 2023-12-12: Second version of the KEP opened (https://github.com/kubernetes/enhancements/pull/4357 ).
931
951
- 2024-29-05: Added a Deployment Scaling Changes and a New Annotation for ReplicaSets section (https://github.com/kubernetes/enhancements/pull/4670 ).
952
+ - 2024-22-11: Added a Deployment Completion and Progress Changes section (https://github.com/kubernetes/enhancements/pull/4976 ).
932
953
933
954
## Drawbacks
934
955
0 commit comments