hashicorp / hashicorp/nomad

[Feature request] Canary-only services

Open
#8,073 2 comments 3 reactions 0 assignees View on GitHub
stage/needs-discussion theme/consul theme/service-discovery type/enhancement
Dominant language
Go
Stars
17k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
105

Description

It would be nice if we had an ability to create temporary (canary only) services. Our use case follows:
We create 2 services for traefik2 routing. One is for canaries (to route by header `X-Canary-Flag`), another is for promoted tasks (without header).
This seems to work fine, but after promotion canary service is not needed any more, while it stays unrouted till next deployment, it still requires consul-checks (actual http port in the example is checked twice by both (canary, non-canary) consul service checkers). Actually all consul checks for services deployed this way are getting multiplied by 2.
So it would be great to have `canary (bool: false)` service parameter implementing this.

This is somehow related to https://github.com/hashicorp/nomad/issues/2920#issuecomment-353386502

```
service {
name = "${NOMAD_META_service_name}"
port = "http"

tags = [
"traefik.enable=true",
"traefik.http.services.${NOMAD_META_service_name}.loadbalancer.healthcheck.path=/status/",
"traefik.http.routers.${NOMAD_META_service_name}.entrypoints=web",
"traefik.http.routers.${NOMAD_META_service_name}.rule=Host(${NOMAD_META_http_hosts})"
]
canary_tags = ["deploy"]

check {
type = "http"
path = "/status/"
}
}

service {
// Not implemented destroying after promotion
// canary = true
name = "${NOMAD_META_service_name}-canary"
port = "http"

tags = ["deploy"]
canary_tags = [
"traefik.enable=true",
"traefik.http.services.${NOMAD_META_service_name}-canary.loadbalancer.healthcheck.path=/status/",
"traefik.http.routers.${NOMAD_META_service_name}-canary.entrypoints=web",
"traefik.http.routers.${NOMAD_META_service_name}-canary.rule=Host(${NOMAD_META_http_hosts})&&Headers(`X-Canary-Flag`,`1`)"
]

check {
type = "http"
path = "/status/"
}
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.