mirror of https://github.com/k3s-io/k3s
Merge pull request #21612 from mesosphere/jdef_scheduler_uses_libprocess_ip
Auto commit by PR queue botpull/6/head
commit
423215fdc6
|
@ -32,7 +32,7 @@ const (
|
|||
SCHEDULER_SERVICE_NAME = "k8sm-scheduler"
|
||||
)
|
||||
|
||||
func (m *SchedulerServer) newServiceWriter(stop <-chan struct{}) func() {
|
||||
func (m *SchedulerServer) newServiceWriter(publishedAddress net.IP, stop <-chan struct{}) func() {
|
||||
return func() {
|
||||
for {
|
||||
// Update service & endpoint records.
|
||||
|
@ -42,7 +42,10 @@ func (m *SchedulerServer) newServiceWriter(stop <-chan struct{}) func() {
|
|||
glog.Errorf("Can't create scheduler service: %v", err)
|
||||
}
|
||||
|
||||
if err := m.setEndpoints(SCHEDULER_SERVICE_NAME, net.IP(m.address), m.port); err != nil {
|
||||
if publishedAddress == nil {
|
||||
publishedAddress = net.IP(m.address)
|
||||
}
|
||||
if err := m.setEndpoints(SCHEDULER_SERVICE_NAME, publishedAddress, m.port); err != nil {
|
||||
glog.Errorf("Can't create scheduler endpoints: %v", err)
|
||||
}
|
||||
|
||||
|
|
|
@ -771,6 +771,16 @@ func (s *SchedulerServer) bootstrap(hks hyperkube.Interface, sc *schedcfg.Config
|
|||
}
|
||||
|
||||
schedulerProcess := ha.New(framework)
|
||||
|
||||
// try publishing on the same IP as the slave
|
||||
var publishedAddress net.IP
|
||||
if libprocessIP := os.Getenv("LIBPROCESS_IP"); libprocessIP != "" {
|
||||
publishedAddress = net.ParseIP(libprocessIP)
|
||||
}
|
||||
if publishedAddress != nil {
|
||||
log.V(1).Infof("driver will publish address %v", publishedAddress)
|
||||
}
|
||||
|
||||
dconfig := &bindings.DriverConfig{
|
||||
Scheduler: schedulerProcess,
|
||||
Framework: info,
|
||||
|
@ -778,6 +788,7 @@ func (s *SchedulerServer) bootstrap(hks hyperkube.Interface, sc *schedcfg.Config
|
|||
Credential: cred,
|
||||
BindingAddress: s.address,
|
||||
BindingPort: uint16(s.driverPort),
|
||||
PublishedAddress: publishedAddress,
|
||||
HostnameOverride: s.hostnameOverride,
|
||||
WithAuthContext: func(ctx context.Context) context.Context {
|
||||
ctx = auth.WithLoginProvider(ctx, s.mesosAuthProvider)
|
||||
|
@ -826,7 +837,7 @@ func (s *SchedulerServer) bootstrap(hks hyperkube.Interface, sc *schedcfg.Config
|
|||
)
|
||||
|
||||
runtime.On(framework.Registration(), func() { sched.Run(schedulerProcess.Terminal()) })
|
||||
runtime.On(framework.Registration(), s.newServiceWriter(schedulerProcess.Terminal()))
|
||||
runtime.On(framework.Registration(), s.newServiceWriter(publishedAddress, schedulerProcess.Terminal()))
|
||||
runtime.On(framework.Registration(), func() { nodeCtl.Run(schedulerProcess.Terminal()) })
|
||||
|
||||
driverFactory := ha.DriverFactory(func() (drv bindings.SchedulerDriver, err error) {
|
||||
|
|
Loading…
Reference in New Issue