configureVIPs configures VIPs on the load balancing interface.
()
| 1303 | |
| 1304 | // configureVIPs configures VIPs on the load balancing interface. |
| 1305 | func (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. |
| 1335 | func (v *vserver) unconfigureVIP(vip *seesaw.VIP) { |
no test coverage detected