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

Method configureVIPs

engine/vserver.go:1305–1332  ·  view source on GitHub ↗

configureVIPs configures VIPs on the load balancing interface.

()

Source from the content-addressed store, hash-verified

1303
1304// configureVIPs configures VIPs on the load balancing interface.
1305func (v *vserver) configureVIPs() {
1306 // TODO(ncope): Return to iterating over v.services once they contain seesaw.VIPs.
1307 for _, vip := range v.config.VIPs {
1308 if _, ok := v.vips[*vip]; ok {
1309 continue
1310 }
1311 // TODO(angusc): Set up anycast Vservers here as well (without bringing up the VIP).
1312 if vip.Type == seesaw.AnycastVIP {
1313 continue
1314 }
1315
1316 // TODO(jsing): Create a ncc.LBVserver that only encapsulates
1317 // the necessary state, rather than storing a full vserver
1318 // snapshot.
1319 lbVserver := v.snapshot()
1320 lbVserver.Services = nil
1321 lbVserver.Warnings = nil
1322 if err := v.engine.lbInterface.AddVserver(lbVserver, vip.IP.AF()); err != nil {
1323 log.Fatalf("%v: failed to add Vserver: %v", v, err)
1324 }
1325 v.lbVservers[vip.IP] = lbVserver
1326
1327 if err := v.engine.lbInterface.AddVIP(vip); err != nil {
1328 log.Fatalf("%v: failed to add VIP %v: %v", v, vip.IP, err)
1329 }
1330 v.vips[*vip] = true
1331 }
1332}
1333
1334// unconfigureVIP removes a unicast VIP from the load balancing interface.
1335func (v *vserver) unconfigureVIP(vip *seesaw.VIP) {

Callers 2

configInitMethod · 0.95
configUpdateMethod · 0.95

Calls 4

snapshotMethod · 0.95
AFMethod · 0.80
AddVserverMethod · 0.65
AddVIPMethod · 0.65

Tested by

no test coverage detected