Enable Auto sync for Argocd using helm chart for alerting

166 Views Asked by At

I have my app running in argoCD and I can enable and disable the auto sync from UI, however I want to set an alert when the auto sync is disabled. I looked into the meta data of the app and I see when we disable autosync the value is "syncPolicy": {} and when we enable it then "syncPolicy": { "automated": {} }

Now in my helm I have some triggers that are working and are checking the status like health etc, but when I try to set it up, it is not sending any alert.

my code looks

 trigger.on-sync-failed: |
      - description: Application syncing has failed
        send:
        - app-sync-failed
        when: app.status.operationState.phase in ['Error', 'Failed'] and not (app.metadata.name in ['test-labs1', 'test-lab2'])


trigger.on-sync-policy: |
      - description: Check if syncPolicy is not set to "automated"
        send:
        - app-sync-policy
        when: app.spec.syncPolicy == {} and not (app.metadata.name in ['test-labs1', 'test-lab2'])

on-sync-failed is working but on-sync-policy is not, I think there is some other way to do this which I am not aware of and if anyone can help here

0

There are 0 best solutions below