Repository navigation
Conversation
With sync.fromHost.nodes.selector configured, a pod that set spec.nodeName skipped the selector; only the existence of a virtual Node with that name was checked, and a tenant can create such a Node. The selector is now merged into the host pod's nodeSelector in both cases, so a pod pinned to a node outside the selector is rejected by that node's kubelet at admission instead of running there. Signed-off-by: Youssef Omar Bouden <youssef.bouden2002@gmail.com>
This branch has not been deployed
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.
What issue type does this pull request address?
/kind bugfix
What does this pull request do? Which issues does it resolve?
resolves #4272
With a node selector configured, pods that set
spec.nodeNameskipped the selector entirely; only the existence of a virtual Node with that name was checked, and a tenant can create such a Node. The selector is now merged into the pod'snodeSelectorin both cases, so a pod pinned to a node outside the selector is rejected by that node's kubelet at admission instead of running there. The existence check stays.Please provide a short message that should be published in the vcluster release notes
Fixed an issue where a pod with
spec.nodeNameset could run on host nodes outsidesync.fromHost.nodes.selector.What else do we need to know?
Unit test added for both the pinned and the unpinned case.
Note
Medium Risk
Changes pod-to-host sync behavior for pinned pods and affects scheduling enforcement at kubelet admission; scope is limited to the pod syncer with new unit coverage.
Overview
Fixes a bypass where pods with
spec.nodeNameset could sync to the host withoutsync.fromHost.nodes.selectorlabels on the physical pod.SyncToHostnow always merges the configured selector into the physical pod’snodeSelector(pinned or not), so the kubelet rejects pods bound to nodes outside the selector. The existing virtual Node existence check whennodeNameis set is unchanged.Adds
TestSyncToHostNodeSelectorWithNodeNamecovering pinned and unpinned pods.Reviewed by Cursor Bugbot for commit 35dd2bf. Bugbot is set up for automated code reviews on this repo. Configure here.