Description of problem: Duplicate error message for invalid parameter values in "oc label" and 'oc env' Version-Release number of selected component (if applicable): oc v1.0.4-510-g1be468d kubernetes v1.1.0-alpha.0-1605-g44c91b1 How reproducible: Always Steps to Reproduce: 1. Create a new project 2. Create rc and pod resources using tempaltes oc process -f /data/src/github.com/openshift/origin/examples/sample-app/application-template-stibuild.json | oc create -f - 3. Add environment variable to replicationcontrollers oc env rc/database-1 123$##%$#%=self -n yapei-test2 4.Add labels for a pod [fedora@ip-10-147-39-115 ~]$ oc label pod/database-1-wwts3 qwer1345%$$#=self -n yapei-test2 5. Update label for a pod $ oc label pod/database-1-wwts3 deployment=qyuertr124%$###$% -n yapei-test2 --config=openshift.local.config/master/admin.kubeconfig Actual results: result for step3: error: ReplicationController "database-1" is invalid: [spec.template.spec.containers[0].env[6].name: invalid value '1230#%0%', Details: must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[0].env[6].name: invalid value '1230#%0%', Details: must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName"] result for step4: The Pod "database-1-wwts3" is invalid. * metadata.labels: invalid value 'qwer1345%732#', Details: must be a qualified name (at most 63 characters, matching regex ([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]), with an optional DNS subdomain prefix (at most 253 characters, matching regex [a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*) and slash (/): e.g. "MyName" or "example.com/MyName" * metadata.labels: invalid value 'qwer1345%732#', Details: must be a qualified name (at most 63 characters, matching regex ([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]), with an optional DNS subdomain prefix (at most 253 characters, matching regex [a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*) and slash (/): e.g. "MyName" or "example.com/MyName" result for step5: error: invalid label spec: deployment=qyuertr124%!$(MISSING)%!(NOVERB) see 'oc label -h' for help. Expected results: result for step3: Error information should be displayed only once result for step4: Error information should be displayed only once result for step5: Should promote error information about invalid value "qyuertr124%$###$%"and give suggestion about what value is valid, just as the web console does [a valid label value is an alphanumberic(a-z,and 0-9)string,with a maximum length of 63 characters with the '-'character allowed anywhere except for the first and last character] Additional info:
Hm, I cannot seem to replicate steps 3 and 5 oc version: oc v1.3.0-alpha.0+8e93729-dirty kubernetes v1.3.0+507d3a7 features: Basic-Auth $ oc env rc/database-1 123$##%$#%=self there is no need to specify a resource type as a separate argument when passing arguments in resource/name form (e.g. 'oc get resource/<resource_name>' instead of 'oc get resource resource/<resource_name>' $ oc label po/database-1-fn0r7 deployment=@#$^^ error: invalid label value: "deployment=@#": must match the regex (([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])? (e.g. 'MyValue' or 'my_value' or '12345') See 'oc label -h' for help and examples. Note: Adding a label with an invalid key (step 4) does give me the same error multiple times, I will look into that.
Related PR: https://github.com/openshift/origin/pull/10317
Invalid Env Name for 'oc set env' # oc set env rc/database-1 test-abc=1234 error: ReplicationController "database-1" is invalid: [spec.template.spec.containers[0].env[5].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName", spec.template.spec.containers[0].env[5].name: Invalid value: "test-abc": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName"] Invalid Label Name for 'oc label' # oc label pod/database-1-rxol6 qwer1345@-abc=self -n yapei-bug The Pod "database-1-rxol6" is invalid. metadata.labels: Invalid value: "qwer1345@-abc": name part must match the regex ([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9] (e.g. 'MyName' or 'my.name' or '123-abc') Invalid Label Value for 'oc label' # oc label pod/database-1-rxol6 self=qwer1345@-abc -n yapei-bug error: invalid label value: "self=qwer1345@-abc": must match the regex (([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])? (e.g. 'MyValue' or 'my_value' or '12345') See 'oc label -h' for help and examples. For 'oc label' we got error message only once However we still get duplicated error message for 'oc set env'(since 'oc env' is DEPRECATED:This command has been moved to "oc set env")
Thanks for catching this. Related PR: https://github.com/openshift/origin/pull/10613
Fixed in: openshift v1.3.0-alpha.3+d8c9694 kubernetes v1.3.0+507d3a7 etcd 2.3.0+git [xxia@ip-172-18-13-122 ~]$ oc env rc/database-1 123$##%$#%=self error: environment variables must be of the form key=value and can only contain letters, numbers, and underscores [xxia@ip-172-18-13-122 ~]$ oc label pod/database-1-5gohf qwer1345%$$#=self The Pod "database-1-5gohf" is invalid. metadata.labels: Invalid value: "qwer1345%3880#": name part must match the regex ([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9] (e.g. 'MyName' or 'my.name' or '123-abc') Now error message is not duplicated