MCPcopy
hub / github.com/microsoft/retina / deleteByIP

Method deleteByIP

pkg/controllers/cache/cache.go:411–436  ·  view source on GitHub ↗

deleteByIP deletes the given IP from the cache.

(ip, key string)

Source from the content-addressed store, hash-verified

409
410// deleteByIP deletes the given IP from the cache.
411func (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
438func (c *Cache) publish(t EventType, obj common.PublishObj) {
439 if c.pubsub == nil {

Callers 3

updateEndpointMethod · 0.95
updateSvcMethod · 0.95
updateNodeMethod · 0.95

Calls 4

deleteSvcMethod · 0.95
deleteEndpointMethod · 0.95
deleteNodeMethod · 0.95
StringMethod · 0.45

Tested by

no test coverage detected