-
Notifications
You must be signed in to change notification settings - Fork 44
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
Network sanity checks #277
Conversation
e7d08d7
to
320dbe1
Compare
@masnax Would you be willing to take a quick pass at this? I'm looking for feedback on if the tests look reasonable as much as anything. Realize I missed testing the case where other |
320dbe1
to
fba259c
Compare
fba259c
to
491144f
Compare
491144f
to
1dc355b
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.
@MggMuggins There's one more component to the networking questions: the dns nameservers we pass to LXD.
Can you also include a check that verifies that the input is a comma-separated list of IPs?
It's part of the same UPLINK network struct as the other fields, accessed by the config key dns.nameservers
microcloud/microcloud/service/lxd_config.go
Lines 88 to 90 in a28d437
if dnsServers != "" { | |
finalUplinkCfg.Config["dns.nameservers"] = dnsServers | |
} |
b1483c8
to
96b886e
Compare
…ster Fixes canonical#210 1. Invalid OVN ranges in UPLINK networks (range outside gateway subnet, etc) 2. UPLINK OVN ranges that contain any system's management address; 3. Invalid dns nameserver IPs Signed-off-by: Wesley Hershberger <[email protected]>
96b886e
to
b7bb3ea
Compare
var ip4OVNRanges, ip6OVNRanges []*shared.IPRange | ||
|
||
for _, network := range curSystem.Networks { | ||
if network.Type == "physical" && network.Name == "UPLINK" { |
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'm not enjoying the hardcoded "UPLINK" here, we should be using a constant for "UPLINK" and then ensuring that everywhere that needs to reference the uplink network by name uses this constant - this allows for quick understanding of the uses of that network and updating of it if needed.
I've burying configuration assumptions in lower level functions like this can lead to brittle code in the future if those assumptions change and its forgotten/unknown about where to update.
Alternatively we could have the dependencies of the validateSystems
function accept them as arguments, i.e uplinkNetName string
and have it passed in by the caller so we aren't tightly coupling things together.
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.
@MggMuggins you can use this method to grab the corresponding network type. These methods are how we keep the payloads that we send to LXD consistent.
You can either instantiate a new LXDService
or extract the receiver from handler.Services[types.LXD].(*service.LXDService)
from the service.Handler
that carries through the whole init.
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.
Apart from the hardcoded UPLINK, which can be addressed in a separate PR, this looks great thanks.
I will rebase once #276 is merged, the only new commit here is this one.