Merge pull request #750 from erikwilson/unresolvable-hostname

Remove hostname requirement in `/etc/hosts`
This commit is contained in:
Darren Shepherd 2019-08-22 22:17:37 -07:00 committed by GitHub
commit bcd1fce4a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 5 additions and 25 deletions

View File

@ -396,19 +396,3 @@ func getConfig(info *clientaccess.Info) (*config.Control, error) {
controlControl := &config.Control{}
return controlControl, json.Unmarshal(data, controlControl)
}
func HostnameCheck(cfg cmds.Agent) error {
hostname, _, err := getHostnameAndIP(cfg)
if err != nil {
return err
}
for i := 0; i < 5; i++ {
_, err = sysnet.LookupHost(hostname)
if err == nil {
return nil
}
logrus.Infof("Waiting for hostname %s to be resolvable: %v", hostname, err)
time.Sleep(time.Second * 3)
}
return fmt.Errorf("Timed out waiting for hostname %s to be resolvable: %v", hostname, err)
}

View File

@ -25,10 +25,6 @@ import (
func run(ctx context.Context, cfg cmds.Agent, lb *loadbalancer.LoadBalancer) error {
nodeConfig := config.Get(ctx, cfg)
if err := config.HostnameCheck(cfg); err != nil {
return err
}
if !nodeConfig.NoFlannel {
if err := flannel.Prepare(ctx, nodeConfig); err != nil {
return err

View File

@ -17,7 +17,7 @@ const ContainerdConfigTemplate = `
path = "{{ .NodeConfig.Containerd.Opt }}"
[plugins.cri]
stream_server_address = "{{ .NodeConfig.AgentConfig.NodeName }}"
stream_server_address = "127.0.0.1"
stream_server_port = "10010"
{{- if .IsRunningInUserNS }}

View File

@ -165,7 +165,7 @@ func run(app *cli.Context, cfg *cmds.Server) error {
}
ip := serverConfig.TLSConfig.BindAddress
if ip == "" {
ip = "localhost"
ip = "127.0.0.1"
}
url := fmt.Sprintf("https://%s:%d", ip, serverConfig.TLSConfig.HTTPSPort)
token := server.FormatToken(serverConfig.ControlConfig.Runtime.NodeToken, certs)

View File

@ -474,7 +474,7 @@ func genClientCerts(config *config.Control, runtime *config.ControlRuntime) erro
factory := getSigningCertFactory(regen, nil, []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth}, runtime.ClientCA, runtime.ClientCAKey)
var certGen bool
apiEndpoint := fmt.Sprintf("https://localhost:%d", config.ListenPort)
apiEndpoint := fmt.Sprintf("https://127.0.0.1:%d", config.ListenPort)
certGen, err = factory("system:admin", []string{"system:masters"}, runtime.ClientAdminCert, runtime.ClientAdminKey)
if err != nil {

View File

@ -193,7 +193,7 @@ func printTokens(certs, advertiseIP string, tlsConfig *dynamiclistener.UserConfi
)
if advertiseIP == "" {
advertiseIP = "localhost"
advertiseIP = "127.0.0.1"
}
if len(config.Runtime.NodeToken) > 0 {
@ -213,7 +213,7 @@ func writeKubeConfig(certs string, tlsConfig *dynamiclistener.UserConfig, config
clientToken := FormatToken(config.ControlConfig.Runtime.ClientToken, certs)
ip := tlsConfig.BindAddress
if ip == "" {
ip = "localhost"
ip = "127.0.0.1"
}
url := fmt.Sprintf("https://%s:%d", ip, tlsConfig.HTTPSPort)
kubeConfig, err := HomeKubeConfig(true, config.Rootless)