kustomize
kustomize copied to clipboard
Defining same port twice with multiple names gets reduced to one port
trafficstars
What happened?
We want to define container port twice as below, with different names, so that same port can be referred by different names depending on the context.
containers:
ports:
- name: app
containerPort: 9090
protocol: TCP
- name: metrics
containerPort: 9090
protocol: TCP
This works with plain kubernetes. But after doing kustomize build output gets reduced to
containers:
ports:
- name: metrics
containerPort: 9090
protocol: TCP
Is this a bug or why there is a limitation to define the port only once?
Thanks, Nidhi
What did you expect to happen?
Expected both port names to be available in output.
How can we reproduce it (as minimally and precisely as possible)?
# kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- resources.yaml
# resources.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: test-object
data:
placeholder: data
Expected output
containers:
ports:
- name: app
containerPort: 9090
protocol: TCP
- name: metrics
containerPort: 9090
protocol: TCP
Actual output
containers:
ports:
- name: metrics
containerPort: 9090
protocol: TCP
Kustomize version
5.4.3
Operating system
Windows