Skip to content

Conversation

@kelnage
Copy link
Contributor

@kelnage kelnage commented Dec 23, 2025

Adds support for fetching secrets (the USERNAME, PASSWORD, and BEARER_TOKEN) from a configured Vault KVv2 mount path. It uses the IAM authentication approaches described in the Vault AWS auth documentation, and the implementation is partly built around the provided code example.

It extends the the secret client to store both the Vault configuration (role, mount, and path) and a cache of the fetched secret data, in order to minimise time fetching environment variables and requests to Vault.

If this implementation seems reasonable, I'd be happy to update the documentation to reflect its intended usage.

Copy link
Collaborator

@jeschkies jeschkies left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a really nice solution. I just think we need to overhaul the credentials providers.

Comment on lines 11 to 17
type secretFetcher interface {
FetchFromAWSSecretsManager(ctx context.Context, secretArn string) (string, error)
FetchFromAWSSSMParameterStore(ctx context.Context, parameterArn string) (string, error)
FetchFromVault(ctx context.Context, key string) (string, error)
HasVaultConfig() bool
SetVaultConfig(config *VaultKVCredentials)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should change it so that the fetcher is injected in main depending on the config. This way we don't need HasVaultConfig. We could also mimic the credentials chain like in AWS. We define a Provider interface and then implement each plus a ChainProvider.

return "", fmt.Errorf("no auth info was returned after login")
}

data, err := client.KVv2(c.vaultConfig.mount).Get(ctx, c.vaultConfig.path)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have thought that Vault would call an API. Is this actually mounting a volume? Also, this only works if Vault is also hosted on AWS right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants