Description of problem: 1.when use "osc lable" command to update resource label with empty value, it can success. But when use this label to filter the resource, it tip the label invalid. So we shouldn't update resource label with empty value. 2.When use invalid characters as the label value, the tip should be friendly. Version-Release number of selected component (if applicable): openshift v0.5.1-230-g8bbf71f kubernetes v0.17.0-441-g6b6b47a devenv-fedora_1572 (ami-0c213864) How reproducible: Always Steps to Reproduce: 1.Get the service under a namespace $ osc get service -n test NAME LABELS SELECTOR IP(S) PORT(S) database template=application-template-stibuild name=database 172.30.247.87 5434/TCP 2.Add label with empty value for service $ osc label service database color= -n test 3.Use the empty label to filter the resource $ osc get service -l color= -n test the provided selector "color=" is not valid: unable to parse requiremnt: found '', expected: identifier 4.Add label with empty value for service $ osc label service database testlable=@#$% -n test Actual results: 2.Update the label successfully $ osc label service database color= -n test NAME LABELS SELECTOR IP(S) PORT(S) database color=,template=application-template-stibuild name=database 172.30.247.87 5434/TCP 3.$ osc get service -l color= -n test the provided selector "color=" is not valid: unable to parse requiremnt: found '', expected: identifier 4.$ osc label service database testlable=@#$% -n test Error from server: service "database" is invalid: [metadata.labels: invalid value '@#$%': must have at most 63 characters, matching regex (([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?: e.g. "MyValue" or "", metadata.labels: invalid value '@#$%': must have at most 63 characters, matching regex (([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?: e.g. "MyValue" or ""] Expected results: 2.Can't update label with empty value 4.When use invalid value, the tip should be friendly. Additional info:
Commit pushed to master at https://github.com/openshift/origin https://github.com/openshift/origin/commit/50a64d912dd08ec9e0da18fe6ec81e4e7f95346d Bug 1223252: UPSTREAM: label: Invalidate empty or invalid value labels
Test on devenv-fedora_1626. This bug is fixed. 1. Add label with empty value. $ osc label service database color= -n test error: invalid label spec: color= see 'osc label -h' for help. 2.Add label with invalid value. $ osc label service database testlable=@#$% -n test error: invalid label spec: testlable=@#$%!(NOVERB) see 'osc label -h' for help.
Fixed in https://github.com/openshift/origin/pull/3200
Commit pushed to master at https://github.com/openshift/origin https://github.com/openshift/origin/commit/19f85548a34addccc7ff99bc5491018382281639 Bug 1223252: UPSTREAM: label: Invalidate empty or invalid value labels
Test on devenv-fedora_1896. verify this bug. 1.Set label with empty value. [fedora@ip-10-138-107-235 examples]$ oc label pod hello-openshift color= -n dma1 error: invalid label spec: color= see 'oc label -h' for help. 2.Set label with invalid value. [fedora@ip-10-138-107-235 examples]$ oc label pod hello-openshift testlable=@#$% -n dma1 error: invalid label spec: testlable=@#$%!(NOVERB) see 'oc label -h' for help.