MCPcopy
hub / github.com/google/seesaw / initAnycast

Method initAnycast

engine/core.go:308–329  ·  view source on GitHub ↗

initAnycast initialises the anycast configuration.

()

Source from the content-addressed store, hash-verified

306
307// initAnycast initialises the anycast configuration.
308func (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.

Callers 1

initNetworkMethod · 0.95

Implementers 3

EngineClientha/engine_client.go
DummyEngineha/engine_client.go
SeesawEngineengine/ipc.go

Calls 3

AddVIPMethod · 0.65
BGPAdvertiseVIPMethod · 0.65
IPMethod · 0.45

Tested by

no test coverage detected