-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kustomize 5 build returns error when labels on a resource is null #5050
Comments
What is the intention of including /triage needs-information |
@KnVerey here's another example where Kustomize 5 isn't able to process null values that Kustomize 4 and Kubernetes (e.g. kubectl apply) are okay with, which is
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: nginx
name: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
initContainers: null
containers:
- name: nginx
image: nginx
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
template:
spec:
imagePullSecrets:
- name: example-pull-secret
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
patchesStrategicMerge:
- pull-secret.yaml
resources:
- deployment.yaml Running kustomize build: $ kustomize build kustomize-example/
# Warning: 'patchesStrategicMerge' is deprecated. Please use 'patches' instead. Run 'kustomize edit fix' to update your Kustomization automatically.
Error: updating name reference in 'spec/template/spec/initContainers/env/valueFrom/configMapKeyRef/name' field of 'Deployment.v1.apps/nginx.[noNs]': considering field 'spec/template/spec/initContainers/env/valueFrom/configMapKeyRef/name' of object Deployment.v1.apps/nginx.[noNs]: expected sequence or mapping node |
For example, there are helm charts out there that produce null values depending on the result of templating. |
@KnVerey any plans to address this issue? this unfortunately breaks some of the Helm charts our customers are using in production and it's not easily workaround-able without breaking existing functionality. |
Any updates? |
Is anyone able to look at this issue? This remains a blocker to our upgrading to 5.x. |
Hi @KnVerey, I have some more interesting findings as it relates to this issue. Apologies in advance for the lengthy comment... It appears that kustomize will actually add
If I simply run this resource through kustomize without any transformations:
The build output is the following:
If I then try to apply a label transformer and patch to this output, it will fail with the aforementioned error. However, it will not if I use the original resource with the empty
Result:
After swapping out
|
Any updates from maintainers? |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues. This bot triages un-triaged issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues. This bot triages un-triaged issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /close not-planned |
@k8s-triage-robot: Closing this issue, marking it as "Not Planned". In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
What happened?
kustomize build(V5.0.0) with patches and transformer on a resource having labels as null returns error:
What did you expect to happen?
expected: kustomize build to
merge the resources and resulting yaml to be returned.
kustomize v4.5.7 build returned the results when
labels: null
[as expected]If I remove
labels: null
from resources the kustomize build works [but should work withlabels:null
]How can we reproduce it (as minimally and precisely as possible)?
Expected output
Actual output
Kustomize version
V5.0.0
Operating system
Linux
The text was updated successfully, but these errors were encountered: