Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add configurable Helm version (#3872) #4111

Merged
merged 1 commit into from
Aug 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
feat: Add configurable Helm version
This commit adds support for configurable Helm version either via
declarative syntax or via argocd cli.

New helm option 'Version' added to the ApplicationSourceHelm
struct which can be either 'v2' or 'v3'.

Argocd app create accepts '--helm-version' that also looks for the
same Helm versions as above.
  • Loading branch information
loxley authored and Johan Sandström committed Aug 19, 2020
commit 66994146547759e7c40f186489e7cae0ebaaf868
4 changes: 4 additions & 0 deletions assets/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -3727,6 +3727,10 @@
"values": {
"type": "string",
"title": "Values is Helm values, typically defined as a block"
},
"version": {
"type": "string",
"title": "Version is the Helm version to use for templating with"
}
}
},
Expand Down
8 changes: 8 additions & 0 deletions cmd/argocd/commands/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,8 @@ func setAppSpecOptions(flags *pflag.FlagSet, spec *argoappv1.ApplicationSpec, ap
setHelmOpt(&spec.Source, helmOpts{values: string(data)})
case "release-name":
setHelmOpt(&spec.Source, helmOpts{releaseName: appOpts.releaseName})
case "helm-version":
setHelmOpt(&spec.Source, helmOpts{version: appOpts.helmVersion})
case "helm-set":
setHelmOpt(&spec.Source, helmOpts{helmSets: appOpts.helmSets})
case "helm-set-string":
Expand Down Expand Up @@ -648,6 +650,7 @@ type helmOpts struct {
valueFiles []string
values string
releaseName string
version string
helmSets []string
helmSetStrings []string
helmSetFiles []string
Expand All @@ -666,6 +669,9 @@ func setHelmOpt(src *argoappv1.ApplicationSource, opts helmOpts) {
if opts.releaseName != "" {
src.Helm.ReleaseName = opts.releaseName
}
if opts.version != "" {
src.Helm.Version = opts.version
}
for _, text := range opts.helmSets {
p, err := argoappv1.NewHelmParameter(text, false)
if err != nil {
Expand Down Expand Up @@ -733,6 +739,7 @@ type appOptions struct {
helmSets []string
helmSetStrings []string
helmSetFiles []string
helmVersion string
project string
syncPolicy string
syncOptions []string
Expand Down Expand Up @@ -766,6 +773,7 @@ func addAppFlags(command *cobra.Command, opts *appOptions) {
command.Flags().StringArrayVar(&opts.valuesFiles, "values", []string{}, "Helm values file(s) to use")
command.Flags().StringVar(&opts.values, "values-literal-file", "", "Filename or URL to import as a literal Helm values block")
command.Flags().StringVar(&opts.releaseName, "release-name", "", "Helm release-name")
command.Flags().StringVar(&opts.helmVersion, "helm-version", "", "Helm version")
command.Flags().StringArrayVar(&opts.helmSets, "helm-set", []string{}, "Helm set values on the command line (can be repeated to set several values: --helm-set key1=val1 --helm-set key2=val2)")
command.Flags().StringArrayVar(&opts.helmSetStrings, "helm-set-string", []string{}, "Helm set STRING values on the command line (can be repeated to set several values: --helm-set-string key1=val1 --helm-set-string key2=val2)")
command.Flags().StringArrayVar(&opts.helmSetFiles, "helm-set-file", []string{}, "Helm set values from respective files specified via the command line (can be repeated to set several values: --helm-set-file key1=path1 --helm-set-file key2=path2)")
Expand Down
5 changes: 5 additions & 0 deletions cmd/argocd/commands/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ func Test_setHelmOpt(t *testing.T) {
setHelmOpt(&src, helmOpts{helmSetFiles: []string{"foo=bar"}})
assert.Equal(t, []v1alpha1.HelmFileParameter{{Name: "foo", Path: "bar"}}, src.Helm.FileParameters)
})
t.Run("Version", func(t *testing.T) {
src := v1alpha1.ApplicationSource{}
setHelmOpt(&src, helmOpts{version: "v3"})
assert.Equal(t, "v3", src.Helm.Version)
})
}

func Test_setJsonnetOpt(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g=
github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
Expand Down
18 changes: 18 additions & 0 deletions manifests/crds/application-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,9 @@ spec:
values:
description: Values is Helm values, typically defined as a block
type: string
version:
description: Version is the Helm version to use for templating with
type: string
type: object
ksonnet:
description: Ksonnet holds ksonnet specific options
Expand Down Expand Up @@ -464,6 +467,9 @@ spec:
values:
description: Values is Helm values, typically defined as a block
type: string
version:
description: Version is the Helm version to use for templating with
type: string
type: object
ksonnet:
description: Ksonnet holds ksonnet specific options
Expand Down Expand Up @@ -735,6 +741,9 @@ spec:
values:
description: Values is Helm values, typically defined as a block
type: string
version:
description: Version is the Helm version to use for templating with
type: string
type: object
ksonnet:
description: Ksonnet holds ksonnet specific options
Expand Down Expand Up @@ -1012,6 +1021,9 @@ spec:
values:
description: Values is Helm values, typically defined as a block
type: string
version:
description: Version is the Helm version to use for templating with
type: string
type: object
ksonnet:
description: Ksonnet holds ksonnet specific options
Expand Down Expand Up @@ -1267,6 +1279,9 @@ spec:
values:
description: Values is Helm values, typically defined as a block
type: string
version:
description: Version is the Helm version to use for templating with
type: string
type: object
ksonnet:
description: Ksonnet holds ksonnet specific options
Expand Down Expand Up @@ -1519,6 +1534,9 @@ spec:
values:
description: Values is Helm values, typically defined as a block
type: string
version:
description: Version is the Helm version to use for templating with
type: string
type: object
ksonnet:
description: Ksonnet holds ksonnet specific options
Expand Down
24 changes: 24 additions & 0 deletions manifests/ha/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,10 @@ spec:
description: Values is Helm values, typically defined as
a block
type: string
version:
description: Version is the Helm version to use for templating
with
type: string
type: object
ksonnet:
description: Ksonnet holds ksonnet specific options
Expand Down Expand Up @@ -526,6 +530,10 @@ spec:
values:
description: Values is Helm values, typically defined as a block
type: string
version:
description: Version is the Helm version to use for templating
with
type: string
type: object
ksonnet:
description: Ksonnet holds ksonnet specific options
Expand Down Expand Up @@ -827,6 +835,10 @@ spec:
description: Values is Helm values, typically defined
as a block
type: string
version:
description: Version is the Helm version to use for templating
with
type: string
type: object
ksonnet:
description: Ksonnet holds ksonnet specific options
Expand Down Expand Up @@ -1148,6 +1160,10 @@ spec:
description: Values is Helm values, typically defined
as a block
type: string
version:
description: Version is the Helm version to use
for templating with
type: string
type: object
ksonnet:
description: Ksonnet holds ksonnet specific options
Expand Down Expand Up @@ -1447,6 +1463,10 @@ spec:
description: Values is Helm values, typically defined
as a block
type: string
version:
description: Version is the Helm version to use for
templating with
type: string
type: object
ksonnet:
description: Ksonnet holds ksonnet specific options
Expand Down Expand Up @@ -1733,6 +1753,10 @@ spec:
description: Values is Helm values, typically defined
as a block
type: string
version:
description: Version is the Helm version to use for
templating with
type: string
type: object
ksonnet:
description: Ksonnet holds ksonnet specific options
Expand Down
24 changes: 24 additions & 0 deletions manifests/ha/namespace-install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,10 @@ spec:
description: Values is Helm values, typically defined as
a block
type: string
version:
description: Version is the Helm version to use for templating
with
type: string
type: object
ksonnet:
description: Ksonnet holds ksonnet specific options
Expand Down Expand Up @@ -526,6 +530,10 @@ spec:
values:
description: Values is Helm values, typically defined as a block
type: string
version:
description: Version is the Helm version to use for templating
with
type: string
type: object
ksonnet:
description: Ksonnet holds ksonnet specific options
Expand Down Expand Up @@ -827,6 +835,10 @@ spec:
description: Values is Helm values, typically defined
as a block
type: string
version:
description: Version is the Helm version to use for templating
with
type: string
type: object
ksonnet:
description: Ksonnet holds ksonnet specific options
Expand Down Expand Up @@ -1148,6 +1160,10 @@ spec:
description: Values is Helm values, typically defined
as a block
type: string
version:
description: Version is the Helm version to use
for templating with
type: string
type: object
ksonnet:
description: Ksonnet holds ksonnet specific options
Expand Down Expand Up @@ -1447,6 +1463,10 @@ spec:
description: Values is Helm values, typically defined
as a block
type: string
version:
description: Version is the Helm version to use for
templating with
type: string
type: object
ksonnet:
description: Ksonnet holds ksonnet specific options
Expand Down Expand Up @@ -1733,6 +1753,10 @@ spec:
description: Values is Helm values, typically defined
as a block
type: string
version:
description: Version is the Helm version to use for
templating with
type: string
type: object
ksonnet:
description: Ksonnet holds ksonnet specific options
Expand Down
24 changes: 24 additions & 0 deletions manifests/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,10 @@ spec:
description: Values is Helm values, typically defined as
a block
type: string
version:
description: Version is the Helm version to use for templating
with
type: string
type: object
ksonnet:
description: Ksonnet holds ksonnet specific options
Expand Down Expand Up @@ -526,6 +530,10 @@ spec:
values:
description: Values is Helm values, typically defined as a block
type: string
version:
description: Version is the Helm version to use for templating
with
type: string
type: object
ksonnet:
description: Ksonnet holds ksonnet specific options
Expand Down Expand Up @@ -827,6 +835,10 @@ spec:
description: Values is Helm values, typically defined
as a block
type: string
version:
description: Version is the Helm version to use for templating
with
type: string
type: object
ksonnet:
description: Ksonnet holds ksonnet specific options
Expand Down Expand Up @@ -1148,6 +1160,10 @@ spec:
description: Values is Helm values, typically defined
as a block
type: string
version:
description: Version is the Helm version to use
for templating with
type: string
type: object
ksonnet:
description: Ksonnet holds ksonnet specific options
Expand Down Expand Up @@ -1447,6 +1463,10 @@ spec:
description: Values is Helm values, typically defined
as a block
type: string
version:
description: Version is the Helm version to use for
templating with
type: string
type: object
ksonnet:
description: Ksonnet holds ksonnet specific options
Expand Down Expand Up @@ -1733,6 +1753,10 @@ spec:
description: Values is Helm values, typically defined
as a block
type: string
version:
description: Version is the Helm version to use for
templating with
type: string
type: object
ksonnet:
description: Ksonnet holds ksonnet specific options
Expand Down
24 changes: 24 additions & 0 deletions manifests/namespace-install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,10 @@ spec:
description: Values is Helm values, typically defined as
a block
type: string
version:
description: Version is the Helm version to use for templating
with
type: string
type: object
ksonnet:
description: Ksonnet holds ksonnet specific options
Expand Down Expand Up @@ -526,6 +530,10 @@ spec:
values:
description: Values is Helm values, typically defined as a block
type: string
version:
description: Version is the Helm version to use for templating
with
type: string
type: object
ksonnet:
description: Ksonnet holds ksonnet specific options
Expand Down Expand Up @@ -827,6 +835,10 @@ spec:
description: Values is Helm values, typically defined
as a block
type: string
version:
description: Version is the Helm version to use for templating
with
type: string
type: object
ksonnet:
description: Ksonnet holds ksonnet specific options
Expand Down Expand Up @@ -1148,6 +1160,10 @@ spec:
description: Values is Helm values, typically defined
as a block
type: string
version:
description: Version is the Helm version to use
for templating with
type: string
type: object
ksonnet:
description: Ksonnet holds ksonnet specific options
Expand Down Expand Up @@ -1447,6 +1463,10 @@ spec:
description: Values is Helm values, typically defined
as a block
type: string
version:
description: Version is the Helm version to use for
templating with
type: string
type: object
ksonnet:
description: Ksonnet holds ksonnet specific options
Expand Down Expand Up @@ -1733,6 +1753,10 @@ spec:
description: Values is Helm values, typically defined
as a block
type: string
version:
description: Version is the Helm version to use for
templating with
type: string
type: object
ksonnet:
description: Ksonnet holds ksonnet specific options
Expand Down
Loading