Closed praveenkumar closed 8 years ago
How would the user set the env variables? AFAIU sccli configures OpenShift for proxy support, if the PROXY env variable is set. How do we do this?
Do we let the user add some provisioning to the Vagrantfile or do we let him add vagrant-proxy-conf or do we add something to vagrant-service-manager. vagrant-proxy-conf seems easy, but I feel a bit reluctant to pull in so many plugins. Not sure.
Also, I guess something similar is needed for Docker, right?
How would the user set the env variables? AFAIU sccli configures OpenShift for proxy support, if the PROXY env variable is set. How do we do this?
sccli
will only configure proxy support (openshift and docker both) using environment variable (PROXY, PROXY_USER, PROXY_PASSWORD
) as per this PR.
Do we let the user add some provisioning to the Vagrantfile
Yes we have to add this ENV to our Vagrantfile as comments and when user need they just can comment out those ENV and able to use.
I feel a bit reluctant to pull in so many plugins.
Same here.
@praveenkumar We need to add documentation with this PR. The documentation should explain how user can just modify the openshift_option file to add support for proxy server.
It looks like documentation is not added yet.
@budhrg I did a scratch build of ADB box and a custom Vagrantfile to test this out.
@praveenkumar Will test it out
@praveenkumar I did a testing with the provided box and Vagrantfile.
I just downloaded box and Vagrantfile and did vagrant up.
My observations:
[vagrant@centos7-adb ~]$ cat /etc/systemd/system/docker.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=http://fedora:fedora123@10.70.49.109:3128" "NO_PROXY=localhost,127.0.0.1,::1,.xip.io,172.30.85.77"
docker pull busybox
. Image got downloaded.HTTP_PROXY
var from http-proxy.conf
file followed by "daemon-reload" and "docker restart"docker pull busybox
. Image got download (Removed previous image).HTTP_PROXY
var from http-proxy.conf
file with invalid credentialsI hope this test out the proxy code.
If it is then it works :+1:
Let me know if any other steps need to be verified.
Removed the HTTP_PROXY var from http-proxy.conf file followed by "daemon-reload" and "docker restart" Did docker pull busybox. Image got download (Removed previous image).
I think that should not work basically you have to enable iptable rule so that you can only allow traffic from proxy server => https://gist.github.com/LalatenduMohanty/5062050ac78721eda9676bbc15ecfd25
Some update on the testing. Docker pulls are working fine with with PR. But in my setup OpenShift is still not working as oc new-app cakephp-example
is not triggering the build.
[vagrant@centos7-adb ~]$ oc new-app cakephp-example
--> Deploying template "cakephp-example" in project "openshift" for "cakephp-example"
With parameters:
Memory Limit=512Mi
Git Repository URL=https://github.com/openshift/cakephp-ex.git
Git Reference=
Context Directory=
Application Hostname=
GitHub Webhook Secret=bg4IeAq0EEQro6g5oYBEqThPxDwbkKTkjnkBU3OB # generated
Database Service Name=
Database Engine=
Database Name=
Database User=
Database Password=
CakePHP Secret Token=Rjj6eVtVe6eLwmVzWFq9m33Pm9wwG7IZzvQiSb_vkzaNMgN3vU # generated
CakePHP Security Salt=Ot0osojrXi86niRhfG2QD6vurxqHHTMV1PFyJCSa # generated
CakePHP Security Cipher Seed=138517866363011140632212858500 # generated
OPcache Revalidation Frequency=2
--> Creating resources with label app=cakephp-example ...
service "cakephp-example" created
route "cakephp-example" created
imagestream "cakephp-example" created
buildconfig "cakephp-example" created
deploymentconfig "cakephp-example" created
--> Success
Build scheduled, use 'oc logs -f bc/cakephp-example' to track its progress.
Run 'oc status' to view your app.
$ oc logs -f bc/cakephp-example
error: no builds found for "cakephp-example"
[vagrant@centos7-adb ~]$ oc status -v
In project OpenShift sample project (sample-project) on server https://10.1.2.2:8443
http://cakephp-example-sample-project.centos7-adb.10.1.2.2.xip.io (svc/cakephp-example)
dc/cakephp-example deploys istag/cakephp-example:latest <-
bc/cakephp-example builds https://github.com/openshift/cakephp-ex.git with openshift/php:5.6
not built yet
deployment #1 waiting on image or update
http://nodejs-example-sample-project.centos7-adb.10.1.2.2.xip.io (svc/nodejs-example)
dc/nodejs-example deploys istag/nodejs-example:latest <-
bc/nodejs-example builds https://github.com/openshift/nodejs-ex.git with openshift/nodejs:0.10
not built yet
deployment #1 waiting on image or update
Warnings:
* istag/cakephp-example:latest needs to be imported or created by a build.
try: oc start-build bc/cakephp-example
* istag/nodejs-example:latest needs to be imported or created by a build.
try: oc start-build bc/nodejs-example
* The image trigger for dc/cakephp-example will have no effect until istag/cakephp-example:latest is imported or created by a build.
* The image trigger for dc/nodejs-example will have no effect until istag/nodejs-example:latest is imported or created by a build.
View details with 'oc describe <resource>/<name>' or list everything with 'oc get all'.
[vagrant@centos7-adb ~]$ oc get all
NAME TYPE FROM LATEST
cakephp-example Source Git 0
nodejs-example Source Git 0
NAME DOCKER REPO TAGS UPDATED
cakephp-example 172.30.252.223:5000/sample-project/cakephp-example
nodejs-example 172.30.252.223:5000/sample-project/nodejs-example
NAME REVISION REPLICAS TRIGGERED BY
cakephp-example 0 1 config,image(cakephp-example:latest)
nodejs-example 0 1 config,image(nodejs-example:latest)
NAME HOST/PORT PATH SERVICE TERMINATION LABELS
cakephp-example cakephp-example-sample-project.centos7-adb.10.1.2.2.xip.io cakephp-example app=cakephp-example,template=cakephp-example
nodejs-example nodejs-example-sample-project.centos7-adb.10.1.2.2.xip.io nodejs-example app=nodejs-example,template=nodejs-example
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
cakephp-example 172.30.207.31 <none> 8080/TCP 28m
nodejs-example 172.30.119.116 <none> 8080/TCP 38m
In system logs I can see below logs
Jul 08 05:28:12 centos7-adb sh[15840]: E0708 09:28:12.530449 15923 config_controller.go:76] error instantiating Build from BuildConfig sample-project/cakephp-example: imagestreamtags "php:5.6" not found
Jul 08 05:28:12 centos7-adb sh[15840]: E0708 09:28:12.541356 15923 config_controller.go:76] error instantiating Build from BuildConfig sample-project/cakephp-example: imagestreamtags "php:5.6" not found
Jul 08 05:28:12 centos7-adb sh[15840]: E0708 09:28:12.554458 15923 config_controller.go:76] error instantiating Build from BuildConfig sample-project/cakephp-example: imagestreamtags "php:5.6" not found
Jul 08 05:28:12 centos7-adb sh[15840]: E0708 09:28:12.563414 15923 config_controller.go:76] error instantiating Build from BuildConfig sample-project/cakephp-example: imagestreamtags "php:5.6" not found
@LalatenduMohanty have we got anything from mailing list about why you are facing this issue or what to be added in iptable rule?
As per https://docs.openshift.com/enterprise/3.0/admin_guide/http_proxies.html S2I and source template needs some change to properly work in a proxy setup. So I am trying to validate that.
@LalatenduMohanty let me know if that changes works for you so we can make changes in the code also.
Apart from above PR we also found some more setting to do to make it work with proxy.
1 Run openshift container with proxy environment
start_openshift() {
docker run $1 --name "openshift" --privileged --net=host --pid=host \
-w ${ORIGIN_DIR} \
-e "KUBECONFIG=${OPENSHIFT_DIR}/admin.kubeconfig" \
-e "NO_PROXY=${NO_PROXY}" \
-e "HTTP_PROXY=${HTTP_PROXY}" \
-e "HTTPS_PROXY=${HTTP_PROXY}" \
-v /:/rootfs:ro \
-v /var/run:/var/run:rw \
-v /sys:/sys:ro \
-v /var/lib/docker:/var/lib/docker:rw \
-v ${ORIGIN_DIR}/openshift.local.volumes:${ORIGIN_DIR}/openshift.local.volumes:z \
-v ${ORIGIN_DIR}/openshift.local.config:${ORIGIN_DIR}/openshift.local.config:z \
-v ${ORIGIN_DIR}/openshift.local.etcd:${ORIGIN_DIR}/openshift.local.etcd:z \
$IMAGE start "${@:2}"
}
2 We should have hostname also part of NO_PROXY variable
NO_PROXY=127.0.0.1,10.0.2.15,10.1.2.2,172.17.0.1,.xip.io,172.30.0.0/16,172.17.0.0/16,centos7-adb
3 master-config.yaml file also should be updated with proxy variables.
kubernetesMasterConfig:
admissionConfig:
pluginConfig:
BuildDefaults:
configuration:
apiVersion: v1
env:
- name: HTTP_PROXY
value: http://fedora:fedora123@10.70.49.109:3128
- name: HTTPS_PROXY
value: http://fedora:fedora123@10.70.49.109:3128
- name: NO_PROXY
value: 127.0.0.1,10.0.2.15,10.1.2.2,172.17.0.1,.xip.io,172.30.0.0/16,172.1.0.0/16,centos7-adb
gitHTTPProxy: http://fedora:fedora123@10.70.49.109:3128
gitHTTPSProxy: http://fedora:fedora123@10.70.49.109:3128
kind: BuildDefaultsConfig
apiLevels: null
New box will be available https://cbs.centos.org/koji/taskinfo?taskID=99676 Vagrant file: https://gist.github.com/praveenkumar/6aad634ba038044865bea9557631d74e
@LalatenduMohanty @budhrg please give it a try once build complete
@praveenkumar Some failures on pulling images:
I followed the commands to setup my host for proxy through LalatenduMohanty gist. Note: Through these steps, you will lost with internet through LAN or Wifi. Setup proxy through firefox.
Then starting with the box and Vagrantfile from praveen's comment.
I performed:
$ vagrant add <test-build-box>
$ vagrant up
$ vagrant ssh
Observations
busybox
cakephp-example
app. [Completed in 8mins 9secs]nodejs-example
app too. [Completed in 13mins 21secs]@budhrg Thanks for testing this out looks like basic testing working as expected.
I can deploy application with the new image @praveenkumar has given. However I am having issues accessing the application so looking in to it.
@praveenkumar @LalatenduMohanty I forgot to mention that I can access the application from inside VM(can able to curl) but from host it was not accessible(some how missed in hustle bustle of proxy setup)
@budhrg ok, what is the curl command you have used?
@LalatenduMohanty curl http://cakephp-example-sample-project.centos7-adb.10.1.2.2.xip.io
full details in the comment observations section (click on the arrow)
It seems the issue is with Libvirt setup. This PR works fine with Virtualbox provider. The issue mostly is in the iptable rules we are using for simulating the proxy setup. We have spent enough time and still can not make application endpoint accessible in proxy setup + libvirt accessible. However the application deployed fine which can be seen in oc status
command.
I am going to merge the PR as we want to get feedback from users about if this works in their proxy setup. Also we are kind of confident it should work in libvirt setup where the xip.io domain is working for the guest Vagrant box.
I will create a separate issue to track the libvirt issue.
https://github.com/projectatomic/adb-utils/issues/159 to track the libvirt proxy issue.
This patch will put proxy configuration for docker daemon and add it to openshift environment variables.