-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Dynamic port range support (fixes issue #1384) #2135
Conversation
@@ -92,6 +92,13 @@ func (f *NetworkFingerprint) Fingerprint(cfg *config.Config, node *structs.Node) | |||
f.logger.Printf("[DEBUG] fingerprint.network: link speed could not be detected and no speed specified by user. Defaulting to %d", defaultNetworkSpeed) | |||
} | |||
|
|||
const INDIVIDUAL_POOL = "Individual Ports Pool" | |||
const RANGE_POOL = "Port Ranges Pool" | |||
individualPortsPool := structs.PortRange{Label: INDIVIDUAL_POOL, Base: 20000, Span: 20000} |
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.
I am going to add client configuration options to make this adjustable.
const INDIVIDUAL_POOL = "Individual Ports Pool" | ||
const RANGE_POOL = "Port Ranges Pool" | ||
// PortRange | ||
individualPortsPool := PortRange{Label: INDIVIDUAL_POOL, Base: 20000, Span: 40000} |
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.
I set individualPortsPool to [20000, 60000] by default to be backward compatible with old clients
MBits int // Throughput | ||
ReservedPorts []Port // Reserved ports | ||
DynamicPorts []Port // Dynamically assigned ports | ||
DynamicPortRanges []PortRange // Dynamically assigned port ranges |
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.
I would like to merge DynamicPortRanges and DynamicPorts and use PortRange everywhere instead of Port struct
We use the port range on Mesos/Marathon, this would be a great addition 👍 |
Hi guys. Whats status with this feature request? |
@capone212 Sorry that we didn't get to this all this time, I am doing some PR/issue housekeeping and will be closing this PR because the code has changed significantly from under it. We are keeping #1384 open to consider implementing in a future release. Let's keep future design discussion in the GH issue instead of here. |
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
This pull request adds two important things
Ability to limit port pool for dynamic ports per nomad client. This helps to expose running services to public network using port forwarding when nomad cluster behind NAT. For example, if we can limit dynamic port pool for nomad client SRV1 to range [30000, 30999], for SRV2 to [31000, 31999] and then configure port forwarding rules to expose specific ports of nodes to public network.
Allocating several consequent ports (a range of ports) for a task, see Feature request: Allocating dynamic port range for task #1384 for more info.
This pool request is far from complete, it is more like proof of concept. Currently it can allocate tasks with dynamic port ranges and limiting port range also works correctly. I have to use more optimal algorithm for allocating port ranges and add some configuration options for adjusting port pools.
Prior that I would like to listen to feedback from hashicorp guys: what do you think about features and current approach. I can allocate as much time as required to have it done so please don't hesitate to ask changes.