mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
40 lines
1.1 KiB
Go
40 lines
1.1 KiB
Go
|
// Code generated by pluginator on ConfigMapGenerator; DO NOT EDIT.
|
||
|
// pluginator {unknown 1970-01-01T00:00:00Z }
|
||
|
|
||
|
package builtins
|
||
|
|
||
|
import (
|
||
|
"sigs.k8s.io/kustomize/api/kv"
|
||
|
"sigs.k8s.io/kustomize/api/resmap"
|
||
|
"sigs.k8s.io/kustomize/api/types"
|
||
|
"sigs.k8s.io/yaml"
|
||
|
)
|
||
|
|
||
|
type ConfigMapGeneratorPlugin struct {
|
||
|
h *resmap.PluginHelpers
|
||
|
types.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||
|
types.ConfigMapArgs
|
||
|
}
|
||
|
|
||
|
func (p *ConfigMapGeneratorPlugin) Config(h *resmap.PluginHelpers, config []byte) (err error) {
|
||
|
p.ConfigMapArgs = types.ConfigMapArgs{}
|
||
|
err = yaml.Unmarshal(config, p)
|
||
|
if p.ConfigMapArgs.Name == "" {
|
||
|
p.ConfigMapArgs.Name = p.Name
|
||
|
}
|
||
|
if p.ConfigMapArgs.Namespace == "" {
|
||
|
p.ConfigMapArgs.Namespace = p.Namespace
|
||
|
}
|
||
|
p.h = h
|
||
|
return
|
||
|
}
|
||
|
|
||
|
func (p *ConfigMapGeneratorPlugin) Generate() (resmap.ResMap, error) {
|
||
|
return p.h.ResmapFactory().FromConfigMapArgs(
|
||
|
kv.NewLoader(p.h.Loader(), p.h.Validator()), p.ConfigMapArgs)
|
||
|
}
|
||
|
|
||
|
func NewConfigMapGeneratorPlugin() resmap.GeneratorPlugin {
|
||
|
return &ConfigMapGeneratorPlugin{}
|
||
|
}
|