Add field "kind" to task for use in connect tasks
This commit is contained in:
parent
bf6f97edfb
commit
a393ea79e8
|
@ -583,6 +583,7 @@ type Task struct {
|
|||
Leader bool
|
||||
ShutdownDelay time.Duration `mapstructure:"shutdown_delay"`
|
||||
KillSignal string `mapstructure:"kill_signal"`
|
||||
Kind string
|
||||
}
|
||||
|
||||
func (t *Task) Canonicalize(tg *TaskGroup, job *Job) {
|
||||
|
|
|
@ -784,6 +784,7 @@ func ApiTaskToStructsTask(apiTask *api.Task, structsTask *structs.Task) {
|
|||
structsTask.KillTimeout = *apiTask.KillTimeout
|
||||
structsTask.ShutdownDelay = apiTask.ShutdownDelay
|
||||
structsTask.KillSignal = apiTask.KillSignal
|
||||
structsTask.Kind = apiTask.Kind
|
||||
structsTask.Constraints = ApiConstraintsToStructs(apiTask.Constraints)
|
||||
structsTask.Affinities = ApiAffinitiesToStructs(apiTask.Affinities)
|
||||
|
||||
|
|
|
@ -892,6 +892,7 @@ func parseTasks(jobName string, taskGroupName string, result *[]*api.Task, list
|
|||
"user",
|
||||
"vault",
|
||||
"kill_signal",
|
||||
"kind",
|
||||
}
|
||||
if err := helper.CheckHCLKeys(listVal, valid); err != nil {
|
||||
return multierror.Prefix(err, fmt.Sprintf("'%s' ->", n))
|
||||
|
|
|
@ -178,6 +178,7 @@ func TestParse(t *testing.T) {
|
|||
Name: "binstore",
|
||||
Driver: "docker",
|
||||
User: "bob",
|
||||
Kind: "connect-proxy:test",
|
||||
Config: map[string]interface{}{
|
||||
"image": "hashicorp/binstore",
|
||||
"labels": []map[string]interface{}{
|
||||
|
|
|
@ -126,6 +126,7 @@ job "binstore-storagelocker" {
|
|||
driver = "docker"
|
||||
user = "bob"
|
||||
leader = true
|
||||
kind = "connect-proxy:test"
|
||||
|
||||
affinity {
|
||||
attribute = "${meta.foo}"
|
||||
|
|
|
@ -5142,6 +5142,10 @@ type Task struct {
|
|||
// KillSignal is the kill signal to use for the task. This is an optional
|
||||
// specification and defaults to SIGINT
|
||||
KillSignal string
|
||||
|
||||
// Used internally to manage tasks according to their Kind. Initial use case
|
||||
// is for Consul Connect
|
||||
Kind string
|
||||
}
|
||||
|
||||
func (t *Task) Copy() *Task {
|
||||
|
|
Loading…
Reference in a new issue