initAnycast initialises the anycast configuration.
()
| 306 | |
| 307 | // initAnycast initialises the anycast configuration. |
| 308 | func (e *Engine) initAnycast() { |
| 309 | vips := make([]*seesaw.VIP, 0) |
| 310 | if e.config.ClusterVIP.IPv4Addr != nil { |
| 311 | for _, ip := range e.config.ServiceAnycastIPv4 { |
| 312 | vips = append(vips, seesaw.NewVIP(ip, nil)) |
| 313 | } |
| 314 | } |
| 315 | if e.config.ClusterVIP.IPv6Addr != nil { |
| 316 | for _, ip := range e.config.ServiceAnycastIPv6 { |
| 317 | vips = append(vips, seesaw.NewVIP(ip, nil)) |
| 318 | } |
| 319 | } |
| 320 | for _, vip := range vips { |
| 321 | if err := e.lbInterface.AddVIP(vip); err != nil { |
| 322 | log.Fatalf("Failed to add VIP %v: %v", vip, err) |
| 323 | } |
| 324 | log.Infof("Advertising BGP route for %v", vip) |
| 325 | if err := e.ncc.BGPAdvertiseVIP(vip.IP.IP()); err != nil { |
| 326 | log.Fatalf("Failed to advertise VIP %v: %v", vip, err) |
| 327 | } |
| 328 | } |
| 329 | } |
| 330 | |
| 331 | // gratuitousARP sends gratuitous ARP messages at regular intervals, if this |
| 332 | // node is the HA master. |
no test coverage detected