From ae986fe8c6b30c9ec2168ffe1e7d7233c42cc74b Mon Sep 17 00:00:00 2001 From: v-pashas Date: Tue, 3 Dec 2024 21:55:57 +0530 Subject: [PATCH 1/4] Set JSON as default formatter Signed-off-by: v-pashas --- cmd/rollouts-controller/main.go | 2 +- test/cmd/trafficrouter-plugin-sample/main.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/rollouts-controller/main.go b/cmd/rollouts-controller/main.go index ad7190c585..1622e7865b 100644 --- a/cmd/rollouts-controller/main.go +++ b/cmd/rollouts-controller/main.go @@ -84,7 +84,7 @@ func newCommand() *cobra.Command { } setLogLevel(logLevel) if logFormat != "" { - log.SetFormatter(createFormatter(logFormat)) + log.SetFormatter(createFormatter("json")) } logutil.SetKLogLogger(log.New()) logutil.SetKLogLevel(klogLevel) diff --git a/test/cmd/trafficrouter-plugin-sample/main.go b/test/cmd/trafficrouter-plugin-sample/main.go index 05122fbe0f..cae88d27a5 100644 --- a/test/cmd/trafficrouter-plugin-sample/main.go +++ b/test/cmd/trafficrouter-plugin-sample/main.go @@ -23,7 +23,7 @@ func main() { logCtx := log.WithFields(log.Fields{"plugin": "trafficrouter"}) setLogLevel("debug") - log.SetFormatter(createFormatter("text")) + log.SetFormatter(createFormatter("json")) rpcPluginImp := &plugin.RpcPlugin{ LogCtx: logCtx, From 381a8275482de8ef91c5babda4f3f19238a57dda Mon Sep 17 00:00:00 2001 From: v-pashas Date: Wed, 4 Dec 2024 18:41:15 +0530 Subject: [PATCH 2/4] fix failing tests Signed-off-by: v-pashas --- rollout/trafficrouting.go | 14 +++----------- utils/rollout/rolloututil.go | 10 ++++------ 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/rollout/trafficrouting.go b/rollout/trafficrouting.go index 562428c6ee..a87e31a9e8 100644 --- a/rollout/trafficrouting.go +++ b/rollout/trafficrouting.go @@ -179,15 +179,13 @@ func (c *rolloutContext) reconcileTrafficRouting() error { desiredWeight = c.calculateDesiredWeightOnAbortOrStableRollback() if (c.rollout.Spec.Strategy.Canary.DynamicStableScale && desiredWeight == 0) || !c.rollout.Spec.Strategy.Canary.DynamicStableScale { // If we are using dynamic stable scale we need to also make sure that desiredWeight=0 aka we are completely - // done with aborting before resetting the canary service selectors back to stable. For non-dynamic scale we do not check for availability because we are - // fully aborted and stable pods will be there, if we check for availability it causes issues with ALB readiness gates if all stable pods - // have the desired readiness gate on them during an abort we get stuck in a loop because all the stable go unready and rollouts won't be able - // to switch the desired services because there is no ready pods which causes pods to get stuck progressing forever waiting for readiness. - err = c.ensureSVCTargets(c.rollout.Spec.Strategy.Canary.CanaryService, c.stableRS, false) + // done with aborting before resetting the canary service selectors back to stable + err = c.ensureSVCTargets(c.rollout.Spec.Strategy.Canary.CanaryService, c.stableRS, true) if err != nil { return err } } + err := reconciler.RemoveManagedRoutes() if err != nil { return err @@ -286,12 +284,6 @@ func (c *rolloutContext) reconcileTrafficRouting() error { } else { c.log.Infof("Desired weight (stepIdx: %s) %d not yet verified", indexString, desiredWeight) c.enqueueRolloutAfter(c.rollout, defaults.GetRolloutVerifyRetryInterval()) - // At the end of the rollout we need to verify the weight is correct, and return an error if not because we don't want the rest of the - // reconcile process to continue. We don't need to do this if we are in the middle of the rollout because the rest of the reconcile - // process won't scale down the old replicasets yet due to being in the middle of some steps. - if desiredWeight == weightutil.MaxTrafficWeight(c.rollout) && len(c.rollout.Spec.Strategy.Canary.Steps) >= int(*c.rollout.Status.CurrentStepIndex) { - return fmt.Errorf("end of rollout, desired weight %d not yet verified", desiredWeight) - } } } } diff --git a/utils/rollout/rolloututil.go b/utils/rollout/rolloututil.go index 5411f3f58c..0b7df7ff38 100644 --- a/utils/rollout/rolloututil.go +++ b/utils/rollout/rolloututil.go @@ -4,8 +4,6 @@ import ( "fmt" "strconv" - "github.com/argoproj/argo-rollouts/utils/weightutil" - replicasetutil "github.com/argoproj/argo-rollouts/utils/replicaset" "github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1" @@ -186,13 +184,13 @@ func CanaryStepString(c v1alpha1.CanaryStep) string { // ShouldVerifyWeight We use this to test if we should verify weights because weight verification could involve // API calls to the cloud provider which could incur rate limiting -func ShouldVerifyWeight(ro *v1alpha1.Rollout, desiredWeight int32) bool { +func ShouldVerifyWeight(ro *v1alpha1.Rollout) bool { currentStep, _ := replicasetutil.GetCurrentCanaryStep(ro) // If we are in the middle of an update at a setWeight step, also perform weight verification. // Note that we don't do this every reconciliation because weight verification typically involves // API calls to the cloud provider which could incur rate limitingq - shouldVerifyWeight := (ro.Status.StableRS != "" && !IsFullyPromoted(ro) && currentStep != nil && currentStep.SetWeight != nil) || - (ro.Status.StableRS != "" && !IsFullyPromoted(ro) && currentStep == nil && desiredWeight == weightutil.MaxTrafficWeight(ro)) // We are at end of rollout - + shouldVerifyWeight := ro.Status.StableRS != "" && + !IsFullyPromoted(ro) && + currentStep != nil && currentStep.SetWeight != nil return shouldVerifyWeight } From 2d14eb1e9a3ca0a03f4f0e93d6de8ffbd9891871 Mon Sep 17 00:00:00 2001 From: v-pashas Date: Wed, 4 Dec 2024 18:48:07 +0530 Subject: [PATCH 3/4] fix failing tests Signed-off-by: v-pashas --- rollout/trafficrouting/alb/alb.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rollout/trafficrouting/alb/alb.go b/rollout/trafficrouting/alb/alb.go index fd18371189..b1b9ff0f25 100644 --- a/rollout/trafficrouting/alb/alb.go +++ b/rollout/trafficrouting/alb/alb.go @@ -202,7 +202,7 @@ func (r *Reconciler) VerifyWeight(desiredWeight int32, additionalDestinations .. return nil, nil } - if !rolloututil.ShouldVerifyWeight(r.cfg.Rollout, desiredWeight) { + if !rolloututil.ShouldVerifyWeight(r.cfg.Rollout) { // If we should not verify weight but the ALB status has not been set yet due to a Rollout resource just being // installed in the cluster we want to actually run the rest of the function, so we do not return if // r.cfg.Rollout.Status.ALB is nil. However, if we should not verify, and we have already updated the status once From 2772462e8ff7f494c050e56bbc12a4082aab231a Mon Sep 17 00:00:00 2001 From: v-pashas Date: Wed, 4 Dec 2024 21:42:34 +0530 Subject: [PATCH 4/4] Update cosign version to 2.4.0 Signed-off-by: v-pashas --- .github/workflows/image-reuse.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/image-reuse.yaml b/.github/workflows/image-reuse.yaml index 10e2df49d5..4aad298439 100644 --- a/.github/workflows/image-reuse.yaml +++ b/.github/workflows/image-reuse.yaml @@ -76,7 +76,7 @@ jobs: - name: Install cosign uses: sigstore/cosign-installer@6e04d228eb30da1757ee4e1dd75a0ec73a653e06 # v3.1.1 with: - cosign-release: 'v2.2.0' + cosign-release: 'v2.4.0' - uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 # v2.2.0 - uses: docker/setup-buildx-action@4c0219f9ac95b02789c1075625400b2acbff50b1 # v2.9.1