Bug 1635513

Summary: Failed to pass the proxy environment variable to s2i build container.
Product: OpenShift Container Platform Reporter: Praveen Kumar <prkumar>
Component: BuildAssignee: Ben Parees <bparees>
Status: CLOSED NOTABUG QA Contact: Wenjing Zheng <wzheng>
Severity: high Docs Contact:
Priority: unspecified    
Version: 3.10.0CC: aos-bugs, bparees, deads, lmohanty, me, mfojtik, veillard
Target Milestone: ---   
Target Release: 3.10.z   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-08 12:37:52 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 Praveen Kumar 2018-10-03 06:52:05 UTC
Description of problem:
oc new-app doesn't work if the cluster is provisioned using `oc cluster up` along with the proxy.

Version-Release number of selected component (if applicable):

$ oc version
openshift v3.10.45
kubernetes v1.10.0+b81c8f8

How reproducible:
step 1: start the cluster using `oc cluster up` along with proxy parameters.
$ ./oc cluster up --http-proxy http://<proxy_server>:3128 --no-proxy $(docker network inspect -f "{{range .IPAM.Config }}{{ .Subnet }}{{end}}" bridge) --loglevel 10

[...]

Server Information ...
OpenShift server started.

The server is accessible via web console at:
    https://127.0.0.1:8443

You are logged in as:
    User:     developer
    Password: <any value>

To login as administrator:
    oc login -u system:admin


Step-2. Deploy an application on recently created cluster.

$ oc new-app centos/ruby-22-centos7~https://github.com/openshift/ruby-ex.git

Step-3. Check the env variable of the builder containers.

Actual results:

Builder container doesn't have any proxy env details.

```
# env
SOURCE_URI=https://github.com/openshift/django-ex.git
HOSTNAME=django-ex-1-build
DJANGO_EX_PORT_8080_TCP_ADDR=172.30.190.91
RUBY_EX_SERVICE_PORT_8080_TCP=8080
DJANGO_EX_PORT_8080_TCP_PROTO=tcp
KUBERNETES_PORT_443_TCP_PORT=443
KUBERNETES_PORT=tcp://172.30.0.1:443
TERM=xterm
KUBERNETES_SERVICE_PORT=443
KUBERNETES_SERVICE_HOST=172.30.0.1
KUBERNETES_PORT_53_TCP=tcp://172.30.0.1:53
RUBY_EX_PORT_8080_TCP_ADDR=172.30.252.3
KUBERNETES_PORT_53_TCP_PORT=53
KUBERNETES_PORT_53_UDP=udp://172.30.0.1:53
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=01;36:*.au=01;36:*.flac=01;36:*.mid=01;36:*.midi=01;36:*.mka=01;36:*.mp3=01;36:*.mpc=01;36:*.ogg=01;36:*.ra=01;36:*.wav=01;36:*.axa=01;36:*.oga=01;36:*.spx=01;36:*.xspf=01;36:
KUBERNETES_SERVICE_PORT_DNS=53
DJANGO_EX_SERVICE_HOST=172.30.190.91
KUBECONFIG=/var/lib/origin/openshift.local.config/master/admin.kubeconfig
RUBY_EX_PORT_8080_TCP_PORT=8080
ALLOWED_UIDS=1-
PUSH_DOCKERCFG_PATH=/var/run/secrets/openshift.io/push
KUBERNETES_PORT_53_TCP_ADDR=172.30.0.1
RUBY_EX_SERVICE_HOST=172.30.252.3
KUBERNETES_PORT_53_UDP_ADDR=172.30.0.1
DROP_CAPS=KILL,MKNOD,SETGID,SETUID
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
BUILD={"kind":"Build","apiVersion":"v1","metadata":{"name":"django-ex-1","namespace":"myproject","selfLink":"/apis/build.openshift.io/v1/namespaces/myproject/builds/django-ex-1","uid":"04a5e900-bfc8-11e8-9059-06f51ac1ee93","resourceVersion":"2682","creationTimestamp":"2018-09-24T07:04:02Z","labels":{"app":"django-ex","buildconfig":"django-ex","openshift.io/build-config.name":"django-ex","openshift.io/build.start-policy":"Serial"},"annotations":{"openshift.io/build-config.name":"django-ex","openshift.io/build.number":"1"},"ownerReferences":[{"apiVersion":"build.openshift.io/v1","kind":"BuildConfig","name":"django-ex","uid":"0484e540-bfc8-11e8-9059-06f51ac1ee93","controller":true}]},"spec":{"serviceAccount":"builder","source":{"type":"Git","git":{"uri":"https://github.com/openshift/django-ex.git","ref":"master"}},"strategy":{"type":"Source","sourceStrategy":{"from":{"kind":"DockerImage","name":"172.30.1.1:5000/openshift/python@sha256:51cf14c1d1491c5ab0e902c52740c22d4fff52f95111b97d195d12325a426350"},"pullSecret":{"name":"builder-dockercfg-5h277"}}},"output":{"to":{"kind":"DockerImage","name":"172.30.1.1:5000/myproject/django-ex:latest"},"pushSecret":{"name":"builder-dockercfg-5h277"}},"resources":{},"postCommit":{},"nodeSelector":null,"triggeredBy":[{"message":"Build configuration change"}]},"status":{"phase":"New","outputDockerImageReference":"172.30.1.1:5000/myproject/django-ex:latest","config":{"kind":"BuildConfig","namespace":"myproject","name":"django-ex"},"output":{}}}

PWD=/var/lib/origin
RUBY_EX_PORT_8080_TCP=tcp://172.30.252.3:8080
RUBY_EX_PORT=tcp://172.30.252.3:8080
LANG=en_US.UTF-8
DJANGO_EX_PORT_8080_TCP_PORT=8080
KUBERNETES_PORT_53_UDP_PORT=53
SOURCE_REF=master
DJANGO_EX_SERVICE_PORT_8080_TCP=8080
DJANGO_EX_PORT_8080_TCP=tcp://172.30.190.91:8080
SOURCE_REPOSITORY=https://github.com/openshift/django-ex.git
SHLVL=1
HOME=/root
KUBERNETES_PORT_53_UDP_PROTO=udp
DJANGO_EX_SERVICE_PORT=8080
KUBERNETES_PORT_443_TCP_PROTO=tcp
DJANGO_EX_PORT=tcp://172.30.190.91:8080
KUBERNETES_SERVICE_PORT_HTTPS=443
RUBY_EX_SERVICE_PORT=8080
LESSOPEN=||/usr/bin/lesspipe.sh %s
PULL_DOCKERCFG_PATH=/var/run/secrets/openshift.io/pull
KUBERNETES_SERVICE_PORT_DNS_TCP=53
KUBERNETES_PORT_443_TCP_ADDR=172.30.0.1
KUBERNETES_PORT_53_TCP_PROTO=tcp
KUBERNETES_PORT_443_TCP=tcp://172.30.0.1:443
RUBY_EX_PORT_8080_TCP_PROTO=tcp
```


Expected results:

Should have proxy details same as 3.9.0 version had.

```
# env
SOURCE_URI=https://github.com/openshift/ruby-ex.git
HOSTNAME=ruby-ex-1-build
RUBY_EX_SERVICE_PORT_8080_TCP=8080
KUBERNETES_PORT=tcp://172.30.0.1:443
KUBERNETES_PORT_443_TCP_PORT=443
TERM=xterm
OPENSHIFT_CONTAINERIZED=true
KUBERNETES_SERVICE_PORT=443
KUBERNETES_SERVICE_HOST=172.30.0.1
KUBERNETES_PORT_53_TCP=tcp://172.30.0.1:53
RUBY_EX_PORT_8080_TCP_ADDR=172.30.202.127
KUBERNETES_PORT_53_TCP_PORT=53
KUBERNETES_PORT_53_UDP=udp://172.30.0.1:53
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=01;36:*.au=01;36:*.flac=01;36:*.mid=01;36:*.midi=01;36:*.mka=01;36:*.mp3=01;36:*.mpc=01;36:*.ogg=01;36:*.ra=01;36:*.wav=01;36:*.axa=01;36:*.oga=01;36:*.spx=01;36:*.xspf=01;36:
KUBERNETES_SERVICE_PORT_DNS=53
KUBECONFIG=/var/lib/origin/openshift.local.config/master/admin.kubeconfig
RUBY_EX_PORT_8080_TCP_PORT=8080
ALLOWED_UIDS=1-
PUSH_DOCKERCFG_PATH=/var/run/secrets/openshift.io/push
RUBY_EX_SERVICE_HOST=172.30.202.127
KUBERNETES_PORT_53_TCP_ADDR=172.30.0.1
KUBERNETES_PORT_53_UDP_ADDR=172.30.0.1
DROP_CAPS=KILL,MKNOD,SETGID,SETUID
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
BUILD={"kind":"Build","apiVersion":"v1","metadata":{"name":"ruby-ex-1","namespace":"myproject","selfLink":"/apis/build.openshift.io/v1/namespaces/myproject/builds/ruby-ex-1","uid":"0b8631a5-bfc9-11e8-aaf7-2a459d1779aa","resourceVersion":"1540","creationTimestamp":"2018-09-24T07:11:23Z","labels":{"app":"ruby-ex","buildconfig":"ruby-ex","openshift.io/build-config.name":"ruby-ex","openshift.io/build.start-policy":"Serial"},"annotations":{"openshift.io/build-config.name":"ruby-ex","openshift.io/build.number":"1"},"ownerReferences":[{"apiVersion":"build.openshift.io/v1","kind":"BuildConfig","name":"ruby-ex","uid":"0b722313-bfc9-11e8-aaf7-2a459d1779aa","controller":true}]},"spec":{"serviceAccount":"builder","source":{"type":"Git","git":{"uri":"https://github.com/openshift/ruby-ex.git","ref":"master","httpProxy":"http://10.65.193.158:3128","noProxy":"localhost,127.0.0.1,172.30.1.1,127.0.0.1,192.168.64.29,localhost,172.30.1.1,172.30.1.2,172.30.0.0/8"}},"strategy":{"type":"Source","sourceStrategy":{"from":{"kind":"DockerImage","name":"docker.io/centos/ruby-24-centos7@sha256:d6529b7680fa77f27592de43a86342bf21bdfa066f7eb8d50e5d8ae9b9a7d141"},"env":[{"name":"NO_PROXY","value":"localhost,127.0.0.1,172.30.1.1,127.0.0.1,192.168.64.29,localhost,172.30.1.1,172.30.1.2,172.30.0.0/8"},{"name":"no_proxy","value":"localhost,127.0.0.1,172.30.1.1,127.0.0.1,192.168.64.29,localhost,172.30.1.1,172.30.1.2,172.30.0.0/8"},{"name":"HTTP_PROXY","value":"http://10.65.193.158:3128"},{"name":"http_proxy","value":"http://10.65.193.158:3128"},{"name":"HTTPS_PROXY"},{"name":"https_proxy"}]}},"output":{"to":{"kind":"DockerImage","name":"172.30.1.1:5000/myproject/ruby-ex:latest"},"pushSecret":{"name":"builder-dockercfg-zjhhh"}},"resources":{},"postCommit":{},"nodeSelector":null,"triggeredBy":[{"message":"Image change","imageChangeBuild":{"imageID":"docker.io/centos/ruby-24-centos7@sha256:d6529b7680fa77f27592de43a86342bf21bdfa066f7eb8d50e5d8ae9b9a7d141","fromRef":{"kind":"ImageStreamTag","namespace":"openshift","name":"ruby:2.4"}}}]},"status":{"phase":"New","outputDockerImageReference":"172.30.1.1:5000/myproject/ruby-ex:latest","config":{"kind":"BuildConfig","namespace":"myproject","name":"ruby-ex"},"output":{}}}

PWD=/var/lib/origin
RUBY_EX_PORT_8080_TCP=tcp://172.30.202.127:8080
RUBY_EX_PORT=tcp://172.30.202.127:8080
LANG=en_US.UTF-8
KUBERNETES_PORT_53_UDP_PORT=53
SOURCE_REF=master
SOURCE_REPOSITORY=https://github.com/openshift/ruby-ex.git
SHLVL=1
HOME=/root
KUBERNETES_PORT_53_UDP_PROTO=udp
KUBERNETES_PORT_443_TCP_PROTO=tcp
KUBERNETES_SERVICE_PORT_HTTPS=443
ORIGIN_VERSION=v3.9.0+71543b2-33
RUBY_EX_SERVICE_PORT=8080
LESSOPEN=||/usr/bin/lesspipe.sh %s
KUBERNETES_PORT_53_TCP_PROTO=tcp
KUBERNETES_PORT_443_TCP_ADDR=172.30.0.1
KUBERNETES_SERVICE_PORT_DNS_TCP=53
KUBERNETES_PORT_443_TCP=tcp://172.30.0.1:443
RUBY_EX_PORT_8080_TCP_PROTO=tcp
_=/usr/bin/env
```


Additional info:

Take a look to 
- https://bugzilla.redhat.com/show_bug.cgi?id=1618311
- https://bugzilla.redhat.com/show_bug.cgi?id=1618311#c19
- https://bugzilla.redhat.com/show_bug.cgi?id=1618311#c20

Comment 1 Ben Parees 2018-10-03 11:51:15 UTC
Most likely cluster up is not setting up the master-config with the appropriate build default stanza which is what i imagine was injecting the build proxy settings in 3.9.

Comment 2 Ben Parees 2018-10-04 18:50:33 UTC
this logic setup the build defaulter in 3.9:
https://github.com/openshift/origin/blob/release-3.9/pkg/oc/bootstrap/docker/openshift/helper.go#L730-L759

There is no equivalent in 3.10.  I assume it was deliberately removed and this is going to get closed as won't fix, but i'll let David chime in on any background.

Comment 5 Lalatendu Mohanty 2018-10-05 09:03:53 UTC
@Ben I am trying to find the commit which removed the code in upstream Origin but not able to track it, can you please point me to it.

Comment 9 Gerard Braad 2018-10-08 07:19:04 UTC
It would be possible for us to inject the proxy information into a profile file inside the container when started. However, this is a very quick and dirty solution.

Comment 11 Lalatendu Mohanty 2018-10-09 13:10:00 UTC
@David I am worried that things like this should have been communicated to CDK team as it affects CDK users. How can we improve communication with respect to design decisions like this?