From 4bd4aa6f3a446c03cefeecfd3e94d4072099b98b Mon Sep 17 00:00:00 2001 From: Aman-Cool Date: Sat, 7 Mar 2026 16:59:11 +0530 Subject: [PATCH] fix: use HelmRelease namespace for HelmChart lookup in reconcile --with-source Signed-off-by: Aman-Cool --- cmd/flux/reconcile_helmrelease.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/cmd/flux/reconcile_helmrelease.go b/cmd/flux/reconcile_helmrelease.go index b00c5409..512d48a8 100644 --- a/cmd/flux/reconcile_helmrelease.go +++ b/cmd/flux/reconcile_helmrelease.go @@ -98,11 +98,9 @@ func (obj helmReleaseAdapter) getSource() (reconcileSource, sourceReference) { return nil, srcRef } default: - // default case assumes the HelmRelease is using a HelmChartTemplate - ns = obj.Spec.Chart.Spec.SourceRef.Namespace - if ns == "" { - ns = obj.Namespace - } + // default case assumes the HelmRelease is using a HelmChartTemplate. + // The HelmChart is always created in the same namespace as the HelmRelease, + // regardless of where the HelmRepository source lives. name = fmt.Sprintf("%s-%s", obj.Namespace, obj.Name) return reconcileWithSourceCommand{ apiType: helmChartType, @@ -111,7 +109,7 @@ func (obj helmReleaseAdapter) getSource() (reconcileSource, sourceReference) { }, sourceReference{ kind: sourcev1.HelmChartKind, name: name, - namespace: ns, + namespace: obj.Namespace, } } }