From b49b6ed4b06984305a1923cbd81fd51457f53bc2 Mon Sep 17 00:00:00 2001 From: Arthur Date: Mon, 16 Sep 2024 12:54:59 +0000 Subject: [PATCH] fix(Apps in Any Namespace): Notification Controller Command Signed-off-by: Arthur --- controllers/argocd/notifications.go | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/controllers/argocd/notifications.go b/controllers/argocd/notifications.go index 174315e06..0c2609162 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" @@ -393,9 +394,6 @@ func (r *ReconcileArgoCD) reconcileNotificationsDeployment(cr *argoproj.ArgoCD, "ALL", }, }, - SeccompProfile: &corev1.SeccompProfile{ - Type: "RuntimeDefault", - }, }, VolumeMounts: []corev1.VolumeMount{ { @@ -478,11 +476,6 @@ func (r *ReconcileArgoCD) reconcileNotificationsDeployment(cr *argoproj.ArgoCD, deploymentChanged = true } - if !reflect.DeepEqual(existingDeployment.Spec.Template.Spec.Containers[0].SecurityContext, desiredDeployment.Spec.Template.Spec.Containers[0].SecurityContext) { - existingDeployment.Spec.Template.Spec.Containers[0].SecurityContext = desiredDeployment.Spec.Template.Spec.Containers[0].SecurityContext - deploymentChanged = true - } - if !reflect.DeepEqual(existingDeployment.Spec.Template.Spec.ServiceAccountName, desiredDeployment.Spec.Template.Spec.ServiceAccountName) { existingDeployment.Spec.Template.Spec.ServiceAccountName = desiredDeployment.Spec.Template.Spec.ServiceAccountName deploymentChanged = true @@ -619,6 +612,16 @@ func getNotificationsCommand(cr *argoproj.ArgoCD) []string { cmd := make([]string, 0) cmd = append(cmd, "argocd-notifications") + // 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, ","))) + } + + // 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") + } + cmd = append(cmd, "--loglevel") cmd = append(cmd, getLogLevel(cr.Spec.Notifications.LogLevel))