Skip to content

Commit

Permalink
fix: lost route when subnet add and is not ready
Browse files Browse the repository at this point in the history
  • Loading branch information
oilbeater committed Mar 26, 2020
1 parent 556b199 commit 2b5dd72
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkg/daemon/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ func NewController(config *Configuration, informerFactory informers.SharedInform

subnetInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
AddFunc: controller.enqueueSubnet,
UpdateFunc: controller.enqueueUpdateSubnet,
DeleteFunc: controller.enqueueSubnet,
})
podInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
Expand All @@ -119,6 +120,16 @@ func (c *Controller) enqueueSubnet(obj interface{}) {
c.subnetQueue.Add(key)
}

func (c *Controller) enqueueUpdateSubnet(old, new interface{}) {
var key string
var err error
if key, err = cache.MetaNamespaceKeyFunc(new); err != nil {
utilruntime.HandleError(err)
return
}
c.subnetQueue.Add(key)
}

func (c *Controller) runSubnetWorker() {
for c.processNextSubnetWorkItem() {
}
Expand Down

0 comments on commit 2b5dd72

Please sign in to comment.