Make plugin dir match Go conventions.

This commit is contained in:
jregan
2019-04-23 23:16:23 -07:00
parent 0ac48f60a5
commit cfb0c5efad
16 changed files with 29 additions and 12 deletions

View File

@@ -0,0 +1,37 @@
// +build plugin
package main
import (
"sigs.k8s.io/kustomize/pkg/ifc"
"sigs.k8s.io/kustomize/pkg/resmap"
"sigs.k8s.io/kustomize/pkg/transformers"
"sigs.k8s.io/kustomize/pkg/transformers/config"
)
type plugin struct{}
var KustomizePlugin plugin
func (p *plugin) Config(
ldr ifc.Loader, rf *resmap.Factory, k ifc.Kunstructured) error {
return nil
}
// Returns a constant, rather than
// time.Now().Format("2006-01-02")
// to make tests happy.
// This is just an example.
func getDate() string {
return "2018-05-11"
}
func (p *plugin) Transform(m resmap.ResMap) error {
tr, err := transformers.NewNamePrefixSuffixTransformer(
getDate()+"-", "",
config.MakeDefaultConfig().NamePrefix)
if err != nil {
return err
}
return tr.Transform(m)
}