I have a base object (custom resource) that I need multiple times with a different name and one property added (or changed). So I have defined a base yaml file and referenced it in the overlay kustomization.yaml
.
├── base
│ ├── kustomization.yaml
| └── base.ClusterOutput.yaml
└── my-env
└── kustomization.yaml
Now I need to update the metadata.name
field and add a property which can be done with patches in kustomization.yaml
patches:
- patch: |-
- op: add
path: /spec/opensearch/logstash_prefix
value: <new-value>
- op: replace
path: /metadata/name
value: <new-name>
Until here it works as expected, but in some environments I need more than the one instance of the custom resource and I can't figure out, how to do that. I tried multiple patches, but they override each other and I end up with one object having the last patch. I don't want to write multiple base objects, in some environments I need only one and they are equal apart from the name and the one property anyway. Is there some way I can do this with kustomize?