eliminate yaml.v3

not convinced these were necessary, users can patch arbitrary yaml in anyhow, I don't think there's a realistic threat model resolved by safetext/yamltemplate

further, the safetext repo doesn't seem to be responsively maintained, last commit 9 months ago, and the small number of issues are going unresponded (4 open, 0 closed, some multiple years old)
This commit is contained in:
Benjamin Elder
2025-04-24 20:38:40 -07:00
parent 84e9c79a40
commit 1e21827948
4 changed files with 16 additions and 18 deletions

View File

@@ -20,8 +20,7 @@ package installcni
import (
"bytes"
"strings"
"github.com/google/safetext/yamltemplate"
"text/template"
"sigs.k8s.io/kind/pkg/errors"
"sigs.k8s.io/kind/pkg/internal/apis/config"
@@ -70,7 +69,7 @@ func (a *action) Execute(ctx *actions.ActionContext) error {
// their own, or use the default. The internal templating mechanism is
// not intended for external usage and is unstable.
if strings.Contains(manifest, "would you kindly template this file") {
t, err := yamltemplate.New("cni-manifest").Parse(manifest)
t, err := template.New("cni-manifest").Parse(manifest)
if err != nil {
return errors.Wrap(err, "failed to parse CNI manifest template")
}

View File

@@ -21,8 +21,7 @@ import (
"fmt"
"sort"
"strings"
"github.com/google/safetext/yamltemplate"
"text/template"
"sigs.k8s.io/kind/pkg/errors"
@@ -192,7 +191,7 @@ kubernetesVersion: {{.KubernetesVersion}}
clusterName: "{{.ClusterName}}"
{{ if .KubeadmFeatureGates}}featureGates:
{{ range $key, $value := .KubeadmFeatureGates }}
"{{ (StructuralData $key) }}": {{ $value }}
"{{ $key }}": {{ $value }}
{{end}}{{end}}
controlPlaneEndpoint: "{{ .ControlPlaneEndpoint }}"
# on docker for mac we have to expose the api server via port forward,
@@ -292,7 +291,7 @@ evictionHard:
imagefs.available: "0%"
{{if .FeatureGates}}featureGates:
{{ range $index, $gate := .SortedFeatureGates }}
"{{ (StructuralData $gate.Name) }}": {{ $gate.Value }}
"{{ $gate.Name }}": {{ $gate.Value }}
{{end}}{{end}}
{{if ne .KubeProxyMode "none"}}
---
@@ -303,7 +302,7 @@ metadata:
mode: "{{ .KubeProxyMode }}"
{{if .FeatureGates}}featureGates:
{{ range $index, $gate := .SortedFeatureGates }}
"{{ (StructuralData $gate.Name) }}": {{ $gate.Value }}
"{{ $gate.Name }}": {{ $gate.Value }}
{{end}}{{end}}
iptables:
minSyncPeriod: 1s
@@ -335,7 +334,7 @@ kubernetesVersion: {{.KubernetesVersion}}
clusterName: "{{.ClusterName}}"
{{ if .KubeadmFeatureGates}}featureGates:
{{ range $key, $value := .KubeadmFeatureGates }}
"{{ (StructuralData $key) }}": {{ $value }}
"{{ $key }}": {{ $value }}
{{end}}{{end}}
controlPlaneEndpoint: "{{ .ControlPlaneEndpoint }}"
# on docker for mac we have to expose the api server via port forward,
@@ -447,7 +446,7 @@ evictionHard:
imagefs.available: "0%"
{{if .FeatureGates}}featureGates:
{{ range $index, $gate := .SortedFeatureGates }}
"{{ (StructuralData $gate.Name) }}": {{ $gate.Value }}
"{{ $gate.Name }}": {{ $gate.Value }}
{{end}}{{end}}
{{if ne .KubeProxyMode "none"}}
---
@@ -458,7 +457,7 @@ metadata:
mode: "{{ .KubeProxyMode }}"
{{if .FeatureGates}}featureGates:
{{ range $index, $gate := .SortedFeatureGates }}
"{{ (StructuralData $gate.Name) }}": {{ $gate.Value }}
"{{ $gate.Name }}": {{ $gate.Value }}
{{end}}{{end}}
iptables:
minSyncPeriod: 1s
@@ -508,7 +507,7 @@ func Config(data ConfigData) (config string, err error) {
templateSource = ConfigTemplateBetaV2
}
t, err := yamltemplate.New("kubeadm-config").Parse(templateSource)
t, err := template.New("kubeadm-config").Parse(templateSource)
if err != nil {
return "", errors.Wrap(err, "failed to parse config template")
}