mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-12 01:14:22 +00:00
Clear config.kubernetes.io/path annotation in cmd/cat
This commit is contained in:
@@ -121,6 +121,13 @@ func (r *CatRunner) runE(c *cobra.Command, args []string) error {
|
|||||||
out = o
|
out = o
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// remove this annotation explicitly, the ByteWriter won't clear it by
|
||||||
|
// default because it doesn't set it
|
||||||
|
clear := []string{"config.kubernetes.io/path"}
|
||||||
|
if r.KeepAnnotations {
|
||||||
|
clear = nil
|
||||||
|
}
|
||||||
|
|
||||||
var outputs []kio.Writer
|
var outputs []kio.Writer
|
||||||
outputs = append(outputs, kio.ByteWriter{
|
outputs = append(outputs, kio.ByteWriter{
|
||||||
Writer: out,
|
Writer: out,
|
||||||
@@ -129,6 +136,7 @@ func (r *CatRunner) runE(c *cobra.Command, args []string) error {
|
|||||||
WrappingAPIVersion: r.WrapApiVersion,
|
WrappingAPIVersion: r.WrapApiVersion,
|
||||||
FunctionConfig: functionConfig,
|
FunctionConfig: functionConfig,
|
||||||
Style: yaml.GetStyle(r.Styles...),
|
Style: yaml.GetStyle(r.Styles...),
|
||||||
|
ClearAnnotations: clear,
|
||||||
})
|
})
|
||||||
|
|
||||||
return handleError(c, kio.Pipeline{Inputs: inputs, Filters: fltr, Outputs: outputs}.Execute())
|
return handleError(c, kio.Pipeline{Inputs: inputs, Filters: fltr, Outputs: outputs}.Execute())
|
||||||
|
|||||||
@@ -90,7 +90,6 @@ metadata:
|
|||||||
name: foo
|
name: foo
|
||||||
annotations:
|
annotations:
|
||||||
app: nginx2
|
app: nginx2
|
||||||
config.kubernetes.io/path: 'f1.yaml'
|
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
---
|
---
|
||||||
@@ -99,7 +98,6 @@ metadata:
|
|||||||
name: foo
|
name: foo
|
||||||
annotations:
|
annotations:
|
||||||
app: nginx
|
app: nginx
|
||||||
config.kubernetes.io/path: 'f1.yaml'
|
|
||||||
spec:
|
spec:
|
||||||
selector:
|
selector:
|
||||||
app: nginx
|
app: nginx
|
||||||
@@ -112,7 +110,6 @@ metadata:
|
|||||||
app: nginx
|
app: nginx
|
||||||
annotations:
|
annotations:
|
||||||
app: nginx
|
app: nginx
|
||||||
config.kubernetes.io/path: 'f2.yaml'
|
|
||||||
spec:
|
spec:
|
||||||
replicas: 3
|
replicas: 3
|
||||||
`, b.String()) {
|
`, b.String()) {
|
||||||
@@ -193,7 +190,6 @@ metadata:
|
|||||||
name: foo
|
name: foo
|
||||||
annotations:
|
annotations:
|
||||||
app: nginx2
|
app: nginx2
|
||||||
config.kubernetes.io/path: 'f1.yaml'
|
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
---
|
---
|
||||||
@@ -202,7 +198,6 @@ metadata:
|
|||||||
name: foo
|
name: foo
|
||||||
annotations:
|
annotations:
|
||||||
app: nginx
|
app: nginx
|
||||||
config.kubernetes.io/path: 'f1.yaml'
|
|
||||||
spec:
|
spec:
|
||||||
selector:
|
selector:
|
||||||
app: nginx
|
app: nginx
|
||||||
@@ -213,7 +208,6 @@ metadata:
|
|||||||
name: foo
|
name: foo
|
||||||
annotations:
|
annotations:
|
||||||
config.kubernetes.io/local-config: "true"
|
config.kubernetes.io/local-config: "true"
|
||||||
config.kubernetes.io/path: 'f2.yaml'
|
|
||||||
configFn:
|
configFn:
|
||||||
container:
|
container:
|
||||||
image: gcr.io/example/image:version
|
image: gcr.io/example/image:version
|
||||||
@@ -227,7 +221,6 @@ metadata:
|
|||||||
name: bar
|
name: bar
|
||||||
annotations:
|
annotations:
|
||||||
app: nginx
|
app: nginx
|
||||||
config.kubernetes.io/path: 'f2.yaml'
|
|
||||||
spec:
|
spec:
|
||||||
replicas: 3
|
replicas: 3
|
||||||
`, b.String()) {
|
`, b.String()) {
|
||||||
@@ -307,7 +300,6 @@ metadata:
|
|||||||
name: foo
|
name: foo
|
||||||
annotations:
|
annotations:
|
||||||
config.kubernetes.io/local-config: "true"
|
config.kubernetes.io/local-config: "true"
|
||||||
config.kubernetes.io/path: 'f2.yaml'
|
|
||||||
configFn:
|
configFn:
|
||||||
container:
|
container:
|
||||||
image: gcr.io/example/reconciler:v1
|
image: gcr.io/example/reconciler:v1
|
||||||
@@ -406,7 +398,6 @@ metadata:
|
|||||||
name: foo
|
name: foo
|
||||||
annotations:
|
annotations:
|
||||||
app: nginx2
|
app: nginx2
|
||||||
config.kubernetes.io/path: 'f1.yaml'
|
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
---
|
---
|
||||||
@@ -415,7 +406,6 @@ metadata:
|
|||||||
name: foo
|
name: foo
|
||||||
annotations:
|
annotations:
|
||||||
app: nginx
|
app: nginx
|
||||||
config.kubernetes.io/path: 'f1.yaml'
|
|
||||||
spec:
|
spec:
|
||||||
selector:
|
selector:
|
||||||
app: nginx
|
app: nginx
|
||||||
@@ -428,7 +418,6 @@ metadata:
|
|||||||
app: nginx
|
app: nginx
|
||||||
annotations:
|
annotations:
|
||||||
app: nginx
|
app: nginx
|
||||||
config.kubernetes.io/path: 'f2.yaml'
|
|
||||||
spec:
|
spec:
|
||||||
replicas: 3
|
replicas: 3
|
||||||
`, string(actual)) {
|
`, string(actual)) {
|
||||||
@@ -525,7 +514,6 @@ metadata:
|
|||||||
name: foo
|
name: foo
|
||||||
annotations:
|
annotations:
|
||||||
app: nginx2
|
app: nginx2
|
||||||
config.kubernetes.io/path: 'f1.yaml'
|
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
---
|
---
|
||||||
@@ -534,7 +522,6 @@ metadata:
|
|||||||
name: foo
|
name: foo
|
||||||
annotations:
|
annotations:
|
||||||
app: nginx
|
app: nginx
|
||||||
config.kubernetes.io/path: 'f1.yaml'
|
|
||||||
spec:
|
spec:
|
||||||
selector:
|
selector:
|
||||||
app: nginx
|
app: nginx
|
||||||
@@ -547,7 +534,6 @@ metadata:
|
|||||||
app: nginx
|
app: nginx
|
||||||
annotations:
|
annotations:
|
||||||
app: nginx
|
app: nginx
|
||||||
config.kubernetes.io/path: 'f2.yaml'
|
|
||||||
spec:
|
spec:
|
||||||
replicas: 3
|
replicas: 3
|
||||||
`, string(actual)) {
|
`, string(actual)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user