Skip to content

Commit

Permalink
fix: ip conflict when use ippool
Browse files Browse the repository at this point in the history
  • Loading branch information
oilbeater committed Dec 2, 2019
1 parent 5904433 commit aa53c7d
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions pkg/controller/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -615,12 +615,10 @@ func (c *Controller) handleAddIpPoolPod(key string) error {

raw, _ := json.Marshal(pod.Annotations)
patchPayload := fmt.Sprintf(patchPayloadTemplate, op, raw)
go func() {
if _, err = c.config.KubeClient.CoreV1().Pods(namespace).Patch(name, types.JSONPatchType, []byte(patchPayload)); err != nil {
klog.Errorf("patch pod %s/%s failed %v", name, namespace, err)
c.addIpPoolPodQueue.AddRateLimited(key)
}
}()
if _, err = c.config.KubeClient.CoreV1().Pods(namespace).Patch(name, types.JSONPatchType, []byte(patchPayload)); err != nil {
klog.Errorf("patch pod %s/%s failed %v", name, namespace, err)
c.addIpPoolPodQueue.AddRateLimited(key)
}
}
}
// In case update event might lost during leader election
Expand Down

0 comments on commit aa53c7d

Please sign in to comment.