Remove some duped code.

This commit is contained in:
jregan
2019-04-06 16:04:04 -07:00
parent 38029d1836
commit b32e041bfe
11 changed files with 106 additions and 129 deletions

View File

@@ -13,7 +13,7 @@ import (
type plugin struct{}
var Transformer plugin
var KustomizePlugin plugin
func (p *plugin) Config(k ifc.Kunstructured) error {
return nil

View File

@@ -1,3 +1,5 @@
// +build plugin
package main
import (
@@ -15,7 +17,7 @@ type plugin struct {
Port string
}
var Generator plugin
var KustomizePlugin plugin
var manifest = `
apiVersion: v1

View File

@@ -18,11 +18,11 @@ import (
"sigs.k8s.io/kustomize/pkg/transformers/config"
)
type plugin struct{
type plugin struct {
prefix string
}
var Transformer plugin
var KustomizePlugin plugin
func (p *plugin) Config(k ifc.Kunstructured) error {
var err error

View File

@@ -1,24 +1,27 @@
// +build plugin
package main
var database = map[string]string{
"TREE": "oak",
"ROCKET": "Saturn V",
"FRUIT": "apple",
"VEGETABLE": "carrot",
"SIMPSON": "homer",
"TREE": "oak",
"ROCKET": "Saturn V",
"FRUIT": "apple",
"VEGETABLE": "carrot",
"SIMPSON": "homer",
}
type plugin struct{}
var KVSource plugin
func (p plugin) Get(
root string, args []string) (map[string]string, error) {
r := make(map[string]string)
for _, k := range args {
v, ok := database[k]
if ok {
r[k] = v
}
}
return r, nil
root string, args []string) (map[string]string, error) {
r := make(map[string]string)
for _, k := range args {
v, ok := database[k]
if ok {
r[k] = v
}
}
return r, nil
}