-
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
Variable Interpolation error with Consul Workload Identity #20025
Comments
Hi @MorphBonehunter! Yeah that looks like a bug for sure (and a regression in any case). We must be missing the interpolation step in the new code. I'll dig into this to verify and then mark this issue for roadmapping (or push a fix sooner rather than later if it's simple). |
Hi @MorphBonehunter, I had a chance to investigate this further and it looks like our new I've run out of time for this week to finish my fix (see my working branch), but I should be able to pick it back up next week. |
Hi @tgross thanks for the update. |
Yeah, it'll almost certainly impact Vault as well because of the missing interpolation in the |
Hey @tgross are there any news on this issue? |
Sorry @MorphBonehunter I didn't get a chance to follow-thru on this. I've got a branch that fixes the issue in the Consul hook but not the WI hook (which is a little trickier). I'll try to get this resolved in the next week. |
Hey @MorphBonehunter I've got a draft PR up #20344 which I've still got to do some end-to-end testing on. I'll hopefully have that ready for review tomorrow with an eye towards getting into the next patch release. Thanks for your patience! |
Hi @tgross, that sounds great. I didn't want to create any pressure here, i just want to ask :) |
So the patch I've got up is close but not quite enough, and I'm running into a design issue I'm going to have to work out. I can get all the signing requests from the client to be interpolated just fine. But when it comes to getting those identities signed, we send an "identity handle" up to the server and tell it to sign the identity from the jobspec that matches that handle. The problem is that the identity handle in the request is interpolated so it won't match the identity handle from the identity in the server's version of the jobspec (which is derived from the I'm bringing this back to the team for some internal discussion around what to do with it, and will report back once I know more. |
Services can have some of their string fields interpolated. The new Workload Identity flow doesn't interpolate the services before requesting signed identities or using those identities to get Consul tokens. Add support for interpolation to the WID manager and the Consul tokens hook by providing both with a taskenv builder. This changeset also makes two related test improvements: * Remove the mock WID manager, which was only used in the Consul hook tests and isn't necessary so long as we provide the real WID manager with the mock signer and never call `Run` on it. * Fixed swapped expect-vs-actual assertions on the `consul_hook` tests. Fixes: #20025
Ok, I've got that problem fixed in #20344 by adding a field to the |
Services can have some of their string fields interpolated. The new Workload Identity flow doesn't interpolate the services before requesting signed identities or using those identities to get Consul tokens. Add support for interpolation to the WID manager and the Consul tokens hook by providing both with a taskenv builder. This changeset also makes two related test improvements: * Remove the mock WID manager, which was only used in the Consul hook tests and isn't necessary so long as we provide the real WID manager with the mock signer and never call `Run` on it. * Fixed swapped expect-vs-actual assertions on the `consul_hook` tests. Fixes: #20025
Services can have some of their string fields interpolated. The new Workload Identity flow doesn't interpolate the services before requesting signed identities or using those identities to get Consul tokens. Add support for interpolation to the WID manager and the Consul tokens hook by providing both with a taskenv builder. Add an "interpolate workload" field to the WI handle to allow passing the original workload name to the server so the server can find the correct service to sign. This changeset also makes two related test improvements: * Remove the mock WID manager, which was only used in the Consul hook tests and isn't necessary so long as we provide the real WID manager with the mock signer and never call `Run` on it. It wasn't feasible to exercise the correct behavior without this refactor, as the mocks were bypassing the new code. * Fixed swapped expect-vs-actual assertions on the `consul_hook` tests. Fixes: #20025
Services can have some of their string fields interpolated. The new Workload Identity flow doesn't interpolate the services before requesting signed identities or using those identities to get Consul tokens. Add support for interpolation to the WID manager and the Consul tokens hook by providing both with a taskenv builder. Add an "interpolate workload" field to the WI handle to allow passing the original workload name to the server so the server can find the correct service to sign. This changeset also makes two related test improvements: * Remove the mock WID manager, which was only used in the Consul hook tests and isn't necessary so long as we provide the real WID manager with the mock signer and never call `Run` on it. It wasn't feasible to exercise the correct behavior without this refactor, as the mocks were bypassing the new code. * Fixed swapped expect-vs-actual assertions on the `consul_hook` tests. Fixes: #20025
…es into release/1.7.x (#20363) Services can have some of their string fields interpolated. The new Workload Identity flow doesn't interpolate the services before requesting signed identities or using those identities to get Consul tokens. Add support for interpolation to the WID manager and the Consul tokens hook by providing both with a taskenv builder. Add an "interpolate workload" field to the WI handle to allow passing the original workload name to the server so the server can find the correct service to sign. This changeset also makes two related test improvements: * Remove the mock WID manager, which was only used in the Consul hook tests and isn't necessary so long as we provide the real WID manager with the mock signer and never call `Run` on it. It wasn't feasible to exercise the correct behavior without this refactor, as the mocks were bypassing the new code. * Fixed swapped expect-vs-actual assertions on the `consul_hook` tests. Fixes: #20025 Co-authored-by: Tim Gross <[email protected]>
@tgross Thanks for figuring this out, great work. |
Services can have some of their string fields interpolated. The new Workload Identity flow doesn't interpolate the services before requesting signed identities or using those identities to get Consul tokens. Add support for interpolation to the WID manager and the Consul tokens hook by providing both with a taskenv builder. Add an "interpolate workload" field to the WI handle to allow passing the original workload name to the server so the server can find the correct service to sign. This changeset also makes two related test improvements: * Remove the mock WID manager, which was only used in the Consul hook tests and isn't necessary so long as we provide the real WID manager with the mock signer and never call `Run` on it. It wasn't feasible to exercise the correct behavior without this refactor, as the mocks were bypassing the new code. * Fixed swapped expect-vs-actual assertions on the `consul_hook` tests. Fixes: #20025
I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues. |
Nomad version
Output from
nomad version
Operating system and Environment details
Arch Linux
Issue
Today i try to migrate to the workload identity mechanism.
While the vault migration went well, the consul part fails on the variable interpolation stuff.
For easiness and simple change possibility i write my jobfiles with extensive use of
NOMAD_TASK_NAME
variable,this doesn't work anymore after migration if you use this in the consul service definition part:
After that the following error occurs:
Reproduction steps
Try to use
NOMAD_TASK_NAME
in service name definition with active workload identity settings.Expected Result
The job should start like it does before the migration.
Actual Result
The job fails.
I'm not sure if this is a corner case and the usage of variable interpolation in this scenario isn't something i should do, but as it worked before i assume this is a bug.
The text was updated successfully, but these errors were encountered: