What happened?
I am trying to configure some kuma mesh stuff with kustomize. I need to be able to add prefixes to all the names of things, and thus, I wrote a nameReference config to make sure that the mesh name can be transformed everywhere, including a label that is set in the MeshMetric resource. That works fine.
Then I had to make it so that the MeshMetric resource would live in the kuma namespace instead of the namespace that I had set with namespace: name in kustomization.yaml. I did this by only setting the namespace in that resource, and then using the NamespaceTransformer with unsetOnly: true, and removing namespace: name from kustomization.yaml.
The namespaces now work, but somehow the nameReference does not. The label with the mesh name that is supposed to be renamed does not get renamed.
What did you expect to happen?
I expect nameReference configuration to still work when I add a NamespaceTransformer to kustomization.yaml.
In my example, I expect the kuma.io/mesh label in the MeshMetric resource to be set to foo-test instead of test.
How can we reproduce it (as minimally and precisely as possible)?
# kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
#namespace: bar
namePrefix: foo-
resources:
- resources.yaml
configurations:
- config.yaml
transformers:
- |-
apiVersion: builtin
kind: NamespaceTransformer
metadata:
name: notImportantHere
namespace: bar
unsetOnly: true
# resources.yaml
---
apiVersion: kuma.io/v1alpha1
kind: Mesh
metadata:
name: test
spec:
stuff: true
---
apiVersion: kuma.io/v1alpha1
kind: MeshMetric
metadata:
name: test-metrics
namespace: kuma
labels:
kuma.io/mesh: test
spec:
moreStuff: true
# config.yaml
nameReference:
- kind: Mesh
version: v1alpha1
fieldSpecs:
- path: metadata/labels/kuma.io\/mesh
kind: MeshMetric
Expected output
apiVersion: kuma.io/v1alpha1
kind: Mesh
metadata:
name: foo-test
namespace: bar
spec:
stuff: true
---
apiVersion: kuma.io/v1alpha1
kind: MeshMetric
metadata:
labels:
kuma.io/mesh: foo-test
name: foo-test-metrics
namespace: kuma
spec:
moreStuff: true
Actual output
apiVersion: kuma.io/v1alpha1
kind: Mesh
metadata:
name: foo-test
namespace: bar
spec:
stuff: true
---
apiVersion: kuma.io/v1alpha1
kind: MeshMetric
metadata:
labels:
kuma.io/mesh: test
name: foo-test-metrics
namespace: kuma
spec:
moreStuff: true
Kustomize version
v5.3.0
Operating system
MacOS
What happened?
I am trying to configure some kuma mesh stuff with kustomize. I need to be able to add prefixes to all the names of things, and thus, I wrote a
nameReferenceconfig to make sure that the mesh name can be transformed everywhere, including a label that is set in theMeshMetricresource. That works fine.Then I had to make it so that the
MeshMetricresource would live in the kuma namespace instead of the namespace that I had set withnamespace: nameinkustomization.yaml. I did this by only setting the namespace in that resource, and then using theNamespaceTransformerwithunsetOnly: true, and removingnamespace: namefromkustomization.yaml.The namespaces now work, but somehow the nameReference does not. The label with the mesh name that is supposed to be renamed does not get renamed.
What did you expect to happen?
I expect
nameReferenceconfiguration to still work when I add aNamespaceTransformerto kustomization.yaml.In my example, I expect the
kuma.io/meshlabel in theMeshMetricresource to be set tofoo-testinstead oftest.How can we reproduce it (as minimally and precisely as possible)?
Expected output
Actual output
Kustomize version
v5.3.0
Operating system
MacOS