mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-13 10:00:56 +00:00
Delete unused code.
This commit is contained in:
@@ -30,10 +30,10 @@ func makeRefs() (Refs, Refs) {
|
|||||||
current[a] = []resid.ItemId{b, c}
|
current[a] = []resid.ItemId{b, c}
|
||||||
current[b] = []resid.ItemId{}
|
current[b] = []resid.ItemId{}
|
||||||
current[c] = []resid.ItemId{}
|
current[c] = []resid.ItemId{}
|
||||||
new := NewRefs()
|
newRefs := NewRefs()
|
||||||
new[a] = []resid.ItemId{b}
|
newRefs[a] = []resid.ItemId{b}
|
||||||
new[b] = []resid.ItemId{}
|
newRefs[b] = []resid.ItemId{}
|
||||||
return current, new
|
return current, newRefs
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestInventory(t *testing.T) {
|
func TestInventory(t *testing.T) {
|
||||||
|
|||||||
@@ -1,53 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2018 The Kubernetes Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package resmap
|
|
||||||
|
|
||||||
import (
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"sigs.k8s.io/kustomize/pkg/ifc"
|
|
||||||
"sigs.k8s.io/kustomize/pkg/types"
|
|
||||||
)
|
|
||||||
|
|
||||||
func GeneratorArgsFromKunstruct(k ifc.Kunstructured) (
|
|
||||||
result types.GeneratorArgs, err error) {
|
|
||||||
result.Name = k.GetName()
|
|
||||||
// TODO: validate behavior values.
|
|
||||||
result.Behavior, err = k.GetFieldValue("behavior")
|
|
||||||
if !IsAcceptableError(err) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
result.EnvSources, err = k.GetStringSlice("envFiles")
|
|
||||||
if !IsAcceptableError(err) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
result.FileSources, err = k.GetStringSlice("valueFiles")
|
|
||||||
if !IsAcceptableError(err) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
result.LiteralSources, err = k.GetStringSlice("literals")
|
|
||||||
if !IsAcceptableError(err) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err = nil
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func IsAcceptableError(err error) bool {
|
|
||||||
return err == nil ||
|
|
||||||
strings.HasPrefix(err.Error(), "no field named")
|
|
||||||
}
|
|
||||||
@@ -64,16 +64,16 @@ func (pt *imageTransformer) Transform(m resmap.ResMap) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (pt *imageTransformer) mutateImage(in interface{}) (interface{}, error) {
|
func (pt *imageTransformer) mutateImage(in interface{}) (interface{}, error) {
|
||||||
image, ok := in.(string)
|
original, ok := in.(string)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, fmt.Errorf("image path is not of type string but %T", in)
|
return nil, fmt.Errorf("image path is not of type string but %T", in)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, img := range pt.images {
|
for _, img := range pt.images {
|
||||||
if !isImageMatched(image, img.Name) {
|
if !isImageMatched(original, img.Name) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
name, tag := split(image)
|
name, tag := split(original)
|
||||||
if img.NewName != "" {
|
if img.NewName != "" {
|
||||||
name = img.NewName
|
name = img.NewName
|
||||||
}
|
}
|
||||||
@@ -85,7 +85,7 @@ func (pt *imageTransformer) mutateImage(in interface{}) (interface{}, error) {
|
|||||||
}
|
}
|
||||||
return name + tag, nil
|
return name + tag, nil
|
||||||
}
|
}
|
||||||
return image, nil
|
return original, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user