Skip to content

fix(inventory): exclude tainted nodes from the inventory#406

Open
neyy91 wants to merge 2 commits into
akash-network:mainfrom
neyy91:fix/exclude-tainted-nodes
Open

fix(inventory): exclude tainted nodes from the inventory#406
neyy91 wants to merge 2 commits into
akash-network:mainfrom
neyy91:fix/exclude-tainted-nodes

Conversation

@neyy91

@neyy91 neyy91 commented Jun 19, 2026

Copy link
Copy Markdown

What

Node discovery (operator/inventory/node-discovery.go) only excluded nodes that were not-ready, cordoned (Unschedulable), or in the operator exclude list. Nodes carrying a NoSchedule/NoExecute taint were still reported as available capacity.

This adds nodeHasBlockingTaint and treats any NoSchedule/NoExecute taint as a reason to keep the node out of the inventory. PreferNoSchedule is a soft preference and is left alone.

Why

Closes the behaviour reported in akash-network/support#253: providers with tainted nodes (e.g. node-role.kubernetes.io/control-plane, CriticalAddonsOnly) kept bidding using that capacity once the rest of the cluster was full. Akash pods carry no custom tolerations, so the pod can never schedule onto a tainted node - the deployment fails FailedScheduling and the provider closes it minutes later. Reported in the wild on multiple providers and on a support call.

Testing

Added TestGenerateLabels_Taints: a ready, untainted node is marked akash-managed; NoSchedule and NoExecute tainted nodes are excluded; PreferNoSchedule is not. Fails without the fix.

refs: akash-network/support#253

Node discovery only excluded nodes that were not-ready, cordoned, or in
the operator exclude list. Nodes carrying a NoSchedule/NoExecute taint
(e.g. control-plane, CriticalAddonsOnly) were still reported as available
capacity, so the provider bid on workloads it could never schedule and
the deployment was closed minutes later.

Treat any NoSchedule/NoExecute taint as a reason to keep the node out of
the inventory. PreferNoSchedule is a soft preference and is left alone.

refs: akash-network/support#253
@neyy91 neyy91 requested a review from a team as a code owner June 19, 2026 10:31
@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 2d3eb4ea-909d-4819-a061-8190c61d44e4

📥 Commits

Reviewing files that changed from the base of the PR and between 5f11d58 and 743d52c.

📒 Files selected for processing (1)
  • operator/inventory/node-discovery.go

Walkthrough

The isNodeReady function is refactored to accept a full *corev1.Node and check for taints with effect NoSchedule or NoExecute, returning false immediately if found before proceeding to verify the NodeReady condition. The generateLabels function is updated to call the refactored isNodeReady signature, integrating taint-based exclusion into node labeling. A new test file adds a readyNode constructor and TestGenerateLabels_Taints covering all three taint effect scenarios.

Changes

Taint-based node exclusion

Layer / File(s) Summary
isNodeReady taint checking and generateLabels wiring with tests
operator/inventory/node-discovery.go, operator/inventory/node-discovery_test.go
Refactors isNodeReady to inspect Spec.Taints and return false for NoSchedule or NoExecute effects before checking NodeReady condition; updates generateLabels to call the refactored isNodeReady(knode) signature; adds readyNode helper and TestGenerateLabels_Taints to verify that untainted and PreferNoSchedule-tainted nodes receive AkashManagedLabelName while NoSchedule- and NoExecute-tainted nodes are excluded.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A taint on the node? Oh dear, oh my!
NoSchedule and NoExecute — we say goodbye!
The rabbit hops past with labels in paw,
Only clean, friendly nodes make it through the door.
PreferNoSchedule? You're still in the game! 🐇✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: excluding tainted nodes from the inventory by checking for NoSchedule/NoExecute taints.
Description check ✅ Passed The description is directly related to the changeset, explaining the issue with tainted nodes, the fix applied, and the testing approach.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Comment thread operator/inventory/node-discovery.go Outdated
adjConfig.FilterOutStorageClasses(presentSc)

isExcluded := !isNodeReady(knode.Status.Conditions) || knode.Spec.Unschedulable || adjConfig.Exclude.IsNodeExcluded(knode.Name)
isExcluded := !isNodeReady(knode.Status.Conditions) || knode.Spec.Unschedulable || nodeHasBlockingTaint(knode.Spec.Taints) || adjConfig.Exclude.IsNodeExcluded(knode.Name)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets keep content of nodeHasBlockingTaint within isNodeReady

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. folded the taint check into isNodeReady, which now takes the node and treats a NoSchedule/NoExecute taint as not-ready. Dropped the separate helper.

Per review: keep the taint check inside isNodeReady rather than a
separate helper. isNodeReady now takes the node and treats a
NoSchedule/NoExecute taint as not-ready, so the exclusion logic stays a
single predicate.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants