|
|
|
@ -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) |
|
|
|
|
} |
|
|
|
|