Change path inside kustomize patch with wild card

174 Views Asked by At

I have a kustomization with patches:

patches:
  - target:
      kind: PrometheusRule
      name: .*-prometheus-recording-rules
      version: v1
    patch: |-
      - op: add
        path: /metadata/namespace
        value: dev1
      - op: add
        path: "/spec/groups/*/rules/*/labels/namespace"
        value: dev1

I'm trying to create it with different namespace for every develop environment that I'm creating.

This is the error that I get kustomize build failed: add operation does not apply: doc is missing path: "/spec/groups/*/rules/*/labels/namespace": missing value

Is there any option to add patch with wildcards?

0

There are 0 best solutions below