argoproj / argo-cd

Declarative Continuous Deployment for Kubernetes
https://argo-cd.readthedocs.io
Apache License 2.0
17.77k stars 5.42k forks source link

Notifications - Events not triggering message to Slack #10951

Open egkelly opened 2 years ago

egkelly commented 2 years ago

Checklist:

Describe the bug

I've set up Slack notifications according to the documentation (with a few tweaks given the helm chart version I have deployed - 2.16.0 ), but the events I have triggers/templates set up for are not actually triggering messages to slack. I've run through all the troubleshooting and verified that argocd admin notifications template notify app-deployed appName --recipient slack:mychannel sends messages as expected. I have also annotated all of my applications with notifications.argoproj.io/subscribe.on-deployed.slack: mychannel.

To Reproduce

Expected behavior

Message is sent to slack on deployment.

Version

ArgoCD version 5.2.0

Helm Chart Version 2.16.0

4wdonny commented 1 year ago

Out of curiosity, if you remove and app.status.health.status == 'Healthy' from the when block, does it work? I've been having issues with the and app.status.health.status == 'Healthy' portion and wondering if it is the same issue.

arturzielinskicard commented 1 year ago

Please check arguments passed to commandline of argocd-notifications-controller: secret-name config-map-name Is it match your config and secret name? For debug you can start notification service with loglevel debug

shreyasgune commented 1 year ago

G'day @egkelly , I was looking an issue very similar to this and I ended up getting it to work by modifying my template.

I am curious about one thing.

The

data:
  service.slack: |
    token: ${var.slack_token}

reference. I know that the secret is defined in

apiVersion: v1
kind: Secret
metadata:
  name: argocd-notifications-secret
stringData:
  slack-token: <base64 encoded auth-token>

but I'm wondering how the configmap knows about the value of $slack-token. How does that "fetching of the value of slack-token" happen behind the scenes?

shreyasgune commented 1 year ago

G'day @egkelly , I was looking an issue very similar to this and I ended up getting it to work by modifying my template.

I am curious about one thing.

The

data:
  service.slack: |
    token: ${var.slack_token}

reference. I know that the secret is defined in

apiVersion: v1
kind: Secret
metadata:
  name: argocd-notifications-secret
stringData:
  slack-token: <base64 encoded auth-token>

but I'm wondering how the configmap knows about the value of $slack-token. How does that "fetching of the value of slack-token" happen behind the scenes?

okay, so there may have been a thing in an older version of the helm-chart that did that secret bit. I think so.