kubernetes: yaml and json parsers silently drop duplicate keys

spec:
  selector:
    app: foobar-service
    track: prod
    track: post-prod-staging

I can’t seem to find how to define IN semantic for svc’s selector, I tried to above and it resulted in only the last one being used:

> kubectl describe svc svc-prod-svc
Name:                   svc-prod-svc
Namespace:              default
Labels:                 <none>
Selector:               app=foobar-service,track=post-prod-staging

kubectl should probably notify of duplication and fail, or are least print warning.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 3
  • Comments: 15 (10 by maintainers)

Most upvoted comments

The API Machinery is not so simple and not what I usually work on. https://github.com/kubernetes/kubernetes/issues/78946 may help as a pointer to where some of it is from last time I dug into a related issue.

@BenTheElder I was assigned #100213, In our investigation it lead us to this, I would like to work on this issue, I am not sure exactly where to begin, can you point me to the bit of code in the api-machinery where the unmarshalling is happening