add k8s compliant validation for label#2414
add k8s compliant validation for label#2414mjudeikis wants to merge 1 commit intoopenshift:masterfrom
Conversation
spadgett
left a comment
There was a problem hiding this comment.
Thanks for pointing out this problem and submitting a fix.
| 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.
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.
But this one still does not do "/" - like kubernetes.io/test ?
There was a problem hiding this comment.
Do we want to update label regexp too?
There was a problem hiding this comment.
It should split on / before testing the regex if you look further down.
There was a problem hiding this comment.
k, let me check what I can do :)
There was a problem hiding this comment.
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.
when it comes to directives and angularjs - I have to say - pass :/
There was a problem hiding this comment.
@mjudeikis I hope you don't mind: I went ahead and opened #2423 to use the label-editor
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:
