From 862040870de02cbc0e1b920e8bce74eec6039d02 Mon Sep 17 00:00:00 2001 From: Wei-Xiang Sun Date: Tue, 19 Dec 2023 13:23:00 +0800 Subject: [PATCH] set default advanced deployment strategy (#176) Signed-off-by: mingzhou.swx Co-authored-by: mingzhou.swx --- .../batchrelease/control/partitionstyle/deployment/control.go | 1 + pkg/webhook/workload/mutating/workload_update_handler.go | 1 + 2 files changed, 2 insertions(+) diff --git a/pkg/controller/batchrelease/control/partitionstyle/deployment/control.go b/pkg/controller/batchrelease/control/partitionstyle/deployment/control.go index e67ab33f..b5b6704e 100644 --- a/pkg/controller/batchrelease/control/partitionstyle/deployment/control.go +++ b/pkg/controller/batchrelease/control/partitionstyle/deployment/control.go @@ -95,6 +95,7 @@ func (rc *realController) Initialize(release *v1beta1.BatchRelease) error { RollingStyle: v1alpha1.PartitionRollingStyle, RollingUpdate: rollingUpdate, } + v1alpha1.SetDefaultDeploymentStrategy(&strategy) d := rc.object.DeepCopy() patchData := patch.NewDeploymentPatch() diff --git a/pkg/webhook/workload/mutating/workload_update_handler.go b/pkg/webhook/workload/mutating/workload_update_handler.go index 98bedf89..60a443de 100644 --- a/pkg/webhook/workload/mutating/workload_update_handler.go +++ b/pkg/webhook/workload/mutating/workload_update_handler.go @@ -285,6 +285,7 @@ func (h *WorkloadHandler) handleDeployment(newObj, oldObj *apps.Deployment) (boo modified = true strategy.Paused = true } + appsv1alpha1.SetDefaultDeploymentStrategy(&strategy) setDeploymentStrategyAnnotation(strategy, newObj) default: // Do not allow to modify strategy as Recreate during rolling