Skip to content

Instantly share code, notes, and snippets.

@sumanthkumarc
Last active May 12, 2023 10:54
Show Gist options
  • Save sumanthkumarc/88783a7cd8b96ac22dcbf02792d89a55 to your computer and use it in GitHub Desktop.
Save sumanthkumarc/88783a7cd8b96ac22dcbf02792d89a55 to your computer and use it in GitHub Desktop.
ArgoCD - custom action on deployment
apiVersion: v1
kind: ConfigMap
metadata:
labels:
app.kubernetes.io/component: server
app.kubernetes.io/name: argocd-cm
app.kubernetes.io/part-of: argocd
name: argocd-cm
namespace: argocd
data:
resource.customizations.actions.apps_Deployment: |
discovery.lua: |
actions = {}
actions["restart-100%-in-1-batch"] = {}
return actions
definitions:
- name: restart-100%-in-1-batch
action.lua: |
local os = require("os")
if obj.spec.template.metadata == nil then
obj.spec.template.metadata = {}
end
if obj.spec.template.metadata.annotations == nil then
obj.spec.template.metadata.annotations = {}
end
if obj.spec.strategy.rollingUpdate == nil then
obj.spec.strategy.rollingUpdate = {}
end
obj.spec.strategy.rollingUpdate.maxSurge = "100%"
obj.spec.template.metadata.annotations["kubectl.kubernetes.io/restartedAt"] = os.date("!%Y-%m-%dT%XZ")
return obj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment