Merge pull request #434 from galal-hussein/add_no_proxy

Add no_proxy env to server
pull/439/head
Erik Wilson 6 years ago committed by GitHub
commit b0e4228609
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -321,10 +321,13 @@ func keys(val map[string]intstr.IntOrString) []string {
func setProxyEnv(job *batch.Job) {
proxySysEnv := []string{
"all_proxy",
"ALL_PROXY",
"http_proxy",
"https_proxy",
"HTTP_PROXY",
"https_proxy",
"HTTPS_PROXY",
"no_proxy",
"NO_PROXY",
}
for _, proxyEnv := range proxySysEnv {

@ -10,6 +10,7 @@ import (
"os"
"path/filepath"
"strconv"
"strings"
"time"
"github.com/pkg/errors"
@ -48,6 +49,10 @@ func StartServer(ctx context.Context, config *Config) (string, error) {
return "", err
}
if err := setNoProxyEnv(&config.ControlConfig); err != nil {
return "", err
}
if err := control.Server(ctx, &config.ControlConfig); err != nil {
return "", errors.Wrap(err, "starting kubernetes")
}
@ -293,3 +298,12 @@ func writeToken(token, file, certs string) error {
token = FormatToken(token, certs)
return ioutil.WriteFile(file, []byte(token+"\n"), 0600)
}
func setNoProxyEnv(config *config.Control) error {
envList := strings.Join([]string{
os.Getenv("NO_PROXY"),
config.ClusterIPRange.String(),
config.ServiceIPRange.String(),
}, ",")
return os.Setenv("NO_PROXY", envList)
}

Loading…
Cancel
Save