File tree Expand file tree Collapse file tree 4 files changed +17
-5
lines changed
pkg/controller/batchrelease/control/partitionstyle Expand file tree Collapse file tree 4 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -71,7 +71,10 @@ type FinalizingPolicyType string
7171const (
7272 // WaitResumeFinalizingPolicyType will wait workload to be resumed, which means
7373 // controller will be hold at Finalizing phase until all pods of workload is upgraded.
74- // WaitResumeFinalizingPolicyType only works in canary-style BatchRelease controller.
74+ // WaitResumeFinalizingPolicyType currently serves two purposes:
75+ // 1. In canary deployments, it determines whether to wait for the stable deployment to complete.
76+ // 2. It distinguishes between a normal deployment completion and a rollout cancellation during deployment.
77+ // Only a normal deployment completion will result in a WaitResume state.
7578 WaitResumeFinalizingPolicyType FinalizingPolicyType = "WaitResume"
7679 // ImmediateFinalizingPolicyType will not to wait workload to be resumed.
7780 ImmediateFinalizingPolicyType FinalizingPolicyType = "Immediate"
Original file line number Diff line number Diff line change @@ -122,7 +122,9 @@ func (rc *realController) Finalize(release *v1beta1.BatchRelease) error {
122122
123123 // if batchPartition == nil, workload should be promoted.
124124 if release .Spec .ReleasePlan .BatchPartition == nil {
125- if utilfeature .DefaultMutableFeatureGate .Enabled (feature .KeepWorkloadPausedOnRolloutDeletion ) {
125+ // This condition is only met when a rollout is canceled during the release process.
126+ if utilfeature .DefaultMutableFeatureGate .Enabled (feature .KeepWorkloadPausedOnRolloutDeletion ) &&
127+ ! control .ShouldWaitResume (release ) {
126128 specBody = `,"spec":{"updateStrategy":{"paused":false}}`
127129 } else {
128130 specBody = `,"spec":{"updateStrategy":{"partition":null,"paused":false}}`
Original file line number Diff line number Diff line change @@ -144,7 +144,11 @@ func (rc *realController) Finalize(release *v1beta1.BatchRelease) error {
144144 patchData := patch .NewDeploymentPatch ()
145145 if release .Spec .ReleasePlan .BatchPartition == nil {
146146 strategy := util .GetDeploymentStrategy (rc .object )
147- if ! utilfeature .DefaultMutableFeatureGate .Enabled (feature .KeepWorkloadPausedOnRolloutDeletion ) {
147+ // This condition is only met when a rollout is canceled during the release process.
148+ if utilfeature .DefaultMutableFeatureGate .Enabled (feature .KeepWorkloadPausedOnRolloutDeletion ) &&
149+ ! control .ShouldWaitResume (release ) {
150+ patchData .UpdatePaused (true )
151+ } else {
148152 patchData .UpdatePaused (false )
149153 }
150154 if rc .object .Spec .Strategy .Type == apps .RecreateDeploymentStrategyType {
Original file line number Diff line number Diff line change @@ -136,8 +136,11 @@ func (rc *realController) Finalize(release *v1beta1.BatchRelease) error {
136136
137137 var specBody string
138138 // If batchPartition == nil, workload should be promoted;
139- if release .Spec .ReleasePlan .BatchPartition == nil && ! utilfeature .DefaultMutableFeatureGate .Enabled (feature .KeepWorkloadPausedOnRolloutDeletion ) {
140- specBody = `,"spec":{"updateStrategy":{"rollingUpdate":{"partition":null}}}`
139+ if release .Spec .ReleasePlan .BatchPartition == nil {
140+ if ! (utilfeature .DefaultMutableFeatureGate .Enabled (feature .KeepWorkloadPausedOnRolloutDeletion ) &&
141+ ! control .ShouldWaitResume (release )) {
142+ specBody = `,"spec":{"updateStrategy":{"rollingUpdate":{"partition":null}}}`
143+ }
141144 }
142145 body := fmt .Sprintf (`{"metadata":{"annotations":{"%s":null}}%s}` , util .BatchReleaseControlAnnotation , specBody )
143146 clone := util .GetEmptyObjectWithKey (rc .object )
You can’t perform that action at this time.
0 commit comments