Skip to content

Commit

Permalink
This also provides a solution to issue 1493
Browse files Browse the repository at this point in the history
  • Loading branch information
KnVerey committed Dec 6, 2022
1 parent ce528f9 commit f9fbbc7
Showing 1 changed file with 79 additions and 0 deletions.
79 changes: 79 additions & 0 deletions api/filters/replacement/replacement_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1755,6 +1755,85 @@ spec:
value: YYYYY
- name: deployment-name
value: sample-deploy
`,
},
"Issue 1493: wildcard to create or replace field in all containers in all workloads": {
input: `apiVersion: v1
kind: ConfigMap
metadata:
name: policy
data:
restart: OnFailure
---
apiVersion: v1
kind: Pod
metadata:
name: pod1
spec:
containers:
- image: nginx
name: main
- image: nginx
name: sidecar
imagePullPolicy: Always
---
apiVersion: v1
kind: Pod
metadata:
name: pod2
spec:
containers:
- image: nginx
name: main
imagePullPolicy: Always
- image: nginx
name: sidecar
`,
replacements: `replacements:
- source:
kind: ConfigMap
name: policy
fieldPath: data.restart
targets:
- select:
kind: Pod
fieldPaths:
- spec.containers.*.imagePullPolicy
options:
create: true
`,
expected: `apiVersion: v1
kind: ConfigMap
metadata:
name: policy
data:
restart: OnFailure
---
apiVersion: v1
kind: Pod
metadata:
name: pod1
spec:
containers:
- image: nginx
name: main
imagePullPolicy: OnFailure
- image: nginx
name: sidecar
imagePullPolicy: OnFailure
---
apiVersion: v1
kind: Pod
metadata:
name: pod2
spec:
containers:
- image: nginx
name: main
imagePullPolicy: OnFailure
- image: nginx
name: sidecar
imagePullPolicy: OnFailure
`,
},
"multiple field paths in target": {
Expand Down

0 comments on commit f9fbbc7

Please sign in to comment.