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