Skip to content
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

Merged
merged 44 commits into from
Sep 21, 2023

Conversation

pkazmierczak
Copy link
Contributor

@pkazmierczak pkazmierczak commented Sep 8, 2023

This PR splits identity_hook between the allocrunner and taskrunner. The allocrunner-level part of the hook signs each task identity, and the taskrunner-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 via Watch method, and IdentitySigner 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-level consul_hook will now be the only hook doing Consul authentication.

Ref: https://github.com/hashicorp/team-nomad/issues/404

@pkazmierczak pkazmierczak changed the title client: adapting identity_hook and new consul_hook for the new Consul client client: split identity_hook across allocrunner and taskrunner Sep 12, 2023
@pkazmierczak pkazmierczak marked this pull request as ready for review September 12, 2023 09:26
}

renewNow := false
minExp := time.Now().Add(30 * time.Hour) // set high default expiration
Copy link
Member

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.

Copy link
Member

@tgross tgross left a 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.

@pkazmierczak
Copy link
Contributor Author

pkazmierczak commented Sep 21, 2023

@tgross I applied all your suggestions in dad0e65 and I'm gonna merge the PR.

@pkazmierczak pkazmierczak merged commit 86d2cdc into main Sep 21, 2023
@pkazmierczak pkazmierczak deleted the f-consul-wi-consul_hook branch September 21, 2023 15:31
lgfa29 added a commit that referenced this pull request Sep 27, 2023
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.
lgfa29 added a commit that referenced this pull request Sep 27, 2023
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.
Copy link

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.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 12, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants