hashicorp / hashicorp/nomad

service discovery: allow setting and discovering meta and canary_meta fields in Nomad services

Open
#12,942 0 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

stage/accepted theme/service-discovery/nomad type/enhancement
Dominant language
Go
Stars
17k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
105

Description

Allow setting [meta](https://www.nomadproject.io/docs/job-specification/service#meta) and [canary_meta](https://www.nomadproject.io/docs/job-specification/service#canary_meta) parameters on services using the `nomad` provider. It is possible that external tooling uses these fields for discovery and routing alongside tags. The [Nomad Ingress NGINX pack](https://github.com/hashicorp/nomad-pack-community-registry/tree/main/packs/nomad_ingress_nginx) showcases this.

There is a bug within the current code that allows a job to be registered that includes a nomad service with `meta` and `meta_canary` fields. The fields are persisted within the job specification, but do not make it to the service registration.

Example job spec:
```
job "example" {
datacenters = ["dc1"]

group "cache" {
network {
port "db" {
to = 6379
}
}

service {
provider = "nomad"
port = "db"
meta {
foo = bar
}
}

task "redis" {
driver = "docker"

config {
image = "redis:3.2"
ports = ["db"]
}
}
}
}
```

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the Nomad provider's service registration path from the job specification, focusing on how meta and canary_meta are persisted and then passed to registration. Compare the job fields with the registered service fields; done means both metadata fields are discoverable on services, including the example configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend, distributed-systems
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.