-
Notifications
You must be signed in to change notification settings - Fork 171
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 annotation to use template path on disk #222
Conversation
Here is a working example in OpenShift with the vault agent template stored in a
We create the
We can see the
|
We really need this good feature for big config file. |
agent-inject/agent/annotations.go
Outdated
// to the same unique value provided in "vault.hashicorp.com/agent-inject-secret-". | ||
// The value is the filename and path of the template used by the agent to render the secrets. | ||
// If not provided, the template content key annotation is used. | ||
AnnotationAgentInjectTemplateSource = "vault.hashicorp.com/agent-inject-template-source" |
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.
Thoughts on making this vault.hashicorp.com/agent-inject-template-file
instead?
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.
Indeed this annotation is clearer. I have updated the code.
His @jfroche! This looks great and is a good feature. I had one small suggestion on the name of the annotation, but overall it looks good to me. By the way, there's a new annotation that allows you to mount additional secrets |
edc11f2
to
4dc8e99
Compare
We currently have two options to define vault agent templates: either define the template configuration as an inline template in the annotation or configure the vault agent directly. The former is really not handy when template is getting complex, the latter forces us to manage the whole vault agent configuration. We add a new annotation that enables the vault agent to inject secrets from a template file on the container disk. Since hashicorp#212, this template can be present in volume defined on the container. Annotation example: ```yaml vault.hashicorp.com/agent-inject-secret-foo: 'database/roles/app' vault.hashicorp.com/agent-inject-template-file-foo: '/etc/my-app/config.toml.tmpl' vault.hashicorp.com/agent-inject-file-foo: '/etc/my-app/config.toml', vault.hashicorp.com/agent-copy-volume-mounts: 'MyContainerNameWithVolumes' ``` If a template content is also defined in annotation (using `vault.hashicorp.com/agent-inject-template`, the template on disk won't be used. refs hashicorp#84
4dc8e99
to
691243e
Compare
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, thanks!
I don't understand the decision for creating this annotation, but not |
We currently have two options to define vault agent templates: either define the template configuration as an inline template in the annotation or configure the vault agent directly. The former is really not handy when template is getting complex, the latter forces us to manage the whole vault agent configuration. We add a new annotation that enables the vault agent to inject secrets from a template file on the container disk. Since hashicorp#212, this template can be present in volume defined on the container. Annotation example: ```yaml vault.hashicorp.com/agent-inject-secret-foo: 'database/roles/app' vault.hashicorp.com/agent-inject-template-file-foo: '/etc/my-app/config.toml.tmpl' vault.hashicorp.com/agent-inject-file-foo: '/etc/my-app/config.toml', vault.hashicorp.com/agent-copy-volume-mounts: 'MyContainerNameWithVolumes' ``` If a template content is also defined in annotation (using `vault.hashicorp.com/agent-inject-template`, the template on disk won't be used. refs hashicorp#84
We currently have two options to define vault agent templates:
either define the template configuration as an inline template in the
annotation or configure the vault agent directly. The former is really
not handy when template is getting complex, the latter forces us to
manage the whole vault agent configuration.
We add a new annotation that enables the vault agent to inject secrets
from a template file on the container disk. Since
#212, this template can be
present in volume defined on the container.
Annotation example:
If a template content is also defined in annotation (using
vault.hashicorp.com/agent-inject-template
, the template on disk won't be used.refs #84