Skip to content

Commit c6b5e38

Browse files
authored
Revert "fix: prevent subnet status update loop in patchSubnetStatus (#7058)" (#7069)
This reverts commit 0221ed9. Signed-off-by: clyi <clyi@alauda.io>
1 parent fee5e3f commit c6b5e38

1 file changed

Lines changed: 8 additions & 11 deletions

File tree

pkg/controller/subnet_status.go

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,25 +49,22 @@ func (c *Controller) updateNatOutgoingPolicyRulesStatus(subnet *kubeovnv1.Subnet
4949
func (c *Controller) patchSubnetStatus(subnet *kubeovnv1.Subnet, reason, errStr string) error {
5050
if errStr != "" {
5151
subnet.Status.SetError(reason, errStr)
52-
switch reason {
53-
case "ValidateLogicalSwitchFailed":
52+
if reason == "ValidateLogicalSwitchFailed" {
5453
subnet.Status.NotValidated(reason, errStr)
55-
case "ValidateLogicalSwitchSuccess":
54+
} else {
5655
subnet.Status.Validated(reason, "")
5756
}
5857
subnet.Status.NotReady(reason, errStr)
5958
c.recorder.Eventf(subnet, v1.EventTypeWarning, reason, errStr)
6059
} else {
61-
switch reason {
62-
case "ValidateLogicalSwitchSuccess":
63-
subnet.Status.Validated(reason, "")
64-
case "SetPrivateLogicalSwitchSuccess",
65-
"ResetLogicalSwitchAclSuccess",
66-
"ReconcileCentralizedGatewaySuccess",
67-
"SetNonOvnSubnetSuccess":
60+
subnet.Status.Validated(reason, "")
61+
c.recorder.Eventf(subnet, v1.EventTypeNormal, reason, errStr)
62+
if reason == "SetPrivateLogicalSwitchSuccess" ||
63+
reason == "ResetLogicalSwitchAclSuccess" ||
64+
reason == "ReconcileCentralizedGatewaySuccess" ||
65+
reason == "SetNonOvnSubnetSuccess" {
6866
subnet.Status.Ready(reason, "")
6967
}
70-
c.recorder.Eventf(subnet, v1.EventTypeNormal, reason, errStr)
7168
}
7269

7370
bytes, err := subnet.Status.Bytes()

0 commit comments

Comments
 (0)