Skip to content

Commit

Permalink
fix invalid subnet not sync route (#4262)
Browse files Browse the repository at this point in the history
Signed-off-by: clyi <[email protected]>

Conflicts:
	pkg/daemon/controller_linux.go
  • Loading branch information
changluyi committed Jul 8, 2024
1 parent 7743d66 commit c12c572
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion pkg/controller/subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,11 @@ func (c *Controller) handleSubnetFinalizer(subnet *kubeovnv1.Subnet) (bool, erro
func (c Controller) patchSubnetStatus(subnet *kubeovnv1.Subnet, reason, errStr string) {
if errStr != "" {
subnet.Status.SetError(reason, errStr)
subnet.Status.NotValidated(reason, errStr)
if reason == "ValidateLogicalSwitchFailed" {
subnet.Status.NotValidated(reason, errStr)
} else {
subnet.Status.Validated(reason, "")
}
subnet.Status.NotReady(reason, errStr)
c.recorder.Eventf(subnet, v1.EventTypeWarning, reason, errStr)
} else {
Expand Down
2 changes: 1 addition & 1 deletion pkg/daemon/controller_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ func (c *Controller) reconcileRouters(event *subnetEvent) error {
for _, subnet := range subnets {
// The route for overlay subnet cidr via ovn0 should not be deleted even though subnet.Status has changed to not ready
if (subnet.Spec.Vlan != "" && !subnet.Spec.LogicalGateway) || subnet.Spec.Vpc != c.config.ClusterRouter ||
(subnet.Name != c.config.NodeSwitch && !subnet.Status.IsReady()) {
!subnet.Status.IsValidated() {
continue
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/daemon/controller_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (c *Controller) reconcileRouters(_ *subnetEvent) error {
// The route for overlay subnet cidr via ovn0 should not be deleted even though subnet.Status has changed to not ready
if (subnet.Spec.Vlan != "" && !subnet.Spec.LogicalGateway) ||
subnet.Spec.Vpc != c.config.ClusterRouter ||
(subnet.Name != c.config.NodeSwitch && !subnet.Status.IsReady()) {
!subnet.Status.IsValidated() {
continue
}

Expand Down

0 comments on commit c12c572

Please sign in to comment.