-
Notifications
You must be signed in to change notification settings - Fork 231
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 k8s compliant validation for label #2414
Conversation
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.
Thanks for pointing out this problem and submitting a fix.
@@ -221,8 +221,8 @@ | |||
entries="claim.selectedLabels" | |||
key-placeholder="label" | |||
value-placeholder="value" | |||
key-validator="[a-zA-Z][a-zA-Z0-9_-]*" | |||
key-validator-error-tooltip="A valid label name is an alphanumeric (a-z and 0-9) string beginning with a letter that may contain underscores and dashes." | |||
key-validator="[a-zA-Z][a-zA-Z0-9_.-\/]*" |
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.
It looks like the label validation is more complicated than this, and the original regex on this page was incorrectly copied from an env variables editor. See
Can you try to use the label-editor
directive here instead? Here's an example:
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.
But this one still does not do "/" - like kubernetes.io/test ?
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.
Do we want to update label regexp too?
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.
It should split on /
before testing the regex if you look further down.
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.
k, let me check what I can do :)
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.
k, having some trouble to use label-editor
directive... there is some styles clashing, which makes directive not visible (my assumption)... my UI skills are rusty :/
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.
when it comes to directives and angularjs - I have to say - pass :/
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.
@mjudeikis I hope you don't mind: I went ahead and opened #2423 to use the label-editor
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.
all good :) Thanks
Automatic merge from submit-queue. Use label-editor for PVC labels Fixes a problem where the regex used for validating label names is wrong. Names with a `/` were incorrectly blocked. See discussion in #2414   /kind bug /assign @jwforres cc @mjudeikis
If I have storageclass like this:
I want to use UI and create storage claim and provide label selector. As per K8S docs labels can have . and / as keys (https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/)
But our validation does not allow this from UI:

We want this to be valid:
