-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
include parent job ID as a Docker container label #17751
Comments
Hi @EtienneBruines! That seems like a good idea. I'll mark this for roadmapping but it's also small enough that I'll mark it as a good first issue to see if anyone from the community wants to give a try at adding it (they might start looking in |
@tgross I would like to contribute to this issue. |
Go for it! Feel free to tag me o the PR and I'll make sure it gets reviewed. |
Hi @tgross, @EtienneBruines, This is my first contribution to Nomad so I am lacking some context. I would appreciate if you could help me with a couple of doubts. So I was able to setup Nomad in my local to start a periodic docker. When I do a docker inspect on the container. I can see the following labels set up by default i.e. dockerLabelAllocID but no com_hashicorp_nomad_job_id label But I do see a similar env set (screenshot attached below) so my question is the ask to add a new env or label itself. If labels can you suggest me how these labels are set in the first place. Below is the config file I used to start the periodic docker.
|
@devashishTaneja Have you configured your Nomad Client to add those labels? e.g.: plugin "docker" {
config {
# Extra labels to add to Docker containers. Available options are job_name, job_id,
# task_group_name, task_name, namespace, node_name, node_id. Globs are supported (e.g. task*)
extra_labels = ["job_name", "job_id", "task_name"]
}
} |
Thanks for the help @EtienneBruines !! Please review the final label. @tgross I have raised the PR can you please review the PR. |
Done in #17843 which will ship in Nomad 1.6.0. |
Proposal
Next to the
container.labels.com_hashicorp_nomad_job_id
field that is already being set, have a field that excludes the/periodic-901283123
suffix for batch jobs.My feeling tells me the
container.labels.com_hashicorp_nomad_job_name
field would make sense for that (since right now, they have the same value) - but that would break backwards compatibility a bit.Any field would suffice. In a lot of cases, I only care about the job name as provided in the
.nomad.hcl
file, and not have to bother with whatever suffixes were added.Use-cases
Logging / filtering / grouping based on that value, while not caring about the timestamp that the batch job.
Attempted Solutions
In my Elasticsearch I now need to setup an ingest pipeline to remove this
/periodic-*
suffix, because I want to filter on the name of the job (without the timestamp).The text was updated successfully, but these errors were encountered: