From 14e60b8a83a4870257d69012d4cf097a29423565 Mon Sep 17 00:00:00 2001 From: Cheng Fang Date: Tue, 17 Dec 2024 20:37:35 -0500 Subject: fix: Image updater changes git write back file (#970) Signed-off-by: Cheng Fang --- pkg/argocd/update.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/argocd/update.go b/pkg/argocd/update.go index a17ccac..0971fdd 100644 --- a/pkg/argocd/update.go +++ b/pkg/argocd/update.go @@ -676,7 +676,9 @@ func getWriteBackConfig(app *v1alpha1.Application, kubeClient *kube.KubernetesCl } func parseDefaultTarget(appNamespace string, appName string, path string, kubeClient *kube.KubernetesClient) string { - if (appNamespace == kubeClient.Namespace) || (appNamespace == "") { + // when running from command line and argocd-namespace is not set, e.g., via --argocd-namespace option, + // kubeClient.Namespace may be resolved to "default". In this case, also use the file name without namespace + if appNamespace == kubeClient.Namespace || kubeClient.Namespace == "default" || appNamespace == "" { defaultTargetFile := fmt.Sprintf(common.DefaultTargetFilePatternWithoutNamespace, appName) return filepath.Join(path, defaultTargetFile) } else { -- cgit v1.2.3