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.
More hard Kustomize questions
- A custom resource refers to a generated ConfigMap by name, but after the build it still uses the name without the hash suffix. Why?
- An overlay's configMapGenerator uses the same name as one generated in the base, with no behavior set. What happens?
- A kustomization sets namespace: team-a and includes a ClusterRole. What happens to the ClusterRole?
- In a strategic merge patch, what does $patch: replace inside a container's resources map do?
- A patch target sets name: app. Does it also match a Deployment named app-worker?
- A patch changes the metadata.name of its target, and the build fails. What allows the rename?