From d5dd5f4567b32fabd290eaad577c161ca428f785 Mon Sep 17 00:00:00 2001 From: Arthur Outhenin-Chalandre Date: Mon, 14 Aug 2023 19:42:06 +0200 Subject: [PATCH] helm: add kube-version Signed-off-by: Arthur Outhenin-Chalandre --- api/types/helmchartargs.go | 7 +++++++ api/types/helmchartargs_test.go | 2 ++ 2 files changed, 9 insertions(+) diff --git a/api/types/helmchartargs.go b/api/types/helmchartargs.go index 15ea7178f..1ed89c01c 100644 --- a/api/types/helmchartargs.go +++ b/api/types/helmchartargs.go @@ -88,6 +88,9 @@ type HelmChart struct { // ApiVersions is the kubernetes apiversions used for Capabilities.APIVersions ApiVersions []string `json:"apiVersions,omitempty" yaml:"apiVersions,omitempty"` + // KubeVersion is the kubernetes version used by Helm for Capabilities.KubeVersion" + KubeVersion string `json:"kubeVersion,omitempty" yaml:"kubeVersion,omitempty"` + // NameTemplate is for specifying the name template used to name the release. NameTemplate string `json:"nameTemplate,omitempty" yaml:"nameTemplate,omitempty"` @@ -172,6 +175,10 @@ func (h HelmChart) AsHelmArgs(absChartHome string) []string { for _, apiVer := range h.ApiVersions { args = append(args, "--api-versions", apiVer) } + if h.KubeVersion != "" { + args = append(args, "--kube-version", h.KubeVersion) + } + if h.IncludeCRDs { args = append(args, "--include-crds") } diff --git a/api/types/helmchartargs_test.go b/api/types/helmchartargs_test.go index 765a28a05..9827360d9 100644 --- a/api/types/helmchartargs_test.go +++ b/api/types/helmchartargs_test.go @@ -17,6 +17,7 @@ func TestAsHelmArgs(t *testing.T) { Version: "1.0.0", Repo: "https://helm.releases.hashicorp.com", ApiVersions: []string{"foo", "bar"}, + KubeVersion: "1.27", NameTemplate: "template", SkipTests: true, IncludeCRDs: true, @@ -33,6 +34,7 @@ func TestAsHelmArgs(t *testing.T) { "-f", "values", "-f", "values1", "-f", "values2", "--api-versions", "foo", "--api-versions", "bar", + "--kube-version", "1.27", "--include-crds", "--skip-tests", "--no-hooks"})