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