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

Commit

Permalink
Merge pull request #8 from walteraa/fix_template_error
Browse files Browse the repository at this point in the history
Fix keepalived config file error when there are no services
  • Loading branch information
aledbf authored Sep 18, 2017
2 parents bd955b4 + fd6877a commit 9006844
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
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 }}

0 comments on commit 9006844

Please sign in to comment.