Skip to content

Commit

Permalink
update centralized subnet gateway ready patch operation
Browse files Browse the repository at this point in the history
  • Loading branch information
hongzhen-ma committed Aug 18, 2022
1 parent c3f23af commit 122754a
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions pkg/controller/subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,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 @@ -979,7 +979,7 @@ func (c *Controller) reconcileGateway(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 @@ -998,13 +998,7 @@ func (c *Controller) reconcileGateway(subnet *kubeovnv1.Subnet) error {
}
}

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

0 comments on commit 122754a

Please sign in to comment.