From f3cbefe3f17c68fcb180733c7fa3b7da886da72d Mon Sep 17 00:00:00 2001 From: Hidde Beydals Date: Fri, 8 Oct 2021 12:49:45 +0200 Subject: [PATCH 1/2] Update fluxcd/source-controller to v0.16.0 This introduces support for defining a `ReconcileStrategy` for `HelmChart` resources. Signed-off-by: Hidde Beydals --- config/default/kustomization.yaml | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/config/default/kustomization.yaml b/config/default/kustomization.yaml index cf7e43483..f6fe7ccd6 100644 --- a/config/default/kustomization.yaml +++ b/config/default/kustomization.yaml @@ -2,8 +2,8 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization namespace: helm-system resources: -- https://github.com/fluxcd/source-controller/releases/download/v0.15.4/source-controller.crds.yaml -- https://github.com/fluxcd/source-controller/releases/download/v0.15.4/source-controller.deployment.yaml +- https://github.com/fluxcd/source-controller/releases/download/v0.16.0/source-controller.crds.yaml +- https://github.com/fluxcd/source-controller/releases/download/v0.16.0/source-controller.deployment.yaml - ../crd - ../rbac - ../manager diff --git a/go.mod b/go.mod index be5b0b6ca..bdbc36349 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/fluxcd/pkg/apis/kustomize v0.1.0 github.com/fluxcd/pkg/apis/meta v0.10.0 github.com/fluxcd/pkg/runtime v0.12.0 - github.com/fluxcd/source-controller/api v0.15.4 + github.com/fluxcd/source-controller/api v0.16.0 github.com/go-logr/logr v0.4.0 github.com/hashicorp/go-retryablehttp v0.6.8 github.com/mattn/go-colorable v0.1.4 // indirect diff --git a/go.sum b/go.sum index 023961c85..9c68f2b03 100644 --- a/go.sum +++ b/go.sum @@ -222,8 +222,8 @@ github.com/fluxcd/pkg/apis/meta v0.10.0 h1:N7wVGHC1cyPdT87hrDC7UwCwRwnZdQM46PBSL github.com/fluxcd/pkg/apis/meta v0.10.0/go.mod h1:CW9X9ijMTpNe7BwnokiUOrLl/h13miwVr/3abEQLbKE= github.com/fluxcd/pkg/runtime v0.12.0 h1:BPZZ8bBkimpqGAPXqOf3LTaw+tcw6HgbWyCuzbbsJGs= github.com/fluxcd/pkg/runtime v0.12.0/go.mod h1:EyaTR2TOYcjL5U//C4yH3bt2tvTgIOSXpVRbWxUn/C4= -github.com/fluxcd/source-controller/api v0.15.4 h1:9aRcH/WKJWt7Bp954K/wzLRuiRiHuD2osvYp74GoP64= -github.com/fluxcd/source-controller/api v0.15.4/go.mod h1:guUCCapjzE2kocwFreQTM/IGvtAglIJc4L97mokairo= +github.com/fluxcd/source-controller/api v0.16.0 h1:xFz+K7lLg/82uOQp+a0g04GsgoWNfyzwXAoVQy4T/oI= +github.com/fluxcd/source-controller/api v0.16.0/go.mod h1:guUCCapjzE2kocwFreQTM/IGvtAglIJc4L97mokairo= github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= From c079240190f7ca0c581ef60df237836da6823f47 Mon Sep 17 00:00:00 2001 From: Hidde Beydals Date: Fri, 8 Oct 2021 12:53:33 +0200 Subject: [PATCH 2/2] Introduce ReconcileStrategy in HelmChartTemplateSpec To allow configuring it within the `HelmRelease`. Signed-off-by: Hidde Beydals --- api/v2beta1/helmrelease_types.go | 9 ++++++ .../helm.toolkit.fluxcd.io_helmreleases.yaml | 7 +++++ controllers/helmrelease_controller_chart.go | 7 +++-- docs/api/helmrelease.md | 30 +++++++++++++++++++ 4 files changed, 50 insertions(+), 3 deletions(-) diff --git a/api/v2beta1/helmrelease_types.go b/api/v2beta1/helmrelease_types.go index 68fc26ac2..3dca93e34 100644 --- a/api/v2beta1/helmrelease_types.go +++ b/api/v2beta1/helmrelease_types.go @@ -246,6 +246,15 @@ type HelmChartTemplateSpec struct { // +optional Interval *metav1.Duration `json:"interval,omitempty"` + // Determines what enables the creation of a new artifact. Valid values are + // ('ChartVersion', 'Revision'). + // See the documentation of the values for an explanation on their behavior. + // Defaults to ChartVersion when omitted. + // +kubebuilder:validation:Enum=ChartVersion;Revision + // +kubebuilder:default:=ChartVersion + // +optional + ReconcileStrategy string `json:"reconcileStrategy,omitempty"` + // Alternative list of values files to use as the chart values (values.yaml // is not included by default), expected to be a relative path in the SourceRef. // Values files are merged in the order of this list with the last file overriding diff --git a/config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml b/config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml index c25dc2750..067a70d48 100644 --- a/config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml +++ b/config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml @@ -56,6 +56,13 @@ spec: interval: description: Interval at which to check the v1beta1.Source for updates. Defaults to 'HelmReleaseSpec.Interval'. type: string + reconcileStrategy: + default: ChartVersion + description: Determines what enables the creation of a new artifact. Valid values are ('ChartVersion', 'Revision'). See the documentation of the values for an explanation on their behavior. Defaults to ChartVersion when omitted. + enum: + - ChartVersion + - Revision + type: string sourceRef: description: The name and namespace of the v1beta1.Source the chart is available at. properties: diff --git a/controllers/helmrelease_controller_chart.go b/controllers/helmrelease_controller_chart.go index acdf81ba7..a9b93343e 100644 --- a/controllers/helmrelease_controller_chart.go +++ b/controllers/helmrelease_controller_chart.go @@ -174,9 +174,10 @@ func buildHelmChartFromTemplate(hr *v2.HelmRelease) *sourcev1.HelmChart { Name: template.Spec.SourceRef.Name, Kind: template.Spec.SourceRef.Kind, }, - Interval: template.GetInterval(hr.Spec.Interval), - ValuesFiles: template.Spec.ValuesFiles, - ValuesFile: template.Spec.ValuesFile, + Interval: template.GetInterval(hr.Spec.Interval), + ReconcileStrategy: template.Spec.ReconcileStrategy, + ValuesFiles: template.Spec.ValuesFiles, + ValuesFile: template.Spec.ValuesFile, }, } } diff --git a/docs/api/helmrelease.md b/docs/api/helmrelease.md index d3e516549..121942186 100644 --- a/docs/api/helmrelease.md +++ b/docs/api/helmrelease.md @@ -518,6 +518,21 @@ Kubernetes meta/v1.Duration +reconcileStrategy
+ +string + + + +(Optional) +

Determines what enables the creation of a new artifact. Valid values are +(‘ChartVersion’, ‘Revision’). +See the documentation of the values for an explanation on their behavior. +Defaults to ChartVersion when omitted.

+ + + + valuesFiles
[]string @@ -625,6 +640,21 @@ Kubernetes meta/v1.Duration +reconcileStrategy
+ +string + + + +(Optional) +

Determines what enables the creation of a new artifact. Valid values are +(‘ChartVersion’, ‘Revision’). +See the documentation of the values for an explanation on their behavior. +Defaults to ChartVersion when omitted.

+ + + + valuesFiles
[]string