mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-13 01:50:55 +00:00
add secret and configmap generator plugins
This commit is contained in:
@@ -240,3 +240,31 @@ metadata:
|
||||
name: p2-com2-c4b8md75k9
|
||||
`)
|
||||
}
|
||||
|
||||
func TestGeneratorPlugins(t *testing.T) {
|
||||
th := NewKustTestHarness(t, "/app")
|
||||
th.writeK("/app", `
|
||||
secretGenerator:
|
||||
- name: bob
|
||||
kvSources:
|
||||
- pluginType: testonly
|
||||
name: testonly
|
||||
args:
|
||||
- FRUIT
|
||||
- VEGETABLE
|
||||
`)
|
||||
m, err := th.makeKustTarget().MakeCustomizedResMap()
|
||||
if err != nil {
|
||||
t.Fatalf("Err: %v", err)
|
||||
}
|
||||
th.assertActualEqualsExpected(m, `
|
||||
apiVersion: v1
|
||||
data:
|
||||
k_FRUIT: dl9GUlVJVA==
|
||||
k_VEGETABLE: dl9WRUdFVEFCTEU=
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: bob-cb9mhbh9gg
|
||||
type: Opaque
|
||||
`)
|
||||
}
|
||||
|
||||
@@ -189,6 +189,9 @@ type GeneratorArgs struct {
|
||||
|
||||
// DataSources for the generator.
|
||||
DataSources `json:",inline,omitempty" yaml:",inline,omitempty"`
|
||||
|
||||
// KVSources for the generator.
|
||||
KVSources []KVSource `json:",inline,omitempty" yaml:",inline,omitempty"`
|
||||
}
|
||||
|
||||
// ConfigMapArgs contains the metadata of how to generate a configmap.
|
||||
@@ -248,3 +251,10 @@ type GeneratorOptions struct {
|
||||
// resource contents.
|
||||
DisableNameSuffixHash bool `json:"disableNameSuffixHash,omitempty" yaml:"disableNameSuffixHash,omitempty"`
|
||||
}
|
||||
|
||||
// KVSource represents a KV plugin backend.
|
||||
type KVSource struct {
|
||||
PluginType string `json:"pluginType,omitempty" yaml:"pluginType,omitempty"`
|
||||
Name string `json:"name,omitempty" yaml:"name,omitempty"`
|
||||
Args []string `json:"args,omitempty" yaml:"args,omitempty"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user