@@ -93,7 +93,6 @@ with kubectl.`,
9393 if err != nil {
9494 log .Fatal (err )
9595 }
96-
9796 helmRepoNamespace := GetHelmRepoNamespace (helmRelease )
9897
9998 // Get the helmrepo based on type, report if error
@@ -105,7 +104,7 @@ with kubectl.`,
105104
106105 // Get the helmchart based on type, report if error
107106 helmChart := & sourcev1.HelmChart {}
108- err = k .Get (ctx , types.NamespacedName {Namespace : helmRelease . Namespace , Name : helmRelease . Namespace + "-" + helmRelease .Name }, helmChart )
107+ err = k .Get (ctx , types.NamespacedName {Namespace : helmRepoNamespace , Name : helmRepoNamespace + "-" + helmRelease .Name }, helmChart )
109108 if err != nil {
110109 log .Fatal (err )
111110 }
@@ -116,10 +115,14 @@ with kubectl.`,
116115 log .Fatal (err )
117116 }
118117
118+ helmAppNamePrefix := helmRelease .Spec .TargetNamespace
119+ if helmAppNamePrefix == "" {
120+ helmAppNamePrefix = helmReleaseNamespace
121+ }
119122 // Generate the Argo CD Helm Application
120123 helmApp := argo.ArgoCdHelmApplication {
121124 //Name: helmRelease.Name,
122- Name : helmRelease . Spec . TargetNamespace + "-" + helmRelease .Name ,
125+ Name : helmAppNamePrefix + "-" + helmRelease .Name ,
123126 Namespace : argoCDNamespace ,
124127 DestinationNamespace : helmRelease .Spec .TargetNamespace ,
125128 DestinationServer : "https://kubernetes.default.svc" ,
0 commit comments