rename DeploymentPodReplacementPolicy FG to DeploymentReplicaSetTerminatingReplicas

This commit is contained in:
Filip Křepinský 2025-03-27 19:05:12 +01:00
parent 83bb5d5705
commit 8db1426554
30 changed files with 112 additions and 112 deletions

View File

@ -614,7 +614,7 @@ name | architectures
### API Change ### API Change
- A new status field `.status.terminatingReplicas` is added to Deployments and ReplicaSets to allow tracking of terminating pods when the DeploymentPodReplacementPolicy feature-gate is enabled. ([#128546](https://github.com/kubernetes/kubernetes/pull/128546), [@atiratree](https://github.com/atiratree)) [SIG API Machinery, Apps and Testing] - A new status field `.status.terminatingReplicas` is added to Deployments and ReplicaSets to allow tracking of terminating pods when the DeploymentReplicaSetTerminatingReplicas feature-gate is enabled. ([#128546](https://github.com/kubernetes/kubernetes/pull/128546), [@atiratree](https://github.com/atiratree)) [SIG API Machinery, Apps and Testing]
- DRA API: the maximum number of pods which can use the same ResourceClaim is now 256 instead of 32. Beware that downgrading a cluster where this relaxed limit is in use to Kubernetes 1.32.0 is not supported because 1.32.0 would refuse to update ResourceClaims with more than 32 entries in the status.reservedFor field. ([#129543](https://github.com/kubernetes/kubernetes/pull/129543), [@pohly](https://github.com/pohly)) [SIG API Machinery, Node and Testing] - DRA API: the maximum number of pods which can use the same ResourceClaim is now 256 instead of 32. Beware that downgrading a cluster where this relaxed limit is in use to Kubernetes 1.32.0 is not supported because 1.32.0 would refuse to update ResourceClaims with more than 32 entries in the status.reservedFor field. ([#129543](https://github.com/kubernetes/kubernetes/pull/129543), [@pohly](https://github.com/pohly)) [SIG API Machinery, Node and Testing]
- DRA: CEL expressions using attribute strings exceeded the cost limit because their cost estimation was incomplete. ([#129661](https://github.com/kubernetes/kubernetes/pull/129661), [@pohly](https://github.com/pohly)) [SIG Node] - DRA: CEL expressions using attribute strings exceeded the cost limit because their cost estimation was incomplete. ([#129661](https://github.com/kubernetes/kubernetes/pull/129661), [@pohly](https://github.com/pohly)) [SIG Node]
- DRA: when asking for "All" devices on a node, Kubernetes <= 1.32 proceeded to schedule pods onto nodes with no devices by not allocating any devices for those pods. Kubernetes 1.33 changes that to only picking nodes which have at least one device. Users who want the "proceed with scheduling also without devices" semantic can use the upcoming prioritized list feature with one sub-request for "all" devices and a second alternative with "count: 0". ([#129560](https://github.com/kubernetes/kubernetes/pull/129560), [@bart0sh](https://github.com/bart0sh)) [SIG API Machinery and Node] - DRA: when asking for "All" devices on a node, Kubernetes <= 1.32 proceeded to schedule pods onto nodes with no devices by not allocating any devices for those pods. Kubernetes 1.33 changes that to only picking nodes which have at least one device. Users who want the "proceed with scheduling also without devices" semantic can use the upcoming prioritized list feature with one sub-request for "all" devices and a second alternative with "count: 0". ([#129560](https://github.com/kubernetes/kubernetes/pull/129560), [@bart0sh](https://github.com/bart0sh)) [SIG API Machinery and Node]

View File

@ -2395,7 +2395,7 @@
"type": "integer" "type": "integer"
}, },
"terminatingReplicas": { "terminatingReplicas": {
"description": "Total number of terminating pods targeted by this deployment. Terminating pods have a non-null .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.\n\nThis is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field.", "description": "Total number of terminating pods targeted by this deployment. Terminating pods have a non-null .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.\n\nThis is an alpha field. Enable DeploymentReplicaSetTerminatingReplicas to be able to use this field.",
"format": "int32", "format": "int32",
"type": "integer" "type": "integer"
}, },
@ -2593,7 +2593,7 @@
"type": "integer" "type": "integer"
}, },
"terminatingReplicas": { "terminatingReplicas": {
"description": "The number of terminating pods for this replica set. Terminating pods have a non-null .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.\n\nThis is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field.", "description": "The number of terminating pods for this replica set. Terminating pods have a non-null .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.\n\nThis is an alpha field. Enable DeploymentReplicaSetTerminatingReplicas to be able to use this field.",
"format": "int32", "format": "int32",
"type": "integer" "type": "integer"
} }

View File

@ -610,7 +610,7 @@
"type": "integer" "type": "integer"
}, },
"terminatingReplicas": { "terminatingReplicas": {
"description": "Total number of terminating pods targeted by this deployment. Terminating pods have a non-null .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.\n\nThis is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field.", "description": "Total number of terminating pods targeted by this deployment. Terminating pods have a non-null .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.\n\nThis is an alpha field. Enable DeploymentReplicaSetTerminatingReplicas to be able to use this field.",
"format": "int32", "format": "int32",
"type": "integer" "type": "integer"
}, },
@ -858,7 +858,7 @@
"type": "integer" "type": "integer"
}, },
"terminatingReplicas": { "terminatingReplicas": {
"description": "The number of terminating pods for this replica set. Terminating pods have a non-null .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.\n\nThis is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field.", "description": "The number of terminating pods for this replica set. Terminating pods have a non-null .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.\n\nThis is an alpha field. Enable DeploymentReplicaSetTerminatingReplicas to be able to use this field.",
"format": "int32", "format": "int32",
"type": "integer" "type": "integer"
} }

View File

@ -533,7 +533,7 @@ type DeploymentStatus struct {
// Total number of terminating pods targeted by this deployment. Terminating pods have a non-null // Total number of terminating pods targeted by this deployment. Terminating pods have a non-null
// .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase. // .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.
// //
// This is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field. // This is an alpha field. Enable DeploymentReplicaSetTerminatingReplicas to be able to use this field.
// +optional // +optional
TerminatingReplicas *int32 TerminatingReplicas *int32
@ -892,7 +892,7 @@ type ReplicaSetStatus struct {
// The number of terminating pods for this replica set. Terminating pods have a non-null .metadata.deletionTimestamp // The number of terminating pods for this replica set. Terminating pods have a non-null .metadata.deletionTimestamp
// and have not yet reached the Failed or Succeeded .status.phase. // and have not yet reached the Failed or Succeeded .status.phase.
// //
// This is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field. // This is an alpha field. Enable DeploymentReplicaSetTerminatingReplicas to be able to use this field.
// +optional // +optional
TerminatingReplicas *int32 TerminatingReplicas *int32

View File

@ -506,7 +506,7 @@ func calculateStatus(allRSs []*apps.ReplicaSet, newRS *apps.ReplicaSet, deployme
UnavailableReplicas: unavailableReplicas, UnavailableReplicas: unavailableReplicas,
CollisionCount: deployment.Status.CollisionCount, CollisionCount: deployment.Status.CollisionCount,
} }
if utilfeature.DefaultFeatureGate.Enabled(features.DeploymentPodReplacementPolicy) { if utilfeature.DefaultFeatureGate.Enabled(features.DeploymentReplicaSetTerminatingReplicas) {
status.TerminatingReplicas = deploymentutil.GetTerminatingReplicaCountForReplicaSets(allRSs) status.TerminatingReplicas = deploymentutil.GetTerminatingReplicaCountForReplicaSets(allRSs)
} }

View File

@ -1455,14 +1455,14 @@ func TestMinAvailable(t *testing.T) {
func TestGetReplicaSetFraction(t *testing.T) { func TestGetReplicaSetFraction(t *testing.T) {
tests := []struct { tests := []struct {
name string name string
enableDeploymentPodReplacementPolicy bool enableDeploymentReplicaSetTerminatingReplicas bool
deploymentReplicas int32 deploymentReplicas int32
deploymentStatusReplicas int32 deploymentStatusReplicas int32
deploymentMaxSurge int32 deploymentMaxSurge int32
rsReplicas int32 rsReplicas int32
rsAnnotations map[string]string rsAnnotations map[string]string
expectedFraction int32 expectedFraction int32
}{ }{
{ {
name: "empty deployment always scales to 0", name: "empty deployment always scales to 0",

View File

@ -719,7 +719,7 @@ func (rsc *ReplicaSetController) syncReplicaSet(ctx context.Context, key string)
} }
var terminatingPods []*v1.Pod var terminatingPods []*v1.Pod
if utilfeature.DefaultFeatureGate.Enabled(features.DeploymentPodReplacementPolicy) { if utilfeature.DefaultFeatureGate.Enabled(features.DeploymentReplicaSetTerminatingReplicas) {
allTerminatingPods := controller.FilterTerminatingPods(allPods) allTerminatingPods := controller.FilterTerminatingPods(allPods)
terminatingPods = controller.FilterClaimedPods(rs, selector, allTerminatingPods) terminatingPods = controller.FilterClaimedPods(rs, selector, allTerminatingPods)
} }

View File

@ -61,7 +61,7 @@ func updateReplicaSetStatus(logger klog.Logger, c appsclient.ReplicaSetInterface
var updatedRS *apps.ReplicaSet var updatedRS *apps.ReplicaSet
for i, rs := 0, rs; ; i++ { for i, rs := 0, rs; ; i++ {
terminatingReplicasUpdateInfo := "" terminatingReplicasUpdateInfo := ""
if utilfeature.DefaultFeatureGate.Enabled(features.DeploymentPodReplacementPolicy) { if utilfeature.DefaultFeatureGate.Enabled(features.DeploymentReplicaSetTerminatingReplicas) {
terminatingReplicasUpdateInfo = fmt.Sprintf("terminatingReplicas %s->%s, ", derefInt32ToStr(rs.Status.TerminatingReplicas), derefInt32ToStr(newStatus.TerminatingReplicas)) terminatingReplicasUpdateInfo = fmt.Sprintf("terminatingReplicas %s->%s, ", derefInt32ToStr(rs.Status.TerminatingReplicas), derefInt32ToStr(newStatus.TerminatingReplicas))
} }
logger.V(4).Info(fmt.Sprintf("Updating status for %v: %s/%s, ", rs.Kind, rs.Namespace, rs.Name) + logger.V(4).Info(fmt.Sprintf("Updating status for %v: %s/%s, ", rs.Kind, rs.Namespace, rs.Name) +
@ -116,7 +116,7 @@ func calculateStatus(rs *apps.ReplicaSet, activePods []*v1.Pod, terminatingPods
} }
var terminatingReplicasCount *int32 var terminatingReplicasCount *int32
if utilfeature.DefaultFeatureGate.Enabled(features.DeploymentPodReplacementPolicy) { if utilfeature.DefaultFeatureGate.Enabled(features.DeploymentReplicaSetTerminatingReplicas) {
terminatingReplicasCount = ptr.To(int32(len(terminatingPods))) terminatingReplicasCount = ptr.To(int32(len(terminatingPods)))
} }

View File

@ -47,12 +47,12 @@ func TestCalculateStatus(t *testing.T) {
} }
rsStatusTests := []struct { rsStatusTests := []struct {
name string name string
enableDeploymentPodReplacementPolicy bool enableDeploymentReplicaSetTerminatingReplicas bool
replicaset *apps.ReplicaSet replicaset *apps.ReplicaSet
activePods []*v1.Pod activePods []*v1.Pod
terminatingPods []*v1.Pod terminatingPods []*v1.Pod
expectedReplicaSetStatus apps.ReplicaSetStatus expectedReplicaSetStatus apps.ReplicaSetStatus
}{ }{
{ {
"1 fully labelled pod", "1 fully labelled pod",
@ -104,7 +104,7 @@ func TestCalculateStatus(t *testing.T) {
}, },
}, },
{ {
"2 fully labelled pods with DeploymentPodReplacementPolicy", "2 fully labelled pods with DeploymentReplicaSetTerminatingReplicas",
true, true,
fullyLabelledRS, fullyLabelledRS,
[]*v1.Pod{ []*v1.Pod{
@ -187,7 +187,7 @@ func TestCalculateStatus(t *testing.T) {
}, },
}, },
{ {
"1 fully labelled pod and 1 terminating without DeploymentPodReplacementPolicy", "1 fully labelled pod and 1 terminating without DeploymentReplicaSetTerminatingReplicas",
false, false,
fullyLabelledRS, fullyLabelledRS,
[]*v1.Pod{ []*v1.Pod{
@ -205,7 +205,7 @@ func TestCalculateStatus(t *testing.T) {
}, },
}, },
{ {
"1 fully labelled pods and 2 terminating with DeploymentPodReplacementPolicy", "1 fully labelled pods and 2 terminating with DeploymentReplicaSetTerminatingReplicas",
true, true,
fullyLabelledRS, fullyLabelledRS,
[]*v1.Pod{ []*v1.Pod{
@ -227,7 +227,7 @@ func TestCalculateStatus(t *testing.T) {
for _, test := range rsStatusTests { for _, test := range rsStatusTests {
t.Run(test.name, func(t *testing.T) { t.Run(test.name, func(t *testing.T) {
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.DeploymentPodReplacementPolicy, test.enableDeploymentPodReplacementPolicy) featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.DeploymentReplicaSetTerminatingReplicas, test.enableDeploymentReplicaSetTerminatingReplicas)
replicaSetStatus := calculateStatus(test.replicaset, test.activePods, test.terminatingPods, nil) replicaSetStatus := calculateStatus(test.replicaset, test.activePods, test.terminatingPods, nil)
if !reflect.DeepEqual(replicaSetStatus, test.expectedReplicaSetStatus) { if !reflect.DeepEqual(replicaSetStatus, test.expectedReplicaSetStatus) {

View File

@ -180,7 +180,7 @@ const (
// kep: http://kep.k8s.io/3973 // kep: http://kep.k8s.io/3973
// //
// Deployments and replica sets can now also track terminating pods via .status.terminatingReplicas. // Deployments and replica sets can now also track terminating pods via .status.terminatingReplicas.
DeploymentPodReplacementPolicy featuregate.Feature = "DeploymentPodReplacementPolicy" DeploymentReplicaSetTerminatingReplicas featuregate.Feature = "DeploymentReplicaSetTerminatingReplicas"
// owner: @elezar // owner: @elezar
// kep: http://kep.k8s.io/4009 // kep: http://kep.k8s.io/4009
@ -1120,7 +1120,7 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate
{Version: version.MustParse("1.33"), Default: false, PreRelease: featuregate.Beta}, {Version: version.MustParse("1.33"), Default: false, PreRelease: featuregate.Beta},
}, },
DeploymentPodReplacementPolicy: { DeploymentReplicaSetTerminatingReplicas: {
{Version: version.MustParse("1.32"), Default: false, PreRelease: featuregate.Alpha}, {Version: version.MustParse("1.32"), Default: false, PreRelease: featuregate.Alpha},
}, },

View File

@ -7582,7 +7582,7 @@ func schema_k8sio_api_apps_v1_DeploymentStatus(ref common.ReferenceCallback) com
}, },
"terminatingReplicas": { "terminatingReplicas": {
SchemaProps: spec.SchemaProps{ SchemaProps: spec.SchemaProps{
Description: "Total number of terminating pods targeted by this deployment. Terminating pods have a non-null .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.\n\nThis is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field.", Description: "Total number of terminating pods targeted by this deployment. Terminating pods have a non-null .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.\n\nThis is an alpha field. Enable DeploymentReplicaSetTerminatingReplicas to be able to use this field.",
Type: []string{"integer"}, Type: []string{"integer"},
Format: "int32", Format: "int32",
}, },
@ -7889,7 +7889,7 @@ func schema_k8sio_api_apps_v1_ReplicaSetStatus(ref common.ReferenceCallback) com
}, },
"terminatingReplicas": { "terminatingReplicas": {
SchemaProps: spec.SchemaProps{ SchemaProps: spec.SchemaProps{
Description: "The number of terminating pods for this replica set. Terminating pods have a non-null .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.\n\nThis is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field.", Description: "The number of terminating pods for this replica set. Terminating pods have a non-null .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.\n\nThis is an alpha field. Enable DeploymentReplicaSetTerminatingReplicas to be able to use this field.",
Type: []string{"integer"}, Type: []string{"integer"},
Format: "int32", Format: "int32",
}, },
@ -8910,7 +8910,7 @@ func schema_k8sio_api_apps_v1beta1_DeploymentStatus(ref common.ReferenceCallback
}, },
"terminatingReplicas": { "terminatingReplicas": {
SchemaProps: spec.SchemaProps{ SchemaProps: spec.SchemaProps{
Description: "Total number of terminating pods targeted by this deployment. Terminating pods have a non-null .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.\n\nThis is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field.", Description: "Total number of terminating pods targeted by this deployment. Terminating pods have a non-null .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.\n\nThis is an alpha field. Enable DeploymentReplicaSetTerminatingReplicas to be able to use this field.",
Type: []string{"integer"}, Type: []string{"integer"},
Format: "int32", Format: "int32",
}, },
@ -10332,7 +10332,7 @@ func schema_k8sio_api_apps_v1beta2_DeploymentStatus(ref common.ReferenceCallback
}, },
"terminatingReplicas": { "terminatingReplicas": {
SchemaProps: spec.SchemaProps{ SchemaProps: spec.SchemaProps{
Description: "Total number of terminating pods targeted by this deployment. Terminating pods have a non-null .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.\n\nThis is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field.", Description: "Total number of terminating pods targeted by this deployment. Terminating pods have a non-null .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.\n\nThis is an alpha field. Enable DeploymentReplicaSetTerminatingReplicas to be able to use this field.",
Type: []string{"integer"}, Type: []string{"integer"},
Format: "int32", Format: "int32",
}, },
@ -10638,7 +10638,7 @@ func schema_k8sio_api_apps_v1beta2_ReplicaSetStatus(ref common.ReferenceCallback
}, },
"terminatingReplicas": { "terminatingReplicas": {
SchemaProps: spec.SchemaProps{ SchemaProps: spec.SchemaProps{
Description: "The number of terminating pods for this replica set. Terminating pods have a non-null .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.\n\nThis is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field.", Description: "The number of terminating pods for this replica set. Terminating pods have a non-null .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.\n\nThis is an alpha field. Enable DeploymentReplicaSetTerminatingReplicas to be able to use this field.",
Type: []string{"integer"}, Type: []string{"integer"},
Format: "int32", Format: "int32",
}, },
@ -35457,7 +35457,7 @@ func schema_k8sio_api_extensions_v1beta1_DeploymentStatus(ref common.ReferenceCa
}, },
"terminatingReplicas": { "terminatingReplicas": {
SchemaProps: spec.SchemaProps{ SchemaProps: spec.SchemaProps{
Description: "Total number of terminating pods targeted by this deployment. Terminating pods have a non-null .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.\n\nThis is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field.", Description: "Total number of terminating pods targeted by this deployment. Terminating pods have a non-null .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.\n\nThis is an alpha field. Enable DeploymentReplicaSetTerminatingReplicas to be able to use this field.",
Type: []string{"integer"}, Type: []string{"integer"},
Format: "int32", Format: "int32",
}, },
@ -36658,7 +36658,7 @@ func schema_k8sio_api_extensions_v1beta1_ReplicaSetStatus(ref common.ReferenceCa
}, },
"terminatingReplicas": { "terminatingReplicas": {
SchemaProps: spec.SchemaProps{ SchemaProps: spec.SchemaProps{
Description: "The number of terminating pods for this replica set. Terminating pods have a non-null .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.\n\nThis is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field.", Description: "The number of terminating pods for this replica set. Terminating pods have a non-null .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.\n\nThis is an alpha field. Enable DeploymentReplicaSetTerminatingReplicas to be able to use this field.",
Type: []string{"integer"}, Type: []string{"integer"},
Format: "int32", Format: "int32",
}, },

View File

@ -209,7 +209,7 @@ func (deploymentStatusStrategy) WarningsOnUpdate(ctx context.Context, obj, old r
// dropDisabledStatusFields removes disabled fields from the deployment status. // dropDisabledStatusFields removes disabled fields from the deployment status.
func dropDisabledStatusFields(deploymentStatus, oldDeploymentStatus *apps.DeploymentStatus) { func dropDisabledStatusFields(deploymentStatus, oldDeploymentStatus *apps.DeploymentStatus) {
if !utilfeature.DefaultFeatureGate.Enabled(features.DeploymentPodReplacementPolicy) && if !utilfeature.DefaultFeatureGate.Enabled(features.DeploymentReplicaSetTerminatingReplicas) &&
(oldDeploymentStatus == nil || oldDeploymentStatus.TerminatingReplicas == nil) { (oldDeploymentStatus == nil || oldDeploymentStatus.TerminatingReplicas == nil) {
deploymentStatus.TerminatingReplicas = nil deploymentStatus.TerminatingReplicas = nil
} }

View File

@ -66,40 +66,40 @@ func TestStatusUpdates(t *testing.T) {
} }
} }
func TestStatusUpdatesWithDeploymentPodReplacementPolicy(t *testing.T) { func TestStatusUpdatesWithDeploymentReplicaSetTerminatingReplicas(t *testing.T) {
tests := []struct { tests := []struct {
name string name string
enableDeploymentPodReplacementPolicy bool enableDeploymentReplicaSetTerminatingReplicas bool
terminatingReplicas *int32 terminatingReplicas *int32
terminatingReplicasUpdate *int32 terminatingReplicasUpdate *int32
expectedTerminatingReplicas *int32 expectedTerminatingReplicas *int32
}{ }{
{ {
name: "should not allow updates when feature gate is disabled", name: "should not allow updates when feature gate is disabled",
enableDeploymentPodReplacementPolicy: false, enableDeploymentReplicaSetTerminatingReplicas: false,
terminatingReplicas: nil, terminatingReplicas: nil,
terminatingReplicasUpdate: ptr.To[int32](2), terminatingReplicasUpdate: ptr.To[int32](2),
expectedTerminatingReplicas: nil, expectedTerminatingReplicas: nil,
}, },
{ {
name: "should allow update when the field is in use when feature gate is disabled", name: "should allow update when the field is in use when feature gate is disabled",
enableDeploymentPodReplacementPolicy: false, enableDeploymentReplicaSetTerminatingReplicas: false,
terminatingReplicas: ptr.To[int32](2), terminatingReplicas: ptr.To[int32](2),
terminatingReplicasUpdate: ptr.To[int32](5), terminatingReplicasUpdate: ptr.To[int32](5),
expectedTerminatingReplicas: ptr.To[int32](5), expectedTerminatingReplicas: ptr.To[int32](5),
}, },
{ {
name: "should allow updates when feature gate is enabled", name: "should allow updates when feature gate is enabled",
enableDeploymentPodReplacementPolicy: true, enableDeploymentReplicaSetTerminatingReplicas: true,
terminatingReplicas: nil, terminatingReplicas: nil,
terminatingReplicasUpdate: ptr.To[int32](2), terminatingReplicasUpdate: ptr.To[int32](2),
expectedTerminatingReplicas: ptr.To[int32](2), expectedTerminatingReplicas: ptr.To[int32](2),
}, },
} }
for _, tc := range tests { for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) { t.Run(tc.name, func(t *testing.T) {
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.DeploymentPodReplacementPolicy, tc.enableDeploymentPodReplacementPolicy) featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.DeploymentReplicaSetTerminatingReplicas, tc.enableDeploymentReplicaSetTerminatingReplicas)
ctx := genericapirequest.NewDefaultContext() ctx := genericapirequest.NewDefaultContext()
validSelector := map[string]string{"a": "b"} validSelector := map[string]string{"a": "b"}

View File

@ -247,7 +247,7 @@ func (rsStatusStrategy) WarningsOnUpdate(ctx context.Context, obj, old runtime.O
// dropDisabledStatusFields removes disabled fields from the replica set status. // dropDisabledStatusFields removes disabled fields from the replica set status.
func dropDisabledStatusFields(rsStatus, oldRSStatus *apps.ReplicaSetStatus) { func dropDisabledStatusFields(rsStatus, oldRSStatus *apps.ReplicaSetStatus) {
if !utilfeature.DefaultFeatureGate.Enabled(features.DeploymentPodReplacementPolicy) && if !utilfeature.DefaultFeatureGate.Enabled(features.DeploymentReplicaSetTerminatingReplicas) &&
(oldRSStatus == nil || oldRSStatus.TerminatingReplicas == nil) { (oldRSStatus == nil || oldRSStatus.TerminatingReplicas == nil) {
rsStatus.TerminatingReplicas = nil rsStatus.TerminatingReplicas = nil
} }

View File

@ -152,40 +152,40 @@ func TestReplicaSetStatusStrategy(t *testing.T) {
} }
} }
func TestReplicaSetStatusStrategyWithDeploymentPodReplacementPolicy(t *testing.T) { func TestReplicaSetStatusStrategyWithDeploymentReplicaSetTerminatingReplicas(t *testing.T) {
tests := []struct { tests := []struct {
name string name string
enableDeploymentPodReplacementPolicy bool enableDeploymentReplicaSetTerminatingReplicas bool
terminatingReplicas *int32 terminatingReplicas *int32
terminatingReplicasUpdate *int32 terminatingReplicasUpdate *int32
expectedTerminatingReplicas *int32 expectedTerminatingReplicas *int32
}{ }{
{ {
name: "should not allow updates when feature gate is disabled", name: "should not allow updates when feature gate is disabled",
enableDeploymentPodReplacementPolicy: false, enableDeploymentReplicaSetTerminatingReplicas: false,
terminatingReplicas: nil, terminatingReplicas: nil,
terminatingReplicasUpdate: ptr.To[int32](2), terminatingReplicasUpdate: ptr.To[int32](2),
expectedTerminatingReplicas: nil, expectedTerminatingReplicas: nil,
}, },
{ {
name: "should allow update when the field is in use when feature gate is disabled", name: "should allow update when the field is in use when feature gate is disabled",
enableDeploymentPodReplacementPolicy: false, enableDeploymentReplicaSetTerminatingReplicas: false,
terminatingReplicas: ptr.To[int32](2), terminatingReplicas: ptr.To[int32](2),
terminatingReplicasUpdate: ptr.To[int32](5), terminatingReplicasUpdate: ptr.To[int32](5),
expectedTerminatingReplicas: ptr.To[int32](5), expectedTerminatingReplicas: ptr.To[int32](5),
}, },
{ {
name: "should allow updates when feature gate is enabled", name: "should allow updates when feature gate is enabled",
enableDeploymentPodReplacementPolicy: true, enableDeploymentReplicaSetTerminatingReplicas: true,
terminatingReplicas: nil, terminatingReplicas: nil,
terminatingReplicasUpdate: ptr.To[int32](2), terminatingReplicasUpdate: ptr.To[int32](2),
expectedTerminatingReplicas: ptr.To[int32](2), expectedTerminatingReplicas: ptr.To[int32](2),
}, },
} }
for _, tc := range tests { for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) { t.Run(tc.name, func(t *testing.T) {
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.DeploymentPodReplacementPolicy, tc.enableDeploymentPodReplacementPolicy) featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.DeploymentReplicaSetTerminatingReplicas, tc.enableDeploymentReplicaSetTerminatingReplicas)
ctx := genericapirequest.NewDefaultContext() ctx := genericapirequest.NewDefaultContext()
validSelector := map[string]string{"a": "b"} validSelector := map[string]string{"a": "b"}

View File

@ -343,7 +343,7 @@ message DeploymentStatus {
// Total number of terminating pods targeted by this deployment. Terminating pods have a non-null // Total number of terminating pods targeted by this deployment. Terminating pods have a non-null
// .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase. // .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.
// //
// This is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field. // This is an alpha field. Enable DeploymentReplicaSetTerminatingReplicas to be able to use this field.
// +optional // +optional
optional int32 terminatingReplicas = 9; optional int32 terminatingReplicas = 9;
@ -481,7 +481,7 @@ message ReplicaSetStatus {
// The number of terminating pods for this replica set. Terminating pods have a non-null .metadata.deletionTimestamp // The number of terminating pods for this replica set. Terminating pods have a non-null .metadata.deletionTimestamp
// and have not yet reached the Failed or Succeeded .status.phase. // and have not yet reached the Failed or Succeeded .status.phase.
// //
// This is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field. // This is an alpha field. Enable DeploymentReplicaSetTerminatingReplicas to be able to use this field.
// +optional // +optional
optional int32 terminatingReplicas = 7; optional int32 terminatingReplicas = 7;

View File

@ -512,7 +512,7 @@ type DeploymentStatus struct {
// Total number of terminating pods targeted by this deployment. Terminating pods have a non-null // Total number of terminating pods targeted by this deployment. Terminating pods have a non-null
// .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase. // .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.
// //
// This is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field. // This is an alpha field. Enable DeploymentReplicaSetTerminatingReplicas to be able to use this field.
// +optional // +optional
TerminatingReplicas *int32 `json:"terminatingReplicas,omitempty" protobuf:"varint,9,opt,name=terminatingReplicas"` TerminatingReplicas *int32 `json:"terminatingReplicas,omitempty" protobuf:"varint,9,opt,name=terminatingReplicas"`
@ -900,7 +900,7 @@ type ReplicaSetStatus struct {
// The number of terminating pods for this replica set. Terminating pods have a non-null .metadata.deletionTimestamp // The number of terminating pods for this replica set. Terminating pods have a non-null .metadata.deletionTimestamp
// and have not yet reached the Failed or Succeeded .status.phase. // and have not yet reached the Failed or Succeeded .status.phase.
// //
// This is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field. // This is an alpha field. Enable DeploymentReplicaSetTerminatingReplicas to be able to use this field.
// +optional // +optional
TerminatingReplicas *int32 `json:"terminatingReplicas,omitempty" protobuf:"varint,7,opt,name=terminatingReplicas"` TerminatingReplicas *int32 `json:"terminatingReplicas,omitempty" protobuf:"varint,7,opt,name=terminatingReplicas"`

View File

@ -182,7 +182,7 @@ var map_DeploymentStatus = map[string]string{
"readyReplicas": "Total number of non-terminating pods targeted by this Deployment with a Ready Condition.", "readyReplicas": "Total number of non-terminating pods targeted by this Deployment with a Ready Condition.",
"availableReplicas": "Total number of available non-terminating pods (ready for at least minReadySeconds) targeted by this deployment.", "availableReplicas": "Total number of available non-terminating pods (ready for at least minReadySeconds) targeted by this deployment.",
"unavailableReplicas": "Total number of unavailable pods targeted by this deployment. This is the total number of pods that are still required for the deployment to have 100% available capacity. They may either be pods that are running but not yet available or pods that still have not been created.", "unavailableReplicas": "Total number of unavailable pods targeted by this deployment. This is the total number of pods that are still required for the deployment to have 100% available capacity. They may either be pods that are running but not yet available or pods that still have not been created.",
"terminatingReplicas": "Total number of terminating pods targeted by this deployment. Terminating pods have a non-null .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.\n\nThis is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field.", "terminatingReplicas": "Total number of terminating pods targeted by this deployment. Terminating pods have a non-null .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.\n\nThis is an alpha field. Enable DeploymentReplicaSetTerminatingReplicas to be able to use this field.",
"conditions": "Represents the latest available observations of a deployment's current state.", "conditions": "Represents the latest available observations of a deployment's current state.",
"collisionCount": "Count of hash collisions for the Deployment. The Deployment controller uses this field as a collision avoidance mechanism when it needs to create the name for the newest ReplicaSet.", "collisionCount": "Count of hash collisions for the Deployment. The Deployment controller uses this field as a collision avoidance mechanism when it needs to create the name for the newest ReplicaSet.",
} }
@ -253,7 +253,7 @@ var map_ReplicaSetStatus = map[string]string{
"fullyLabeledReplicas": "The number of non-terminating pods that have labels matching the labels of the pod template of the replicaset.", "fullyLabeledReplicas": "The number of non-terminating pods that have labels matching the labels of the pod template of the replicaset.",
"readyReplicas": "The number of non-terminating pods targeted by this ReplicaSet with a Ready Condition.", "readyReplicas": "The number of non-terminating pods targeted by this ReplicaSet with a Ready Condition.",
"availableReplicas": "The number of available non-terminating pods (ready for at least minReadySeconds) for this replica set.", "availableReplicas": "The number of available non-terminating pods (ready for at least minReadySeconds) for this replica set.",
"terminatingReplicas": "The number of terminating pods for this replica set. Terminating pods have a non-null .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.\n\nThis is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field.", "terminatingReplicas": "The number of terminating pods for this replica set. Terminating pods have a non-null .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.\n\nThis is an alpha field. Enable DeploymentReplicaSetTerminatingReplicas to be able to use this field.",
"observedGeneration": "ObservedGeneration reflects the generation of the most recently observed ReplicaSet.", "observedGeneration": "ObservedGeneration reflects the generation of the most recently observed ReplicaSet.",
"conditions": "Represents the latest available observations of a replica set's current state.", "conditions": "Represents the latest available observations of a replica set's current state.",
} }

View File

@ -208,7 +208,7 @@ message DeploymentStatus {
// Total number of terminating pods targeted by this deployment. Terminating pods have a non-null // Total number of terminating pods targeted by this deployment. Terminating pods have a non-null
// .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase. // .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.
// //
// This is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field. // This is an alpha field. Enable DeploymentReplicaSetTerminatingReplicas to be able to use this field.
// +optional // +optional
optional int32 terminatingReplicas = 9; optional int32 terminatingReplicas = 9;

View File

@ -578,7 +578,7 @@ type DeploymentStatus struct {
// Total number of terminating pods targeted by this deployment. Terminating pods have a non-null // Total number of terminating pods targeted by this deployment. Terminating pods have a non-null
// .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase. // .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.
// //
// This is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field. // This is an alpha field. Enable DeploymentReplicaSetTerminatingReplicas to be able to use this field.
// +optional // +optional
TerminatingReplicas *int32 `json:"terminatingReplicas,omitempty" protobuf:"varint,9,opt,name=terminatingReplicas"` TerminatingReplicas *int32 `json:"terminatingReplicas,omitempty" protobuf:"varint,9,opt,name=terminatingReplicas"`

View File

@ -119,7 +119,7 @@ var map_DeploymentStatus = map[string]string{
"readyReplicas": "Total number of non-terminating pods targeted by this Deployment with a Ready Condition.", "readyReplicas": "Total number of non-terminating pods targeted by this Deployment with a Ready Condition.",
"availableReplicas": "Total number of available non-terminating pods (ready for at least minReadySeconds) targeted by this deployment.", "availableReplicas": "Total number of available non-terminating pods (ready for at least minReadySeconds) targeted by this deployment.",
"unavailableReplicas": "Total number of unavailable pods targeted by this deployment. This is the total number of pods that are still required for the deployment to have 100% available capacity. They may either be pods that are running but not yet available or pods that still have not been created.", "unavailableReplicas": "Total number of unavailable pods targeted by this deployment. This is the total number of pods that are still required for the deployment to have 100% available capacity. They may either be pods that are running but not yet available or pods that still have not been created.",
"terminatingReplicas": "Total number of terminating pods targeted by this deployment. Terminating pods have a non-null .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.\n\nThis is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field.", "terminatingReplicas": "Total number of terminating pods targeted by this deployment. Terminating pods have a non-null .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.\n\nThis is an alpha field. Enable DeploymentReplicaSetTerminatingReplicas to be able to use this field.",
"conditions": "Represents the latest available observations of a deployment's current state.", "conditions": "Represents the latest available observations of a deployment's current state.",
"collisionCount": "collisionCount is the count of hash collisions for the Deployment. The Deployment controller uses this field as a collision avoidance mechanism when it needs to create the name for the newest ReplicaSet.", "collisionCount": "collisionCount is the count of hash collisions for the Deployment. The Deployment controller uses this field as a collision avoidance mechanism when it needs to create the name for the newest ReplicaSet.",
} }

View File

@ -348,7 +348,7 @@ message DeploymentStatus {
// Total number of terminating pods targeted by this deployment. Terminating pods have a non-null // Total number of terminating pods targeted by this deployment. Terminating pods have a non-null
// .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase. // .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.
// //
// This is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field. // This is an alpha field. Enable DeploymentReplicaSetTerminatingReplicas to be able to use this field.
// +optional // +optional
optional int32 terminatingReplicas = 9; optional int32 terminatingReplicas = 9;
@ -487,7 +487,7 @@ message ReplicaSetStatus {
// The number of terminating pods for this replica set. Terminating pods have a non-null .metadata.deletionTimestamp // The number of terminating pods for this replica set. Terminating pods have a non-null .metadata.deletionTimestamp
// and have not yet reached the Failed or Succeeded .status.phase. // and have not yet reached the Failed or Succeeded .status.phase.
// //
// This is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field. // This is an alpha field. Enable DeploymentReplicaSetTerminatingReplicas to be able to use this field.
// +optional // +optional
optional int32 terminatingReplicas = 7; optional int32 terminatingReplicas = 7;

View File

@ -556,7 +556,7 @@ type DeploymentStatus struct {
// Total number of terminating pods targeted by this deployment. Terminating pods have a non-null // Total number of terminating pods targeted by this deployment. Terminating pods have a non-null
// .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase. // .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.
// //
// This is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field. // This is an alpha field. Enable DeploymentReplicaSetTerminatingReplicas to be able to use this field.
// +optional // +optional
TerminatingReplicas *int32 `json:"terminatingReplicas,omitempty" protobuf:"varint,9,opt,name=terminatingReplicas"` TerminatingReplicas *int32 `json:"terminatingReplicas,omitempty" protobuf:"varint,9,opt,name=terminatingReplicas"`
@ -958,7 +958,7 @@ type ReplicaSetStatus struct {
// The number of terminating pods for this replica set. Terminating pods have a non-null .metadata.deletionTimestamp // The number of terminating pods for this replica set. Terminating pods have a non-null .metadata.deletionTimestamp
// and have not yet reached the Failed or Succeeded .status.phase. // and have not yet reached the Failed or Succeeded .status.phase.
// //
// This is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field. // This is an alpha field. Enable DeploymentReplicaSetTerminatingReplicas to be able to use this field.
// +optional // +optional
TerminatingReplicas *int32 `json:"terminatingReplicas,omitempty" protobuf:"varint,7,opt,name=terminatingReplicas"` TerminatingReplicas *int32 `json:"terminatingReplicas,omitempty" protobuf:"varint,7,opt,name=terminatingReplicas"`

View File

@ -182,7 +182,7 @@ var map_DeploymentStatus = map[string]string{
"readyReplicas": "Total number of non-terminating pods targeted by this Deployment with a Ready Condition.", "readyReplicas": "Total number of non-terminating pods targeted by this Deployment with a Ready Condition.",
"availableReplicas": "Total number of available non-terminating pods (ready for at least minReadySeconds) targeted by this deployment.", "availableReplicas": "Total number of available non-terminating pods (ready for at least minReadySeconds) targeted by this deployment.",
"unavailableReplicas": "Total number of unavailable pods targeted by this deployment. This is the total number of pods that are still required for the deployment to have 100% available capacity. They may either be pods that are running but not yet available or pods that still have not been created.", "unavailableReplicas": "Total number of unavailable pods targeted by this deployment. This is the total number of pods that are still required for the deployment to have 100% available capacity. They may either be pods that are running but not yet available or pods that still have not been created.",
"terminatingReplicas": "Total number of terminating pods targeted by this deployment. Terminating pods have a non-null .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.\n\nThis is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field.", "terminatingReplicas": "Total number of terminating pods targeted by this deployment. Terminating pods have a non-null .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.\n\nThis is an alpha field. Enable DeploymentReplicaSetTerminatingReplicas to be able to use this field.",
"conditions": "Represents the latest available observations of a deployment's current state.", "conditions": "Represents the latest available observations of a deployment's current state.",
"collisionCount": "Count of hash collisions for the Deployment. The Deployment controller uses this field as a collision avoidance mechanism when it needs to create the name for the newest ReplicaSet.", "collisionCount": "Count of hash collisions for the Deployment. The Deployment controller uses this field as a collision avoidance mechanism when it needs to create the name for the newest ReplicaSet.",
} }
@ -253,7 +253,7 @@ var map_ReplicaSetStatus = map[string]string{
"fullyLabeledReplicas": "The number of non-terminating pods that have labels matching the labels of the pod template of the replicaset.", "fullyLabeledReplicas": "The number of non-terminating pods that have labels matching the labels of the pod template of the replicaset.",
"readyReplicas": "The number of non-terminating pods targeted by this ReplicaSet with a Ready Condition.", "readyReplicas": "The number of non-terminating pods targeted by this ReplicaSet with a Ready Condition.",
"availableReplicas": "The number of available non-terminating pods (ready for at least minReadySeconds) for this replica set.", "availableReplicas": "The number of available non-terminating pods (ready for at least minReadySeconds) for this replica set.",
"terminatingReplicas": "The number of terminating pods for this replica set. Terminating pods have a non-null .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.\n\nThis is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field.", "terminatingReplicas": "The number of terminating pods for this replica set. Terminating pods have a non-null .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.\n\nThis is an alpha field. Enable DeploymentReplicaSetTerminatingReplicas to be able to use this field.",
"observedGeneration": "ObservedGeneration reflects the generation of the most recently observed ReplicaSet.", "observedGeneration": "ObservedGeneration reflects the generation of the most recently observed ReplicaSet.",
"conditions": "Represents the latest available observations of a replica set's current state.", "conditions": "Represents the latest available observations of a replica set's current state.",
} }

View File

@ -345,7 +345,7 @@ message DeploymentStatus {
// Total number of terminating pods targeted by this deployment. Terminating pods have a non-null // Total number of terminating pods targeted by this deployment. Terminating pods have a non-null
// .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase. // .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.
// //
// This is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field. // This is an alpha field. Enable DeploymentReplicaSetTerminatingReplicas to be able to use this field.
// +optional // +optional
optional int32 terminatingReplicas = 9; optional int32 terminatingReplicas = 9;
@ -924,7 +924,7 @@ message ReplicaSetStatus {
// The number of terminating pods for this replica set. Terminating pods have a non-null .metadata.deletionTimestamp // The number of terminating pods for this replica set. Terminating pods have a non-null .metadata.deletionTimestamp
// and have not yet reached the Failed or Succeeded .status.phase. // and have not yet reached the Failed or Succeeded .status.phase.
// //
// This is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field. // This is an alpha field. Enable DeploymentReplicaSetTerminatingReplicas to be able to use this field.
// +optional // +optional
optional int32 terminatingReplicas = 7; optional int32 terminatingReplicas = 7;

View File

@ -270,7 +270,7 @@ type DeploymentStatus struct {
// Total number of terminating pods targeted by this deployment. Terminating pods have a non-null // Total number of terminating pods targeted by this deployment. Terminating pods have a non-null
// .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase. // .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.
// //
// This is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field. // This is an alpha field. Enable DeploymentReplicaSetTerminatingReplicas to be able to use this field.
// +optional // +optional
TerminatingReplicas *int32 `json:"terminatingReplicas,omitempty" protobuf:"varint,9,opt,name=terminatingReplicas"` TerminatingReplicas *int32 `json:"terminatingReplicas,omitempty" protobuf:"varint,9,opt,name=terminatingReplicas"`
@ -1002,7 +1002,7 @@ type ReplicaSetStatus struct {
// The number of terminating pods for this replica set. Terminating pods have a non-null .metadata.deletionTimestamp // The number of terminating pods for this replica set. Terminating pods have a non-null .metadata.deletionTimestamp
// and have not yet reached the Failed or Succeeded .status.phase. // and have not yet reached the Failed or Succeeded .status.phase.
// //
// This is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field. // This is an alpha field. Enable DeploymentReplicaSetTerminatingReplicas to be able to use this field.
// +optional // +optional
TerminatingReplicas *int32 `json:"terminatingReplicas,omitempty" protobuf:"varint,7,opt,name=terminatingReplicas"` TerminatingReplicas *int32 `json:"terminatingReplicas,omitempty" protobuf:"varint,7,opt,name=terminatingReplicas"`

View File

@ -174,7 +174,7 @@ var map_DeploymentStatus = map[string]string{
"readyReplicas": "Total number of non-terminating pods targeted by this Deployment with a Ready Condition.", "readyReplicas": "Total number of non-terminating pods targeted by this Deployment with a Ready Condition.",
"availableReplicas": "Total number of available non-terminating pods (ready for at least minReadySeconds) targeted by this deployment.", "availableReplicas": "Total number of available non-terminating pods (ready for at least minReadySeconds) targeted by this deployment.",
"unavailableReplicas": "Total number of unavailable pods targeted by this deployment. This is the total number of pods that are still required for the deployment to have 100% available capacity. They may either be pods that are running but not yet available or pods that still have not been created.", "unavailableReplicas": "Total number of unavailable pods targeted by this deployment. This is the total number of pods that are still required for the deployment to have 100% available capacity. They may either be pods that are running but not yet available or pods that still have not been created.",
"terminatingReplicas": "Total number of terminating pods targeted by this deployment. Terminating pods have a non-null .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.\n\nThis is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field.", "terminatingReplicas": "Total number of terminating pods targeted by this deployment. Terminating pods have a non-null .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.\n\nThis is an alpha field. Enable DeploymentReplicaSetTerminatingReplicas to be able to use this field.",
"conditions": "Represents the latest available observations of a deployment's current state.", "conditions": "Represents the latest available observations of a deployment's current state.",
"collisionCount": "Count of hash collisions for the Deployment. The Deployment controller uses this field as a collision avoidance mechanism when it needs to create the name for the newest ReplicaSet.", "collisionCount": "Count of hash collisions for the Deployment. The Deployment controller uses this field as a collision avoidance mechanism when it needs to create the name for the newest ReplicaSet.",
} }
@ -461,7 +461,7 @@ var map_ReplicaSetStatus = map[string]string{
"fullyLabeledReplicas": "The number of non-terminating pods that have labels matching the labels of the pod template of the replicaset.", "fullyLabeledReplicas": "The number of non-terminating pods that have labels matching the labels of the pod template of the replicaset.",
"readyReplicas": "The number of non-terminating pods targeted by this ReplicaSet with a Ready Condition.", "readyReplicas": "The number of non-terminating pods targeted by this ReplicaSet with a Ready Condition.",
"availableReplicas": "The number of available non-terminating pods (ready for at least minReadySeconds) for this replica set.", "availableReplicas": "The number of available non-terminating pods (ready for at least minReadySeconds) for this replica set.",
"terminatingReplicas": "The number of terminating pods for this replica set. Terminating pods have a non-null .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.\n\nThis is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field.", "terminatingReplicas": "The number of terminating pods for this replica set. Terminating pods have a non-null .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.\n\nThis is an alpha field. Enable DeploymentReplicaSetTerminatingReplicas to be able to use this field.",
"observedGeneration": "ObservedGeneration reflects the generation of the most recently observed ReplicaSet.", "observedGeneration": "ObservedGeneration reflects the generation of the most recently observed ReplicaSet.",
"conditions": "Represents the latest available observations of a replica set's current state.", "conditions": "Represents the latest available observations of a replica set's current state.",
} }

View File

@ -379,7 +379,7 @@
lockToDefault: false lockToDefault: false
preRelease: Beta preRelease: Beta
version: "1.33" version: "1.33"
- name: DeploymentPodReplacementPolicy - name: DeploymentReplicaSetTerminatingReplicas
versionedSpecs: versionedSpecs:
- default: false - default: false
lockToDefault: false lockToDefault: false

View File

@ -1308,7 +1308,7 @@ func TestReplicaSetOrphaningAndAdoptionWhenLabelsChange(t *testing.T) {
} }
func TestTerminatingReplicasDeploymentStatus(t *testing.T) { func TestTerminatingReplicasDeploymentStatus(t *testing.T) {
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.DeploymentPodReplacementPolicy, false) featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.DeploymentReplicaSetTerminatingReplicas, false)
_, ctx := ktesting.NewTestContext(t) _, ctx := ktesting.NewTestContext(t)
ctx, cancel := context.WithCancel(ctx) ctx, cancel := context.WithCancel(ctx)
@ -1366,7 +1366,7 @@ func TestTerminatingReplicasDeploymentStatus(t *testing.T) {
} }
// should update terminating replicas when feature gate is enabled // should update terminating replicas when feature gate is enabled
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.DeploymentPodReplacementPolicy, true) featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.DeploymentReplicaSetTerminatingReplicas, true)
// Scale down the deployment // Scale down the deployment
tester.deployment, err = tester.updateDeployment(func(update *apps.Deployment) { tester.deployment, err = tester.updateDeployment(func(update *apps.Deployment) {
update.Spec.Replicas = ptr.To(int32(3)) update.Spec.Replicas = ptr.To(int32(3))
@ -1384,7 +1384,7 @@ func TestTerminatingReplicasDeploymentStatus(t *testing.T) {
} }
// should not update terminating replicas when feature gate is disabled // should not update terminating replicas when feature gate is disabled
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.DeploymentPodReplacementPolicy, false) featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.DeploymentReplicaSetTerminatingReplicas, false)
// Scale down the deployment // Scale down the deployment
tester.deployment, err = tester.updateDeployment(func(update *apps.Deployment) { tester.deployment, err = tester.updateDeployment(func(update *apps.Deployment) {
update.Spec.Replicas = ptr.To(int32(2)) update.Spec.Replicas = ptr.To(int32(2))

View File

@ -1072,7 +1072,7 @@ func TestReplicaSetsAppsV1DefaultGCPolicy(t *testing.T) {
} }
func TestTerminatingReplicas(t *testing.T) { func TestTerminatingReplicas(t *testing.T) {
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.DeploymentPodReplacementPolicy, false) featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.DeploymentReplicaSetTerminatingReplicas, false)
tCtx, closeFn, rm, informers, c := rmSetup(t) tCtx, closeFn, rm, informers, c := rmSetup(t)
defer closeFn() defer closeFn()
@ -1108,7 +1108,7 @@ func TestTerminatingReplicas(t *testing.T) {
} }
// should update terminating pods when feature gate is enabled // should update terminating pods when feature gate is enabled
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.DeploymentPodReplacementPolicy, true) featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.DeploymentReplicaSetTerminatingReplicas, true)
if err := podClient.Delete(tCtx, pods.Items[1].Name, metav1.DeleteOptions{}); err != nil { if err := podClient.Delete(tCtx, pods.Items[1].Name, metav1.DeleteOptions{}); err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -1125,7 +1125,7 @@ func TestTerminatingReplicas(t *testing.T) {
} }
// should revert terminating pods to 0 when feature gate is disabled // should revert terminating pods to 0 when feature gate is disabled
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.DeploymentPodReplacementPolicy, false) featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.DeploymentReplicaSetTerminatingReplicas, false)
if err := podClient.Delete(tCtx, pods.Items[2].Name, metav1.DeleteOptions{}); err != nil { if err := podClient.Delete(tCtx, pods.Items[2].Name, metav1.DeleteOptions{}); err != nil {
t.Fatal(err) t.Fatal(err)
} }