Fix some minor naming mistakes. (#434)

* Fix some minor naming mistakes.

* Fix some minor naming mistakes.
This commit is contained in:
Jeff Regan
2018-10-08 15:58:44 -07:00
committed by Jingfang Liu
parent fd3cd64e11
commit 30814302af
22 changed files with 35 additions and 35 deletions

View File

@@ -29,8 +29,8 @@ type KunstructurerFactoryImpl struct {
var _ ifc.KunstructuredFactory = &KunstructurerFactoryImpl{}
// NewKustKunstructuredFactory returns a factory.
func NewKustKunstructuredFactory(d ifc.Decoder) ifc.KunstructuredFactory {
// NewKunstructuredFactoryImpl returns a factory.
func NewKunstructuredFactoryImpl(d ifc.Decoder) ifc.KunstructuredFactory {
return &KunstructurerFactoryImpl{decoder: d}
}

View File

@@ -24,7 +24,7 @@ import (
)
func TestSliceFromBytes(t *testing.T) {
factory := NewKustKunstructuredFactory(NewKustDecoder())
factory := NewKunstructuredFactoryImpl(NewKustDecoder())
testConfigMap := factory.FromMap(
map[string]interface{}{
"apiVersion": "v1",

View File

@@ -29,7 +29,7 @@ import (
)
var rf = resource.NewFactory(
k8sdeps.NewKustKunstructuredFactory(k8sdeps.NewKustDecoder()))
k8sdeps.NewKunstructuredFactoryImpl(k8sdeps.NewKustDecoder()))
var deploy = gvk.Gvk{Group: "apps", Version: "v1", Kind: "Deployment"}
var foo = gvk.Gvk{Group: "example.com", Version: "v1", Kind: "Foo"}

View File

@@ -21,7 +21,7 @@ import (
)
func TestGetFieldValue(t *testing.T) {
factory := NewKustKunstructuredFactory(NewKustDecoder())
factory := NewKunstructuredFactoryImpl(NewKustDecoder())
kunstructured := factory.FromMap(map[string]interface{}{
"Kind": "Service",
"metadata": map[string]interface{}{

View File

@@ -29,7 +29,7 @@ func main() {
defer glog.Flush()
if err := commands.NewDefaultCommand(
k8sdeps.NewKustKunstructuredFactory(k8sdeps.NewKustDecoder()),
k8sdeps.NewKunstructuredFactoryImpl(k8sdeps.NewKustDecoder()),
patch.NewPatchTransformerFactory(),
k8sdeps.NewKustDecoder(),
k8sdeps.NewKustValidator(),

View File

@@ -64,7 +64,7 @@ Use different transformer configurations by passing files to kustomize
func NewCmdBuild(
out io.Writer, fs fs.FileSystem,
kf ifc.KunstructuredFactory,
ptf patch.PatchTransformerFactory,
ptf patch.TransformerFactory,
decoder ifc.Decoder, hash ifc.Hash) *cobra.Command {
var o buildOptions
var p string
@@ -125,7 +125,7 @@ func (o *buildOptions) Validate(args []string, p string, fs fs.FileSystem) error
func (o *buildOptions) RunBuild(
out io.Writer, fSys fs.FileSystem,
kf ifc.KunstructuredFactory,
ptf patch.PatchTransformerFactory,
ptf patch.TransformerFactory,
decoder ifc.Decoder, hash ifc.Hash) error {
rootLoader, err := loader.NewLoader(o.kustomizationPath, "", fSys)
if err != nil {

View File

@@ -131,7 +131,7 @@ func runBuildTestCase(t *testing.T, testcaseName string, updateKustomizeExpected
buf := bytes.NewBuffer([]byte{})
err = ops.RunBuild(
buf, fSys,
k8sdeps.NewKustKunstructuredFactory(k8sdeps.NewKustDecoder()),
k8sdeps.NewKunstructuredFactoryImpl(k8sdeps.NewKustDecoder()),
patch.NewPatchTransformerFactory(),
k8sdeps.NewKustDecoder(), k8sdeps.NewKustHash())
switch {

View File

@@ -32,7 +32,7 @@ import (
// NewDefaultCommand returns the default (aka root) command for kustomize command.
func NewDefaultCommand(
kf ifc.KunstructuredFactory, ptf patch.PatchTransformerFactory,
kf ifc.KunstructuredFactory, ptf patch.TransformerFactory,
decoder ifc.Decoder,
validator ifc.Validator, hash ifc.Hash) *cobra.Command {
fsys := fs.MakeRealFS()

View File

@@ -151,16 +151,6 @@ func makeLoader(t *testing.T) ifc.Loader {
func TestRegisterCRD(t *testing.T) {
refpathconfigs := []transformerconfig.ReferencePathConfig{
{
Gvk: gvk.Gvk{Kind: "Bee", Version: "v1beta1"},
PathConfigs: []transformerconfig.PathConfig{
{
CreateIfNotPresent: false,
Gvk: gvk.Gvk{Kind: "MyKind"},
Path: "spec/beeRef/name",
},
},
},
{
Gvk: gvk.Gvk{Kind: "Secret", Version: "v1"},
PathConfigs: []transformerconfig.PathConfig{
@@ -171,6 +161,16 @@ func TestRegisterCRD(t *testing.T) {
},
},
},
{
Gvk: gvk.Gvk{Kind: "Bee", Version: "v1beta1"},
PathConfigs: []transformerconfig.PathConfig{
{
CreateIfNotPresent: false,
Gvk: gvk.Gvk{Kind: "MyKind"},
Path: "spec/beeRef/name",
},
},
},
}
expected := &transformerconfig.TransformerConfig{

View File

@@ -22,7 +22,7 @@ import (
"sigs.k8s.io/kustomize/pkg/transformers"
)
// PatchTransformerFactory makes patch transformer.
type PatchTransformerFactory interface {
// TransformerFactory makes patch transformer.
type TransformerFactory interface {
MakePatchTransformer(slice []*resource.Resource, rf *resource.Factory) (transformers.Transformer, error)
}

View File

@@ -32,7 +32,7 @@ import (
)
var rf = resource.NewFactory(
k8sdeps.NewKustKunstructuredFactory(k8sdeps.NewKustDecoder()))
k8sdeps.NewKunstructuredFactoryImpl(k8sdeps.NewKustDecoder()))
func TestNewPatchJson6902FactoryNoTarget(t *testing.T) {
p := patch.Json6902{}

View File

@@ -32,7 +32,7 @@ var deploy = gvk.Gvk{Group: "apps", Version: "v1", Kind: "Deployment"}
func TestJsonPatchJSONTransformer_Transform(t *testing.T) {
rf := resource.NewFactory(
k8sdeps.NewKustKunstructuredFactory(k8sdeps.NewKustDecoder()))
k8sdeps.NewKunstructuredFactoryImpl(k8sdeps.NewKustDecoder()))
id := resid.NewResId(deploy, "deploy1")
base := resmap.ResMap{
id: rf.FromMap(

View File

@@ -30,7 +30,7 @@ import (
var deploy = gvk.Gvk{Group: "apps", Version: "v1", Kind: "Deployment"}
var statefulset = gvk.Gvk{Group: "apps", Version: "v1", Kind: "StatefulSet"}
var rf = resource.NewFactory(
k8sdeps.NewKustKunstructuredFactory(k8sdeps.NewKustDecoder()))
k8sdeps.NewKunstructuredFactoryImpl(k8sdeps.NewKustDecoder()))
var rmF = NewFactory(rf)
func TestEncodeAsYaml(t *testing.T) {

View File

@@ -23,7 +23,7 @@ import (
)
var factory = NewFactory(
k8sdeps.NewKustKunstructuredFactory(k8sdeps.NewKustDecoder()))
k8sdeps.NewKunstructuredFactoryImpl(k8sdeps.NewKustDecoder()))
var testConfigMap = factory.FromMap(
map[string]interface{}{

View File

@@ -50,14 +50,14 @@ type KustTarget struct {
fSys fs.FileSystem
rf *resmap.Factory
tcfg *transformerconfig.TransformerConfig
ptf patch.PatchTransformerFactory
ptf patch.TransformerFactory
}
// NewKustTarget returns a new instance of KustTarget primed with a Loader.
func NewKustTarget(
ldr ifc.Loader, fSys fs.FileSystem,
rf *resmap.Factory,
ptf patch.PatchTransformerFactory,
ptf patch.TransformerFactory,
tcfg *transformerconfig.TransformerConfig,
d ifc.Decoder, h ifc.Hash) (*KustTarget, error) {
content, err := ldr.Load(constants.KustomizationFileName)

View File

@@ -90,7 +90,7 @@ metadata:
)
var rf = resmap.NewFactory(resource.NewFactory(
k8sdeps.NewKustKunstructuredFactory(k8sdeps.NewKustDecoder())))
k8sdeps.NewKunstructuredFactoryImpl(k8sdeps.NewKustDecoder())))
func makeLoader1(t *testing.T) ifc.Loader {
ldr := loadertest.NewFakeLoader("/testpath")

View File

@@ -30,7 +30,7 @@ import (
func TestImageTagTransformer(t *testing.T) {
var rf = resource.NewFactory(
k8sdeps.NewKustKunstructuredFactory(k8sdeps.NewKustDecoder()))
k8sdeps.NewKunstructuredFactoryImpl(k8sdeps.NewKustDecoder()))
m := resmap.ResMap{
resid.NewResId(deploy, "deploy1"): rf.FromMap(

View File

@@ -42,7 +42,7 @@ var crb = gvk.Gvk{Group: "rbac.authorization.k8s.io", Version: "v1", Kind: "Clus
var sa = gvk.Gvk{Version: "v1", Kind: "ServiceAccount"}
var ingress = gvk.Gvk{Kind: "Ingress"}
var rf = resource.NewFactory(
k8sdeps.NewKustKunstructuredFactory(k8sdeps.NewKustDecoder()))
k8sdeps.NewKunstructuredFactoryImpl(k8sdeps.NewKustDecoder()))
func TestLabelsRun(t *testing.T) {
m := resmap.ResMap{

View File

@@ -29,7 +29,7 @@ import (
func TestNameHashTransformer(t *testing.T) {
rf := resource.NewFactory(
k8sdeps.NewKustKunstructuredFactory(k8sdeps.NewKustDecoder()))
k8sdeps.NewKunstructuredFactoryImpl(k8sdeps.NewKustDecoder()))
objs := resmap.ResMap{
resid.NewResId(cmap, "cm1"): rf.FromMap(
map[string]interface{}{

View File

@@ -29,7 +29,7 @@ import (
func TestNameReferenceRun(t *testing.T) {
rf := resource.NewFactory(
k8sdeps.NewKustKunstructuredFactory(k8sdeps.NewKustDecoder()))
k8sdeps.NewKunstructuredFactoryImpl(k8sdeps.NewKustDecoder()))
m := resmap.ResMap{
resid.NewResId(cmap, "cm1"): rf.FromMap(
map[string]interface{}{

View File

@@ -29,7 +29,7 @@ import (
func TestNamespaceRun(t *testing.T) {
rf := resource.NewFactory(
k8sdeps.NewKustKunstructuredFactory(k8sdeps.NewKustDecoder()))
k8sdeps.NewKunstructuredFactoryImpl(k8sdeps.NewKustDecoder()))
m := resmap.ResMap{
resid.NewResId(cmap, "cm1"): rf.FromMap(
map[string]interface{}{

View File

@@ -29,7 +29,7 @@ import (
func TestPrefixNameRun(t *testing.T) {
rf := resource.NewFactory(
k8sdeps.NewKustKunstructuredFactory(k8sdeps.NewKustDecoder()))
k8sdeps.NewKunstructuredFactoryImpl(k8sdeps.NewKustDecoder()))
m := resmap.ResMap{
resid.NewResId(cmap, "cm1"): rf.FromMap(
map[string]interface{}{