Merge pull request #252 from arbourd/values-files
Add `ValuesFiles` to HelmChart spec
This commit is contained in:
commit
449a469ec4
|
@ -246,9 +246,19 @@ type HelmChartTemplateSpec struct {
|
|||
// +optional
|
||||
Interval *metav1.Duration `json:"interval,omitempty"`
|
||||
|
||||
// Alternative values file to use as the default chart values, expected to be a
|
||||
// relative path in the SourceRef. Ignored when omitted.
|
||||
// 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
|
||||
// the first. Ignored when omitted.
|
||||
// +optional
|
||||
ValuesFiles []string `json:"valuesFiles,omitempty"`
|
||||
|
||||
// Alternative values file to use as the default chart values, expected to
|
||||
// be a relative path in the SourceRef. Deprecated in favor of ValuesFiles,
|
||||
// for backwards compatibility the file defined here is merged before the
|
||||
// ValuesFiles items. Ignored when omitted.
|
||||
// +optional
|
||||
// +deprecated
|
||||
ValuesFile string `json:"valuesFile,omitempty"`
|
||||
}
|
||||
|
||||
|
|
|
@ -68,6 +68,11 @@ func (in *HelmChartTemplateSpec) DeepCopyInto(out *HelmChartTemplateSpec) {
|
|||
*out = new(metav1.Duration)
|
||||
**out = **in
|
||||
}
|
||||
if in.ValuesFiles != nil {
|
||||
in, out := &in.ValuesFiles, &out.ValuesFiles
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmChartTemplateSpec.
|
||||
|
|
|
@ -94,8 +94,19 @@ spec:
|
|||
valuesFile:
|
||||
description: Alternative values file to use as the default
|
||||
chart values, expected to be a relative path in the SourceRef.
|
||||
Deprecated in favor of ValuesFiles, for backwards compatibility
|
||||
the file defined here is merged before the ValuesFiles items.
|
||||
Ignored when omitted.
|
||||
type: string
|
||||
valuesFiles:
|
||||
description: 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
|
||||
the first. Ignored when omitted.
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
version:
|
||||
default: '*'
|
||||
description: Version semver expression, ignored for charts
|
||||
|
|
|
@ -24,6 +24,7 @@ import (
|
|||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
"github.com/go-logr/logr"
|
||||
|
@ -173,8 +174,9 @@ func buildHelmChartFromTemplate(hr *v2.HelmRelease) *sourcev1.HelmChart {
|
|||
Name: template.Spec.SourceRef.Name,
|
||||
Kind: template.Spec.SourceRef.Kind,
|
||||
},
|
||||
Interval: template.GetInterval(hr.Spec.Interval),
|
||||
ValuesFile: template.Spec.ValuesFile,
|
||||
Interval: template.GetInterval(hr.Spec.Interval),
|
||||
ValuesFiles: template.Spec.ValuesFiles,
|
||||
ValuesFile: template.Spec.ValuesFile,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -197,6 +199,8 @@ func helmChartRequiresUpdate(hr *v2.HelmRelease, chart *sourcev1.HelmChart) bool
|
|||
return true
|
||||
case template.GetInterval(hr.Spec.Interval) != chart.Spec.Interval:
|
||||
return true
|
||||
case !reflect.DeepEqual(template.Spec.ValuesFiles, chart.Spec.ValuesFiles):
|
||||
return true
|
||||
case template.Spec.ValuesFile != chart.Spec.ValuesFile:
|
||||
return true
|
||||
default:
|
||||
|
|
|
@ -420,6 +420,13 @@ func Test_helmChartRequiresUpdate(t *testing.T) {
|
|||
},
|
||||
want: true,
|
||||
},
|
||||
{
|
||||
name: "detects values files change",
|
||||
modify: func(hr *v2.HelmRelease, hc *sourcev1.HelmChart) {
|
||||
hr.Spec.Chart.Spec.ValuesFiles = []string{"values-prod.yaml"}
|
||||
},
|
||||
want: true,
|
||||
},
|
||||
{
|
||||
name: "detects values file change",
|
||||
modify: func(hr *v2.HelmRelease, hc *sourcev1.HelmChart) {
|
||||
|
|
|
@ -509,6 +509,21 @@ Kubernetes meta/v1.Duration
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>valuesFiles</code><br>
|
||||
<em>
|
||||
[]string
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<em>(Optional)</em>
|
||||
<p>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
|
||||
the first. Ignored when omitted.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>valuesFile</code><br>
|
||||
<em>
|
||||
string
|
||||
|
@ -516,8 +531,10 @@ string
|
|||
</td>
|
||||
<td>
|
||||
<em>(Optional)</em>
|
||||
<p>Alternative values file to use as the default chart values, expected to be a
|
||||
relative path in the SourceRef. Ignored when omitted.</p>
|
||||
<p>Alternative values file to use as the default chart values, expected to
|
||||
be a relative path in the SourceRef. Deprecated in favor of ValuesFiles,
|
||||
for backwards compatibility the file defined here is merged before the
|
||||
ValuesFiles items. Ignored when omitted.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -599,6 +616,21 @@ Kubernetes meta/v1.Duration
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>valuesFiles</code><br>
|
||||
<em>
|
||||
[]string
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<em>(Optional)</em>
|
||||
<p>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
|
||||
the first. Ignored when omitted.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>valuesFile</code><br>
|
||||
<em>
|
||||
string
|
||||
|
@ -606,8 +638,10 @@ string
|
|||
</td>
|
||||
<td>
|
||||
<em>(Optional)</em>
|
||||
<p>Alternative values file to use as the default chart values, expected to be a
|
||||
relative path in the SourceRef. Ignored when omitted.</p>
|
||||
<p>Alternative values file to use as the default chart values, expected to
|
||||
be a relative path in the SourceRef. Deprecated in favor of ValuesFiles,
|
||||
for backwards compatibility the file defined here is merged before the
|
||||
ValuesFiles items. Ignored when omitted.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
|
4
go.mod
4
go.mod
|
@ -9,7 +9,7 @@ require (
|
|||
github.com/fluxcd/pkg/apis/kustomize v0.0.1
|
||||
github.com/fluxcd/pkg/apis/meta v0.8.0
|
||||
github.com/fluxcd/pkg/runtime v0.10.2
|
||||
github.com/fluxcd/source-controller/api v0.10.0
|
||||
github.com/fluxcd/source-controller/api v0.11.1-0.20210419133153-f56c96fff636
|
||||
github.com/go-logr/logr v0.3.0
|
||||
github.com/hashicorp/go-retryablehttp v0.6.8
|
||||
github.com/onsi/ginkgo v1.14.1
|
||||
|
@ -18,7 +18,7 @@ require (
|
|||
helm.sh/helm/v3 v3.5.3
|
||||
k8s.io/api v0.20.2
|
||||
k8s.io/apiextensions-apiserver v0.20.2
|
||||
k8s.io/apimachinery v0.20.2
|
||||
k8s.io/apimachinery v0.20.4
|
||||
k8s.io/cli-runtime v0.20.2
|
||||
k8s.io/client-go v0.20.2
|
||||
sigs.k8s.io/controller-runtime v0.8.3
|
||||
|
|
7
go.sum
7
go.sum
|
@ -239,8 +239,8 @@ github.com/fluxcd/pkg/apis/meta v0.8.0 h1:wqWpUsxhKHB1ZztcvOz+vnyhdKW9cWmjFp8Vci
|
|||
github.com/fluxcd/pkg/apis/meta v0.8.0/go.mod h1:yHuY8kyGHYz22I0jQzqMMGCcHViuzC/WPdo9Gisk8Po=
|
||||
github.com/fluxcd/pkg/runtime v0.10.2 h1:JAI/pOfU3Rgr4MysWJoWenEP6vq03EspBmoekSZMUfo=
|
||||
github.com/fluxcd/pkg/runtime v0.10.2/go.mod h1:JD0eZIn5xkTeHHQUWXSqJPIh/ecO0d0qrUKbSVHnpnw=
|
||||
github.com/fluxcd/source-controller/api v0.10.0 h1:Mu4cAXtZ7yq/rIrab81q1jbbhWwUxxAZ2R5bZ1m8AxE=
|
||||
github.com/fluxcd/source-controller/api v0.10.0/go.mod h1:Vuw+7UqEUUOdkKBfTUPHwaQgbn6LL2FwqPDx2UAk7NE=
|
||||
github.com/fluxcd/source-controller/api v0.11.1-0.20210419133153-f56c96fff636 h1:MKewkVohNKjqpQW/J4dU9oyKGv8TCN5jcfuS09iPkjY=
|
||||
github.com/fluxcd/source-controller/api v0.11.1-0.20210419133153-f56c96fff636/go.mod h1:/LRxF55Mf+j5mXVfHLbonb/2YYHVSaouLa5zt5aj7D4=
|
||||
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=
|
||||
|
@ -1275,8 +1275,9 @@ k8s.io/apiextensions-apiserver v0.20.2 h1:rfrMWQ87lhd8EzQWRnbQ4gXrniL/yTRBgYH1x1
|
|||
k8s.io/apiextensions-apiserver v0.20.2/go.mod h1:F6TXp389Xntt+LUq3vw6HFOLttPa0V8821ogLGwb6Zs=
|
||||
k8s.io/apimachinery v0.17.0/go.mod h1:b9qmWdKlLuU9EBh+06BtLcSf/Mu89rWL33naRxs1uZg=
|
||||
k8s.io/apimachinery v0.20.1/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU=
|
||||
k8s.io/apimachinery v0.20.2 h1:hFx6Sbt1oG0n6DZ+g4bFt5f6BoMkOjKWsQFu077M3Vg=
|
||||
k8s.io/apimachinery v0.20.2/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU=
|
||||
k8s.io/apimachinery v0.20.4 h1:vhxQ0PPUUU2Ns1b9r4/UFp13UPs8cw2iOoTjnY9faa0=
|
||||
k8s.io/apimachinery v0.20.4/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU=
|
||||
k8s.io/apiserver v0.20.1/go.mod h1:ro5QHeQkgMS7ZGpvf4tSMx6bBOgPfE+f52KwvXfScaU=
|
||||
k8s.io/apiserver v0.20.2 h1:lGno2t3gcZnLtzsKH4oG0xA9/4GTiBzMO1DGp+K+Bak=
|
||||
k8s.io/apiserver v0.20.2/go.mod h1:2nKd93WyMhZx4Hp3RfgH2K5PhwyTrprrkWYnI7id7jA=
|
||||
|
|
Loading…
Reference in New Issue