Skip to content

Commit 2d4af78

Browse files
authored
Merge pull request #3922 from BenTheElder/no-yaml-v3
eliminate yaml.v3
2 parents 84e9c79 + 1e21827 commit 2d4af78

File tree

4 files changed

+16
-18
lines changed

4 files changed

+16
-18
lines changed

go.mod

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ require (
1414
al.essio.dev/pkg/shellescape v1.5.1
1515
github.com/BurntSushi/toml v1.4.0
1616
github.com/evanphx/json-patch/v5 v5.6.0
17-
github.com/google/safetext v0.0.0-20220905092116-b49f7bc46da2
1817
github.com/mattn/go-isatty v0.0.20
1918
github.com/pelletier/go-toml v1.9.5
2019
github.com/pkg/errors v0.9.1
@@ -23,10 +22,14 @@ require (
2322
sigs.k8s.io/yaml v1.4.0
2423
)
2524

25+
// test-only transitive deps, these are used by sigs.k8s.io/yaml's tests
26+
require (
27+
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
28+
gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b // indirect
29+
)
30+
2631
require (
2732
github.com/inconshreveable/mousetrap v1.1.0 // indirect
2833
github.com/kr/text v0.2.0 // indirect
2934
golang.org/x/sys v0.6.0 // indirect
30-
// TODO: https://github.com/google/safetext/issues/9
31-
gopkg.in/yaml.v3 v3.0.1 // indirect
3235
)

go.sum

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ github.com/evanphx/json-patch/v5 v5.6.0 h1:b91NhWfaz02IuVxO9faSllyAtNXHMPkC5J8sJ
88
github.com/evanphx/json-patch/v5 v5.6.0/go.mod h1:G79N1coSVB93tBe7j6PhzjmR3/2VvlbKOFpnXhI9Bw4=
99
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
1010
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
11-
github.com/google/safetext v0.0.0-20220905092116-b49f7bc46da2 h1:SJ+NtwL6QaZ21U+IrK7d0gGgpjGGvd2kz+FzTHVzdqI=
12-
github.com/google/safetext v0.0.0-20220905092116-b49f7bc46da2/go.mod h1:Tv1PlzqC9t8wNnpPdctvtSUOPUUg4SHeE6vR1Ir2hmg=
1311
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4=
1412
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ=
1513
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
@@ -38,7 +36,6 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
3836
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
3937
gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b h1:QRR6H1YWRnHb4Y/HeNFCTJLFVxaq6wH4YuVdsUOr75U=
4038
gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
41-
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
4239
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
4340
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
4441
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=

pkg/cluster/internal/create/actions/installcni/cni.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ package installcni
2020
import (
2121
"bytes"
2222
"strings"
23-
24-
"github.com/google/safetext/yamltemplate"
23+
"text/template"
2524

2625
"sigs.k8s.io/kind/pkg/errors"
2726
"sigs.k8s.io/kind/pkg/internal/apis/config"
@@ -70,7 +69,7 @@ func (a *action) Execute(ctx *actions.ActionContext) error {
7069
// their own, or use the default. The internal templating mechanism is
7170
// not intended for external usage and is unstable.
7271
if strings.Contains(manifest, "would you kindly template this file") {
73-
t, err := yamltemplate.New("cni-manifest").Parse(manifest)
72+
t, err := template.New("cni-manifest").Parse(manifest)
7473
if err != nil {
7574
return errors.Wrap(err, "failed to parse CNI manifest template")
7675
}

pkg/cluster/internal/kubeadm/config.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ import (
2121
"fmt"
2222
"sort"
2323
"strings"
24-
25-
"github.com/google/safetext/yamltemplate"
24+
"text/template"
2625

2726
"sigs.k8s.io/kind/pkg/errors"
2827

@@ -192,7 +191,7 @@ kubernetesVersion: {{.KubernetesVersion}}
192191
clusterName: "{{.ClusterName}}"
193192
{{ if .KubeadmFeatureGates}}featureGates:
194193
{{ range $key, $value := .KubeadmFeatureGates }}
195-
"{{ (StructuralData $key) }}": {{ $value }}
194+
"{{ $key }}": {{ $value }}
196195
{{end}}{{end}}
197196
controlPlaneEndpoint: "{{ .ControlPlaneEndpoint }}"
198197
# on docker for mac we have to expose the api server via port forward,
@@ -292,7 +291,7 @@ evictionHard:
292291
imagefs.available: "0%"
293292
{{if .FeatureGates}}featureGates:
294293
{{ range $index, $gate := .SortedFeatureGates }}
295-
"{{ (StructuralData $gate.Name) }}": {{ $gate.Value }}
294+
"{{ $gate.Name }}": {{ $gate.Value }}
296295
{{end}}{{end}}
297296
{{if ne .KubeProxyMode "none"}}
298297
---
@@ -303,7 +302,7 @@ metadata:
303302
mode: "{{ .KubeProxyMode }}"
304303
{{if .FeatureGates}}featureGates:
305304
{{ range $index, $gate := .SortedFeatureGates }}
306-
"{{ (StructuralData $gate.Name) }}": {{ $gate.Value }}
305+
"{{ $gate.Name }}": {{ $gate.Value }}
307306
{{end}}{{end}}
308307
iptables:
309308
minSyncPeriod: 1s
@@ -335,7 +334,7 @@ kubernetesVersion: {{.KubernetesVersion}}
335334
clusterName: "{{.ClusterName}}"
336335
{{ if .KubeadmFeatureGates}}featureGates:
337336
{{ range $key, $value := .KubeadmFeatureGates }}
338-
"{{ (StructuralData $key) }}": {{ $value }}
337+
"{{ $key }}": {{ $value }}
339338
{{end}}{{end}}
340339
controlPlaneEndpoint: "{{ .ControlPlaneEndpoint }}"
341340
# on docker for mac we have to expose the api server via port forward,
@@ -447,7 +446,7 @@ evictionHard:
447446
imagefs.available: "0%"
448447
{{if .FeatureGates}}featureGates:
449448
{{ range $index, $gate := .SortedFeatureGates }}
450-
"{{ (StructuralData $gate.Name) }}": {{ $gate.Value }}
449+
"{{ $gate.Name }}": {{ $gate.Value }}
451450
{{end}}{{end}}
452451
{{if ne .KubeProxyMode "none"}}
453452
---
@@ -458,7 +457,7 @@ metadata:
458457
mode: "{{ .KubeProxyMode }}"
459458
{{if .FeatureGates}}featureGates:
460459
{{ range $index, $gate := .SortedFeatureGates }}
461-
"{{ (StructuralData $gate.Name) }}": {{ $gate.Value }}
460+
"{{ $gate.Name }}": {{ $gate.Value }}
462461
{{end}}{{end}}
463462
iptables:
464463
minSyncPeriod: 1s
@@ -508,7 +507,7 @@ func Config(data ConfigData) (config string, err error) {
508507
templateSource = ConfigTemplateBetaV2
509508
}
510509

511-
t, err := yamltemplate.New("kubeadm-config").Parse(templateSource)
510+
t, err := template.New("kubeadm-config").Parse(templateSource)
512511
if err != nil {
513512
return "", errors.Wrap(err, "failed to parse config template")
514513
}

0 commit comments

Comments
 (0)