-
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
client: add Nomad template service functionality to runner. #12458
Conversation
This change modifies the template task runner to utilise the new consul-template which includes Nomad service lookup template funcs. In order to provide security and auth to consul-template, we use a custom HTTP dialer which is passed to consul-template when setting up the runner. This method follows Vault implementation.
Adds 2 functions for retrieving services from Nomad: - nomadServices - retrieves all services from Nomad - nomadService - retrieves all registrations for a service Tag filtering for `nomadService` is currently implemented in consul-template as the Nomad API does not support it directly. Tests use a Nomad binary on path and require Nomad 1.3.0-beta or a binary built from the PR: hashicorp/nomad#12458 Tests also require Docker.
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.
🎉 No functional changes, so feel free to merge as-is if we just want to clean up comments after the fact.
// Set up a custom listener and dialer. This is used by Nomad clients when | ||
// running consul-template functions that utilise the Nomad API. We lazy | ||
// load this into the client config, therefore this needs to happen before | ||
// we call NewClient. | ||
a.builtinListener, a.builtinDialer = bufconndialer.New() | ||
conf.TemplateDialer = a.builtinDialer |
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.
Great placement 👍
@@ -0,0 +1,48 @@ | |||
// BufConnWrapper implements consul-template's TransportDialer using a |
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.
Oops, no tests. I'll try to get to that later today. #12483
Adds 2 functions for retrieving services from Nomad: - nomadServices - retrieves all services from Nomad - nomadService - retrieves all registrations for a service Tag filtering for `nomadService` is currently implemented in consul-template as the Nomad API does not support it directly. Tests use a Nomad binary on path and require Nomad 1.3.0-beta or a binary built from the PR: hashicorp/nomad#12458 Tests also require Docker.
Adds 2 functions for retrieving services from Nomad: - nomadServices - retrieves all services from Nomad - nomadService - retrieves all registrations for a service Tag filtering for `nomadService` is currently implemented in consul-template as the Nomad API does not support it directly. Tests use a Nomad binary on path and require Nomad 1.3.0-beta or a binary built from the PR: hashicorp/nomad#12458 Tests also require Docker.
Adds 2 functions for retrieving services from Nomad: - nomadServices - retrieves all services from Nomad - nomadService - retrieves all registrations for a service Tag filtering for `nomadService` is currently implemented in consul-template as the Nomad API does not support it directly. Tests use a Nomad binary on path and require Nomad 1.3.0-beta or a binary built from the PR: hashicorp/nomad#12458 Tests also require Docker.
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 change modifies the template task runner to utilise the
new consul-template which includes Nomad service lookup template
funcs.
In order to provide security and auth to consul-template, we use
a custom HTTP dialer which is passed to consul-template when
setting up the runner. This method follows Vault implementation.
This PR also includes an E2E test in lieu of integration tests. This
is due to the taskrunner/template pkg being in a long import chain
making utilising current test agents/clients impossible without a
large refactor. We will therefore step back and address this
properly in the future.