Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

notification - trigger is not configured using the configuration in namespace #17773

Open
andronux opened this issue Apr 8, 2024 · 7 comments
Labels
component:notifications Related to notifications subsystem question Issue is a question or reach for support

Comments

@andronux
Copy link

andronux commented Apr 8, 2024

Hello everyone,

version: argocd:v2.10.6

I keep getting the following error:

argocd-notifications-controller-65664f4d96-zvxgm notifications-controller time="2024-04-08T08:56:18Z" level=debug msg="Failed to execute condition of trigger on-health-degraded: trigger 'on-health-degraded' is not configured using the configuration in namespace argocd" resource=argocd/kube-prometheus-stack

Although I have my service/triggers/templates configured in the configmap argocd-notifications-cm.

Am I missing something here?
Thanks

@andronux andronux added the bug Something isn't working label Apr 8, 2024
@jannfis jannfis added question Issue is a question or reach for support component:notifications Related to notifications subsystem and removed bug Something isn't working labels Apr 8, 2024
@andronux
Copy link
Author

Any help from anyone please?

@andronux
Copy link
Author

@jannfis any chance you could help me with this?

@ericjmooney
Copy link

ericjmooney commented May 9, 2024

@andronux -- not sure if you have made any progress but i ran into this same issue today. after a lot of screwing around and trial and error, i have come to believe that it is now necessary to have a trigger defined for this thing to work.

this example file was very helpful for me to try to figure out how this should work https://github.com/argoproj-labs/argocd-notifications/blob/master/docs/argocd-notifications-cm.yaml

Ultimately I ended up w/ a configmap like this (just the data section for relevance):

apiVersion: v1
data:
  context: |
    argocdUrl: https://my-argocd.ericexample.com

  service.email.smtp: |
    host: mail.ericexample.com
    port: 587
    from: argocd@ericexample.com

  template.eric-app-sync-running: |
    message: |
      The sync operation of application {{.app.metadata.name}} has started at {{.app.status.operationState.startedAt}}.
      Sync operation details are available at: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true
    email:
      subject: Start syncing application {{.app.metadata.name}}.

  trigger.app-sync-running: |
    - when: true
      send: [eric-app-sync-running]

and the annotation on my application like:
notifications.argoproj.io/subscribe.app-sync-running.smtp=eric@ericexample.com

Hope this helps!

@ddeath
Copy link

ddeath commented Aug 22, 2024

@ericjmooney did you get same error message? trigger is not configured using the configuration in namespace

Also in which namespace is your app running?

To me this looks like having trigger and template definitions in argocd namespace is not enough.

I see same error on 2.12.0

@ddeath
Copy link

ddeath commented Aug 22, 2024

@andronux so I tested it out and if I create new configmap with triggers and templates in namespace where application is running, then the error message is gone.... In the debug logs I can see that it is trying to send slack message now, however failing because invalid auth... I think it will need also secrets in that namespace....

Just for reference this is the configmap I created manually:

apiVersion: v1
kind: ConfigMap
metadata:
  name: argocd-notifications-cm
  namespace: app-services
  labels:
    helm.sh/chart: argo-cd-7.4.1
    app.kubernetes.io/name: argocd-notifications-controller
    app.kubernetes.io/instance: argo
    app.kubernetes.io/component: notifications-controller
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/part-of: argocd
    app.kubernetes.io/version: "v2.12.0"
data:
  context: |
    argocdUrl: https://localhost:8080
  service.slack: |
    token: $slack-token
  template.microservice-sync-failed: |
    message: |
      {{if eq .serviceType "slack"}}:exclamation:{{end}}  The sync operation of ** {{.app.metadata.name}} ** has failed at {{.app.status.operationState.finishedAt}} with the following error: {{.app.status.operationState.message}}
      Sync operation details are available at: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true .
  
      {{((call .repo.GetAppDetails).Helm.GetParameterValueByName "boundedContext") }}
    slack:
      attachments: |-
        [{
          "title": "{{ .app.metadata.name}}",
          "title_link":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}",
          "color": "#E96D76",
          "fields": [
          {
            "title": "Sync Status",
            "value": "{{.app.status.sync.status}}",
            "short": true
          },
          {
            "title": "Repository",
            "value": "{{.app.spec.source.repoURL}}",
            "short": true
          }
          {{range $index, $c := .app.status.conditions}}
          {{if not $index}},{{end}}
          {{if $index}},{{end}}
          {
            "title": "{{$c.type}}",
            "value": "{{$c.message}}",
            "short": true
          }
          {{end}}
          ]
        }]
  trigger.microservice-sync-failed: |
    - description: Service syncing has failed
      send: [microservice-sync-failed]
      when: app.status.operationState != nil and app.status.operationState.phase in ['Error', 'Failed']

@ddeath
Copy link

ddeath commented Aug 23, 2024

Just small realization, it is not actually error message I guess. What is happening is that it will try to look for configuration with namespace where app is running and if it does not find, it will print that message. After that it will look into argocd namespace for those triggers and templates

@roshnij7
Copy link

Application is running in different namespace in different cluster, how to configure it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:notifications Related to notifications subsystem question Issue is a question or reach for support
Projects
None yet
Development

No branches or pull requests

5 participants