patchesJson6902

Patch resources using the json 6902 standard

Each entry in this list should resolve to a kubernetes object and a JSON patch that will be applied to the object. The JSON patch is documented at https://tools.ietf.org/html/rfc6902

target field points to a kubernetes object within the same kustomization by the object’s group, version, kind, name and namespace. path field is a relative file path of a JSON patch file. The content in this patch file can be either in JSON format as

  1. [
  2. {"op": "add", "path": "/some/new/path", "value": "value"},
  3. {"op": "replace", "path": "/some/existing/path", "value": "new value"}
  4. ]

or in YAML format as

  1. - op: add
  2. path: /some/new/path
  3. value: value
  4. - op: replace
  5. path: /some/existing/path
  6. value: new value
  1. apiVersion: kustomize.config.k8s.io/v1beta1
  2. kind: Kustomization
  3. patchesJson6902:
  4. - target:
  5. version: v1
  6. kind: Deployment
  7. name: my-deployment
  8. path: add_init_container.yaml
  9. - target:
  10. version: v1
  11. kind: Service
  12. name: my-service
  13. path: add_service_annotation.yaml

The patch content can be an inline string as well:

  1. apiVersion: kustomize.config.k8s.io/v1beta1
  2. kind: Kustomization
  3. patchesJson6902:
  4. - target:
  5. version: v1
  6. kind: Deployment
  7. name: my-deployment
  8. patch: |-
  9. - op: add
  10. path: /some/new/path
  11. value: value
  12. - op: replace
  13. path: /some/existing/path
  14. value: "new value"