Mesos: Use slave.PID.Host as task SlaveIP.

This commit is contained in:
Nimi Wariboko Jr 2017-12-20 03:12:03 -08:00 committed by Traefiker
parent cd1b3904da
commit 3c7c6c4d9f
2 changed files with 5 additions and 1 deletions

View file

@ -408,7 +408,7 @@ func (p *Provider) taskRecords(sj state.State) []state.Task {
for _, task := range f.Tasks { for _, task := range f.Tasks {
for _, slave := range sj.Slaves { for _, slave := range sj.Slaves {
if task.SlaveID == slave.ID { if task.SlaveID == slave.ID {
task.SlaveIP = slave.Hostname task.SlaveIP = slave.PID.Host
} }
} }

View file

@ -6,6 +6,7 @@ import (
"github.com/containous/traefik/log" "github.com/containous/traefik/log"
"github.com/containous/traefik/types" "github.com/containous/traefik/types"
"github.com/mesos/mesos-go/upid"
"github.com/mesosphere/mesos-dns/records/state" "github.com/mesosphere/mesos-dns/records/state"
) )
@ -194,6 +195,9 @@ func TestTaskRecords(t *testing.T) {
ID: "s_id", ID: "s_id",
Hostname: "127.0.0.1", Hostname: "127.0.0.1",
} }
slave.PID.UPID = &upid.UPID{}
slave.PID.Host = slave.Hostname
var state = state.State{ var state = state.State{
Slaves: []state.Slave{slave}, Slaves: []state.Slave{slave},
Frameworks: []state.Framework{framework}, Frameworks: []state.Framework{framework},