fluxcd / notification-controller

The GitOps Toolkit event forwarder and notification dispatcher
https://fluxcd.io
Apache License 2.0
150 stars 133 forks source link

Specifying notification Provider's namespace in an alert #125

Open ambis opened 3 years ago

ambis commented 3 years ago

Running 0.6.1

Regarding this section: https://github.com/fluxcd/notification-controller/blob/main/config/crd/bases/notification.toolkit.fluxcd.io_alerts.yaml#L92

It only allows you to specify the name of the alert Provider, in my case discord. But it does not allow to reference it form another namespace (monitoring in this case).

The intent I believe, in a single tenant cluster, is to have only one Provider, which sits nicely in the flux-system namespace.

But it is impossible now to create an alert in a namespace where there are eg. HelmReleases you want to watch (like monitoring).

This is what I must do right now:

apiVersion: notification.toolkit.fluxcd.io/v1beta1
kind: Alert
metadata:
  name: discord-alert-monitoring
  namespace: flux-system
spec:
  providerRef:
    name: discord
  eventSeverity: info
  eventSources:
    - kind: HelmRelease
      name: '*'
      namespace: monitoring

This is what I would like to do:

apiVersion: notification.toolkit.fluxcd.io/v1beta1
kind: Alert
metadata:
  name: discord-alert-monitoring
  namespace: monitoring  # <<--- not flux-system
spec:
  providerRef:
    name: discord
    namespace: flux-system   #  <<---- THIS IS NOT SUPPORTED
  eventSeverity: info
  eventSources:
    - kind: HelmRelease
      name: '*'

For me, the best solution would be:

Have issue https://github.com/fluxcd/notification-controller/issues/71 implemented, since I could subscribe to all (single tenant) cluster events at once, without having to worry about setting up separate alerts per namespace.

phillebaba commented 3 years ago

Is this something that we should consider implementing? It will break existing multi tenant setups if we switch over to allowing cross namespace references.

hrvatskibogmars commented 3 years ago

👍

benfairless commented 3 years ago

I personally would like the suggested behaviour. It would allow tenants to set up their own alerts using an existing integration.

sambonbonne commented 1 year ago

Something like this would be useful for one of my clients: we have one provider for a lot of alerts and we want alerts to be created in same namespaces as Helm releases (and not as the provider) so each namespace would be more "self-contained".

rsafonseca commented 8 months ago

I've opened a PR that solves this issue and a couple others :)