Skip to content

Commit 11ce9e0

Browse files
authored
Merge pull request #5398 from atiratree/pod-replacement-policy-1.34
KEP-3973: update Consider Terminating Pods in Deployments
2 parents 42cd64c + 30c2def commit 11ce9e0

File tree

2 files changed

+31
-18
lines changed

2 files changed

+31
-18
lines changed

keps/sig-apps/3973-consider-terminating-pods-deployment/README.md

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,9 @@ are only expecting non-terminating pods to be present in this field.
278278

279279
To satisfy the requirement for tracking terminating pods, and for implementation purposes,
280280
we propose a new field `.status.terminatingReplicas` to the ReplicaSet's and Deployment's
281-
status.
281+
status. This should be gated by a separate feature gate called
282+
DeploymentReplicaSetTerminatingReplicas to handle graduation from the main
283+
DeploymentPodReplacementPolicy separately.
282284

283285
### Deployment Completion and Progress Changes
284286

@@ -435,8 +437,8 @@ type DeploymentSpec struct {
435437
// - RollingUpdate strategy uses TerminationStarted behavior for both rolling out and
436438
// scaling the deployments.
437439
//
438-
// This is an alpha field. Enable DeploymentPodReplacementPolicy to be able to
439-
// use this field.
440+
// This is an alpha field. Enable DeploymentPodReplacementPolicy and
441+
// DeploymentReplicaSetTerminatingReplicas to be able to use this field.
440442
// +optional
441443
PodReplacementPolicy *DeploymentPodReplacementPolicy `json:"podReplacementPolicy,omitempty" protobuf:"bytes,10,opt,name=podReplacementPolicy,casttype=podReplacementPolicy"`
442444
...
@@ -464,7 +466,7 @@ type ReplicaSetStatus struct {
464466

465467
// The number of terminating pods (have a non-null .metadata.deletionTimestamp) for this replica set.
466468
//
467-
// This is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field.
469+
// This is an alpha field. Enable DeploymentReplicaSetTerminatingReplicas to be able to use this field.
468470
// +optional
469471
TerminatingReplicas *int32 `json:"terminatingReplicas,omitempty" protobuf:"varint,7,opt,name=terminatingReplicas"`
470472
...
@@ -498,7 +500,7 @@ type DeploymentStatus struct {
498500

499501
// Total number of terminating pods (have a non-null .metadata.deletionTimestamp) targeted by this deployment.
500502
//
501-
// This is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field.
503+
// This is an alpha field. Enable DeploymentReplicaSetTerminatingReplicas to be able to use this field.
502504
// +optional
503505
TerminatingReplicas *int32 `json:"terminatingReplicas,omitempty" protobuf:"varint,9,opt,name=terminatingReplicas"`
504506
...
@@ -550,14 +552,14 @@ extending the production code to implement this enhancement.
550552
Unit tests covering:
551553

552554
ReplicaSet
553-
- The current behavior remains unchanged when the DeploymentPodReplacementPolicy feature gate is disabled.
555+
- The current behavior remains unchanged when the DeploymentReplicaSetTerminatingReplicas feature gate is disabled.
554556
The `.status.terminatingReplicas` field should be 0 in that case.
555-
- Add a new test that correctly counts .status.TerminatingReplicas when the DeploymentPodReplacementPolicy feature gate is enabled.
557+
- Add a new test that correctly counts .status.TerminatingReplicas when the DeploymentReplicaSetTerminatingReplicas feature gate is enabled.
556558

557559

558560
Deployment
559-
- The current behavior remains unchanged when the DeploymentPodReplacementPolicy feature gate is disabled or PodReplacementPolicy is nil.
560-
The `.status.terminatingReplicas` field should be 0 in that case.
561+
- The current behavior remains unchanged when the DeploymentReplicaSetTerminatingReplicas and DeploymentPodReplacementPolicy feature gate is
562+
disabled or PodReplacementPolicy is nil. The `.status.terminatingReplicas` field should be 0 in that case.
561563
- Add a test wrapper for any relevant tests, to ensure that they are run with all possible PodReplacementPolicy values correctly.
562564
The relevant tests are those that expect some behavior on Pod deletion, and are affected by this change.
563565
- New unit tests should be added for any new helper functions.
@@ -587,20 +589,22 @@ Integration tests covering:
587589

588590
<!-- test/integration/replicaset/replicaset_test.go -->
589591
ReplicaSet
590-
- The current behavior remains unchanged when the DeploymentPodReplacementPolicy feature gate is disabled.
591-
- Add a new test that correctly counts `.status.terminatingReplicas` when the DeploymentPodReplacementPolicy feature gate is enabled.
592+
- The current behavior remains unchanged when the DeploymentReplicaSetTerminatingReplicas feature gate is disabled.
593+
- Add a new test that correctly counts `.status.terminatingReplicas` when the DeploymentReplicaSetTerminatingReplicas feature gate is enabled.
592594

593595
<!--
594596
- <test>: <link to test coverage>
595597
-->
596598

597599
<!-- test/integration/deployment/deployment_test.go -->
598600
Deployment
599-
- The current behavior remains unchanged when the DeploymentPodReplacementPolicy feature gate is disabled or PodReplacementPolicy is nil.
601+
- The current behavior remains unchanged when the DeploymentReplicaSetTerminatingReplicas and DeploymentPodReplacementPolicy feature gate is
602+
disabled or PodReplacementPolicy is nil.
600603
- Add a test wrapper for any relevant tests, to ensure that they are run with all possible PodReplacementPolicy values correctly.
601604
The relevant tests are those that expect some behavior on Pod deletion, and are affected by this change.
602605
- Add new tests that observe rollout and scaling transitions for all possible PodReplacementPolicy values and
603-
ensure that `.status.terminatingReplicas` is correctly counted when the DeploymentPodReplacementPolicy feature gate is enabled.
606+
ensure that `.status.terminatingReplicas` is correctly counted when the DeploymentReplicaSetTerminatingReplicas and
607+
DeploymentPodReplacementPolicy feature gate is enabled.
604608

605609
<!--
606610
- <test>: <link to test coverage>
@@ -644,15 +648,18 @@ test/e2e/storage/utils/deployment.go
644648

645649
#### Alpha
646650

647-
- Feature gate disabled by default.
651+
- Feature gates disabled by default.
648652
- Unit, enablement/disablement, e2e, and integration tests implemented and passing.
649653
- Document [kubectl Skew](#kubectl-skew) for alpha.
650654

651655

652656
#### Beta
653-
- Feature gate enabled by default.
657+
- DeploymentPodReplacementPolicy and DeploymentReplicaSetTerminatingReplicas feature gates enabled by default.
658+
DeploymentReplicaSetTerminatingReplicas feature should be enabled and graduated to beta first at least one release
659+
before the DeploymentPodReplacementPolicy feature is.
654660
- Any test that checks Deployment and Replicaset status is updated to count updates to `.status.TerminatingReplicas`.
655661
- `.spec.podReplacementPolicy` is nil by default and preserves the original behavior.
662+
- Explore and try to resolve [Protional scaling in Deployments in not fully re-entrant](https://github.com/kubernetes/kubernetes/issues/44734) issue.
656663
- E2e and integration tests are in Testgrid and linked in the KEP.
657664
- add new metrics to `kube-state-metrics`
658665
- Remove documentation for [kubectl Skew](#kubectl-skew) that was introduced in alpha.
@@ -948,8 +955,10 @@ deployment and replicaset controllers.
948955

949956
- 2023-05-01: First version of the KEP opened (https://github.com/kubernetes/enhancements/pull/3974).
950957
- 2023-12-12: Second version of the KEP opened (https://github.com/kubernetes/enhancements/pull/4357).
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).
958+
- 2024-05-29: Added a Deployment Scaling Changes and a New Annotation for ReplicaSets section (https://github.com/kubernetes/enhancements/pull/4670).
959+
- 2024-11-22: Added a Deployment Completion and Progress Changes section (https://github.com/kubernetes/enhancements/pull/4976).
960+
- 2025-04-01: Introduced DeploymentReplicaSetTerminatingReplicas FG to split .status.terminatingReplicas feature from DeploymentPodReplacementPolicy (https://github.com/kubernetes/kubernetes/pull/131088)
961+
- 2025-06-11: Fixed ReplicationController reconciliation when the DeploymentReplicaSetTerminatingReplicas feature gate is enabled (https://github.com/kubernetes/kubernetes/issues/131821)
953962

954963
## Drawbacks
955964

keps/sig-apps/3973-consider-terminating-pods-deployment/kep.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ stage: alpha
2222
# The most recent milestone for which work toward delivery of this KEP has been
2323
# done. This can be the current (upcoming) milestone, if it is being actively
2424
# worked on.
25-
latest-milestone: "v1.33"
25+
latest-milestone: "v1.34"
2626

2727
# The milestone at which this feature was, or is targeted to be, at each stage.
2828
milestone:
@@ -33,6 +33,10 @@ milestone:
3333
# The following PRR answers are required at alpha release
3434
# List the feature gate name and the components for which it must be enabled
3535
feature-gates:
36+
- name: DeploymentReplicaSetTerminatingReplicas
37+
components:
38+
- kube-apiserver
39+
- kube-controller-manager
3640
- name: DeploymentPodReplacementPolicy
3741
components:
3842
- kube-apiserver

0 commit comments

Comments
 (0)