Skip to content

Fix clusterresourcequota annotations validation - #10912

Merged
openshift-bot merged 1 commit into
openshift:masterfrom
fabianofranz:issues_10877
Sep 21, 2016
Merged

openshift-bot merged 1 commit into
openshift:masterfrom
fabianofranz:issues_10877

Conversation

@fabianofranz

@fabianofranz fabianofranz commented Sep 14, 2016 •

Copy link
Copy Markdown
Contributor

Fixes #10877 (client-side part)

@fabianofranz

fabianofranz commented Sep 14, 2016 •

Copy link
Copy Markdown
Contributor Author

@liggitt PTAL

@fabianofranz

Copy link
Copy Markdown
Contributor Author

[test]

// further validation is left to be done server-side.
func parseAnnotationSelector(s string) (map[string]string, error) {
parsed := map[string]string{}
if len(s) == 0 {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zero length should return nil, not {}

@liggitt liggitt changed the title Skimp clusterresourcequota annotations validation Fix clusterresourcequota annotations validation Sep 14, 2016
@liggitt

liggitt commented Sep 14, 2016 •

Copy link
Copy Markdown
Contributor

@smarterclayton for 1.3.0? (just for the API validation change)

}
if clusterquota.Spec.Selector.AnnotationSelector != nil {
allErrs = append(allErrs, validation.ValidateAnnotations(clusterquota.Spec.Selector.AnnotationSelector, field.NewPath("spec", "selector", "annotations"))...)
}

@liggitt liggitt Sep 14, 2016 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@deads2k this seem good to you? I like the early feedback about invalid keys

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine.

@liggitt liggitt modified the milestones: 1.3.0, 1.3.1 Sep 14, 2016
@liggitt

liggitt commented Sep 14, 2016

Copy link
Copy Markdown
Contributor

moved to 1.3.1, will need a release note since we're tightening validation

@fabianofranz
fabianofranz force-pushed the issues_10877 branch 2 times, most recently from 875f505 to cc53467 Compare September 14, 2016 21:08
@fabianofranz

Copy link
Copy Markdown
Contributor Author

@liggitt comments addressed, PTAL.

.nf
# Create an cluster resource quota limited to 10 pods
# Create a cluster resource quota limited to 10 pods
oc create clusterresourcequota limit\-bob \-\-project\-label\-selector=openshift.io/requester=user\-bob \-\-hard=pods=10

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the example should state project-annotation-selector considering openshift.io/requester is an annotation not label.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha, good catch. Fixed.

@fabianofranz

Copy link
Copy Markdown
Contributor Author

@liggitt 1.3.0 by any chance given the example was also wrong?

@liggitt

liggitt commented Sep 15, 2016

Copy link
Copy Markdown
Contributor

flaked on #10928
[test]

@liggitt liggitt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a couple test nits, LGTM otherwise

errorExpected: true,
},
{
input: "\"us=deads,liggitt,ffranz\"",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

raw strings make it clearer whether the escaping is part of the test or not

`"us=deads,liggitt,ffranz"`

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

input: "\"us=deads,liggitt,ffranz\"",
parsed: map[string]string{
"us": "deads,liggitt,ffranz",
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a test with multiple items that contains a value with a comma

`"a=1,2,3",b=1`

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

@liggitt liggitt self-assigned this Sep 15, 2016
@liggitt liggitt added the lgtm Indicates that a PR is ready to be merged. label Sep 15, 2016
@liggitt

liggitt commented Sep 15, 2016

Copy link
Copy Markdown
Contributor

LGTM

@openshift-bot openshift-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 16, 2016
Comment thread test/cmd/quota.sh

os::test::junit::declare_suite_start "cmd/quota"

# Cleanup cluster resources created by this test suite

@fabianofranz fabianofranz Sep 16, 2016 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stevekuznetsov PTAL? If this looks good I'll port to the release cherry-picks.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand why we'd want to wait for the namespaces to get cleaned up, but I think we should not do it because:

  • nowhere else do we bother
  • whoever is using the tests in that manner (existing cluster, rerun suite) hasn't complained yet
  • I want to kill wait_for_command, not increase its usage.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stevekuznetsov There are not many places where we delete the namespace before starting the suite, one of them is the templates.sh test and we do wait_for_command there. But I agree if it goes fine without the wait we better remove it. Done. Anything else?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, other than that it looks fine.

@openshift-bot openshift-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 16, 2016
@fabianofranz

Copy link
Copy Markdown
Contributor Author

[merge]

@openshift-bot

Copy link
Copy Markdown
Contributor

Evaluated for origin test up to 063c94a

@openshift-bot

Copy link
Copy Markdown
Contributor

Evaluated for origin merge up to 063c94a

@openshift-bot

Copy link
Copy Markdown
Contributor

@openshift-bot
openshift-bot merged commit bc0be34 into openshift:master Sep 21, 2016
@openshift-bot

Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants