Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#194
new CRD that generates vault tokens and stores them in k8s secrets.
This does not give you the k8s service account's token, it uses the service account to generate a new token.
the service account requires permission in vault to call the auth/token/create/ endpoint (and that permission should obviously be locked down to specific roles or fields using appropriate policies)
this is hardcoded to only generate non renewable tokens
but same as the dynamic secrets crd, it generates a new one at 67% (configurable) of the old one's lifetime,
so as long as you are using the up to date token from the secret, you'll always have a valid token.
the latest token accessor is stored in the VaultTokenSecret object, and is revoked if the object is deleted.
(currently it doesnt store or revoke the old accessor, if you delete the object after a new token has been generated, the old one still has 33% of it's lifetime left and is valid to log in with)
you can set most fields for generating a token:
policies
,meta
,no_default_policy
,ttl
,display_name
,entity_alias
.most others could be set using the role, apart from
renewable
, that is hardcoded to false for security,your app doesnt need to renew this token, it just gets a new one from the secret.
I dont really understand the code, but I pieced it together from parts of the static secret controller and dynamic secret controller, I know it works, but this probably needs to be rewritten by someone who actually understands it