Skip to content

Commit

Permalink
Enable reconciling HelmReleases with ChartRef
Browse files Browse the repository at this point in the history
If implemented HR with ChartRef can be reconciled with
`--with-source`set.

Signed-off-by: Soule BA <bah.soule@gmail.com>
  • Loading branch information
souleb committed May 9, 2024
1 parent 6981683 commit ea30859
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions cmd/flux/reconcile_helmrelease.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,25 @@ func (obj helmReleaseAdapter) getSource() (reconcileSource, types.NamespacedName
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 == "" {
ns = obj.Namespace
}

return cmd, types.NamespacedName{
Name: fmt.Sprintf("%s-%s", obj.Namespace, obj.Name),
Name: name,
Namespace: ns,
}
}
Expand Down

0 comments on commit ea30859

Please sign in to comment.