open-nomad/command/agent/consul
Danielle Lancashire 8112177503
consul: Include port-label in service registration
It is possible to provide multiple identically named services with
different port assignments in a Nomad configuration.

We introduced a regression when migrating to stable service identifiers where
multiple services with the same name would conflict, and the last definition
would take precedence.

This commit includes the port label in the stable service identifier to
allow the previous behaviour where this was supported, for example
providing:

```hcl
service {
  name = "redis-cache"
  tags = ["global", "cache"]
  port = "db"
  check {
    name     = "alive"
    type     = "tcp"
    interval = "10s"
    timeout  = "2s"
  }
}

service {
  name = "redis-cache"
  tags = ["global", "foo"]
  port = "foo"

  check {
    name     = "alive"
    type     = "tcp"
    port     = "db"
    interval = "10s"
    timeout  = "2s"
  }
}

service {
  name = "redis-cache"
  tags = ["global", "bar"]
  port = "bar"

  check {
    name     = "alive"
    type     = "tcp"
    port     = "db"
    interval = "10s"
    timeout  = "2s"
  }
}
```

in a nomad task definition is now completely valid. Each service
definition with the same name must still have a unique port label however.
2019-06-13 15:24:54 +02:00
..
catalog_testing.go agent + consul 2018-09-13 10:43:40 -07:00
check_watcher.go consul service hook 2018-10-16 16:53:29 -07:00
check_watcher_test.go Fix lints 2018-10-16 16:56:56 -07:00
client.go consul: Include port-label in service registration 2019-06-13 15:24:54 +02:00
int_test.go Remove old comment; it's been fixed! 2019-01-14 09:56:53 -08:00
script.go consul: add ScriptExecutor context wrapper 2018-12-03 20:26:31 -08:00
script_test.go consul: add ScriptExecutor context wrapper 2018-12-03 20:26:31 -08:00
structs.go move cstructs.DeviceNetwork to drivers pkg 2019-01-08 09:11:47 -05:00
unit_test.go consul: Include port-label in service registration 2019-06-13 15:24:54 +02:00
version_checker.go agent + consul 2018-09-13 10:43:40 -07:00
version_checker_test.go Replace Consul TLSSkipVerify handling 2018-03-14 17:43:06 -07:00