Skip to content

should clusterresourcequota support email address? #10877

Closed

Description

@andrewklau

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.

Activity

  1. liggitt commented on Sep 11, 2016

    @liggitt
    Contributor

    That should work in the annotations portion of the selector. Can you include the JSON of the clusterresourcequota you are trying to create?

  2. andrewklau commented on Sep 11, 2016

    @andrewklau
    ContributorAuthor

    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')

  3. liggitt commented on Sep 11, 2016

    @liggitt
    Contributor

    The requester is stored in an annotation, not a label.

  4. andrewklau commented on Sep 11, 2016

    @andrewklau
    ContributorAuthor

    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')
    
  5. liggitt commented on Sep 11, 2016

    @liggitt
    Contributor

    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

  6. andrewklau commented on Sep 12, 2016

    @andrewklau
    ContributorAuthor

    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.

  7. added
    kind/bug
    and removed on Sep 13, 2016
  8. liggitt commented on Sep 14, 2016

    @liggitt
    Contributor

    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

  9. fabianofranz commented on Sep 14, 2016

    @fabianofranz
    Contributor

    on it

  10. fabianofranz commented on Sep 14, 2016

    @fabianofranz
    Contributor

    Client-side fix proposed in #10912.

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

Metadata

Metadata

Labels

component/clikind/bugpriority/P1

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions