-
Notifications
You must be signed in to change notification settings - Fork 42
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
Bug 1866347: monitoring keepalive wrong format #89
Bug 1866347: monitoring keepalive wrong format #89
Conversation
…file instead of generating them
Can you provide more details in the description on why these changes are being made? |
@cybertron Added. Full description can be found in Bugzilla |
I think it worth mentioning in the PR the format of the expected file |
pkg/monitor/lease.go
Outdated
cmd := exec.Command("dhclient", "-d", "--no-pid", "-sf", "/bin/true", | ||
"-lf", getLeaseFile(cfgPath, name), "-v", iface.Name, "-H", name) | ||
"-lf", lease_file, "-v", iface.Name, "-H", name) |
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.
We are watching the file, but we will not know if the dhclient terminated for some reason. Shouldn't we monitor the process as well and maybe restart if it terminates?
/retitle Bug 1866347: monitoring keepalive wrong format |
@YuviGold: This pull request references Bugzilla bug 1866347, which is invalid:
Comment In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Is this even a valid use case? Duplicate cluster names in a single DHCP domain are going to cause other issues besides this. Shouldn't we avoid that in the first place? |
f89ddd4
to
870cd2e
Compare
@cybertron |
24c7c93
to
97aeb2b
Compare
Did all of the new vendoring really need to happen? Is that central to the fix? |
/retest Failed on an infra issue. |
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.
Okay, if I'm understanding this correctly then there are two primary changes here:
-Read a passed in MAC instead of generating one. I guess this pushes the responsibility for generating the MAC to someone else, so fair enough.
-Parse the lease file to determine whether there is a conflict with another cluster. I guess this is fine too. I'm still not convinced two clusters with the same name on the same network is going to work, but that's someone else's problem. :-)
I do see a few issues which I've left comments on inline. The log ones are mostly nitpicks that could be addressed in followups, but I'd like fixes or explanations for the others.
pkg/monitor/lease.go
Outdated
} | ||
|
||
func leaseVIPs(cfgPath string, clusterName string, vips []VIP) error { | ||
func LeaseVIPs(log logrus.FieldLogger, cfgPath string, clusterName string, vipMasterIface string, vips []vip, runInfinite bool) error { |
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.
Why are we passing a logger here? Can't this use the same one as the rest of the package?
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.
It can use and it actually uses the same one when it is called from dynkeepalived.go
if err = LeaseVIPs(log, cfgPath, vipIface.Name, []vip{*vips.APIVip, *vips.IngressVip}, true); err != nil {
We want to use the leasing functions from the monitor
package in the assisted-service
as well.
You define your own log in the monitor package via var log = logrus.New()
.
In case another package with their own logger wants to use it (or even for it to be manipulated for the tests) it would be impossible without giving a log parameter.
Hence a log parameter is more flexible
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.
In the future, when adding a new use case for code like this it would be a good thing to highlight in the PR description. That's important context for reviewers.
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.
Personally, I would add new parameters to the end of the signature, not the beginning. Also, I'm not a huge fan of bare booleans. There is no context at the caller as to what a magic "true" or "false" might mean.
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.
In the future, when adding a new use case for code like this it would be a good thing to highlight in the PR description. That's important context for reviewers.
@cybertron agreed
Personally, I would add new parameters to the end of the signature, not the beginning. Also, I'm not a huge fan of bare booleans. There is no context at the caller as to what a magic "true" or "false" might mean.
@bcrochet Seems fair. The boolean part has been removed anyway. But how would you implement that? Enums?
pkg/monitor/lease.go
Outdated
// --no-pid in order to allow running multiple dhclients | ||
commandArgs := []string{"-v", iface.Name, "-H", name, | ||
"-sf", "/bin/true", "-lf", leaseFile, "-d", | ||
"--no-pid", "-pf", fmt.Sprintf("/var/run/dhclient.%s.pid", iface.Name)} |
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.
It doesn't make sense to pass both --no-pid and -pf. I'd be surprised if this does what you want.
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.
--no-pid
in order to allow running multipledhclient
simultaneously-pf
allow killing the process
Couldn't make it work without them both
pkg/monitor/lease.go
Outdated
write := make(chan error) | ||
defer close(write) | ||
|
||
RunFiniteWatcher(log, watcher, leaseFile, iface.Name, ip, write) |
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 think that if you run with -1 flag, then it will run once, and then it will terminate. After that the lease file can be checked. Seems simpler flow. No need for goroutine, channel , and inotify usage.
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.
It could be much simpler but unfortunately couldn't make it work
97aeb2b
to
f036ccf
Compare
func CreateFileWatcher(log logrus.FieldLogger, fileName string) (*fsnotify.Watcher, error) { | ||
watcher, err := fsnotify.NewWatcher() | ||
if err != nil { | ||
log.WithError(err).Error("Failed to add a create a new watcher") |
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.
Nit: I think "add a" should be removed from this log message.
pkg/monitor/lease.go
Outdated
} | ||
|
||
func leaseVIPs(cfgPath string, clusterName string, vips []VIP) error { | ||
func LeaseVIPs(log logrus.FieldLogger, cfgPath string, clusterName string, vipMasterIface string, vips []vip, runInfinite bool) error { |
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.
In the future, when adding a new use case for code like this it would be a good thing to highlight in the PR description. That's important context for reviewers.
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
One nit on a log message inline, but that can be fixed in a followup.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cybertron, YuviGold The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/bugzilla refresh |
@cybertron: This pull request references Bugzilla bug 1866347, which is valid. 3 validation(s) were run on this bug
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@YuviGold: All pull requests linked via external trackers have merged: openshift/baremetal-runtimecfg#89. Bugzilla bug 1866347 has been moved to the MODIFIED state. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Deploying multiple assisted installers where the user does not provide the VIP addresses with the same cluster name ends up with them competing for the same DHCP leased address and conflicting.
The format should be as follows:
inotify
implementation https://github.com/fsnotify/fsnotifyIn order to verify the
dhclient
made a renew for the lease instead of creating a new one.