Merge pull request #13483 from olemarkus/remove-yamlv2

Remove explicit dependency on yamlv2
This commit is contained in:
Kubernetes Prow Robot 2022-04-10 05:22:04 -07:00 committed by GitHub
commit 24437366e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 7 deletions

2
go.mod
View File

@ -83,7 +83,6 @@ require (
gopkg.in/gcfg.v1 v1.2.3
gopkg.in/inf.v0 v0.9.1
gopkg.in/square/go-jose.v2 v2.5.1
gopkg.in/yaml.v2 v2.4.0
helm.sh/helm/v3 v3.8.1
k8s.io/api v0.23.5
k8s.io/apimachinery v0.23.5
@ -231,6 +230,7 @@ require (
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/ini.v1 v1.66.3 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
k8s.io/apiextensions-apiserver v0.23.5 // indirect
k8s.io/cloud-provider v0.23.5 // indirect

View File

@ -15,7 +15,6 @@ go_library(
visibility = ["//visibility:public"],
deps = [
"//util/pkg/text:go_default_library",
"//vendor/gopkg.in/yaml.v2:go_default_library",
"//vendor/k8s.io/api/core/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",

View File

@ -20,9 +20,9 @@ import (
"encoding/json"
"fmt"
yamlv2 "gopkg.in/yaml.v2"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/klog/v2"
"sigs.k8s.io/yaml"
)
// KubeObjectToApplyYAML returns the kubernetes object converted to YAML, with "noisy" fields removed.
@ -41,7 +41,7 @@ func KubeObjectToApplyYAML(data runtime.Object) (string, error) {
// Convert the JSON to a map.
jsonObj := make(map[string]interface{})
if err := yamlv2.Unmarshal(j, &jsonObj); err != nil {
if err := yaml.Unmarshal(j, &jsonObj); err != nil {
return "", err
}
@ -61,7 +61,7 @@ func KubeObjectToApplyYAML(data runtime.Object) (string, error) {
}
// Marshal the cleaned-up map into YAML.
y, err := yamlv2.Marshal(jsonObj)
y, err := yaml.Marshal(jsonObj)
if err != nil {
return "", err
}

View File

@ -7,7 +7,6 @@ require (
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
github.com/octago/sflags v0.2.0
github.com/spf13/pflag v1.0.5
gopkg.in/yaml.v2 v2.4.0
k8s.io/api v0.23.5
k8s.io/apimachinery v0.23.5
k8s.io/client-go v9.0.0+incompatible
@ -140,6 +139,7 @@ require (
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/square/go-jose.v2 v2.5.1 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
k8s.io/klog v1.0.0 // indirect
k8s.io/release v0.7.1-0.20210204090829-09fb5e3883b8 // indirect

View File

@ -22,9 +22,9 @@ import (
"path"
"strings"
"gopkg.in/yaml.v2"
"k8s.io/klog/v2"
"sigs.k8s.io/kubetest2/pkg/exec"
"sigs.k8s.io/yaml"
)
// renderTemplate will render the manifest template with the provided values,