mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-19 18:02:01 +00:00
rename DeploymentPodReplacementPolicy FG to DeploymentReplicaSetTerminatingReplicas
This commit is contained in:
parent
83bb5d5705
commit
8db1426554
@ -614,7 +614,7 @@ name | architectures
|
||||
|
||||
### 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: 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]
|
||||
|
4
api/openapi-spec/swagger.json
generated
4
api/openapi-spec/swagger.json
generated
@ -2395,7 +2395,7 @@
|
||||
"type": "integer"
|
||||
},
|
||||
"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",
|
||||
"type": "integer"
|
||||
},
|
||||
@ -2593,7 +2593,7 @@
|
||||
"type": "integer"
|
||||
},
|
||||
"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",
|
||||
"type": "integer"
|
||||
}
|
||||
|
4
api/openapi-spec/v3/apis__apps__v1_openapi.json
generated
4
api/openapi-spec/v3/apis__apps__v1_openapi.json
generated
@ -610,7 +610,7 @@
|
||||
"type": "integer"
|
||||
},
|
||||
"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",
|
||||
"type": "integer"
|
||||
},
|
||||
@ -858,7 +858,7 @@
|
||||
"type": "integer"
|
||||
},
|
||||
"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",
|
||||
"type": "integer"
|
||||
}
|
||||
|
@ -533,7 +533,7 @@ type DeploymentStatus struct {
|
||||
// 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.
|
||||
//
|
||||
// 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
|
||||
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
|
||||
// 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
|
||||
TerminatingReplicas *int32
|
||||
|
||||
|
@ -506,7 +506,7 @@ func calculateStatus(allRSs []*apps.ReplicaSet, newRS *apps.ReplicaSet, deployme
|
||||
UnavailableReplicas: unavailableReplicas,
|
||||
CollisionCount: deployment.Status.CollisionCount,
|
||||
}
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.DeploymentPodReplacementPolicy) {
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.DeploymentReplicaSetTerminatingReplicas) {
|
||||
status.TerminatingReplicas = deploymentutil.GetTerminatingReplicaCountForReplicaSets(allRSs)
|
||||
}
|
||||
|
||||
|
@ -1455,14 +1455,14 @@ func TestMinAvailable(t *testing.T) {
|
||||
|
||||
func TestGetReplicaSetFraction(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
enableDeploymentPodReplacementPolicy bool
|
||||
deploymentReplicas int32
|
||||
deploymentStatusReplicas int32
|
||||
deploymentMaxSurge int32
|
||||
rsReplicas int32
|
||||
rsAnnotations map[string]string
|
||||
expectedFraction int32
|
||||
name string
|
||||
enableDeploymentReplicaSetTerminatingReplicas bool
|
||||
deploymentReplicas int32
|
||||
deploymentStatusReplicas int32
|
||||
deploymentMaxSurge int32
|
||||
rsReplicas int32
|
||||
rsAnnotations map[string]string
|
||||
expectedFraction int32
|
||||
}{
|
||||
{
|
||||
name: "empty deployment always scales to 0",
|
||||
|
@ -719,7 +719,7 @@ func (rsc *ReplicaSetController) syncReplicaSet(ctx context.Context, key string)
|
||||
}
|
||||
|
||||
var terminatingPods []*v1.Pod
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.DeploymentPodReplacementPolicy) {
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.DeploymentReplicaSetTerminatingReplicas) {
|
||||
allTerminatingPods := controller.FilterTerminatingPods(allPods)
|
||||
terminatingPods = controller.FilterClaimedPods(rs, selector, allTerminatingPods)
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ func updateReplicaSetStatus(logger klog.Logger, c appsclient.ReplicaSetInterface
|
||||
var updatedRS *apps.ReplicaSet
|
||||
for i, rs := 0, rs; ; i++ {
|
||||
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))
|
||||
}
|
||||
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
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.DeploymentPodReplacementPolicy) {
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.DeploymentReplicaSetTerminatingReplicas) {
|
||||
terminatingReplicasCount = ptr.To(int32(len(terminatingPods)))
|
||||
}
|
||||
|
||||
|
@ -47,12 +47,12 @@ func TestCalculateStatus(t *testing.T) {
|
||||
}
|
||||
|
||||
rsStatusTests := []struct {
|
||||
name string
|
||||
enableDeploymentPodReplacementPolicy bool
|
||||
replicaset *apps.ReplicaSet
|
||||
activePods []*v1.Pod
|
||||
terminatingPods []*v1.Pod
|
||||
expectedReplicaSetStatus apps.ReplicaSetStatus
|
||||
name string
|
||||
enableDeploymentReplicaSetTerminatingReplicas bool
|
||||
replicaset *apps.ReplicaSet
|
||||
activePods []*v1.Pod
|
||||
terminatingPods []*v1.Pod
|
||||
expectedReplicaSetStatus apps.ReplicaSetStatus
|
||||
}{
|
||||
{
|
||||
"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,
|
||||
fullyLabelledRS,
|
||||
[]*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,
|
||||
fullyLabelledRS,
|
||||
[]*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,
|
||||
fullyLabelledRS,
|
||||
[]*v1.Pod{
|
||||
@ -227,7 +227,7 @@ func TestCalculateStatus(t *testing.T) {
|
||||
|
||||
for _, test := range rsStatusTests {
|
||||
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)
|
||||
if !reflect.DeepEqual(replicaSetStatus, test.expectedReplicaSetStatus) {
|
||||
|
@ -180,7 +180,7 @@ const (
|
||||
// kep: http://kep.k8s.io/3973
|
||||
//
|
||||
// Deployments and replica sets can now also track terminating pods via .status.terminatingReplicas.
|
||||
DeploymentPodReplacementPolicy featuregate.Feature = "DeploymentPodReplacementPolicy"
|
||||
DeploymentReplicaSetTerminatingReplicas featuregate.Feature = "DeploymentReplicaSetTerminatingReplicas"
|
||||
|
||||
// owner: @elezar
|
||||
// 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},
|
||||
},
|
||||
|
||||
DeploymentPodReplacementPolicy: {
|
||||
DeploymentReplicaSetTerminatingReplicas: {
|
||||
{Version: version.MustParse("1.32"), Default: false, PreRelease: featuregate.Alpha},
|
||||
},
|
||||
|
||||
|
14
pkg/generated/openapi/zz_generated.openapi.go
generated
14
pkg/generated/openapi/zz_generated.openapi.go
generated
@ -7582,7 +7582,7 @@ func schema_k8sio_api_apps_v1_DeploymentStatus(ref common.ReferenceCallback) com
|
||||
},
|
||||
"terminatingReplicas": {
|
||||
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"},
|
||||
Format: "int32",
|
||||
},
|
||||
@ -7889,7 +7889,7 @@ func schema_k8sio_api_apps_v1_ReplicaSetStatus(ref common.ReferenceCallback) com
|
||||
},
|
||||
"terminatingReplicas": {
|
||||
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"},
|
||||
Format: "int32",
|
||||
},
|
||||
@ -8910,7 +8910,7 @@ func schema_k8sio_api_apps_v1beta1_DeploymentStatus(ref common.ReferenceCallback
|
||||
},
|
||||
"terminatingReplicas": {
|
||||
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"},
|
||||
Format: "int32",
|
||||
},
|
||||
@ -10332,7 +10332,7 @@ func schema_k8sio_api_apps_v1beta2_DeploymentStatus(ref common.ReferenceCallback
|
||||
},
|
||||
"terminatingReplicas": {
|
||||
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"},
|
||||
Format: "int32",
|
||||
},
|
||||
@ -10638,7 +10638,7 @@ func schema_k8sio_api_apps_v1beta2_ReplicaSetStatus(ref common.ReferenceCallback
|
||||
},
|
||||
"terminatingReplicas": {
|
||||
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"},
|
||||
Format: "int32",
|
||||
},
|
||||
@ -35457,7 +35457,7 @@ func schema_k8sio_api_extensions_v1beta1_DeploymentStatus(ref common.ReferenceCa
|
||||
},
|
||||
"terminatingReplicas": {
|
||||
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"},
|
||||
Format: "int32",
|
||||
},
|
||||
@ -36658,7 +36658,7 @@ func schema_k8sio_api_extensions_v1beta1_ReplicaSetStatus(ref common.ReferenceCa
|
||||
},
|
||||
"terminatingReplicas": {
|
||||
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"},
|
||||
Format: "int32",
|
||||
},
|
||||
|
@ -209,7 +209,7 @@ func (deploymentStatusStrategy) WarningsOnUpdate(ctx context.Context, obj, old r
|
||||
|
||||
// dropDisabledStatusFields removes disabled fields from the deployment status.
|
||||
func dropDisabledStatusFields(deploymentStatus, oldDeploymentStatus *apps.DeploymentStatus) {
|
||||
if !utilfeature.DefaultFeatureGate.Enabled(features.DeploymentPodReplacementPolicy) &&
|
||||
if !utilfeature.DefaultFeatureGate.Enabled(features.DeploymentReplicaSetTerminatingReplicas) &&
|
||||
(oldDeploymentStatus == nil || oldDeploymentStatus.TerminatingReplicas == nil) {
|
||||
deploymentStatus.TerminatingReplicas = nil
|
||||
}
|
||||
|
@ -66,40 +66,40 @@ func TestStatusUpdates(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestStatusUpdatesWithDeploymentPodReplacementPolicy(t *testing.T) {
|
||||
func TestStatusUpdatesWithDeploymentReplicaSetTerminatingReplicas(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
enableDeploymentPodReplacementPolicy bool
|
||||
terminatingReplicas *int32
|
||||
terminatingReplicasUpdate *int32
|
||||
expectedTerminatingReplicas *int32
|
||||
name string
|
||||
enableDeploymentReplicaSetTerminatingReplicas bool
|
||||
terminatingReplicas *int32
|
||||
terminatingReplicasUpdate *int32
|
||||
expectedTerminatingReplicas *int32
|
||||
}{
|
||||
{
|
||||
name: "should not allow updates when feature gate is disabled",
|
||||
enableDeploymentPodReplacementPolicy: false,
|
||||
terminatingReplicas: nil,
|
||||
terminatingReplicasUpdate: ptr.To[int32](2),
|
||||
expectedTerminatingReplicas: nil,
|
||||
name: "should not allow updates when feature gate is disabled",
|
||||
enableDeploymentReplicaSetTerminatingReplicas: false,
|
||||
terminatingReplicas: nil,
|
||||
terminatingReplicasUpdate: ptr.To[int32](2),
|
||||
expectedTerminatingReplicas: nil,
|
||||
},
|
||||
{
|
||||
name: "should allow update when the field is in use when feature gate is disabled",
|
||||
enableDeploymentPodReplacementPolicy: false,
|
||||
terminatingReplicas: ptr.To[int32](2),
|
||||
terminatingReplicasUpdate: ptr.To[int32](5),
|
||||
expectedTerminatingReplicas: ptr.To[int32](5),
|
||||
name: "should allow update when the field is in use when feature gate is disabled",
|
||||
enableDeploymentReplicaSetTerminatingReplicas: false,
|
||||
terminatingReplicas: ptr.To[int32](2),
|
||||
terminatingReplicasUpdate: ptr.To[int32](5),
|
||||
expectedTerminatingReplicas: ptr.To[int32](5),
|
||||
},
|
||||
{
|
||||
name: "should allow updates when feature gate is enabled",
|
||||
enableDeploymentPodReplacementPolicy: true,
|
||||
terminatingReplicas: nil,
|
||||
terminatingReplicasUpdate: ptr.To[int32](2),
|
||||
expectedTerminatingReplicas: ptr.To[int32](2),
|
||||
name: "should allow updates when feature gate is enabled",
|
||||
enableDeploymentReplicaSetTerminatingReplicas: true,
|
||||
terminatingReplicas: nil,
|
||||
terminatingReplicasUpdate: ptr.To[int32](2),
|
||||
expectedTerminatingReplicas: ptr.To[int32](2),
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
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()
|
||||
validSelector := map[string]string{"a": "b"}
|
||||
|
@ -247,7 +247,7 @@ func (rsStatusStrategy) WarningsOnUpdate(ctx context.Context, obj, old runtime.O
|
||||
|
||||
// dropDisabledStatusFields removes disabled fields from the replica set status.
|
||||
func dropDisabledStatusFields(rsStatus, oldRSStatus *apps.ReplicaSetStatus) {
|
||||
if !utilfeature.DefaultFeatureGate.Enabled(features.DeploymentPodReplacementPolicy) &&
|
||||
if !utilfeature.DefaultFeatureGate.Enabled(features.DeploymentReplicaSetTerminatingReplicas) &&
|
||||
(oldRSStatus == nil || oldRSStatus.TerminatingReplicas == nil) {
|
||||
rsStatus.TerminatingReplicas = nil
|
||||
}
|
||||
|
@ -152,40 +152,40 @@ func TestReplicaSetStatusStrategy(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestReplicaSetStatusStrategyWithDeploymentPodReplacementPolicy(t *testing.T) {
|
||||
func TestReplicaSetStatusStrategyWithDeploymentReplicaSetTerminatingReplicas(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
enableDeploymentPodReplacementPolicy bool
|
||||
terminatingReplicas *int32
|
||||
terminatingReplicasUpdate *int32
|
||||
expectedTerminatingReplicas *int32
|
||||
name string
|
||||
enableDeploymentReplicaSetTerminatingReplicas bool
|
||||
terminatingReplicas *int32
|
||||
terminatingReplicasUpdate *int32
|
||||
expectedTerminatingReplicas *int32
|
||||
}{
|
||||
{
|
||||
name: "should not allow updates when feature gate is disabled",
|
||||
enableDeploymentPodReplacementPolicy: false,
|
||||
terminatingReplicas: nil,
|
||||
terminatingReplicasUpdate: ptr.To[int32](2),
|
||||
expectedTerminatingReplicas: nil,
|
||||
name: "should not allow updates when feature gate is disabled",
|
||||
enableDeploymentReplicaSetTerminatingReplicas: false,
|
||||
terminatingReplicas: nil,
|
||||
terminatingReplicasUpdate: ptr.To[int32](2),
|
||||
expectedTerminatingReplicas: nil,
|
||||
},
|
||||
{
|
||||
name: "should allow update when the field is in use when feature gate is disabled",
|
||||
enableDeploymentPodReplacementPolicy: false,
|
||||
terminatingReplicas: ptr.To[int32](2),
|
||||
terminatingReplicasUpdate: ptr.To[int32](5),
|
||||
expectedTerminatingReplicas: ptr.To[int32](5),
|
||||
name: "should allow update when the field is in use when feature gate is disabled",
|
||||
enableDeploymentReplicaSetTerminatingReplicas: false,
|
||||
terminatingReplicas: ptr.To[int32](2),
|
||||
terminatingReplicasUpdate: ptr.To[int32](5),
|
||||
expectedTerminatingReplicas: ptr.To[int32](5),
|
||||
},
|
||||
{
|
||||
name: "should allow updates when feature gate is enabled",
|
||||
enableDeploymentPodReplacementPolicy: true,
|
||||
terminatingReplicas: nil,
|
||||
terminatingReplicasUpdate: ptr.To[int32](2),
|
||||
expectedTerminatingReplicas: ptr.To[int32](2),
|
||||
name: "should allow updates when feature gate is enabled",
|
||||
enableDeploymentReplicaSetTerminatingReplicas: true,
|
||||
terminatingReplicas: nil,
|
||||
terminatingReplicasUpdate: ptr.To[int32](2),
|
||||
expectedTerminatingReplicas: ptr.To[int32](2),
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
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()
|
||||
validSelector := map[string]string{"a": "b"}
|
||||
|
@ -343,7 +343,7 @@ message DeploymentStatus {
|
||||
// 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.
|
||||
//
|
||||
// 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 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
|
||||
// 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 int32 terminatingReplicas = 7;
|
||||
|
||||
|
@ -512,7 +512,7 @@ type DeploymentStatus struct {
|
||||
// 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.
|
||||
//
|
||||
// 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
|
||||
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
|
||||
// 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
|
||||
TerminatingReplicas *int32 `json:"terminatingReplicas,omitempty" protobuf:"varint,7,opt,name=terminatingReplicas"`
|
||||
|
||||
|
@ -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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"conditions": "Represents the latest available observations of a replica set's current state.",
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ message DeploymentStatus {
|
||||
// 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.
|
||||
//
|
||||
// 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 int32 terminatingReplicas = 9;
|
||||
|
||||
|
@ -578,7 +578,7 @@ type DeploymentStatus struct {
|
||||
// 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.
|
||||
//
|
||||
// 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
|
||||
TerminatingReplicas *int32 `json:"terminatingReplicas,omitempty" protobuf:"varint,9,opt,name=terminatingReplicas"`
|
||||
|
||||
|
@ -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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
}
|
||||
|
@ -348,7 +348,7 @@ message DeploymentStatus {
|
||||
// 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.
|
||||
//
|
||||
// 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 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
|
||||
// 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 int32 terminatingReplicas = 7;
|
||||
|
||||
|
@ -556,7 +556,7 @@ type DeploymentStatus struct {
|
||||
// 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.
|
||||
//
|
||||
// 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
|
||||
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
|
||||
// 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
|
||||
TerminatingReplicas *int32 `json:"terminatingReplicas,omitempty" protobuf:"varint,7,opt,name=terminatingReplicas"`
|
||||
|
||||
|
@ -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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"conditions": "Represents the latest available observations of a replica set's current state.",
|
||||
}
|
||||
|
@ -345,7 +345,7 @@ message DeploymentStatus {
|
||||
// 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.
|
||||
//
|
||||
// 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 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
|
||||
// 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 int32 terminatingReplicas = 7;
|
||||
|
||||
|
@ -270,7 +270,7 @@ type DeploymentStatus struct {
|
||||
// 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.
|
||||
//
|
||||
// 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
|
||||
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
|
||||
// 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
|
||||
TerminatingReplicas *int32 `json:"terminatingReplicas,omitempty" protobuf:"varint,7,opt,name=terminatingReplicas"`
|
||||
|
||||
|
@ -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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"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.",
|
||||
"conditions": "Represents the latest available observations of a replica set's current state.",
|
||||
}
|
||||
|
@ -379,7 +379,7 @@
|
||||
lockToDefault: false
|
||||
preRelease: Beta
|
||||
version: "1.33"
|
||||
- name: DeploymentPodReplacementPolicy
|
||||
- name: DeploymentReplicaSetTerminatingReplicas
|
||||
versionedSpecs:
|
||||
- default: false
|
||||
lockToDefault: false
|
||||
|
@ -1308,7 +1308,7 @@ func TestReplicaSetOrphaningAndAdoptionWhenLabelsChange(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, cancel := context.WithCancel(ctx)
|
||||
@ -1366,7 +1366,7 @@ func TestTerminatingReplicasDeploymentStatus(t *testing.T) {
|
||||
}
|
||||
|
||||
// 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
|
||||
tester.deployment, err = tester.updateDeployment(func(update *apps.Deployment) {
|
||||
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
|
||||
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.DeploymentPodReplacementPolicy, false)
|
||||
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.DeploymentReplicaSetTerminatingReplicas, false)
|
||||
// Scale down the deployment
|
||||
tester.deployment, err = tester.updateDeployment(func(update *apps.Deployment) {
|
||||
update.Spec.Replicas = ptr.To(int32(2))
|
||||
|
@ -1072,7 +1072,7 @@ func TestReplicaSetsAppsV1DefaultGCPolicy(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)
|
||||
defer closeFn()
|
||||
@ -1108,7 +1108,7 @@ func TestTerminatingReplicas(t *testing.T) {
|
||||
}
|
||||
|
||||
// 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 {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@ -1125,7 +1125,7 @@ func TestTerminatingReplicas(t *testing.T) {
|
||||
}
|
||||
|
||||
// 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 {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user