mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
Prepopulate known IPs in TLS
This commit is contained in:
parent
529e22ef80
commit
400225e73d
@ -8,6 +8,8 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"k8s.io/apimachinery/pkg/util/net"
|
||||
|
||||
"github.com/docker/docker/pkg/reexec"
|
||||
"github.com/natefinch/lumberjack"
|
||||
"github.com/rancher/k3s/pkg/agent"
|
||||
@ -69,6 +71,7 @@ func run(app *cli.Context, cfg *cmds.Server) error {
|
||||
serverConfig.ControlConfig.KubeConfigMode = cfg.KubeConfigMode
|
||||
serverConfig.TLSConfig.HTTPSPort = cfg.HTTPSPort
|
||||
serverConfig.TLSConfig.HTTPPort = cfg.HTTPPort
|
||||
serverConfig.TLSConfig.KnownIPs = knownIPs()
|
||||
|
||||
// TODO: support etcd
|
||||
serverConfig.ControlConfig.NoLeaderElect = true
|
||||
@ -104,3 +107,14 @@ func run(app *cli.Context, cfg *cmds.Server) error {
|
||||
|
||||
return agent.Run(ctx, agentConfig)
|
||||
}
|
||||
|
||||
func knownIPs() []string {
|
||||
ips := []string{
|
||||
"127.0.0.1",
|
||||
}
|
||||
ip, err := net.ChooseHostInterface()
|
||||
if err == nil {
|
||||
ips = append(ips, ip.String())
|
||||
}
|
||||
return ips
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user