Merge pull request #2448 from MonzElmasry/new_b

Make etcd use node private ip
pull/2456/head
Menna Elmasry 2020-10-29 00:23:56 +02:00 committed by GitHub
commit 523ccaf3f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 5 deletions

View File

@ -130,7 +130,9 @@ func run(app *cli.Context, cfg *cmds.Server) error {
if cmds.AgentConfig.FlannelIface != "" && cmds.AgentConfig.NodeIP == "" { if cmds.AgentConfig.FlannelIface != "" && cmds.AgentConfig.NodeIP == "" {
cmds.AgentConfig.NodeIP = netutil.GetIPFromInterface(cmds.AgentConfig.FlannelIface) cmds.AgentConfig.NodeIP = netutil.GetIPFromInterface(cmds.AgentConfig.FlannelIface)
} }
if serverConfig.ControlConfig.PrivateIP == "" && cmds.AgentConfig.NodeIP != "" {
serverConfig.ControlConfig.PrivateIP = cmds.AgentConfig.NodeIP
}
if serverConfig.ControlConfig.AdvertiseIP == "" && cmds.AgentConfig.NodeExternalIP != "" { if serverConfig.ControlConfig.AdvertiseIP == "" && cmds.AgentConfig.NodeExternalIP != "" {
serverConfig.ControlConfig.AdvertiseIP = cmds.AgentConfig.NodeExternalIP serverConfig.ControlConfig.AdvertiseIP = cmds.AgentConfig.NodeExternalIP
} }

View File

@ -137,8 +137,8 @@ type Control struct {
BindAddress string BindAddress string
SANs []string SANs []string
PrivateIP string
Runtime *ControlRuntime `json:"-"` Runtime *ControlRuntime `json:"-"`
} }
type ControlRuntimeBootstrap struct { type ControlRuntimeBootstrap struct {

View File

@ -309,12 +309,11 @@ func (e *ETCD) Register(ctx context.Context, config *config.Control, handler htt
} }
e.client = client e.client = client
address, err := getAdvertiseAddress(config.AdvertiseIP) address, err := getAdvertiseAddress(config.PrivateIP)
if err != nil { if err != nil {
return nil, err return nil, err
} }
e.address = address e.address = address
e.config.Datastore.Endpoint = endpoint e.config.Datastore.Endpoint = endpoint
e.config.Datastore.Config.CAFile = e.runtime.ETCDServerCA e.config.Datastore.Config.CAFile = e.runtime.ETCDServerCA
e.config.Datastore.Config.CertFile = e.runtime.ClientETCDCert e.config.Datastore.Config.CertFile = e.runtime.ClientETCDCert