Skip to content
This repository was archived by the owner on Jun 29, 2022. It is now read-only.

Commit 8e39195

Browse files
committed
k8sutil: Rename YAML imports
This commit makes sure that the import-naming is consistent with the project. Signed-off-by: Suraj Deshmukh <suraj@kinvolk.io>
1 parent e7e25d3 commit 8e39195

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

pkg/k8sutil/create.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ import (
3030
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3131
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
3232
yamlserializer "k8s.io/apimachinery/pkg/runtime/serializer/yaml"
33-
"k8s.io/apimachinery/pkg/util/yaml"
33+
yamlutil "k8s.io/apimachinery/pkg/util/yaml"
3434
corev1typed "k8s.io/client-go/kubernetes/typed/core/v1"
35-
sigyaml "sigs.k8s.io/yaml"
35+
"sigs.k8s.io/yaml"
3636

3737
"github.com/kinvolk/lokomotive/internal"
3838
)
@@ -93,7 +93,7 @@ func LoadManifests(files map[string]string) ([]manifest, error) {
9393
// parseManifests parses a YAML or JSON document that may contain one or more
9494
// kubernetes resources.
9595
func parseManifests(r io.Reader) ([]manifest, error) {
96-
reader := yaml.NewYAMLReader(bufio.NewReader(r))
96+
reader := yamlutil.NewYAMLReader(bufio.NewReader(r))
9797
var manifests []manifest
9898
for {
9999
yamlManifest, err := reader.Read()
@@ -108,7 +108,7 @@ func parseManifests(r io.Reader) ([]manifest, error) {
108108
continue
109109
}
110110

111-
jsonManifest, err := yaml.ToJSON(yamlManifest)
111+
jsonManifest, err := yamlutil.ToJSON(yamlManifest)
112112
if err != nil {
113113
return nil, fmt.Errorf("invalid manifest: %w", err)
114114
}
@@ -256,12 +256,12 @@ func YAMLToUnstructured(yamlObj []byte) (*unstructured.Unstructured, error) {
256256
// removeYAMLComments converts YAML to JSON and back again, this removes the comments in the YAML
257257
// and any extra whitespaces spaces.
258258
func removeYAMLComments(yamlObj []byte) ([]byte, error) {
259-
jsonObj, err := sigyaml.YAMLToJSON(yamlObj)
259+
jsonObj, err := yaml.YAMLToJSON(yamlObj)
260260
if err != nil {
261261
return nil, fmt.Errorf("converting YAML to JSON: %w", err)
262262
}
263263

264-
yamlObj, err = sigyaml.JSONToYAML(jsonObj)
264+
yamlObj, err = yaml.JSONToYAML(jsonObj)
265265
if err != nil {
266266
return nil, fmt.Errorf("converting JSON to YAML: %w", err)
267267
}
@@ -274,7 +274,7 @@ func removeYAMLComments(yamlObj []byte) ([]byte, error) {
274274
func SplitYAMLDocuments(yamlObj string) ([]string, error) {
275275
var ret []string
276276

277-
reader := yaml.NewYAMLReader(bufio.NewReader(strings.NewReader(yamlObj)))
277+
reader := yamlutil.NewYAMLReader(bufio.NewReader(strings.NewReader(yamlObj)))
278278

279279
for {
280280
// Read the YAML document delimited by `---`.

0 commit comments

Comments
 (0)