kubernetes/apimachinery

Label Selector doesn't allow `/` in key or value

mukrishn opened this issue · 1 comments

On trying to use label selector with special characters like / is not allowed by this client library but allowed in k8s.

const qnameExtCharFmt string = "[-A-Za-z0-9_.]"

Should also consider / as part of this regex ExtChar.

Error on using a label selector

github.com/kubernetes-sigs/cluster-proportional-autoscaler/pkg/autoscaler/k8sclient/k8sclient.go:97: Failed to watch *v1.Node: failed to list *v1.Node: unable to parse requirement: values[0][node-role.kubernetes.io/worker]: Invalid value: "\"\"": a valid label must be an empty string or consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyValue', or 'my_value', or '12345', regex used for validation is '(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?')

But supported in k8s

# kubectl label --help
Update the labels on a resource.

  *  A label key and value must begin with a letter or number, and may contain letters, numbers,
hyphens, dots, and underscores, up to  63 characters each.
  *  Optionally, the key can begin with a DNS subdomain prefix and a single '/', like
example.com/my-app.

it has been already taken care, the error is because of invalid value to it "".