-
Notifications
You must be signed in to change notification settings - Fork 200
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
refactor vip #408
refactor vip #408
Conversation
// Reload sends SIGHUP to keepalived to reload the configuration. | ||
func (k *KeepAlived) Reload() error { | ||
klog.Info("Waiting for keepalived to start") | ||
for !k.IsRunning() { |
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 should add some info logs here.
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 should add some info logs here.
There are already info logs and error logs.
scanner.Buffer(nil, 1024*1024) | ||
klog.Info("start scanning keepalived logs") | ||
go func() { | ||
for scanner.Scan() { |
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.
Nice work!
pkg/speaker/vip/keepalived.go
Outdated
if err = k.client.CoreV1().ConfigMaps(util.EnvNamespace()).Delete(context.TODO(), cm.Name, deleteOpt); err != nil { | ||
k.log.Error(err, "keepalived configMap delete error") | ||
defer logWriter.Close() | ||
k.cmd = exec.Command(keepalivedStarter, "--dont-fork", "--log-console", "--log-detail", "--vrrp", "--release-vips") |
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 we provide an external parameter that allows users to customize the parameters of keepalived?
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.
done.
pkg/speaker/manager.go
Outdated
if protocol == constant.OpenELBProtocolVip { | ||
ip = fmt.Sprintf("%s:%s", ip, value) | ||
if len(nodes) == 0 { | ||
klog.Warningf("no available nodes for service ip %s:%s", ip, value) |
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.
Should we also add an event here?
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.
done.
{{ range $name, $instance := .instances }} | ||
{{ if $instance.Enabled }} | ||
vrrp_instance {{ $name }} { | ||
state BACKUP |
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.
Just one question: Why is there a fixed value BACKUP here? When will it become MASTER?
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.
Here's what the official documentation says:
Initial state, MASTER|BACKUP If the priority is 255, then the instance will transition immediately to MASTER if state MASTER is specified; otherwise the instance will wait between 3 and 4 advert intervals before it can transition, depending on the priority.
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.
ok.
Signed-off-by: renyunkang <[email protected]>
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
Great job!
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: chaunceyjiang, renyunkang 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 |
1 similar comment
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: chaunceyjiang, renyunkang 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 |
/lgtm |
LGTM label has been added. Git tree hash: 94f47b0a9e27a5dac6b95f34b9e0897c93015693
|
1 similar comment
LGTM label has been added. Git tree hash: 94f47b0a9e27a5dac6b95f34b9e0897c93015693
|
Description
What type of PR is this ?:
We have refactored the VIP mode of OpenELB, eliminating openelb-keepalived-vip and switching to the built-in keepalived for ARP announcements. Simultaneously, we have reduced redundancy in the allocation record data, making it more maintainable.
Related links: