diff --git a/controllers/argocd/argocd_controller.go b/controllers/argocd/argocd_controller.go index 7a24637..06d69ef 100644 --- a/controllers/argocd/argocd_controller.go +++ b/controllers/argocd/argocd_controller.go @@ -3,6 +3,7 @@ package argocd import ( "context" "os" + "sort" "strconv" "strings" @@ -214,6 +215,9 @@ func (r *Reconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) { } slice = add(slice, req.Namespace) + // sort namespaces + sort.Strings(slice) + values["namespaces"] = slice } diff --git a/controllers/argocd/argocd_controller_test.go b/controllers/argocd/argocd_controller_test.go index ca979ec..00cec50 100644 --- a/controllers/argocd/argocd_controller_test.go +++ b/controllers/argocd/argocd_controller_test.go @@ -609,7 +609,7 @@ var _ = Describe("Reconciler", func() { mockHelm. EXPECT(). - Upgrade(argocd.Name, gomock.Any(), Values("namespaces", []string{"myapp3", "myapp4", "default"}), true). + Upgrade(argocd.Name, gomock.Any(), Values("namespaces", []string{"default", "myapp3", "myapp4"}), true). Return(nil) testReconcile(mockHelm, argocd, namespaces...)