kpt
kpt copied to clipboard
Allow implicit namespace resolution in apply-time-mutation
I would like to create packages with config.kubernetes.io/apply-time-mutation
that are independent of the namespace they are going to be deployed in.
Example:
Given this configuration:
apiVersion: v1
kind: ConfigMap
metadata:
name: test-b
annotations:
config.kubernetes.io/apply-time-mutation: |
- sourceRef:
kind: ConfigMap
name: test-a
sourcePath: $.data.src
targetPath: $.spec.dest
token: ${value}
data:
dest: "${value}-bar"
---
apiVersion: v1
kind: ConfigMap
metadata:
name: test-a
data:
src: "foo"
when applying it to the cluster it fails with the following error:
error: invalid object: "default_test-b__ConfigMap": invalid "config.kubernetes.io/apply-time-mutation" annotation: external dependency: /namespaces/default/ConfigMap/test-b -> /ConfigMap/test-a
and force me to explicitly define the namespace of the source resources making the package impossible to reuse in different namespaces.