Skip to content

Commit 57138ca

Browse files
authored
fix: Image updater changes git write back file (#970) (#980)
Signed-off-by: Cheng Fang <[email protected]>
1 parent 2da386b commit 57138ca

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/argocd/update.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,9 @@ func getWriteBackConfig(app *v1alpha1.Application, kubeClient *kube.KubernetesCl
652652
}
653653

654654
func parseDefaultTarget(appNamespace string, appName string, path string, kubeClient *kube.KubernetesClient) string {
655-
if (appNamespace == kubeClient.Namespace) || (appNamespace == "") {
655+
// when running from command line and argocd-namespace is not set, e.g., via --argocd-namespace option,
656+
// kubeClient.Namespace may be resolved to "default". In this case, also use the file name without namespace
657+
if appNamespace == kubeClient.Namespace || kubeClient.Namespace == "default" || appNamespace == "" {
656658
defaultTargetFile := fmt.Sprintf(common.DefaultTargetFilePatternWithoutNamespace, appName)
657659
return filepath.Join(path, defaultTargetFile)
658660
} else {

0 commit comments

Comments
 (0)