Skip to content
This repository was archived by the owner on Aug 19, 2020. It is now read-only.

Fix keepalived config file error when there are no services #8

Merged
merged 1 commit into from
Sep 18, 2017
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
1 change: 1 addition & 0 deletions pkg/controller/keepalived.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ func (k *keepalived) WriteCfg(svcs []vip) error {
conf["useUnicast"] = k.useUnicast
conf["vrid"] = k.vrid
conf["proxyMode"] = k.proxyMode
conf["vipIsEmpty"] = len(k.vips) == 0

if glog.V(2) {
b, _ := json.Marshal(conf)
Expand Down
10 changes: 9 additions & 1 deletion rootfs/keepalived.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ global_defs {
vrrp_iptables {{ .iptablesChain }}
}


#Check if the VIP list is empty
{{ if not .vipIsEmpty }}


{{ if .proxyMode }}
vrrp_script chk_haproxy {
script "/haproxy-check.sh"
Expand Down Expand Up @@ -65,4 +70,7 @@ virtual_server {{ $svc.IP }} {{ $svc.Port }} {
{{ end }}
}
{{ end }}
{{ end }}
{{ end }}

#End if vip list is empty
{{ end }}