argo-kube-notifier icon indicating copy to clipboard operation
argo-kube-notifier copied to clipboard

Notification in one namespace watches ressources in other namespaces

Open tiej-dr opened this issue 4 years ago • 0 comments

Describe the bug Notification controller checks ressources in all namespaces - and not only the namespace where notification is applied.

To Reproduce

  1. Have two apps in two different namespaces "foo" and "bar".
  2. Apply a notification to namespace "foo"

kubectl apply -f example/foo-notifier.yaml -n foo

apiVersion: argoproj.io/v1alpha1
kind: Notification
metadata:
  name: "foo-notifier"
  namespace: foo
spec:
  Namespace: foo
  monitorResource:
    Resource: pods
    Version: v1
  rules:
  - allConditions:
    - jsonPath: metadata/name
      operator: ne
      value: badName
    events:
        -
          message: |
            Test notification from namespace: {{ .metadata.namespace }}
          notificationLevel: info
          notifierNames:
            - slack
    name: "test-notification"
    initialDelaySec: 1
    throttleMinutes: 10
  notifiers:
  - name: slack
    slack:
      channel: placeholder
      hookUrlSecret:
        key: hookURL
        name: webhook-server-secret

If initialDelaySec > 0 - a warning in kube-notifier-controller-0 is logged and no message is send

kubectl logs -f  kube-notifier-controller-0

time="2020-05-18T07:19:47Z" level=warning msg="Error occured getting resource. pods \"bar-sjshv\" not found"

If initialDelaySec = 0 - the notification is send : "Test notification from namespace: bar"

Expected behavior The controller would only watch ressources in the namespace where notification is applied. In the above example, ressources in namespace foo, but not bar

tiej-dr avatar May 18 '20 07:05 tiej-dr