From 5e676b81f74c4661becd54455d7faf17bdb27928 Mon Sep 17 00:00:00 2001 From: Siddhesh Ghadi Date: Thu, 28 Dec 2023 11:08:58 +0530 Subject: [PATCH] Use correct repo-server address for notification controller Signed-off-by: Siddhesh Ghadi --- controllers/argocd/notifications.go | 6 ++++++ controllers/argocd/notifications_test.go | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/controllers/argocd/notifications.go b/controllers/argocd/notifications.go index 5e0699568..b7baa3ad0 100644 --- a/controllers/argocd/notifications.go +++ b/controllers/argocd/notifications.go @@ -531,6 +531,12 @@ func getNotificationsCommand(cr *argoproj.ArgoCD) []string { cmd = append(cmd, "--loglevel") cmd = append(cmd, getLogLevel(cr.Spec.Notifications.LogLevel)) + if cr.Spec.Repo.IsEnabled() { + cmd = append(cmd, "--argocd-repo-server", getRepoServerAddress(cr)) + } else { + log.Info("Repo Server is disabled. This would affect the functioning of Notification Controller.") + } + return cmd } diff --git a/controllers/argocd/notifications_test.go b/controllers/argocd/notifications_test.go index 11bbd5f18..6418f6fc0 100644 --- a/controllers/argocd/notifications_test.go +++ b/controllers/argocd/notifications_test.go @@ -166,7 +166,7 @@ func TestReconcileNotifications_CreateDeployments(t *testing.T) { assert.Equal(t, deployment.Spec.Template.Spec.ServiceAccountName, sa.ObjectMeta.Name) want := []corev1.Container{{ - Command: []string{"argocd-notifications", "--loglevel", "info"}, + Command: []string{"argocd-notifications", "--loglevel", "info", "--argocd-repo-server", "argocd-repo-server.argocd.svc.cluster.local:8081"}, Image: argoutil.CombineImageTag(common.ArgoCDDefaultArgoImage, common.ArgoCDDefaultArgoVersion), ImagePullPolicy: corev1.PullAlways, Name: "argocd-notifications-controller", @@ -413,6 +413,8 @@ func TestReconcileNotifications_testLogLevel(t *testing.T) { "argocd-notifications", "--loglevel", "debug", + "--argocd-repo-server", + "argocd-repo-server.argocd.svc.cluster.local:8081", } if diff := cmp.Diff(expectedCMD, deployment.Spec.Template.Spec.Containers[0].Command); diff != "" {