Enable reconciling HelmReleases with ChartRef

If implemented HR with ChartRef can be reconciled with
`--with-source`set.

Signed-off-by: Soule BA <bah.soule@gmail.com>
pull/4766/head
Soule BA 8 months ago
parent 86b3581f5e
commit 0d0285ad09
No known key found for this signature in database
GPG Key ID: 4D40965192802994

@ -74,13 +74,25 @@ func (obj helmReleaseAdapter) getSource() (reconcileSource, types.NamespacedName
force: true, force: true,
} }
ns := obj.Spec.Chart.Spec.SourceRef.Namespace var (
name string
ns string
)
switch {
case obj.Spec.Chart != &helmv2.HelmChart{}:
ns = obj.Spec.Chart.Spec.SourceRef.Namespace
name = fmt.Sprintf("%s-%s", obj.Namespace, obj.Name)
case obj.Spec.ChartRef != nil:
ns = obj.Spec.ChartRef.Namespace
name = obj.Spec.ChartRef.Name
}
if ns == "" { if ns == "" {
ns = obj.Namespace ns = obj.Namespace
} }
return cmd, types.NamespacedName{ return cmd, types.NamespacedName{
Name: fmt.Sprintf("%s-%s", obj.Namespace, obj.Name), Name: name,
Namespace: ns, Namespace: ns,
} }
} }

Loading…
Cancel
Save