hashicorp / hashicorp/nomad

invalid update to service definition does not fail during registration

Open
#9,364 1 comment 0 reactions 0 assignees View on GitHub
stage/accepted theme/consul theme/service-discovery type/bug
Dominant language
Go
Stars
17k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
105

Description

### Nomad version
0.12.5

### Operating system and Environment details
linux

### Issue
Update to the service stanza with an invalid configuration does not fail during deployment, as it should do normally.
The job file below normally will trigger an error during deployment saying:
```
unable to get address for service "example-service": invalid port "8080": port label not found
```
However, the validation failed to detect the wrong `check` stanza if the job file is deployed first without check, then adding the check in a subsequent deployment.

### Reproduction steps

1. remove the check section from the job file below and deploy
2. add the check section back and deploy
3. deploy finishes "successfully" however no check is registered as the check is invalid.

### Job file (if appropriate)

Click this to expand

```
job "example-job" {
datacenters = ["dc1"]

group "example-service-api-group" {
service {
name = "example-service"
port = "8080"

check {
type = "http"
path = "/"
interval = "5s"
timeout = "1s"
}
}

task "example-fake" {
driver = "docker"

config {
image = "nicholasjackson/fake-service:v0.12.0"
}

env {
LISTEN_ADDR = "0.0.0.0:8080"
}
}
}
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the behavior with the supplied Nomad job: deploy it without the check stanza, then add the check and deploy again. Compare validation during initial registration with validation during the update; done means the invalid service update fails with the reported port-label error instead of completing without registering the check.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.