Skip to content
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

Merged
merged 2 commits into from
Oct 19, 2016

Conversation

brendandburns
Copy link
Contributor

@brendandburns brendandburns commented Oct 9, 2016

Fixes #2965 (a nearly 2 year old feature request!)

@kubernetes/kubectl

@eparis


This change is Reviewable

@k8s-github-robot k8s-github-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. release-note-label-needed labels Oct 9, 2016
@k8s-ci-robot
Copy link
Contributor

Jenkins verification failed for commit fb1f6fec0f434d88f5c74ad1be0a547e6b303c9b. Full PR test history.

The magic incantation to run this job again is @k8s-bot verify test this. Please help us cut down flakes by linking to an open flake issue when you hit one in your PR.

@k8s-ci-robot
Copy link
Contributor

Jenkins GCI GCE e2e failed for commit c43b984. Full PR test history.

The magic incantation to run this job again is @k8s-bot gci gce e2e test this. Please help us cut down flakes by linking to an open flake issue when you hit one in your PR.

@k8s-ci-robot
Copy link
Contributor

Jenkins GKE smoke e2e failed for commit c43b984. Full PR test history.

The magic incantation to run this job again is @k8s-bot gke e2e test this. Please help us cut down flakes by linking to an open flake issue when you hit one in your PR.

}
}

type ConjunctiveSchema struct {
Copy link
Contributor

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.

Copy link
Contributor Author

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 {
Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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.

@brendandburns
Copy link
Contributor Author

@k8s-bot test this issue: IGNORE

(ran out of firewall quota)

@brendandburns
Copy link
Contributor Author

Comment addressed, please take another look.

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 13, 2016
@brendandburns brendandburns added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. release-note-label-needed labels Oct 14, 2016
@brendandburns
Copy link
Contributor Author

Rebased, ptal.

@brendandburns
Copy link
Contributor Author

Friendly monday ping on this one ;)

@thockin
Copy link
Member

thockin commented Oct 19, 2016

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...

@smarterclayton
Copy link
Contributor

I didn't think the JSONPath printer supports actual JSON (it supports types laid out with JSON tags, which is similar).

@thockin thockin assigned smarterclayton and unassigned thockin Oct 19, 2016
@smarterclayton smarterclayton added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 19, 2016
@k8s-ci-robot
Copy link
Contributor

Jenkins GCI GKE smoke e2e failed for commit d9d06f6. Full PR test history.

The magic incantation to run this job again is @k8s-bot gci gke e2e test this. Please help us cut down flakes by linking to an open flake issue when you hit one in your PR.

@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit 2de1f5c into kubernetes:master Oct 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants