mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-05-17 18:25:26 +00:00
Fix some minor naming mistakes. (#434)
* Fix some minor naming mistakes. * Fix some minor naming mistakes.
This commit is contained in:
@@ -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}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import (
|
||||
)
|
||||
|
||||
func TestSliceFromBytes(t *testing.T) {
|
||||
factory := NewKustKunstructuredFactory(NewKustDecoder())
|
||||
factory := NewKunstructuredFactoryImpl(NewKustDecoder())
|
||||
testConfigMap := factory.FromMap(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "v1",
|
||||
|
||||
@@ -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"}
|
||||
|
||||
|
||||
@@ -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{}{
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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{
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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{}
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -23,7 +23,7 @@ import (
|
||||
)
|
||||
|
||||
var factory = NewFactory(
|
||||
k8sdeps.NewKustKunstructuredFactory(k8sdeps.NewKustDecoder()))
|
||||
k8sdeps.NewKunstructuredFactoryImpl(k8sdeps.NewKustDecoder()))
|
||||
|
||||
var testConfigMap = factory.FromMap(
|
||||
map[string]interface{}{
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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{
|
||||
|
||||
@@ -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{}{
|
||||
|
||||
@@ -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{}{
|
||||
|
||||
@@ -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{}{
|
||||
|
||||
@@ -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{}{
|
||||
|
||||
Reference in New Issue
Block a user