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 authored Aug 18, 2022
1 parent 9937ef8 commit 013549a
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 @@ -456,7 +456,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 @@ -1262,7 +1262,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 @@ -1272,14 +1272,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 013549a

Please sign in to comment.