github.com/argoproj-labs/argocd-operator@v0.10.0/tests/k8s/1-026_validate_resource_action/01-argocd-with-resource-action.yaml (about)

     1  apiVersion: argoproj.io/v1alpha1
     2  kind: ArgoCD
     3  metadata:
     4    name: example-argocd
     5  spec:
     6    resourceActions:
     7    - group: apps
     8      kind: Deployment
     9      action: |
    10        discovery.lua: |
    11          actions = {}
    12          actions["restart"] = {}
    13          return actions
    14        definitions:
    15          - name: restart
    16            # Lua Script to modify the obj
    17            action.lua: |
    18              local os = require("os")
    19              if obj.spec.template.metadata == nil then
    20                  obj.spec.template.metadata = {}
    21              end
    22              if obj.spec.template.metadata.annotations == nil then
    23                  obj.spec.template.metadata.annotations = {}
    24              end
    25              obj.spec.template.metadata.annotations["kubectl.kubernetes.io/restartedAt"] = os.date("!%Y-%m-%dT%XZ")
    26              return obj