What is the difference between patches vs patchesJson6902 in Kustomize
The explanation for this is here.
To summarize, patchJson6902
is an older keyword which can only match one resource via target
(no wildcards), and accepts only Group-version-kind (GVK), namespace, and name.
The patches
directive is newer and accepts more elements (annotation selector and label selector as well). In addition, namespace and name can be regexes. The target for patches
can match more than one resource, all of which will be patched.
In addition, with patches
, it will attempt to parse patch files as a Json6902 patch, and if that does not work, it will fall back to attempting the patch as a strategic merge. Therefore, in many cases patches
can obviate the need of using patchesStrategicMerge
as well.
Overall, it seems as if patches
should work pretty universally for new projects.
Upstream documentation for these key words: