0

i'm using kustomize to build k8s manifest file , i'm looking for a solution to insert value of namespace as variable (to be dynamic) into patch operation as described in file below , i had many patch operations and actually i just hardcoded value of namespace in each op.

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
    namespace: test1
patchesJson6902:
  - patch: |-
      - op: add
        path: /spec/groups/0/rules/0/labels/namespace
        value: test1
     - op: add
        path: /spec/groups/0/rules/1/labels/namespace
        value: test1
      - op: add
        path: /spec/groups/0/rules/2/labels/namespace
        value: test1
Turing85
  • 18,217
  • 7
  • 33
  • 58
  • While Stack Overflow does permit certain questions about Kubernetes, we require that they (like all questions asked here) be specifically related to programming. This question does not appear to be specifically related to programming, but manifest generation, which makes it off-topic here. You might be able to ask questions like this one on [sf] or [DevOps](https://devops.stackexchange.com/). – Turing85 Aug 15 '22 at 10:41
  • So you want to make the `namespace: ...` in your kustomization to also be applied to further fields in your resources, correct? – criztovyl Aug 15 '22 at 14:48

0 Answers0