-
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
validate connect block allowed only within group.service (fixes #9450) #9817
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @roccoblues! Thanks for contributing this PR!
Unfortunately it doesn't look like this fixes the bug... I pulled this PR down locally and used the jobspec @shoenig provided in #9405
jobspec
job "countdash" {
datacenters = ["dc1"]
group "api" {
network {
mode = "bridge"
port "count" {}
}
task "web" {
driver = "docker"
config {
image = "hashicorpnomad/counter-api:v1"
}
service {
name = "count-api"
port = "count"
# should only be valid in group level
connect {
sidecar_service {}
}
}
}
}
}
If I run that job, it passes validation and runs:
$ nomad version
Nomad v1.0.2-dev (2bccb85d38164cfee4bede21fa3d2b10d75a1985)
$ nomad job run ./example.nomad
==> Monitoring evaluation "205d603a"
Evaluation triggered by job "countdash"
Evaluation within deployment: "48b3bd4b"
Allocation "588298bf" created: node "ebf7bb9b", group "api"
Evaluation status changed: "pending" -> "complete"
==> Evaluation "205d603a" finished with status "complete"
$ nomad alloc status 588
...
Recent Events:
Time Type Description
2021-01-20T08:13:57-05:00 Started Task started by client
2021-01-20T08:13:56-05:00 Task Setup Building Task Directory
2021-01-20T08:13:55-05:00 Received Task received by client
Co-authored-by: Tim Gross <[email protected]>
Hi @tgross, yes you're right. The connect block was silently thrown away. Took me a while to step through the code and find the right place. I've fixed it now.
|
LGTM! Thanks @roccoblues! |
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
This adds the missing validation mentioned in #9450 for a connect block to be allowed only in a group service.