diff options
| author | Cheng Fang <cfang@redhat.com> | 2024-12-17 20:37:35 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-17 20:37:35 -0500 |
| commit | 14e60b8a83a4870257d69012d4cf097a29423565 (patch) | |
| tree | 6bdd8da5fb84c97d81ba915a1998997ba242c069 | |
| parent | 70968a78c15325daaeb149448fc5ee9e96ed6991 (diff) | |
fix: Image updater changes git write back file (#970)
Signed-off-by: Cheng Fang <cfang@redhat.com>
| -rw-r--r-- | pkg/argocd/update.go | 4 |
1 files changed, 3 insertions, 1 deletions
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 { |
