deleteByIP deletes the given IP from the cache.
(ip, key string)
| 409 | |
| 410 | // deleteByIP deletes the given IP from the cache. |
| 411 | func (c *Cache) deleteByIP(ip, key string) error { |
| 412 | if svcKey, ok := c.ipToSvcKey[ip]; ok { |
| 413 | if svcKey == key { |
| 414 | return nil |
| 415 | } |
| 416 | c.l.Debug("deleting service by IP", zap.String("ip", ip), zap.String("service", svcKey)) |
| 417 | return c.deleteSvc(svcKey) |
| 418 | } |
| 419 | if epKey, ok := c.ipToEpKey[ip]; ok { |
| 420 | if epKey == key { |
| 421 | return nil |
| 422 | } |
| 423 | c.l.Debug("deleting pod by IP", zap.String("ip", ip), zap.String("pod", epKey)) |
| 424 | return c.deleteEndpoint(epKey) |
| 425 | } |
| 426 | if nodeName, ok := c.ipToNodeName[ip]; ok { |
| 427 | if nodeName == key { |
| 428 | return nil |
| 429 | } |
| 430 | c.l.Debug("deleting node by IP", zap.String("ip", ip), zap.String("node", nodeName)) |
| 431 | return c.deleteNode(nodeName) |
| 432 | } |
| 433 | |
| 434 | c.l.Debug("IP not found in cache", zap.String("ip", ip)) |
| 435 | return nil |
| 436 | } |
| 437 | |
| 438 | func (c *Cache) publish(t EventType, obj common.PublishObj) { |
| 439 | if c.pubsub == nil { |
no test coverage detected