Skip to content

Support configurable vault-client binary in vault-k8s - #928

Merged
Siddharth-Kannan merged 4 commits into
mainfrom
VAULT-52160-support-configurable-vault-client-binary-in-vault-helm-and-vault-k-8-s-agent-injector
Nov 25, 2026
Merged

Siddharth-Kannan merged 4 commits into
mainfrom
VAULT-52160-support-configurable-vault-client-binary-in-vault-helm-and-vault-k-8-s-agent-injector

Conversation

@Siddharth-Kannan

@Siddharth-Kannan Siddharth-Kannan commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Support agent images containing only vault-client by making the injector-generated executable configurable.

  • Add the vault.hashicorp.com/agent-binary pod annotation.
  • Add the vault-binary flag and AGENT_INJECT_VAULT_BINARY environment variable.
  • Use the selected binary consistently for init agents, sidecar agents, ConfigMap-based startup, and revoke-on-shutdown commands.
  • Preserve vault as the default and leave command arguments unchanged.
  • Validate supported binary names and document configuration and precedence.

The existing Helm injector.extraEnvironmentVars setting can pass the new environment variable to an injector image containing this change.
Vault server commands and user-supplied commands remain unchanged.

Validation

  • Race-enabled repository tests passed through make test.
  • Added tests for defaults, overrides, invalid values, generated commands, and admission patches.

Manual Testing

Used a real enterprise image containing vault-client but no vault executable.

  • Init and sidecar agents started successfully with both generated JSON and ConfigMap-based configurations.
  • Each agent created its Unix socket and exited with code 0 when stopped.
  • Shutdown hooks ran vault-client token revoke and attempted a request to the expected /v1/auth/token/revoke-self API endpoint.
  • Containers ran as non-root with a read-only root filesystem.

These checks confirm command compatibility with a client-only image.
Kubernetes authentication, secret retrieval, and successful token revocation were not tested.

PCI review checklist

  • I have documented a clear reason for, and description of, the change I am making.

  • If applicable, I've documented a plan to revert these changes if they require more than reverting the pull request.

  • If applicable, I've documented the impact of any changes to security controls.

    Examples of changes to security controls include using new access control methods, adding or removing logging pipelines, etc.

@Siddharth-Kannan
Siddharth-Kannan requested review from a team as code owners November 11, 2026 11:36
Comment thread agent-inject/agent/annotations.go Resolved
Comment thread agent-inject/agent/annotations.go Resolved
Comment thread subcommand/injector/command.go Resolved
Comment thread subcommand/injector/command.go Resolved
Comment thread README.md Resolved
Comment thread agent-inject/agent/agent.go Outdated
if a.ImageName == "" {
return errors.New("no Vault image found")
}
if a.binary() != "vault" && a.binary() != "vault-client" {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we have single exported helper for this validation as this is duplicated in command.go as well. It will be easier to maintain.

@vijayavelsekar vijayavelsekar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@Siddharth-Kannan
Siddharth-Kannan merged commit 2ac553c into main Nov 25, 2026
75 of 80 checks passed
@Siddharth-Kannan
Siddharth-Kannan deleted the VAULT-52160-support-configurable-vault-client-binary-in-vault-helm-and-vault-k-8-s-agent-injector branch November 25, 2026 05:44
@vijayavelsekar vijayavelsekar added this to the v1.8.0 milestone Nov 26, 2026
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