auth: allow nodes to sync their own allocations during node pool changes#28110
Open
vky5 wants to merge 2 commits into
Open
auth: allow nodes to sync their own allocations during node pool changes#28110vky5 wants to merge 2 commits into
vky5 wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes the server-side check so that when a node's node pool changes, the node can still fetch and sync allocations that are already assigned to it.
Right now, if the node pool names mismatch (because the old allocations are still on the old pool), the server blocks the node from syncing them.
How I fixed it:
AuthorizeClientAllocationinnomad/auth/auth.goto take the node'sAuthenticatedIdentity. Added a check at the top usingAuthorizeSameNodeto bypass node pool/namespace checks if the caller node matches the allocation's assignedNodeID.Serverwrapper method innomad/acl.goto match the signature.args.GetIdentity()at call-sites innomad/alloc_endpoint.go(insideGetAlloc,GetAllocs, andSignIdentities).Testing & Reproduction steps
Added new test cases to
TestResolveAuthorizedClientNodePoolHelpersinnomad/auth/auth_test.go:To run:
GOTOOLCHAIN=auto go test -v ./nomad/auth -run TestResolveAuthorizedClientNodePoolHelpersLinks
Contributor Checklist
changelog entry using the
make clcommand.ensure regressions will be caught.
Reviewer Checklist
backporting document.
in the majority of situations.
Changes to Security Controls
Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.
Yes, modified
AuthorizeClientAllocationinnomad/auth/auth.goto accept the caller's identity. If the caller is the same node the alloc is scheduled on, it bypasses the node pool check. This is safe since the node is already running that allocation.