Kustomize
Hard
Troubleshooting
A pod has containers named web and web-sidecar. A replacement target uses the path spec.containers.[name=web].image. Which containers get the new image?
Select your answer:
Show answer and explanation
Answer: Both, because the value in [name=web] is an unanchored regex
Explanation
In current Kustomize the value in a [key=value] path segment is matched as a regular expression, and every matching list item is a target. web matches web-sidecar too. Write [name=^web$] to hit only the container named web.
More hard Kustomize questions
- A replacement's source sets kind: ConfigMap and name: cm.*, and the build fails with "nothing selected by". Why?
- Why can a component patch resources defined in the overlay that includes it, when a base can't?
- Which field path selects the value of the env var SERVICE_HOST in the container named app, for a replacement target?
- A production overlay lists a remote base with ?ref=main. What's the risk?
- A strategic merge patch adds one item to a list in a custom resource, but the build replaces the whole list. Why?
- A custom resource refers to a generated ConfigMap by name, but after the build it still uses the name without the hash suffix. Why?