agent: allow setting auto-auth and vault.namespace separately (#26427)

The new vault.namespace config option seems to always be overridden by
the auto-auth namespace, so add an extra check to allow them to be set
separately.

---------

Co-authored-by: Violet Hynes <violet.hynes@hashicorp.com>
This commit is contained in:
Theron Voran 2024-04-15 14:05:38 -07:00 committed by GitHub
parent 51ee69d02c
commit 6df779f1ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 0 deletions

3
changelog/26427.txt Normal file
View file

@ -0,0 +1,3 @@
```release-note:bug
agent: `vault.namespace` no longer gets incorrectly overridden by `auto_auth.namespace`, if set
```

View file

@ -328,6 +328,9 @@ func (c *AgentCommand) Run(args []string) int {
client.SetNamespace(config.AutoAuth.Method.Namespace)
}
templateNamespace = client.Namespace()
if !namespaceSetByEnvironmentVariable && config.Vault != nil && config.Vault.Namespace != "" {
templateNamespace = config.Vault.Namespace
}
sinkClient, err := client.CloneWithHeaders()
if err != nil {