From ec34da8aa4d47a20d6199afc2cefbebd31f81fd6 Mon Sep 17 00:00:00 2001 From: Craig O'Donnell Date: Mon, 4 Dec 2023 15:39:15 -0500 Subject: [PATCH] remove code associated with unused --set flag (#4198) --- cmd/kots/cli/install.go | 1 - pkg/base/helm.go | 12 ++---------- pkg/base/helm_v2.go | 4 ++-- pkg/base/helm_v3.go | 4 ++-- pkg/base/render.go | 1 - 5 files changed, 6 insertions(+), 16 deletions(-) diff --git a/cmd/kots/cli/install.go b/cmd/kots/cli/install.go index 0e0a7c1bcf..bf28b2d0b2 100644 --- a/cmd/kots/cli/install.go +++ b/cmd/kots/cli/install.go @@ -531,7 +531,6 @@ func InstallCmd() *cobra.Command { cmd.Flags().String("app-version-label", "", "the application version label to install. if not specified, the latest version will be installed") cmd.Flags().String("repo", "", "repo uri to use when installing a helm chart") - cmd.Flags().StringSlice("set", []string{}, "values to pass to helm when running helm template") registryFlags(cmd.Flags()) diff --git a/pkg/base/helm.go b/pkg/base/helm.go index ccb43aeca8..d74a865e24 100644 --- a/pkg/base/helm.go +++ b/pkg/base/helm.go @@ -14,7 +14,6 @@ import ( "github.com/replicatedhq/kots/pkg/logger" upstreamtypes "github.com/replicatedhq/kots/pkg/upstream/types" "github.com/replicatedhq/kots/pkg/util" - "helm.sh/helm/v3/pkg/strvals" "sigs.k8s.io/kustomize/api/filesys" "sigs.k8s.io/kustomize/api/krusty" kustomizetypes "sigs.k8s.io/kustomize/api/types" @@ -45,23 +44,16 @@ func RenderHelm(u *upstreamtypes.Upstream, renderOptions *RenderOptions) (*Base, } } - vals := renderOptions.HelmValues - for _, value := range renderOptions.HelmOptions { - if err := strvals.ParseInto(value, vals); err != nil { - return nil, errors.Wrapf(err, "failed to parse helm value %q", value) - } - } - var rendered []BaseFile var additional []BaseFile switch strings.ToLower(renderOptions.HelmVersion) { case "v3", "": - rendered, additional, err = renderHelmV3(u.Name, chartPath, vals, renderOptions) + rendered, additional, err = renderHelmV3(u.Name, chartPath, renderOptions) if err != nil { return nil, errors.Wrap(err, "failed to render with helm v3") } case "v2": - rendered, additional, err = renderHelmV2(u.Name, chartPath, vals, renderOptions) + rendered, additional, err = renderHelmV2(u.Name, chartPath, renderOptions) if err != nil { return nil, errors.Wrap(err, "failed to render with helm v2") } diff --git a/pkg/base/helm_v2.go b/pkg/base/helm_v2.go index 2a18b93c55..71690d2d69 100644 --- a/pkg/base/helm_v2.go +++ b/pkg/base/helm_v2.go @@ -17,8 +17,8 @@ import ( k8syaml "sigs.k8s.io/yaml" ) -func renderHelmV2(chartName string, chartPath string, vals map[string]interface{}, renderOptions *RenderOptions) ([]BaseFile, []BaseFile, error) { - marshalledVals, err := yaml.Marshal(vals) +func renderHelmV2(chartName string, chartPath string, renderOptions *RenderOptions) ([]BaseFile, []BaseFile, error) { + marshalledVals, err := yaml.Marshal(renderOptions.HelmValues) if err != nil { return nil, nil, errors.Wrap(err, "failed to marshal helm values") } diff --git a/pkg/base/helm_v3.go b/pkg/base/helm_v3.go index e6d355b2d2..bedfbf9d78 100644 --- a/pkg/base/helm_v3.go +++ b/pkg/base/helm_v3.go @@ -25,7 +25,7 @@ var ( const NamespaceTemplateConst = "repl{{ Namespace}}" -func renderHelmV3(releaseName string, chartPath string, vals map[string]interface{}, renderOptions *RenderOptions) ([]BaseFile, []BaseFile, error) { +func renderHelmV3(releaseName string, chartPath string, renderOptions *RenderOptions) ([]BaseFile, []BaseFile, error) { cfg := &action.Configuration{ Log: renderOptions.Log.Debug, } @@ -51,7 +51,7 @@ func renderHelmV3(releaseName string, chartPath string, vals map[string]interfac } } - rel, err := client.Run(chartRequested, vals) + rel, err := client.Run(chartRequested, renderOptions.HelmValues) if err != nil { return nil, nil, util.ActionableError{ NoRetry: true, diff --git a/pkg/base/render.go b/pkg/base/render.go index 59b57658a5..182cdb3d8b 100644 --- a/pkg/base/render.go +++ b/pkg/base/render.go @@ -10,7 +10,6 @@ type RenderOptions struct { SplitMultiDocYAML bool Namespace string HelmVersion string - HelmOptions []string HelmValues map[string]interface{} LocalRegistryHost string LocalRegistryNamespace string