-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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 namespace config option to agent config #6988
Conversation
command/agent.go
Outdated
@@ -219,6 +219,12 @@ func (c *AgentCommand) Run(args []string) int { | |||
Default: "https://127.0.0.1:8200", | |||
EnvVar: api.EnvVaultAddress, | |||
}) | |||
c.setStringFlag(f, config.Vault.Namespace, &StringVar{ |
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.
If we end up implementing this, we should also print in during agent's startup (probably by appending to infoKeys
).
I am not sure if it makes sense to have this config for agent caching since clients that hit the agent can fully control what namespace they want to hit. This is a bit different that Consul Template's scenario, where we don't actually control the API client, so there needs to be a config option exposed in order to specify which namespace we want to read/write from. From a UX perspective, it might end up being confusing since my request on |
@calvn I think your explanation makes sense. Consul Template's behavior and use-cases are different than the Vault Agent and what features it provides. |
@calvn I disagree: The client does not know (and should not know) which endpoint to hit. The vault agent is abstracting this from the client, in the same way that it abstracts the address of the Vault server away from the client. As an example, we are running a Vault server in staging, and one in production -> two different I would accept your argument if the However, as the In my opinion, not supporting the
Both of these are specifically a problem when multiple clients share the same vault agent: In that case, either one of the clients needs to be chosen to launch that If the configuration is all contained in the vault agent config file, then all it takes is a simple "if vault agent is not already running, then start it" logic, which makes this thing universal and fairly fail-safe. |
Are you referring to Vault agent for auto-auth or caching capabilities? If it's the former I think that it would make sense to have the namespace be configurable. This should probably go under The |
I am only using However, in our deployment, the auth method is configured in the namespace. The reason for this is that the namespace admins have 100% control over how they would like to control their namespace, which includes configuration of their own auth method. This is not uncommon for a SaaS service (which is how we operate our Vault Enterprise deployment). Consequently, the auth token retrieved by the auth method is only useful in the specific namespace it has been retrieved for. In this case, if you placed the namespace config into the method, the caching would not work against other namespaces, because its token would be invalid there. Unless of course you would also change I could imagine that someone may use different namespaces for the caching use case, but from all I know, when namespaces were introduced in Vault, they were marketed as a feature to create "virtual" Vault servers with decentralized administration. When looking at it from that perspective, it would not make much sense to have a single Vault agent instance serve multiple "virtual Vault servers". If I were to deploy clients that have to connect to different Vault namespaces, I would probably want them separated to avoid any potential contamination, and consequently run multiple instances of vault agent (one for each addr + namespace combo) to keep things strictly isolated (different PIDs, users, groups). |
This would be true even if we placed For the case where caching is enabled, If the client wants to make requests to a specific namespace through agent caching (and not provide its own token in the request), it will have to talk to the right agent which satisfies the "virtual Vault servers" model. |
Does this summarize your proposal correctly then:
From my perspective (as I am primarily interested in auto-auth at this point), this would work just fine. However, I do see the risk of some inconsistency / confusion for the users of the caching function ("why do I have to specify the namespace for my caching request, if authN worked just fine without it?!?").
I understand. One more suggestion though before I give up on this one: What do you think about moving this back into the
If That seems to be backwards compatible and make for a good UX:
|
I am awaiting feedback from the team on this one. However, it's been brought up that there are wider changes around the Vault API down the road that would facilitate the interaction with agent which will likely encompass namespace behavior, so it's possible that we will hold from committing to something until then. |
Sounds good, please keep me posted |
I don't really think this needs to be coupled to caching; the fact that a path can be gotten to by full path vs namespace plus relative path means this is just an implementation nicety... exactly in the same vein as the -ns CLI parameter. I don't see a reason not to add this. As for caching, I don't think we should set a default namespace. The client making normal requests to Vault is responsible for setting the namespace appropriately. The fact that there is a proxy in front doesn't change that. To do otherwise is to make the proxy less transparent. |
2769140
to
67f0a4f
Compare
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.
Two small comments, looks good otherwise!
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.
Agree with Calvin's comments, otherwise looks good!
975a5c5
@calvn have this changes been made or are still planned?
This scenario just happened for me:
To give more details of why I am wanting to do that, we use different namespaces for various environments and I am looking to switch to using agent caching instead of the applications getting a token and managing everything. I would like to be able to remove all knowledge of namespaces out of the applications, so they just know that the secrets live at The tokens themselves are only good for the single namespace in my setup, and without this I have to have namespace info in both the agent config and the application. |
Fixes #6981