Skip to content

Commit 787cc23

Browse files
committed
toolbox: switch to forked helmstrvals; drop helm dependency
Replaces helm.sh/helm/v3/pkg/strvals and helm.sh/helm/v3/pkg/cli/values with the in-tree fork at third_party/forked/helmstrvals plus a small inline mergeMaps for value-file loading. Signed-off-by: Ciprian Hacman <ciprian@hakman.dev>
1 parent 040bcba commit 787cc23

224 files changed

Lines changed: 24 additions & 43888 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cmd/kops/toolbox_template.go

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,15 @@ import (
2525
"strings"
2626

2727
"github.com/spf13/cobra"
28-
"helm.sh/helm/v3/pkg/strvals"
29-
"k8s.io/kops/pkg/commands/commandutils"
3028
"k8s.io/kubectl/pkg/util/i18n"
3129
"k8s.io/kubectl/pkg/util/templates"
3230
"sigs.k8s.io/yaml"
3331

34-
helmvalues "helm.sh/helm/v3/pkg/cli/values"
35-
3632
kopsapi "k8s.io/kops/pkg/apis/kops"
33+
"k8s.io/kops/pkg/commands/commandutils"
3734
"k8s.io/kops/pkg/try"
3835
"k8s.io/kops/pkg/util/templater"
36+
"k8s.io/kops/third_party/forked/helmstrvals"
3937
"k8s.io/kops/upup/pkg/fi/utils"
4038
)
4139

@@ -250,30 +248,20 @@ func newTemplateContext(files []string, values []string, stringValues []string)
250248
if err := utils.YamlUnmarshal(content, &ctx); err != nil {
251249
return nil, fmt.Errorf("unable decode the configuration file: %s, error: %v", j, err)
252250
}
253-
254-
valueOpts := &helmvalues.Options{
255-
Values: values,
256-
ValueFiles: files,
257-
StringValues: stringValues,
258-
}
259-
260-
context, err = valueOpts.MergeValues(nil)
261-
if err != nil {
262-
return nil, err
263-
}
251+
context = mergeMaps(context, ctx)
264252
}
265253
}
266254

267255
// User specified a value via --set
268256
for _, value := range values {
269-
if err := strvals.ParseInto(value, context); err != nil {
257+
if err := helmstrvals.ParseInto(value, context); err != nil {
270258
return nil, fmt.Errorf("failed parsing --set data: %s", err)
271259
}
272260
}
273261

274262
// User specified a value via --set-string
275263
for _, value := range stringValues {
276-
if err := strvals.ParseIntoString(value, context); err != nil {
264+
if err := helmstrvals.ParseIntoString(value, context); err != nil {
277265
return nil, fmt.Errorf("failed parsing --set-string data: %s", err)
278266
}
279267
}
@@ -307,3 +295,22 @@ func expandFiles(path string) ([]string, error) {
307295

308296
return list, nil
309297
}
298+
299+
// mergeMaps deep-merges src into dst, returning the result. Nested maps are
300+
// recursively merged; other values from src overwrite dst.
301+
func mergeMaps(dst, src map[string]interface{}) map[string]interface{} {
302+
out := make(map[string]interface{}, len(dst))
303+
for k, v := range dst {
304+
out[k] = v
305+
}
306+
for k, v := range src {
307+
if vmap, ok := v.(map[string]interface{}); ok {
308+
if existing, ok := out[k].(map[string]interface{}); ok {
309+
out[k] = mergeMaps(existing, vmap)
310+
continue
311+
}
312+
}
313+
out[k] = v
314+
}
315+
return out
316+
}

go.mod

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ require (
8383
google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af
8484
gopkg.in/gcfg.v1 v1.2.3
8585
gopkg.in/inf.v0 v0.9.1
86-
helm.sh/helm/v3 v3.19.4
8786
k8s.io/api v0.36.0
8887
k8s.io/apimachinery v0.36.0
8988
k8s.io/cli-runtime v0.36.0
@@ -139,17 +138,12 @@ require (
139138
github.com/charmbracelet/x/ansi v0.10.1 // indirect
140139
github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd // indirect
141140
github.com/charmbracelet/x/term v0.2.1 // indirect
142-
github.com/containerd/containerd v1.7.29 // indirect
143-
github.com/containerd/errdefs v1.0.0 // indirect
144-
github.com/containerd/log v0.1.0 // indirect
145-
github.com/containerd/platforms v0.2.1 // indirect
146141
github.com/containerd/stargz-snapshotter/estargz v0.18.1 // indirect
147142
github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect
148143
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
149144
github.com/docker/cli v29.0.3+incompatible // indirect
150145
github.com/docker/distribution v2.8.3+incompatible // indirect
151146
github.com/docker/docker-credential-helpers v0.9.3 // indirect
152-
github.com/docker/go-events v0.0.0-20250114142523-c867878c5e32 // indirect
153147
github.com/emicklei/go-restful/v3 v3.13.0 // indirect
154148
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
155149
github.com/evanphx/json-patch v5.9.11+incompatible // indirect
@@ -222,7 +216,6 @@ require (
222216
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
223217
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
224218
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
225-
github.com/pkg/errors v0.9.1 // indirect
226219
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
227220
github.com/prometheus/client_model v0.6.2 // indirect
228221
github.com/prometheus/common v0.67.5 // indirect
@@ -265,7 +258,6 @@ require (
265258
k8s.io/apiextensions-apiserver v0.36.0 // indirect
266259
k8s.io/cloud-provider v0.36.0 // indirect
267260
k8s.io/kube-openapi v0.0.0-20260317180543-43fb72c5454a // indirect
268-
oras.land/oras-go/v2 v2.6.0 // indirect
269261
sigs.k8s.io/gateway-api v1.4.0 // indirect
270262
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect
271263
sigs.k8s.io/kustomize/api v0.21.1 // indirect

go.sum

Lines changed: 0 additions & 79 deletions
Large diffs are not rendered by default.

vendor/github.com/containerd/containerd/LICENSE

Lines changed: 0 additions & 191 deletions
This file was deleted.

vendor/github.com/containerd/containerd/NOTICE

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)