-
Notifications
You must be signed in to change notification settings - Fork 1k
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
v3: feature request: yaml should provide function to disable unique keys. #751
Comments
Please consider adding this. I have a real world example. If you look at the spec for deploying ports:
- name: http
containerPort: 80
protocol: TCP
- name: https
containerPort: 80
protocol: TCP
- name: tohttps
containerPort: 2443
protocol: TCP
- name: webhook
containerPort: 8443
protocol: TCP When run through kustomize (which uses go-yaml), it generates the following error:
But this is the way the spec needs to be. I know @xyz-li added a PR in Kustomize to disable unique key check but it was rejected because they wanted to handle it here instead. As it stands right now, my deployment is broken because of this. Can someone please strongly consider adopting this feature? |
@davisford What you have is duplicate kubernetes merge keys. Related: kubernetes/kubernetes#39188 That is not the same thing as YAML keys, which what this issue is about. go-yaml (correctly) throws an error with something like:
Or something like:
(Notice the duplicate As I've stated in the other PR you commented on in kustomize, I believe that your problem is with duplicate kubernetes merge keys, which is distinct from YAML keys and probably not related to this issue. |
Is this stalled? Any updates on this? |
Why we need this feature?
The
strict
flag was split intoknownFields
anduniqueKeys
in commit 085f382.But in commit 309c9d1,
uniqueKeys
was dropped and set to true.If yaml text has duplicate keys,
Decoder.Decode
andyaml.Unmarshal
will return errors. This result in application likes kustomize returns errors after version v3.9.0, since kustomize usesyaml.Unmarshal
of v3.I think it is a good option to provide a function to disable unique keys, then these application could ignore duplicate keys.
Related issues
kubernetes-sigs/kustomize#3480
kubesphere/kubesphere#3933
The text was updated successfully, but these errors were encountered: