Skip to content
This repository has been archived by the owner on Apr 17, 2019. It is now read-only.

add option to use notfy scripts for keepalived #2912

Merged
merged 3 commits into from
Feb 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion keepalived-vip/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
iproute2 \
ipvsadm \
bash && \
bash \
jq \
curl && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

Expand Down
3 changes: 3 additions & 0 deletions keepalived-vip/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,8 @@ func newIPVSController(kubeClient *unversioned.Client, namespace string, useUnic

neighbors := getNodeNeighbors(nodeInfo, clusterNodes)

notify := os.Getenv("KEEPALIVED_NOTIFY")

execer := exec.New()
dbus := utildbus.New()
iptInterface := utiliptables.New(execer, dbus, utiliptables.ProtocolIpv4)
Expand All @@ -352,6 +354,7 @@ func newIPVSController(kubeClient *unversioned.Client, namespace string, useUnic
ipt: iptInterface,
vrid: vrid,
vrrpVersion: vrrpVersion,
notify: notify,
}

ipvsc.syncQueue = NewTaskQueue(ipvsc.sync)
Expand Down
2 changes: 2 additions & 0 deletions keepalived-vip/keepalived.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ type keepalived struct {
ipt iptables.Interface
vrid int
vrrpVersion int
notify string
}

// WriteCfg creates a new keepalived configuration file.
Expand All @@ -76,6 +77,7 @@ func (k *keepalived) WriteCfg(svcs []vip) error {
conf["useUnicast"] = k.useUnicast
conf["vrid"] = k.vrid
conf["vrrpVersion"] = k.vrrpVersion
conf["notify"] = k.notify

if glog.V(2) {
b, _ := json.Marshal(conf)
Expand Down
1 change: 1 addition & 0 deletions keepalived-vip/keepalived.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ vrrp_instance vips {
track_interface {
{{ $iface }}
}
{{ if .notify }} notify {{ .notify }} {{ end }}

{{ if .useUnicast }}
unicast_src_ip {{ .myIP }}
Expand Down