Fix #6678: restrict toleration.taints keys via operator allow list#6695
Open
HarshMehta112 wants to merge 2 commits into
Open
Fix #6678: restrict toleration.taints keys via operator allow list#6695HarshMehta112 wants to merge 2 commits into
HarshMehta112 wants to merge 2 commits into
Conversation
Signed-off-by: Harsh Mehta <harshmehta010102@gmail.com>
squakez
reviewed
Jun 22, 2026
squakez
left a comment
Contributor
There was a problem hiding this comment.
I think the existing e2e on toleration may be failing now. Let's see the check results to confirm.
…raction Signed-off-by: Harsh Mehta <harshmehta010102@gmail.com>
squakez
approved these changes
Jun 22, 2026
Contributor
Author
|
Hi @squakez |
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.
Summary
Adds an operator-level allow list to restrict which taint keys CR authors can use in
toleration.taints, preventing unauthorized node targeting in shared clusters.How it works:
Set
TOLERATION_TAINTS_ALLOWED_KEYSon the operator deployment to a comma-separatedlist of permitted taint keys:
TOLERATION_TAINTS_ALLOWED_KEYS=node-role.kubernetes.io/master,disktype
taints are dropped and logged at info level before
NewTolerationsis calledTaint key extraction handles both formats:
key:Effect(key before:) andkey=value:Effect(key before=).Changes
pkg/platform/env_platform.go— newTolerationTaintsAllowList()reads and parsesTOLERATION_TAINTS_ALLOWED_KEYS(same comma-split/trim pattern as the nodeSelector and affinity allow lists)pkg/trait/toleration.go—filterTaints()iterates taints and usestaintKey()helper to extract the key before checking against the allow list; called at the start ofApply()beforeNewTolerationspkg/platform/env_platform_test.go— 4 tests: not-set, empty, single key, multiple keys with whitespace trimmingpkg/trait/toleration_test.go— 6 tests: no allow list (pass-through), partial filter, all allowed, all dropped, key-with-value format (key=value:Effect), end-to-end throughApply()docs/modules/ROOT/pages/installation/builds.adoc—TOLERATION_TAINTS_ALLOWED_KEYSadded to build env var tabledocs/modules/traits/pages/toleration.adoc— NOTE block added with xref to builds config docsTest plan
make testpasses locallyTestTolerationTaintsAllowList_*(platform) — env var parsingTestFilterTaints_*(trait) — allow list filtering covering bothkey:Effectandkey=value:Effecttaint formatsTestApplyTolerationWithAllowList— end-to-end throughApply()TOLERATION_TAINTS_ALLOWED_KEYSset; apply Integration with a disallowed taint key; verify toleration absent from pod spec and info log emittedFixes #6678