hashicorp / hashicorp/nomad

Allow explicit re-render of template

Open
#17,520 2 comments 4 reactions 0 assignees View on GitHub
stage/accepted theme/template theme/vault type/enhancement
Dominant language
Go
Stars
17k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
105

Description

### Proposal
Add new parameter `render_on_task_restart` for `template` block.
When this boolean flag is set to `true`, the template will be re-rendered when a task is restarted.

The flag can be added to the check here.

https://github.com/hashicorp/nomad/blob/b30f76e7d72114f9d06a4ee2c34c7242a1f5572c/client/allocrunner/taskrunner/template_hook.go#L98-L101

### Use-cases
For template retrieving secrets from Vault, due to lack of blocking query in Vault, the template will only re-render when getting closer to the lease duration. This is not ideal when Vault secret is no longer relevant, e.g. lease get revoked.

Having this parameter will enable template to be re-rendered explicitly when the task is restarted.

### Attempted Solutions
The current workaround is to modify jobspec with some unique meta so that new alloc will be created, which means template will be re-rendered.

I can help with the PR if the feature request is accepted.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.