mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-11 17:12:51 +00:00
minor fix: incorrect apiVersion and add NoOpTransformer for vars (#757)
This commit is contained in:
@@ -20,7 +20,7 @@ import (
|
|||||||
func TestGeneratorOptionsWithBases(t *testing.T) {
|
func TestGeneratorOptionsWithBases(t *testing.T) {
|
||||||
th := NewKustTestHarness(t, "/app/overlay")
|
th := NewKustTestHarness(t, "/app/overlay")
|
||||||
th.writeK("/app/base", `
|
th.writeK("/app/base", `
|
||||||
apiVersion: v1beta1
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
generatorOptions:
|
generatorOptions:
|
||||||
disableNameSuffixHash: true
|
disableNameSuffixHash: true
|
||||||
@@ -32,7 +32,7 @@ configMapGenerator:
|
|||||||
- foo=bar
|
- foo=bar
|
||||||
`)
|
`)
|
||||||
th.writeK("/app/overlay", `
|
th.writeK("/app/overlay", `
|
||||||
apiVersion: v1beta1
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
bases:
|
bases:
|
||||||
- ../base
|
- ../base
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ spec:
|
|||||||
name: example
|
name: example
|
||||||
`)
|
`)
|
||||||
th.writeF("/app/kustomization.yaml", `
|
th.writeF("/app/kustomization.yaml", `
|
||||||
apiVersion: v1beta1
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
resources:
|
resources:
|
||||||
- deployment.yaml
|
- deployment.yaml
|
||||||
|
|||||||
@@ -18,6 +18,9 @@ type refvarTransformer struct {
|
|||||||
// The fieldSpecs are the places to look for occurrences of $(VAR).
|
// The fieldSpecs are the places to look for occurrences of $(VAR).
|
||||||
func NewRefVarTransformer(
|
func NewRefVarTransformer(
|
||||||
varMap map[string]string, fs []config.FieldSpec) Transformer {
|
varMap map[string]string, fs []config.FieldSpec) Transformer {
|
||||||
|
if len(varMap) == 0 {
|
||||||
|
return NewNoOpTransformer()
|
||||||
|
}
|
||||||
return &refvarTransformer{
|
return &refvarTransformer{
|
||||||
fieldSpecs: fs,
|
fieldSpecs: fs,
|
||||||
mappingFunc: expansion.MappingFuncFor(varMap),
|
mappingFunc: expansion.MappingFuncFor(varMap),
|
||||||
|
|||||||
Reference in New Issue
Block a user