-
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
HCL2: Fetch data from consul, vault, etc #9434
Comments
Especially for vault secrets having an additional option to fetch them once during deployment would bring the benefit of using nomad without direct vault integration. To describe our workflow and the reasoning of #9423: |
This sounds like a bit of a security nightmare since Nomad doesn't protect the jobspec as sensitive data. I don't see a way to implement this without significant structural changes to the Nomad security model to accommodate making the jobspec secret. |
This is probably true as long as you have access to the running jobspec you can get the substituted values. But this is the case with every other templating solution as well. |
Consider adding job spec HCL functions for fetching data from vault/consul and other sources. Packer categorizes these as Contextual Functions.
Design Considerations
Nomad currently support fetching data from Vault and Consul via Consul Template. When adding contextual HCL functions, they should co-exist nicely with that support - operators must have clear expectations of the behavior of each and don't get surprised when they switch between them.
We have two open questions for supporting contextual functions.
Evaluation Context
Contextual variables present a design challenge: How should they be evaluated?
Current HCL2 functions are evaluated statically by the CLI on the job submitter host. By implementing
vault
/consul
functions as a normal HCL function, the CLI must be configured to access the production Vault/Consul. The CLI must reach the production Vault/Consul cluster, and the operator must have direct read access to production secrets. Such production access may not be ideal.An alternative is to have Nomad servers fetch Vault/Consul values on behalf of the job. This is consistent with the current Vault/Consul integration with consul templates, and eases the deployment flow.
Leases and Refresh
The documentation must set clear expectations on refresh behavior. Current, Consul Template integration have watch semantics, so a task may be notified when a vault/consul value changes. Also, Consul Template integration now refreshes the lease of the Vault secret.
As HCL functions are evaluated statically, a simple contextual function will only be evaluated once at submission time. Operators shouldn't expect the jobs to be updated when the vault/consul source data is changed. Also, they should expect the jobs to potentially run past the lease expiry of the fetched secrets, potentially causing a service outage.
The text was updated successfully, but these errors were encountered: