add rpc_public_addr_subnet config option #817
No reviewers
Labels
No labels
action
check-aws
action
discussion-needed
action
for-external-contributors
action
for-newcomers
action
more-info-needed
action
need-funding
action
triage-required
kind
correctness
kind
ideas
kind
improvement
kind
performance
kind
testing
kind
usability
kind
wrong-behavior
prio
critical
prio
low
scope
admin-api
scope
background-healing
scope
build
scope
documentation
scope
k8s
scope
layout
scope
metadata
scope
ops
scope
rpc
scope
s3-api
scope
security
scope
telemetry
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: Deuxfleurs/garage#817
Loading…
Reference in a new issue
No description provided.
Delete branch "flokli/garage:rpc_public_addr_subnet"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
In case
rpc_public_addr
is not set, but autodiscovery is used, thisallows filtering the list of automatically discovered IPs to a specific
subnet.
For example, if nodes should pick their IP inside a specific subnet,
but you don't want to explicitly write the IP down (as it's dynamic, or
you want to share configs across nodes), you can use this option.
Fixes #811.
add rpc_public_addr_subnet config optionto WIP: add rpc_public_addr_subnet config option@ -55,6 +55,7 @@ hexdump = "0.1"
hmac = "0.12"
idna = "0.5"
itertools = "0.12"
ipnet = "2.9.0"
This was already in the list of dependencies (through
reqwest
), but we now explicitly depend on it, too.79729da4af
to3dc836afcb
3dc836afcb
to6d0b343232
WIP: add rpc_public_addr_subnet config optionto add rpc_public_addr_subnet config optionI applied this to all cluster nodes, then set my desired netmask in the option provided above, and indeed I don't see any other IP addresses anymore.
Happy to keep it running for some more time, but I think this is ready for review now :-)
@ -543,6 +543,14 @@ RPC calls. **This parameter is optional but recommended.** In case you have
a NAT that binds the RPC port to a port that is different on your public IP,
this field might help making it work.
#### `rpc_public_addr_subnet` {#rpc_public_addr_subnet}
New options should also be added in the example config file at the beginning of the page (that contains an instance of all configuration parameters), as well as in the index/list of everything at the beginning of "available configuration options".
rpc_public_addr_subnet
only applies ifrpc_public_addr
is not set (as it influences autodiscovery), which only happens if that is not set.I added a comment, and a commented-out example value.
@ -881,0 +901,4 @@
error!(
"Cannot parse rpc_public_addr_subnet {} from config file: {}. Ignoring.",
filter_subnet_str, e
);
I think we probably want this to be a hard error that makes garage exit immediately, because the only reason for this is a syntax error in the config file which is the admin's fault
I made this a
panic!
. This function doesn't return errors, and threading that through would be a bit more of a diff.It seems
panic!
is also commonly used in other places that deal with config parsing.Long-term, we probably want to move these parsing concerns to much earlier into the CLI code, not that late, but that also feels out of scope for this PR.
6d0b343232
to600f8c5c90
Tiny changes, thanks for your patience
@ -543,6 +546,14 @@ RPC calls. **This parameter is optional but recommended.** In case you have
a NAT that binds the RPC port to a port that is different on your public IP,
this field might help making it work.
#### `rpc_public_addr_subnet` {#rpc_public_addr_subnet}
A reference should also be added in the list that starts on line 93
Done
@ -881,0 +892,4 @@
.and_then(|filter_subnet_str| match filter_subnet_str.parse::<ipnet::IpNet>() {
Ok(filter_subnet) => {
let filter_subnet_trunc = filter_subnet.trunc();
if filter_subnet.trunc() != filter_subnet {
this code calls
.trunc()
again instead of using thefilter_subnet_trunc
variableGood catch! Might have missed while moving things around. Updated.
600f8c5c90
toa0f6bc5b7f
Thanks!