Skip to content

Commit

Permalink
fix: when subnet cidr conflict requeue the subnet
Browse files Browse the repository at this point in the history
the subnet conflict err is replaced by later err and return nil that will not requeue the conflicted subnet.
  • Loading branch information
oilbeater committed Jan 7, 2020
1 parent 8dbbe6b commit ff1ff14
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions pkg/controller/subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,12 +409,14 @@ func (c *Controller) handleAddSubnet(key string) error {
subnet.TypeMeta.APIVersion = "kubeovn.io/v1"
c.recorder.Eventf(subnet, v1.EventTypeWarning, "ValidateLogicalSwitchFailed", err.Error())
subnet.Status.NotValidated("ValidateLogicalSwitchFailed", err.Error())
bytes, err := subnet.Status.Bytes()
if err != nil {
klog.Error(err)
bytes, err1 := subnet.Status.Bytes()
if err1 != nil {
klog.Error(err1)
return err1
} else {
if _, err := c.config.KubeOvnClient.KubeovnV1().Subnets().Patch(subnet.Name, types.MergePatchType, bytes, "status"); err != nil {
klog.Error("patch subnet status failed", err)
if _, err2 := c.config.KubeOvnClient.KubeovnV1().Subnets().Patch(subnet.Name, types.MergePatchType, bytes, "status"); err2 != nil {
klog.Error("patch subnet status failed", err2)
return err2
}
}
return err
Expand Down

0 comments on commit ff1ff14

Please sign in to comment.