Skip to content

fix(config): apply cluster node port quantity to the inventory#407

Open
neyy91 wants to merge 1 commit into
akash-network:mainfrom
neyy91:fix/apply-node-port-quantity
Open

fix(config): apply cluster node port quantity to the inventory#407
neyy91 wants to merge 1 commit into
akash-network:mainfrom
neyy91:fix/apply-node-port-quantity

Conversation

@neyy91

@neyy91 neyy91 commented Jun 20, 2026

Copy link
Copy Markdown

What

The --cluster-node-port-quantity flag (env AKASH_CLUSTER_NODE_PORT_QUANTITY) was assigned to a Config field that nothing reads. The inventory service reads the embedded cluster.Config.InventoryExternalPortQuantity, which was never populated, so the operator's configured value was silently ignored.

This drops the orphaned field and routes the flag into the inventory config via a small SetClusterExternalPortQuantity setter.

Why

Closes akash-network/support#135: operators setting the node port quantity (e.g. to 0/1) saw no effect - the provider kept bidding with the default port quantity.

Testing

Added TestConfig_NodePortQuantityReachesInventory, asserting the configured value lands in InventoryExternalPortQuantity. The orphaned field is removed and the whole repo builds (it was read nowhere).

refs: akash-network/support#135

The --cluster-node-port-quantity flag was stored in a Config field that
nothing read, while the inventory service reads the embedded
cluster.Config.InventoryExternalPortQuantity, which was never set. The
operator's configured node port quantity was therefore ignored.

Drop the orphaned field and route the value into the inventory config via
SetClusterExternalPortQuantity.

refs: akash-network/support#135
@neyy91 neyy91 requested a review from a team as a code owner June 20, 2026 14:51
@coderabbitai

coderabbitai Bot commented Jun 20, 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: 1383f988-4e1a-4258-806a-72cefa0e3478

📥 Commits

Reviewing files that changed from the base of the PR and between 0e0fd8a and e590b33.

📒 Files selected for processing (3)
  • cmd/provider-services/cmd/run.go
  • config.go
  • config_test.go

Walkthrough

Fixes a bug where AKASH_CLUSTER_NODE_PORT_QUANTITY had no effect. The standalone ClusterExternalPortQuantity field is removed from provider.Config; a SetClusterExternalPortQuantity setter now writes to cluster.Config.InventoryExternalPortQuantity. The call site is updated to use the setter, and a regression test verifies the wiring.

Changes

Node Port Quantity Propagation Fix

Layer / File(s) Summary
Config struct and setter fix
config.go
Removes the dead ClusterExternalPortQuantity field from Config, which was never read by inventory. SetClusterExternalPortQuantity now writes the provided value to InventoryExternalPortQuantity on the embedded cluster.Config.
Call site update and regression test
cmd/provider-services/cmd/run.go, config_test.go
doRunCmd is updated to call config.SetClusterExternalPortQuantity(nodePortQuantity) instead of direct field assignment. TestConfig_NodePortQuantityReachesInventory constructs a default config, calls the setter, and asserts that cfg.InventoryExternalPortQuantity matches the expected value.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐇 A field sat alone, unread and unseen,
Its value ignored — what a gap in between!
I hopped through the code with a setter in paw,
And wired the port quantity, fixing the flaw.
Now inventory listens, the config rings true,
No node port left silent — hooray, it goes through! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% 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: fixing the configuration bug where cluster node port quantity is now properly applied to the inventory system.
Description check ✅ Passed The description clearly explains what was broken, why it matters, and how it was fixed, with concrete context about the silent configuration failure.
Linked Issues check ✅ Passed The PR fully addresses the linked issue #135 by routing the AKASH_CLUSTER_NODE_PORT_QUANTITY flag to InventoryExternalPortQuantity, enabling operator control over node port advertising.
Out of Scope Changes check ✅ Passed All changes are directly focused on fixing the configuration flow issue: removing the orphaned field, implementing the setter, and adding a test to verify the fix.

✏️ 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.

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.

AKASH_CLUSTER_NODE_PORT_QUANTITY doesn't appear to take into effect

1 participant