kustomize "patchesStrategicMerge is deprecated" in CI
Newer kustomize deprecates the separate patchesStrategicMerge and patchesJson6902 fields in favor of a single patches field. Depending on version it prints a deprecation warning or, with strict checks, fails the build. The fix is to migrate to patches.
What this error means
kustomize build prints "# Warning: 'patchesStrategicMerge' is deprecated. Please use 'patches' instead." or fails a lint gate that treats the deprecation as an error.
# Warning: 'patchesStrategicMerge' is deprecated. Please use 'patches' instead.
Run 'kustomize edit fix' to update your Kustomization automatically.Common causes
The kustomization uses a deprecated patch field
A legacy patchesStrategicMerge or patchesJson6902 block triggers the deprecation notice on newer kustomize.
A CI gate fails on deprecation output
A pipeline that greps for warnings or runs strict checks turns the deprecation into a build failure.
How to fix it
Migrate to the unified patches field
- Move each strategic-merge patch under
patches:with apath:. - Move JSON6902 patches under
patches:with atarget:selector. - Run
kustomize edit fixto migrate automatically, then review the diff.
patches:
- path: deployment-patch.yaml
- path: replica-patch.yaml
target:
kind: Deployment
name: apiAuto-migrate with kustomize edit fix
Let kustomize rewrite the deprecated fields, then commit the result.
kustomize edit fix
git diff kustomization.yamlHow to prevent it
- Prefer the unified
patchesfield in new kustomizations. - Run
kustomize edit fixwhen upgrading kustomize versions. - Pin the kustomize version in CI so behavior is consistent.