From 68fbed9ca8d267bdd5778a38131b331e7fdbb3d4 Mon Sep 17 00:00:00 2001 From: Oleksandr Saulyak Date: Tue, 8 Apr 2025 11:19:26 +0300 Subject: [PATCH 1/2] feat: argo-cd cm custom rollout action 'pause' 'skip-current-step' --- charts/gitops-runtime/values.yaml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/charts/gitops-runtime/values.yaml b/charts/gitops-runtime/values.yaml index 73d92c03..e9373c7c 100644 --- a/charts/gitops-runtime/values.yaml +++ b/charts/gitops-runtime/values.yaml @@ -206,6 +206,31 @@ argo-cd: timeout.reconciliation: 20s accounts.admin: apiKey,login application.resourceTrackingMethod: annotation+label + resource.customizations.actions.argoproj.io_Rollout: | + mergeBuiltinActions: true + discovery.lua: | + actions = {} + local fullyPromoted = obj.status.currentPodHash == obj.status.stableRS + actions["pause"] = {["disabled"] = fullyPromoted or obj.spec.paused == true} + actions["skip-current-step"] = {["disabled"] = obj.spec.strategy.canary == nil or obj.spec.strategy.canary.steps == nil or obj.status.currentStepIndex == table.getn(obj.spec.strategy.canary.steps)} + return actions + definitions: + - name: pause + action.lua: | + obj.spec.paused = true + return obj + - name: skip-current-step + action.lua: | + if + if obj.status ~= nil then + if obj.spec.strategy.canary ~= nil and obj.spec.strategy.canary.steps ~= nil and obj.status.currentStepIndex < table.getn(obj.spec.strategy.canary.steps) then + if obj.status.pauseConditions ~= nil and table.getn(obj.status.pauseConditions) > 0 then + obj.status.pauseConditions = nil + end + obj.status.currentStepIndex = obj.status.currentStepIndex + 1 + end + end + return obj params: server.insecure: true application.namespaces: 'cf-*' From 64f5c6c422e0f85d6766ba358a87c66419b2fd5c Mon Sep 17 00:00:00 2001 From: Oleksandr Saulyak Date: Tue, 8 Apr 2025 15:42:38 +0300 Subject: [PATCH 2/2] removed redundant if --- charts/gitops-runtime/values.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/charts/gitops-runtime/values.yaml b/charts/gitops-runtime/values.yaml index e9373c7c..2501de00 100644 --- a/charts/gitops-runtime/values.yaml +++ b/charts/gitops-runtime/values.yaml @@ -221,7 +221,6 @@ argo-cd: return obj - name: skip-current-step action.lua: | - if if obj.status ~= nil then if obj.spec.strategy.canary ~= nil and obj.spec.strategy.canary.steps ~= nil and obj.status.currentStepIndex < table.getn(obj.spec.strategy.canary.steps) then if obj.status.pauseConditions ~= nil and table.getn(obj.status.pauseConditions) > 0 then