fabric8io-images / s2i

OpenShift S2I images for Java and Karaf applications
Apache License 2.0
70 stars 84 forks source link

Prefix hosts with a wildcard '*' in env var 'http.nonProxyHosts' #164

Closed matleclaire closed 6 years ago

matleclaire commented 6 years ago

Property http.nonProxyHosts allows to use * for pattern matching. For example : -Dhttp.nonProxyHosts=” *.foo.com|localhost”

But Openshift doesn't accept * attached to a domain suffix. That's why NO_PROXY is set like this :

NO_PROXY=.example.com,.local,127.0.0.1

This PR prefixes subdomains with a * using the two next commands :

References :

https://docs.oracle.com/javase/7/docs/api/java/net/doc-files/net-properties.html https://docs.openshift.com/container-platform/3.9/install_config/http_proxies.html#configuring-no-proxy

rhuss commented 6 years ago

Thanks a lot for the PR !

Actually we are using fish-pepper for generating the build images, so run-java.sh in this repo is a generated file (and only checked in to allow automatic Docker Hub builds).

The original file is located here: https://github.com/fabric8io-images/run-java-sh/blob/master/fish-pepper/run-java-sh/fp-files/run-java.sh#L465

It would be awesome if you create a PR over there and as soon as this gets merged, I will make a release of run-java.sh and update this repo (as well as the other repos depending on run-java.sh)

You might also consider to add some integration tests to https://github.com/fabric8io-images/run-java-sh/blob/master/test/t/04_proxy.bats

BTW, not sure whether [[:space:]] is required here (knowing that it wasn't your addition) as it increase probbaly unnecessarily the requirements on the sed implementation in use (afair [[:space:]] is a gnu addition). Maybe we can use a regular character class for witespace, too ?

matleclaire commented 6 years ago

Thanks for your feedback.

The mentioned original file is already prefixing subdomains with a wildcard. A PR on it seems to be useless. https://github.com/fabric8io-images/run-java-sh/blob/master/fish-pepper/run-java-sh/fp-files/run-java.sh#L465

ret="$ret -Dhttp.nonProxyHosts=\"$(echo "|$noProxy" | sed -e 's/,[[:space:]]*/|/g' | sed -e 's/|\./|\*\./g' | cut -c 2-)\""

It looks like the run-java.sh from this repo is not up-to-date. This PR is not relevant. I'm closing it.

rhuss commented 6 years ago

Thanks for the heads up. I'm going to make a new release then soonish.

The version of run-java.sh used in this image can be seen here btw --> https://github.com/fabric8io-images/s2i/blob/master/java/fish-pepper.yml#L17

This needs to be updated to 1.2.2 via fish-pepper and then we can make a new release 2.2.1 for this image.