-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathkeepalived.tmpl
executable file
·56 lines (49 loc) · 1.09 KB
/
keepalived.tmpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
{{ $iface := .iface }}{{ $netmask := .netmask }}
global_defs {
vrrp_version {{ .vrrpVersion }}
vrrp_iptables {{ .iptablesChain }}
}
vrrp_instance vips {
state BACKUP
interface {{ $iface }}
virtual_router_id {{ .vrid }}
priority {{ .priority }}
nopreempt
advert_int 1
track_interface {
{{ $iface }}
}
{{ if .notify }} notify {{ .notify }} {{ end }}
{{ if .useUnicast }}
unicast_src_ip {{ .myIP }}
unicast_peer { {{ range .nodes }}
{{ . }}{{ end }}
}
{{ end }}
virtual_ipaddress { {{ range .vips }}
{{ . }}{{ end }}
}
}
{{ range $i, $svc := .svcs }}
{{ if eq $svc.LVSMethod "VIP" }}
# VIP Service with no pods: {{ $svc.IP }}
{{ else }}
# Service: {{ $svc.Name }}
virtual_server {{ $svc.IP }} {{ $svc.Port }} {
delay_loop 5
lvs_sched wlc
lvs_method {{ $svc.LVSMethod }}
persistence_timeout 1800
protocol {{ $svc.Protocol }}
{{ range $j, $backend := $svc.Backends }}
real_server {{ $backend.IP }} {{ $backend.Port }} {
weight 1
TCP_CHECK {
connect_port {{ $backend.Port }}
connect_timeout 3
}
}
{{ end }}
}
{{ end }}
{{ end }}