Remove support for CheckID field in service check definitions

This commit is contained in:
Kyle Havlovitz 2018-05-07 15:51:05 -07:00
parent cf57a23bb1
commit 6461087c25
No known key found for this signature in database
GPG Key ID: 8A5E6B173056AD6C
4 changed files with 11 additions and 23 deletions

View File

@ -94,14 +94,12 @@ func Parse(data string, format string) (c Config, err error) {
// CamelCase and snake_case. Since changing either format would break // CamelCase and snake_case. Since changing either format would break
// existing setups we have to support both and slowly transition to one of // existing setups we have to support both and slowly transition to one of
// the formats. Also, there is at least one case where we use the "wrong" // the formats. Also, there is at least one case where we use the "wrong"
// key and want to map that to the new key to support deprecation // key and want to map that to the new key to support deprecation -
// (`check.id` vs `service.check.CheckID`) See [GH-3179]. TranslateKeys // see [GH-3179]. TranslateKeys maps potentially CamelCased values to the
// maps potentially CamelCased values to the snake_case that is used in the // snake_case that is used in the config file parser. If both the CamelCase
// config file parser. If both the CamelCase and snake_case values are set, // and snake_case values are set the snake_case value is used and the other
// the snake_case value is used and the other value is discarded. // value is discarded.
TranslateKeys(m, map[string]string{ TranslateKeys(m, map[string]string{
"check_id": "id",
"checkid": "id",
"deregistercriticalserviceafter": "deregister_critical_service_after", "deregistercriticalserviceafter": "deregister_critical_service_after",
"dockercontainerid": "docker_container_id", "dockercontainerid": "docker_container_id",
"enabletagoverride": "enable_tag_override", "enabletagoverride": "enable_tag_override",

View File

@ -1988,7 +1988,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
"port": 80, "port": 80,
"EnableTagOverride": true, "EnableTagOverride": true,
"check": { "check": {
"CheckID": "x", "id": "x",
"name": "y", "name": "y",
"DockerContainerID": "z", "DockerContainerID": "z",
"DeregisterCriticalServiceAfter": "10s", "DeregisterCriticalServiceAfter": "10s",
@ -2003,7 +2003,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
port = 80 port = 80
EnableTagOverride = true EnableTagOverride = true
check = { check = {
CheckID = "x" id = "x"
name = "y" name = "y"
DockerContainerID = "z" DockerContainerID = "z"
DeregisterCriticalServiceAfter = "10s" DeregisterCriticalServiceAfter = "10s"
@ -2445,7 +2445,7 @@ func TestFullConfig(t *testing.T) {
"port": 24237, "port": 24237,
"enable_tag_override": true, "enable_tag_override": true,
"check": { "check": {
"check_id": "RMi85Dv8", "id": "RMi85Dv8",
"name": "iehanzuq", "name": "iehanzuq",
"status": "rCvn53TH", "status": "rCvn53TH",
"notes": "fti5lfF3", "notes": "fti5lfF3",
@ -2523,7 +2523,7 @@ func TestFullConfig(t *testing.T) {
"port": 72219, "port": 72219,
"enable_tag_override": true, "enable_tag_override": true,
"check": { "check": {
"check_id": "qmfeO5if", "id": "qmfeO5if",
"name": "atDGP7n5", "name": "atDGP7n5",
"status": "pDQKEhWL", "status": "pDQKEhWL",
"notes": "Yt8EDLev", "notes": "Yt8EDLev",
@ -2886,7 +2886,7 @@ func TestFullConfig(t *testing.T) {
port = 24237 port = 24237
enable_tag_override = true enable_tag_override = true
check = { check = {
check_id = "RMi85Dv8" id = "RMi85Dv8"
name = "iehanzuq" name = "iehanzuq"
status = "rCvn53TH" status = "rCvn53TH"
notes = "fti5lfF3" notes = "fti5lfF3"
@ -2964,7 +2964,7 @@ func TestFullConfig(t *testing.T) {
port = 72219 port = 72219
enable_tag_override = true enable_tag_override = true
check = { check = {
check_id = "qmfeO5if" id = "qmfeO5if"
name = "atDGP7n5" name = "atDGP7n5"
status = "pDQKEhWL" status = "pDQKEhWL"
notes = "Yt8EDLev" notes = "Yt8EDLev"

View File

@ -197,11 +197,6 @@ and the check is embedded within a service definition a unique check id is
generated. Otherwise, `id` will be set to `name`. If names might conflict, generated. Otherwise, `id` will be set to `name`. If names might conflict,
unique IDs should be provided. unique IDs should be provided.
-> **Note:** Consul 0.9.3 and before require the optional check ID for a check
that is embedded in a service definition to be configured via the `CheckID`
field. Consul 1.0 accepts both `id` and `CheckID` but the latter is
deprecated and will be removed in Consul 1.1.
The `notes` field is opaque to Consul but can be used to provide a human-readable The `notes` field is opaque to Consul but can be used to provide a human-readable
description of the current state of the check. With a script check, the field is description of the current state of the check. With a script check, the field is
set to any output generated by the script. Similarly, an external process updating set to any output generated by the script. Similarly, an external process updating

View File

@ -90,11 +90,6 @@ from `1`.
-> **Note:** There is more information about [checks here](/docs/agent/checks.html). -> **Note:** There is more information about [checks here](/docs/agent/checks.html).
-> **Note:** Consul 0.9.3 and before require the optional check ID for a check
that is embedded in a service definition to be configured via the `CheckID`
field. Consul 1.0 accepts both `id` and `CheckID` but the latter is
deprecated and will be removed in Consul 1.1.
The `enable_tag_override` can optionally be specified to disable the The `enable_tag_override` can optionally be specified to disable the
anti-entropy feature for this service. If `enable_tag_override` is set to anti-entropy feature for this service. If `enable_tag_override` is set to
`TRUE` then external agents can update this service in the `TRUE` then external agents can update this service in the