Skip to content

Commit

Permalink
Use correct repo-server address for notification controller (#1125)
Browse files Browse the repository at this point in the history
Signed-off-by: Siddhesh Ghadi <[email protected]>
  • Loading branch information
svghadi authored Jan 17, 2024
1 parent 816c053 commit 3c80cd2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions controllers/argocd/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
4 changes: 3 additions & 1 deletion controllers/argocd/notifications_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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 != "" {
Expand Down

0 comments on commit 3c80cd2

Please sign in to comment.