forked from hashicorp/vault-plugin-auth-kubernetes
-
Notifications
You must be signed in to change notification settings - Fork 0
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 support for using serviceaccount annotations #1
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Addresses hashicorp#85 We took Mark's proposed design and added support for defining annotations on service accounts that can later on be used in policy templating. ```yaml apiVersion: v1 kind: ServiceAccount metadata: name: example-account namespace: default annotations: vault.hashicorp.com/auth-metadata/service-role: example-value ``` Should allow us to use in policies as so ``` {{identity.entity.aliases.${vault_auth_backend.kubernetes.accessor}.metadata.service_role}} ``` The change is behind a config flag called `enable_custom_metadata_from_annotations` so it should not affect any of the existing integrations. In order to enable the flag users will have to update the clusterrole and allow Vault to read service accounts. If this change is accepted we'll open PRs to update various docs, terraform providers, etc. This will al so introduce another roundtrip to the Kubernetes API, however we are using a pooled tcp client so hopefully not too many new open connections.
chongyangshi
pushed a commit
to monzo/terraform-provider-vault
that referenced
this pull request
Feb 1, 2022
This change accompanies monzo/vault-plugin-auth-kubernetes#1, which adds a new config flag to the Kubernetes auth plugin , which if enabled will cause the auth plugin to read service account annotations in Kubernetes prefixed with vault.hashicorp.com/auth-metadata/ as auth metadata in Vault.
chongyangshi
pushed a commit
to chongyangshi/terraform-provider-vault
that referenced
this pull request
Feb 1, 2022
This change accompanies monzo/vault-plugin-auth-kubernetes#1, which adds a new config flag to the Kubernetes auth plugin , which if enabled will cause the auth plugin to read service account annotations in Kubernetes prefixed with vault.hashicorp.com/auth-metadata/ as auth metadata in Vault.
…t have multiple subpaths
chongyangshi
reviewed
Feb 2, 2022
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.
Looks fine, once we patch up that comment we should be able to raise a PR to hashicorp/vault-plugin-auth-kubernetes
from this branch
chongyangshi
previously approved these changes
Feb 2, 2022
Co-authored-by: Chongyang Shi <8771937+chongyangshi@users.noreply.github.com>
chongyangshi
approved these changes
Feb 2, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Addresses hashicorp#85
We took Mark's proposed design and added support for defining annotations on service accounts that can later on be used in policy templating.
Should allow us to use in policies as so
Who the change affects or is for (stakeholders)?
The change is behind a config flag called
enable_custom_metadata_from_annotations
so it should not affect any of the existing integrations.In order to enable the flag users will have to update the clusterrole and allow Vault to read service accounts. If this change is accepted we'll open PRs to update various docs, terraform providers, etc.
This will also introduce another roundtrip to the Kubernetes API, however we are using a pooled tcp client so hopefully not too many new open connections.
Why is the change needed?
At Monzo we want to use fully qualified service names for certificates issued under Vault's PKI, ie
service.profile
which we can attach as annotations to service accounts. At the same time we want the policies to be very strict soservice.profile
is not allowed to obtain certificates forservice.id
.Design of Change
We've largely adhered to the current code style present in the repo.
All changes are behind a config flag
enable_custom_metadata_from_annotations
so existing integrations shouldn't be affected.Related Issues/Pull Requests
TBD
Contributor Checklist
TBD
[ ] Add relevant docs to upstream Vault repository, or sufficient reasoning why docs won’t be added yet
My Docs PR Link
Example
[x] Add output for any tests not ran in CI to the PR description (eg, acceptance tests)
[x] Backwards compatible