Nomad v0.7.1-rc1 (b81a2b64e659d297b0d90ef6003b8af8e5edb578)
Some of our jobs are don't bind any ports.
But with the latest version we started to get error:
unable to get address for service "job_name": invalid port "": port label not found
It seems that all work fine before this PR: https://github.com/hashicorp/nomad/pull/3619
job "test-job" {
datacenters = ["staging"]
type = "service"
update {
max_parallel = 1
min_healthy_time = "10s"
healthy_deadline = "3m"
}
group "test-job" {
count = 1
restart {
attempts = 10
interval = "5m"
delay = "20s"
mode = "delay"
}
task "test-job" {
driver = "docker"
user = "test-user"
config {
image = "test-image"
force_pull = true
network_mode = "host"
}
env {
APP_ENV = "staging"
}
resources {
cpu = 500
memory = 128
}
service {
name = "test-job"
tags = ["test-job", "staging"]
}
}
}
}
Thanks for reporting this issue, and the PR that seems to introduce this break. Do you also have a jobspec where you do not see this error?
@pznamensky Why are you registering a service without specifying its port? The service stanza requires a port to be specified as documented here: https://www.nomadproject.io/docs/job-specification/service.html#port.
So if anything the bug is that we did not catch the invalid stanza on job submit
Oops, I missed it.
Nevertheless, I think that it would be fine to register task without a port.
In our case we have some apps that just get some data from db/storage/mq then process it and put it back to db/storage/mq.
We're monitoring those apps using statistics which were sent to statsd and count of services which were registered in consul.
It's not usual case even for us, but it works fine.
Hi @pznamensky! I'm responsible for that validation change in #3619
We never intended to allow jobs to register services without a port, so that PR added validation to prevent it.
However after hearing your use case (and discussing some other potential uses I'm sure others' are using), we've decided to allow services without ports. I'll get a PR up ASAP and it will be included in 0.7.1 final.
Thank you!
@pznamensky thanks for testing the rc and making 0.7.1 better! We really appreciate it!