Skip to content

Commit

Permalink
fix issue with replacements
Browse files Browse the repository at this point in the history
  • Loading branch information
natasha41575 committed Apr 7, 2022
1 parent e428a39 commit a32228b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
3 changes: 0 additions & 3 deletions api/filters/replacement/replacement.go
Expand Up @@ -142,9 +142,6 @@ func applyToOneNode(options *types.FieldOptions, t *yaml.RNode, value *yaml.RNod
}

for _, scalarNode := range t.YNode().Content {
if options != nil && options.Create {
return fmt.Errorf("cannot use create option in a multi-value target")
}
rn := yaml.NewRNode(scalarNode)
if err := setTargetValue(options, rn, value); err != nil {
return err
Expand Down
23 changes: 22 additions & 1 deletion api/filters/replacement/replacement_test.go
Expand Up @@ -2347,7 +2347,28 @@ spec:
options:
create: true
`,
expectedErr: `cannot use create option in a multi-value target`,
expected: `
apiVersion: batch/v1
kind: Job
metadata:
name: hello
spec:
template:
spec:
containers:
- image: busybox
name: myapp-container
restartPolicy: OnFailure
---
apiVersion: v1
kind: Pod
metadata:
name: my-pod
spec:
containers:
- image: busybox
name: myapp-container
restartPolicy: OnFailure`,
},
}

Expand Down

0 comments on commit a32228b

Please sign in to comment.