k8wiz
Kustomize
Hard
Troubleshooting

A strategic merge patch adds one item to a list in a custom resource, but the build replaces the whole list. Why?

Select your answer:

Show answer and explanation

Answer: Kustomize has no merge key for that list, so strategic merge replaces it

Explanation

Strategic merge relies on schema information such as merge keys, which Kustomize's built-in schema only has for Kubernetes types. For a custom resource, a list in the patch replaces the original. Use a JSON 6902 patch, or provide the CRD's schema through the openapi field.