-
Notifications
You must be signed in to change notification settings - Fork 38.8k
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
Add validation that detects repeated keys in the labels and annotations maps #34407
Add validation that detects repeated keys in the labels and annotations maps #34407
Conversation
Jenkins verification failed for commit fb1f6fec0f434d88f5c74ad1be0a547e6b303c9b. Full PR test history. The magic incantation to run this job again is |
fb1f6fe
to
c43b984
Compare
Jenkins GCI GCE e2e failed for commit c43b984. Full PR test history. The magic incantation to run this job again is |
Jenkins GKE smoke e2e failed for commit c43b984. Full PR test history. The magic incantation to run this job again is |
} | ||
} | ||
|
||
type ConjunctiveSchema struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could just declare this as type ConjunctiveSchema []Schema
. More idiomatic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
@@ -62,6 +64,70 @@ type NullSchema struct{} | |||
|
|||
func (NullSchema) ValidateBytes(data []byte) error { return nil } | |||
|
|||
type NoDoubleKeySchema struct{} | |||
|
|||
func (NoDoubleKeySchema) ValidateBytes(data []byte) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunate that you have to hardcode just two fields. This would be a lot more useful if it traversed all maps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the trouble is that this is bytes, we could automatically build up a map for every runtime.Object I suppose. Follow on PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't think of a way to improve it, just noting that we really want a SAX / streaming parser here.
@k8s-bot test this issue: IGNORE (ran out of firewall quota) |
Comment addressed, please take another look. |
66e3ee5
to
d9d06f6
Compare
Rebased, ptal. |
Friendly monday ping on this one ;) |
I didn't realize this was assigned to me. 2 questions: 1) who knows the schema validation logic, because I don't. 2) don't we already have a JSONpath decoder somewhere? I know we decode JSONpath for kubectl... |
I didn't think the JSONPath printer supports actual JSON (it supports types laid out with JSON tags, which is similar). |
Jenkins GCI GKE smoke e2e failed for commit d9d06f6. Full PR test history. The magic incantation to run this job again is |
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
Automatic merge from submit-queue |
Fixes #2965 (a nearly 2 year old feature request!)
@kubernetes/kubectl
@eparis
This change is![Reviewable](https://camo.githubusercontent.com/2d899f4291d07d3cd2fa4aaae1e3b243f164c23fce87d30a589ace0d496a444c/68747470733a2f2f72657669657761626c652e6b756265726e657465732e696f2f7265766965775f627574746f6e2e737667)