Skip to content

Commit

Permalink
remove code associated with unused --set flag (#4198)
Browse files Browse the repository at this point in the history
  • Loading branch information
Craig O'Donnell authored Dec 4, 2023
1 parent a47c0e8 commit ec34da8
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 16 deletions.
1 change: 0 additions & 1 deletion cmd/kots/cli/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand Down
12 changes: 2 additions & 10 deletions pkg/base/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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")
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/base/helm_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/base/helm_v3.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand All @@ -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,
Expand Down
1 change: 0 additions & 1 deletion pkg/base/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ type RenderOptions struct {
SplitMultiDocYAML bool
Namespace string
HelmVersion string
HelmOptions []string
HelmValues map[string]interface{}
LocalRegistryHost string
LocalRegistryNamespace string
Expand Down

0 comments on commit ec34da8

Please sign in to comment.