Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Auth config block can support common arguments from env and flags #576

Open
uchanchlani opened this issue Jan 17, 2024 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@uchanchlani
Copy link

uchanchlani commented Jan 17, 2024

Although the injector allows the user to pass a custom auth config attribute as an annotation. Example:

annotations:
  vault.hashicorp.com/auth-config-header-value: https://vault.addess:8200

Sometimes a custom auth config attribute is required when using an auth type other than kubernetes.

For example, when using the AWS auth type, it asks the user for an optional header_value.
If the AWS auth on the vault server is configured to mandatorily use the X-Vault-AWS-IAM-Server-ID argument, it must be passed in the header_value or else the login request will fail.

Because this configuration is set on the overall auth method's settings and not on individual auth roles, it makes more sense to configure this value one time in the vault agent injector deployment for a one to one mapping, instead of on the multiple deployments/jobs/etc objects.

Requesting a feature request to allow such custom configuration via environment variable or CLI flags. Example environment variable:

export AGENT_INJECT_VAULT_AUTH_TYPE="aws"
export AGENT_INJECT_VAULT_AUTH_PATH="auth/aws"
# Below is the proposed env variable
export AGENT_INJECT_VAULT_AUTH_CONFIG_EXTRA_ARGS="header_value:https://vault.addess:8200"

This generates the config block as:

{
  "auto_auth":{
    "type": "aws",
    "mount_path": "auth/aws",
    "config": {
      "role": "<some-role-from-annotations>",
      "header_value": "https://vault.addess:8200"
    }
  }
}

Another example:

export AGENT_INJECT_VAULT_AUTH_TYPE="aws"
export AGENT_INJECT_VAULT_AUTH_PATH="auth/aws"
# Below is the proposed env variable
export AGENT_INJECT_VAULT_AUTH_CONFIG_EXTRA_ARGS="header_value:https://vault.addess:8200,type:iam"

This generates the config block as:

{
  "auto_auth":{
    "type": "aws",
    "mount_path": "auth/aws",
    "config": {
      "role": "<some-role-from-annotations>",
      "header_value": "https://vault.addess:8200",
      "type": "iam"
    }
  }
}
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant