hashicorp / hashicorp/nomad

Nomad service parsing silently "corrects errors" without failing

Open
#6,777 1 comment 0 reactions 0 assignees View on GitHub
stage/needs-verification theme/consul/connect theme/jobspec type/bug
Dominant language
Go
Stars
17k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
105

Description

nomad version: 0.10.0

job extract:
```
job "presto" {
....
group "worker" {
count = 1
service {
port = "https"
connect {
sidecar_service {
proxy {
upstreams {
destination_name = "hive-connect-metastore"
local_bind_port = 9083
}
}
}
}
}
network {
mode = "bridge"
# This exposes a port externaly
port "https" {}
}
task "db" {
driver = "docker"
...
}
service {
name = "${NOMAD_JOB_NAME}-${NOMAD_GROUP_NAME}-${NOMAD_TASK_NAME}-${NOMAD_ALLOC_INDEX}"
connect {
sidecar_service {
proxy {
upstreams {
destination_name = "hive-connect-metastores"
local_bind_port = 9085
}
}
}
}
}
}
}
```

While getting to grips with nomad's consul connect implementation I came across this code path.
Edit: Which seemingly deletes the connect part?
https://github.com/hashicorp/nomad/blob/3e38891b88e089b57093efbdcbecd17fddaee001/jobspec/parse_service.go#L63
I copied the connect spec to a different task group, but instead of adding it to the group, I added it to a service stanza in the task. It took a good while to understand why none of my changes seemingly would take effect.

Expected outcome: An error message that connect stanzas are not allowed inside of a task.

- Edited to add context.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in jobspec/parse_service.go around the referenced line and inspect how a connect stanza inside a task service is handled. Reproduce the supplied job configuration, then verify that this misplaced stanza produces an error instead of being silently ignored or removed. Confirm the expected rejection using the repository's relevant job-spec parsing checks.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.