Skip to content

Commit

Permalink
Fix syncHandler issue in status_controller (#2036)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dyanngg authored Apr 7, 2021
1 parent 958898f commit d5fd8f3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/controller/networkpolicy/status_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,15 @@ func (c *StatusController) syncHandler(key string) error {
// It means the NetworkPolicy hasn't been processed once. Set it to Pending to differentiate from NetworkPolicies
// that spans 0 Node.
if internalNP.SpanMeta.NodeNames == nil {
return c.npControlInterface.UpdateAntreaNetworkPolicyStatus(internalNP.SourceRef.Namespace, internalNP.SourceRef.Name, &crdv1alpha1.NetworkPolicyStatus{
status := &crdv1alpha1.NetworkPolicyStatus{
Phase: crdv1alpha1.NetworkPolicyPending,
ObservedGeneration: internalNP.Generation,
})
}
if internalNP.SourceRef.Type == controlplane.AntreaNetworkPolicy {
return c.npControlInterface.UpdateAntreaNetworkPolicyStatus(internalNP.SourceRef.Namespace, internalNP.SourceRef.Name, status)
} else {
return c.npControlInterface.UpdateAntreaClusterNetworkPolicyStatus(internalNP.SourceRef.Name, status)
}
}
desiredNodes := len(internalNP.SpanMeta.NodeNames)
currentNodes := 0
Expand Down

0 comments on commit d5fd8f3

Please sign in to comment.