Skip to content

Commit

Permalink
update centralized subnet gateway ready patch operation (#1827)
Browse files Browse the repository at this point in the history
  • Loading branch information
hongzhen-ma committed Aug 18, 2022
1 parent 1c3b622 commit 919bb23
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions pkg/controller/subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ func (c Controller) patchSubnetStatus(subnet *kubeovnv1.Subnet, reason string, e
c.recorder.Eventf(subnet, v1.EventTypeWarning, reason, errStr)
} else {
subnet.Status.Validated(reason, "")
if reason == "SetPrivateLogicalSwitchSuccess" || reason == "ResetLogicalSwitchAclSuccess" {
if reason == "SetPrivateLogicalSwitchSuccess" || reason == "ResetLogicalSwitchAclSuccess" || reason == "ReconcileCentralizedGatewaySuccess" {
subnet.Status.Ready(reason, "")
}
}
Expand Down Expand Up @@ -1083,7 +1083,7 @@ func (c *Controller) reconcileOvnRoute(subnet *kubeovnv1.Subnet) error {
if _, err = c.config.KubeOvnClient.KubeovnV1().Subnets().Patch(context.Background(), subnet.Name, types.MergePatchType, bytes, metav1.PatchOptions{}, "status"); err != nil {
klog.Errorf("failed to patch subnet %s NoReadyGateway status: %v", subnet.Name, err)
}
return fmt.Errorf("all subnet %s gws are not ready", subnet.Name)
return err
}

nextHop := getNextHopByTunnelIP(nodeTunlIPAddr)
Expand All @@ -1093,14 +1093,7 @@ func (c *Controller) reconcileOvnRoute(subnet *kubeovnv1.Subnet) error {
}

subnet.Status.ActivateGateway = newActivateNode
subnet.Status.Ready("ReconcileCentralizedGatewaySuccess", "")
bytes, err := subnet.Status.Bytes()
if err != nil {
return err
}
if _, err := c.config.KubeOvnClient.KubeovnV1().Subnets().Patch(context.Background(), subnet.Name, types.MergePatchType, bytes, metav1.PatchOptions{}, "status"); err != nil {
return err
}
c.patchSubnetStatus(subnet, "ReconcileCentralizedGatewaySuccess", "")
}

if err := c.deletePolicyRouteByGatewayType(subnet, kubeovnv1.GWDistributedType, false); err != nil {
Expand Down

0 comments on commit 919bb23

Please sign in to comment.