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

Loosen label and annotation validation and related tests #4898

Merged
merged 3 commits into from
Mar 6, 2015

Conversation

gmarek
Copy link
Contributor

@gmarek gmarek commented Feb 27, 2015

No description provided.

}
totalSize += (int64)(len(k)) + (int64)(len(v))
}
if totalSize > (int64)(util.TotalAnnotationSizeB) {
Copy link
Member

Choose a reason for hiding this comment

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

The total allowed annotation size is an attribute of the API, not an attribute of util. I'm trying to keep the util.* plausibly generic - not kubernetes policy in there. This const should move to this file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved to validation.go

@gmarek gmarek force-pushed the client2 branch 2 times, most recently from fa5e5f8 to 15f6d1f Compare March 2, 2015 14:08
@gmarek
Copy link
Contributor Author

gmarek commented Mar 4, 2015

Friendly ping

return true
}

const kubeToken string = "[A-Za-z0-9]"
Copy link
Member

Choose a reason for hiding this comment

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

just nits:

"token" implies a word, but this is a char.

Suggest "qualNameChar" for what you call kubeToken, "qualNameInnerChar" for extendedKubeToken

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I figured out that we can be even move general, as those definitions will be used for label value format as well. I went with kubeChar and extendedKubeChar.

const extendedKubeChar string = "[-A-Za-z0-9_.]"
const qualifiedToken string = "(" + kubeChar + extendedKubeChar + "*)?" + kubeChar

const LabelValueFmt string = "((" + kubeChar + extendedKubeChar + "*)?" + kubeChar + ")?"
Copy link
Member

Choose a reason for hiding this comment

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

Why not define this as "(" + qualifiedToken + ")?" - is that offensive to the purist in you?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope:)

@thockin
Copy link
Member

thockin commented Mar 6, 2015

I'm going to merge this - my last comments are nits and can be done in a followup.

thockin added a commit that referenced this pull request Mar 6, 2015
Loosen label and annotation validation and related tests
@thockin thockin merged commit ca265c5 into kubernetes:master Mar 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants