Bug 1614155

Summary: Env variable key needs to allow "-" for bc
Product: OpenShift Container Platform Reporter: XiaochuanWang <xiaocwan>
Component: BuildAssignee: Corey Daley <cdaley>
Status: CLOSED ERRATA QA Contact: Wenjing Zheng <wzheng>
Severity: low Docs Contact:
Priority: medium    
Version: 3.11.0CC: aos-bugs, jokerman, mmccomas, spadgett
Target Milestone: ---Keywords: Reopened
Target Release: 3.11.z   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
undefined
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-12-12 14:15:51 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description XiaochuanWang 2018-08-09 05:34:32 UTC
Description of problem:
On web console, dc allows "-" but bc does not allow it. 

Version-Release number of selected component (if applicable):
OpenShift Master: v3.11.0-0.11.0 
Kubernetes Master: v1.11.0+d4cacc0 
OpenShift Web Console: v3.11.0-0.11.0 

How reproducible:
always

Steps to Reproduce:
1. Login on web console, create an app by eg. oc new-app ruby~https://github.com/openshift/ruby-ex.git

2. Go to build config page, add env var, set the key to "test-key", "-key" with values


Actual results:
2. Error message pop up "An error occurred updating environment variables for build config ruby-sample-build."

Expected results:
2. Key should be added succesfully

Additional info:

Comment 1 Samuel Padgett 2018-08-09 12:45:32 UTC
`-key` not currently a valid env var name for build configs, which have different rules than deployment configs. This is enforced by the API server and not the console.

Reassigning to the build component. It looks like env var name validation was relaxed upstream in 1.8.

https://github.com/kubernetes/kubernetes/blob/8d7d7a5e0d4d7e75f5a860574346944b8cc0fc43/staging/src/k8s.io/apimachinery/pkg/util/validation/validation.go#L305-L306

Comment 2 Corey Daley 2018-08-23 18:29:35 UTC
submitted pull request: https://github.com/openshift/origin/pull/20738

Comment 6 XiaochuanWang 2018-12-04 05:27:01 UTC
      env:
        - name: test-key
          value: '-v'
        - name: '-key'
          value: '-value'
Env variables are added correctly now, verified on Openshift v3.11.51.

Comment 8 errata-xmlrpc 2018-12-12 14:15:51 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:3743