Merge pull request #1070 from monopole/deleteUnused

Delete some code.
This commit is contained in:
Jeff Regan
2019-05-13 12:42:59 -07:00
committed by GitHub
3 changed files with 8 additions and 61 deletions

View File

@@ -30,10 +30,10 @@ func makeRefs() (Refs, Refs) {
current[a] = []resid.ItemId{b, c}
current[b] = []resid.ItemId{}
current[c] = []resid.ItemId{}
new := NewRefs()
new[a] = []resid.ItemId{b}
new[b] = []resid.ItemId{}
return current, new
newRefs := NewRefs()
newRefs[a] = []resid.ItemId{b}
newRefs[b] = []resid.ItemId{}
return current, newRefs
}
func TestInventory(t *testing.T) {

View File

@@ -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")
}

View File

@@ -64,16 +64,16 @@ func (pt *imageTransformer) Transform(m resmap.ResMap) error {
}
func (pt *imageTransformer) mutateImage(in interface{}) (interface{}, error) {
image, ok := in.(string)
original, ok := in.(string)
if !ok {
return nil, fmt.Errorf("image path is not of type string but %T", in)
}
for _, img := range pt.images {
if !isImageMatched(image, img.Name) {
if !isImageMatched(original, img.Name) {
continue
}
name, tag := split(image)
name, tag := split(original)
if img.NewName != "" {
name = img.NewName
}
@@ -85,7 +85,7 @@ func (pt *imageTransformer) mutateImage(in interface{}) (interface{}, error) {
}
return name + tag, nil
}
return image, nil
return original, nil
}
/*