-
Notifications
You must be signed in to change notification settings - Fork 2k
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
client: split identity_hook across allocrunner and taskrunner #18431
Conversation
78a575c
to
b959429
Compare
client/widmgr/widmgr.go
Outdated
} | ||
|
||
renewNow := false | ||
minExp := time.Now().Add(30 * time.Hour) // set high default expiration |
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.
I like the idea of being able to bail out of the renew loop entirely. That implies downstream consumers will need to either Get
or Watch
based on whether they have a TTL, but I think that's ok.
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.
@pkazmierczak I've left some minor remaining comments but the only one that seems potentially blocking are the ones around shutdown and double-closing the channels. Good-to-merge once that's fixed.
The initial intention behind the `vault.use_identity` configuration was to indicate to Nomad servers that they would need to sign a workload identities for allocs with a `vault` block. But in order to support identity renewal, #18262 and #18431 moved the token signing logic to the alloc runner since a new token needs to be signed prior to the TTL expiring. So #18343 implemented `use_identity` as a flag to indicate that the workload identity JWT flow should be used when deriving Vault tokens for tasks. But this configuration value is set on servers so it is not available to clients at the time of token derivation, making its meaning not clear: a job may end up using the identity-based flow even when `use_identity` is `false`. The only reliable signal available to clients at token derivation time is the presence of an `identity` block for Vault, and this is already configured with the `vault.default_identity` configuration block, making `vault.use_identity` redundant. This commit removes the `vault.use_identity` configuration and simplifies the logic on when an implicit Vault identity is injected into tasks.
The initial intention behind the `vault.use_identity` configuration was to indicate to Nomad servers that they would need to sign a workload identities for allocs with a `vault` block. But in order to support identity renewal, #18262 and #18431 moved the token signing logic to the alloc runner since a new token needs to be signed prior to the TTL expiring. So #18343 implemented `use_identity` as a flag to indicate that the workload identity JWT flow should be used when deriving Vault tokens for tasks. But this configuration value is set on servers so it is not available to clients at the time of token derivation, making its meaning not clear: a job may end up using the identity-based flow even when `use_identity` is `false`. The only reliable signal available to clients at token derivation time is the presence of an `identity` block for Vault, and this is already configured with the `vault.default_identity` configuration block, making `vault.use_identity` redundant. This commit removes the `vault.use_identity` configuration and simplifies the logic on when an implicit Vault identity is injected into tasks.
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
This PR splits
identity_hook
between theallocrunner
andtaskrunner
. Theallocrunner
-level part of the hook signs each task identity, and thetaskrunner
-level part picks it up and stores secrets for each task.This code revamps the
WIDMgr
, which is now split into 2 interfaces:IdentityManager
which manages renewals of signatures and handles sending updates to subscribers viaWatch
method, andIdentitySigner
which only does the signing.This work is necessary for having a unified Consul login workflow that comes with the new Consul integration. A new,
allocrunner
-levelconsul_hook
will now be the only hook doing Consul authentication.Ref: https://github.com/hashicorp/team-nomad/issues/404