mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-05-17 18:25:26 +00:00
Avoiding Prefix Transformer for Namespace resource
This commit is contained in:
@@ -26,6 +26,7 @@ type PrefixSuffixTransformerPlugin struct {
|
||||
var prefixSuffixFieldSpecsToSkip = types.FsSlice{
|
||||
{Gvk: resid.Gvk{Kind: "CustomResourceDefinition"}},
|
||||
{Gvk: resid.Gvk{Group: "apiregistration.k8s.io", Kind: "APIService"}},
|
||||
{Gvk: resid.Gvk{Kind: "Namespace"}},
|
||||
}
|
||||
|
||||
func (p *PrefixSuffixTransformerPlugin) Config(
|
||||
|
||||
@@ -187,7 +187,7 @@ metadata:
|
||||
"apiVersion": "v1",
|
||||
"kind": "Namespace",
|
||||
"metadata": map[string]interface{}{
|
||||
"name": "foo-ns1-bar",
|
||||
"name": "ns1",
|
||||
"labels": map[string]interface{}{
|
||||
"app": "nginx",
|
||||
},
|
||||
|
||||
@@ -70,7 +70,7 @@ metadata:
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: p-b-myNs
|
||||
name: myNs
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Role
|
||||
@@ -95,7 +95,7 @@ metadata:
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: p-myNs2
|
||||
name: myNs2
|
||||
`)
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ var KustomizePlugin plugin
|
||||
var prefixSuffixFieldSpecsToSkip = types.FsSlice{
|
||||
{Gvk: resid.Gvk{Kind: "CustomResourceDefinition"}},
|
||||
{Gvk: resid.Gvk{Group: "apiregistration.k8s.io", Kind: "APIService"}},
|
||||
{Gvk: resid.Gvk{Kind: "Namespace"}},
|
||||
}
|
||||
|
||||
func (p *plugin) Config(
|
||||
|
||||
@@ -25,6 +25,11 @@ fieldSpecs:
|
||||
- path: metadata/name
|
||||
`, `
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: apple
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: apple
|
||||
@@ -50,6 +55,11 @@ metadata:
|
||||
|
||||
th.AssertActualEqualsExpected(rm, `
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: apple
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: baked-apple-pie
|
||||
|
||||
Reference in New Issue
Block a user