Merge pull request #35 from fluxcd/fix-chartupdate

This commit is contained in:
Hidde Beydals 2020-07-21 18:13:21 +02:00 committed by GitHub
commit 3e3951593d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 5 deletions

View File

@ -9,7 +9,7 @@ spec:
version: '^4.0.0'
sourceRef:
kind: HelmRepository
name: podinfo
name: webapp
interval: 1m
test:
enable: true

View File

@ -9,7 +9,7 @@ spec:
version: '^4.0.0'
sourceRef:
kind: HelmRepository
name: podinfo
name: webapp
interval: 1m
dependsOn:
- backend

View File

@ -1,7 +1,7 @@
apiVersion: source.fluxcd.io/v1alpha1
kind: HelmRepository
metadata:
name: podinfo
name: webapp
spec:
interval: 1m
url: https://stefanprodan.github.io/podinfo

View File

@ -252,8 +252,9 @@ func (r *HelmReleaseReconciler) reconcileChart(ctx context.Context, hr *v2.HelmR
hr.Status.HelmChart = chartName.String()
return nil, false, nil
case helmChartRequiresUpdate(*hr, helmChart):
r.Log.Info("chart diverged from template", strings.ToLower(sourcev1.HelmChartKind), chartName.String())
helmChart.Spec = hc.Spec
if err = r.Client.Update(ctx, hc); err != nil {
if err = r.Client.Update(ctx, &helmChart); err != nil {
return nil, false, err
}
hr.Status.HelmChart = chartName.String()
@ -483,7 +484,7 @@ func helmChartRequiresUpdate(hr v2.HelmRelease, chart sourcev1.HelmChart) bool {
return true
case template.Version != chart.Spec.Version:
return true
case template.SourceRef.Name != chart.Spec.Name:
case template.SourceRef.Name != chart.Spec.HelmRepositoryRef.Name:
return true
case template.GetInterval(hr.Spec.Interval) != chart.Spec.Interval:
return true