-
Notifications
You must be signed in to change notification settings - Fork 173
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
Source -> Destination for templates & secrets #171
Comments
Hi @taylorsmithgg, this should be possible with this feature: #158. This will be in the next release of Vault K8s. |
I do not believe that PR fully addresses this use case, but possibly one key piece of it. If you could provide a fully-formed example, I would be happy to confirm! |
@jasonodonnell sorry for the direct mention. I have been hit with the issue that we need the same filename for a secret in multiple directories. Is it possible to cut a release? |
Our next release is planned Monday, August 24th @wernerb! |
@taylorsmithgg, you could try this (using the newest release 0.5.0): vault.hashicorp.com/agent-inject: "true"
vault.hashicorp.com/agent-inject-status: "update"
vault.hashicorp.com/agent-inject-secret-kv-secret: "secret/hashiconf"
vault.hashicorp.com/agent-inject-template-kv-secret: |
{{ with secret "secret/hashiconf" }}{{ .Data | toJSONPretty }}{{ end }}
vault.hashicorp.com/secret-volume-path-kv-secret: "/etc/mysecret"
vault.hashicorp.com/agent-inject-file-kv-secret: "secret.json"
vault.hashicorp.com/role: "app" |
Looks good! |
Is your feature request related to a problem? Please describe.
Currently, I am forced to add
cp /vault/secrets/file /destination
to my entrypoint in order to use a templated config in most practical configuration scenarios that do not allow config location overrides.Furthermore, local development environments do not provide the needed directory
/vault/secrets
without fostering it, so we have to maintain two sources of truth:1.) The dev docker configuration
2.) The chart/manifest for kubernetes
However, in most cases, we want to keep the same structure as the source code in order to maintain a seamless dev -> production environment.
With the introduction of the new annotation for defining the path, this is now possible for non-existing paths , but not for replacements or even adding a file to an existing path.
This is currently possible using confd with a vault backend.
Confd also allows us to decide whether or not to keep the staged file in the event we need to compare the rendered template to a replaced file. This allows us to apply a default configuration that is used during development, but overwritten in kubernetes.
The major difference is that my project (git repo) can define the source and destination, as well as the templates.
Currently, the recommended approach is using annotations, based on the examples.
This vastly simplifies the integration of complex configuration files across multiple kubernetes environments.
For example:
Describe the solution you'd like
The features of confd are currently more expressive and inline with regular development cycles.
I would like to see vault adopt some of these patterns:
1.) file replacement, with options for keeping original file
2.) ability to write to existing paths, source -> destination
3.) Better integration from git repo -> vault template
There is a limited example of using a postgres connection string in configmaps, but requires a lot of overhead in order to automate the process of converting git repo contents for templates -> configmap.
One of the biggest drawbacks for the current tutorials around these features are that they are extremely limited in scope.
It would be great to have an example that showed overriding a spring boot or nodejs hello world app with an overidden config using templates.
Describe alternatives you've considered
For the moment, I am using confd with vault as a backend.
Additional context
As mentioned before, moving long configurations into configmaps is possible, but still requires complex automation to copy from git repository -> configmap -> /vault/secrets -> /destination
PHP as obnoxious example config annotation
The text was updated successfully, but these errors were encountered: