diff --git a/contrib/mesos/pkg/executor/executor.go b/contrib/mesos/pkg/executor/executor.go index a3ec909992522..6aec2e97033b3 100644 --- a/contrib/mesos/pkg/executor/executor.go +++ b/contrib/mesos/pkg/executor/executor.go @@ -717,8 +717,8 @@ func (k *KubernetesExecutor) FrameworkMessage(driver bindings.ExecutorDriver, me log.Infof("Receives message from framework %v\n", message) //TODO(jdef) master reported a lost task, reconcile this! @see scheduler.go:handleTaskLost - if strings.HasPrefix(message, "task-lost:") && len(message) > 10 { - taskId := message[10:] + if strings.HasPrefix(message, messages.TaskLost+":") { + taskId := message[len(messages.TaskLost)+1:] if taskId != "" { // clean up pod state k.lock.Lock() diff --git a/contrib/mesos/pkg/executor/messages/messages.go b/contrib/mesos/pkg/executor/messages/messages.go index f3287b2c9f536..f16a81eaad554 100644 --- a/contrib/mesos/pkg/executor/messages/messages.go +++ b/contrib/mesos/pkg/executor/messages/messages.go @@ -26,6 +26,7 @@ const ( ExecutorShutdown = "executor-shutdown" LaunchTaskFailed = "launch-task-failed" TaskKilled = "task-killed" + TaskLost = "task-lost" UnmarshalTaskDataFailure = "unmarshal-task-data-failure" TaskLostAck = "task-lost-ack" // executor acknowledgement of forwarded TASK_LOST framework message Kamikaze = "kamikaze" diff --git a/contrib/mesos/pkg/scheduler/scheduler.go b/contrib/mesos/pkg/scheduler/scheduler.go index af14b098653a9..afa8e79fe8273 100644 --- a/contrib/mesos/pkg/scheduler/scheduler.go +++ b/contrib/mesos/pkg/scheduler/scheduler.go @@ -441,7 +441,7 @@ func (k *KubernetesScheduler) reconcileTerminalTask(driver bindings.SchedulerDri //to do anything. The underlying driver transport may be able to send a //FrameworkMessage directly to the slave to terminate the task. log.V(2).Info("forwarding TASK_LOST message to executor %v on slave %v", taskStatus.ExecutorId, taskStatus.SlaveId) - data := fmt.Sprintf("task-lost:%s", task.ID) //TODO(jdef) use a real message type + data := fmt.Sprintf("%s:%s", messages.TaskLost, task.ID) //TODO(jdef) use a real message type if _, err := driver.SendFrameworkMessage(taskStatus.ExecutorId, taskStatus.SlaveId, data); err != nil { log.Error(err.Error()) }