-
Notifications
You must be signed in to change notification settings - Fork 6
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
feature(no_network) Add an option to disable any network activity on the NIC #128
base: master
Are you sure you want to change the base?
Conversation
…the NIC * Add NoNetwork option that prevent any Gratuitous ARP burst and the addition/removal of the IP on the NIC * Add the update command on the link client that let's user customize VIP options This is a first step toward #97 a next step would be to implements hooks on the FAILING, STANDBY and ACTIVATED state
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 still submitting my review as it was pending for some times now. I am still not convinced we want to add this feature. This "no-network" flag seems confusing, I'm not fond of it. Maybe @Soulou has an opinion on that matter?
Flags: []cli.Flag{ | ||
cli.BoolFlag{ | ||
Name: "no-network", | ||
Usage: "Disable any operation on the network interface", |
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 find this option so counterintuitive that I would add in the usage an example of why one would want to call it. WDYT?
cli.BoolFlag{ | ||
Name: "no-network", | ||
Usage: "Disable any operation on the network interface", | ||
}, | ||
}, | ||
Action: func(c *cli.Context) error { | ||
if c.NArg()%2 == 0 { |
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.
Is this condition still working with the flag no-network
?
var noNetwork bool | ||
if c.Bool("no-network") { | ||
noNetwork = true | ||
updateParams.NoNetwork = &noNetwork | ||
} | ||
|
||
if c.Bool("network") { | ||
noNetwork = false | ||
updateParams.NoNetwork = &noNetwork | ||
} |
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.
nitpick: I don't think you need to declare it outside the conditions:
var noNetwork bool | |
if c.Bool("no-network") { | |
noNetwork = true | |
updateParams.NoNetwork = &noNetwork | |
} | |
if c.Bool("network") { | |
noNetwork = false | |
updateParams.NoNetwork = &noNetwork | |
} | |
if c.Bool("no-network") { | |
noNetwork := true | |
updateParams.NoNetwork = &noNetwork | |
} | |
if c.Bool("network") { | |
noNetwork := false | |
updateParams.NoNetwork = &noNetwork | |
} |
@@ -27,12 +27,14 @@ type Manager interface { | |||
Status() string | |||
IP() models.IP | |||
SetHealthchecks(context.Context, config.Config, []models.Healthcheck) | |||
UpdateIP(ctx context.Context, ip models.IP) |
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.
nitpick: like for the other methods, don't name the arguments if it doesn't add any value:
UpdateIP(ctx context.Context, ip models.IP) | |
UpdateIP(context.Context, models.IP) |
log.Info("NoNetwork option enabled: Removing IP from network interface") | ||
err := m.networkInterface.RemoveIP(ip.IP) | ||
if err != nil { | ||
log.WithError(err).Error("Fail to remove IP from network interface") |
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.
Can you explain in a comment why we don't return in case of error here? This is unclear for me
log.Info("NoNetwork option disabled and we are MASTER: Adding the IP to our network interface") | ||
err := m.networkInterface.EnsureIP(ip.IP) | ||
if err != nil { | ||
log.WithError(err).Error("fail to add IP to our network interface") |
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.
Can you explain in a comment why we don't return in case of error here? This is unclear for me
This is a first step toward #97 a next step would be to implements hooks on the FAILING, STANDBY and ACTIVATED state