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

Commit

Permalink
Merge pull request #2912 from cornelius-keller/keepalived_with_notify
Browse files Browse the repository at this point in the history
add option to use notfy scripts for keepalived
  • Loading branch information
k8s-ci-robot authored Feb 11, 2019
2 parents 19c8d34 + 5124fda commit 1043fc9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
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

0 comments on commit 1043fc9

Please sign in to comment.