-
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
Add meta on ConsulSidecarService #16705
Add meta on ConsulSidecarService #16705
Conversation
…nsul-nomad-sync-consul-sidecar-service
…nsul-nomad-sync-consul-sidecar-service
…nsul-nomad-sync-consul-sidecar-service
… github.com:southworks/nomad into consul-648-consul-nomad-sync-consul-sidecar-service
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 @horaciomonsalvo !
This is missing the implementation for Diff
from nomad/structs/diff.go
. If you take a look at the jobspec checklist it's the 2nd-to-the-last item in the main checklist. The easiest way to manually test this is to run a job with the new field, change the field, and then nomad plan
to verify the change is detected.
@@ -57,6 +57,8 @@ job "countdash" { | |||
- `tags` <code>(array<string>: nil)</code> - Custom Consul service tags | |||
for the sidecar service. | |||
|
|||
- `meta` <code>(map<string|string>: nil)</code> - Specifies arbitrary KV metadata pairs. |
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.
Can we move meta
up above port
so they're in alphabetical order?
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 @tgross , thanks for the feedback!
I moved meta to match alphabetical order. 👍
Regarding Diff updates, I think there is no need to apply any updates for this PR, since the only field added is the meta
field, which is a map[string]string
. Anyway, I have added a test case for the scenario you mentioned.
Also, I tested this implementation as you commented, and it seems to be working as expected.
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.
Regarding
Diff
updates, I think there is no need to apply any updates for this PR, since the only field added is the meta field, which is amap[string]string
. Anyway, I have added a test case for the scenario you mentioned.
Also, I tested this implementation as you commented, and it seems to be working as expected.
Ah, looks like the diff for this field passes thru the flatmap.Flatten
, which I didn't realize actually works for maps of primitives (ref flatmap.go#L55
). But thanks for testing!
…nsul-nomad-sync-consul-sidecar-service
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.
LGTM
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.
@horaciomonsalvo I missed that we need a changelog entry for this. I tried pushing a commit onto the PR but something about the way you've set this up is preventing me from doing so. If you have disabled "maintainers can make edits" on your PRs, please don't for this body of work.
In the meantime, to add a changelog file, run make cl
and it'll run you thru questions:
- this is PR 16705
- it's an "improvement" (option 2)
- the body should read
connect: Added support for meta field on sidecar service block
Thanks @tgross ! I added the changelog. 👍 Regarding "maintainers can make edits" I don't see this options. I will continue looking at it, but I think it could be related to this issue. |
Yeah that looks like it. No worries. |
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.
LGTM. Just going to wait for CI to be green again and then I'll merge. Thanks @horaciomonsalvo!
Co-authored-by: Sol-Stiep <[email protected]>
Co-authored-by: Horacio Monsalvo <[email protected]> Co-authored-by: Sol-Stiep <[email protected]>
Description
Changes
Testing Changes
To test these changes you need to build a Nomad binary and deploy a cluster with both Nomad and Consul agents and clients.
When you have your cluster running you can run the following job-spec:
Once the job is running and healthy, use Consul's API to get the terminating gateway's configuration:
curl --request GET http://127.0.0.1:8500/v1/catalog/service/count-api-sidecar-service | json_pp
You will get the following JSON output:
Demo Video
ConsulSidecarService.mp4