-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check ports allocation for NS8 Modules #742
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some thoughts to discuss together.
- The PR makes the library a Redis client.
- The check is required only when a module (not the cluster) agent invokes
node/allocate-ports
. - New and existing modules instances, only those with the new
portsadm
role, are interested by this limit.
f23137f
to
8a24475
Compare
8a24475
to
ae2a41a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More validation error details
core/imageroot/var/lib/nethserver/node/actions/allocate-ports/50allocate
Outdated
Show resolved
Hide resolved
core/imageroot/var/lib/nethserver/node/actions/allocate-ports/50allocate
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is still a reference to a removed function
core/imageroot/var/lib/nethserver/node/actions/allocate-ports/50allocate
Outdated
Show resolved
Hide resolved
606368b
to
e931675
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an issue with the max_ports_exceeded computation.
core/imageroot/var/lib/nethserver/node/actions/allocate-ports/50allocate
Outdated
Show resolved
Hide resolved
core/imageroot/var/lib/nethserver/node/actions/allocate-ports/50allocate
Outdated
Show resolved
Hide resolved
The message is sent to the system journal and also in the API error stream, which is visible in the Python exception raised by agent.allocate_ports(), too.
Return an empty list if the module has no ports allocation. Suppress module-not-found warnings when a module is removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This pull request adds a check to the port allocation library to ensure modules don’t request more ports than allowed. When a module is installed, its maximum required TCP and UDP ports are stored in Redis. Then, when allocating new ports, the system checks that the total number of allocated ports plus the requested ports doesn’t exceed this limit. This prevents over-allocation and keeps port usage within safe limits.
Refs NethServer/dev#7092