diff --git a/controllers/argocd/notifications.go b/controllers/argocd/notifications.go index 174315e06..8046140d6 100644 --- a/controllers/argocd/notifications.go +++ b/controllers/argocd/notifications.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "reflect" + "strings" "time" monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" @@ -628,6 +629,16 @@ func getNotificationsCommand(cr *argoproj.ArgoCD) []string { log.Info("Repo Server is disabled. This would affect the functioning of Notification Controller.") } + // This flag allows the notification controller to watch + if cr.Spec.SourceNamespaces != nil && len(cr.Spec.SourceNamespaces) > 0 { + cmd = append(cmd, "--self-service-notification-enabled") + } + + // This flag allows the notification controller to watch all namespaces + if cr.Spec.SourceNamespaces != nil && len(cr.Spec.SourceNamespaces) > 0 { + cmd = append(cmd, "--application-namespaces", fmt.Sprint(strings.Join(cr.Spec.SourceNamespaces, ","))) + } + return cmd }