You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
should clusterresourcequota support email address? #10877
I would assume a common use case for many would be to have email addresses as usernames, however clusterresourcequota
does not accept email address as a valid regex pattern.
error: couldn't parse the selector string "openshift.io/[email protected]": unable to parse requirement: invalid label value: "[email protected]": must match the regex (([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])? (e.g. 'MyValue' or 'my_value' or '12345')
Manually modifying the clusterresource to bypass the regex validation, the user is also not selected.
Posting the JSON to the API or editing it with oc accepts the JSON, but the quota isn't applied to the user.
My assumptions for above is when I tried the oc create:
oc create clusterresourcequota test --project-label-selector=openshift.io/[email protected] --hard=pods=10
error: couldn't parse the selector string "openshift.io/requester=[email protected]": unable to parse requirement: invalid label value: "[email protected]": must match the regex (([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])? (e.g. 'MyValue' or 'my_value' or '12345')
Ah missed that! Then the example in oc create clusterresourcequota is a bit misleading:
Examples:
# Create an cluster resource quota limited to 10 pods
oc create clusterresourcequota limit-bob --project-label-selector=openshift.io/requester=user-bob --hard=pods=10
But the issue still happens when using the project annotation:
oc create clusterresourcequota test3 --project-annotation-selector=openshift.io/[email protected] --hard=pods=10
error: couldn't parse the selector string "openshift.io/[email protected]": unable to parse requirement: invalid label value: "[email protected]": must match the regex (([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])? (e.g. 'MyValue' or 'my_value' or '12345')
The code that parses the CLI arg into the annotations selector map is likely trying to use the label selector parsing code, which operates on a much more constrained syntax
there are two bugs here, one is server-side with the way clusterresourcequota annotation selection was used to select projects. the other is on the CLI with the way special characters interact with specifying the annotation selector. #10896 fixes the server-side issue. leaving this open until the CLI issue is fixed as well
Activity
liggitt commentedon Sep 11, 2016
That should work in the annotations portion of the selector. Can you include the JSON of the clusterresourcequota you are trying to create?
andrewklau commentedon Sep 11, 2016
Posting the JSON to the API or editing it with oc accepts the JSON, but the quota isn't applied to the user.
My assumptions for above is when I tried the oc create:
oc create clusterresourcequota test --project-label-selector=openshift.io/[email protected] --hard=pods=10error: couldn't parse the selector string "openshift.io/requester=[email protected]": unable to parse requirement: invalid label value: "[email protected]": must match the regex (([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])? (e.g. 'MyValue' or 'my_value' or '12345')
liggitt commentedon Sep 11, 2016
The requester is stored in an annotation, not a label.
andrewklau commentedon Sep 11, 2016
Ah missed that! Then the example in
oc create clusterresourcequotais a bit misleading:But the issue still happens when using the project annotation:
liggitt commentedon Sep 11, 2016
The code that parses the CLI arg into the annotations selector map is likely trying to use the label selector parsing code, which operates on a much more constrained syntax
andrewklau commentedon Sep 12, 2016
Yes looks like it, but the selector will still not match the user.
example json:
{ "kind": "ClusterResourceQuota", "apiVersion": "v1", "metadata": { "name": "test3", "creationTimestamp": null }, "spec": { "selector": { "labels": null, "annotations": { "openshift.io/requester": "[email protected]" } }, "quota": { "hard": { "pods": "10" } } } }If the user was just testuser it would match and apply the quota.
liggitt commentedon Sep 14, 2016
there are two bugs here, one is server-side with the way clusterresourcequota annotation selection was used to select projects. the other is on the CLI with the way special characters interact with specifying the annotation selector. #10896 fixes the server-side issue. leaving this open until the CLI issue is fixed as well
fabianofranz commentedon Sep 14, 2016
on it
fabianofranz commentedon Sep 14, 2016
Client-side fix proposed in #10912.