Skip to content

Commit

Permalink
fix: remove not alive pod in pg
Browse files Browse the repository at this point in the history
(cherry picked from commit c3c4f1c)
  • Loading branch information
oilbeater committed Sep 29, 2020
1 parent 60afb4e commit f8a4e65
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/controller/network_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,9 @@ func (c *Controller) fetchSelectedPorts(namespace string, selector *metav1.Label

ports := make([]string, 0, len(pods))
for _, pod := range pods {
if !isPodAlive(pod) {
continue
}
if !pod.Spec.HostNetwork && pod.Annotations[util.AllocatedAnnotation] == "true" {
ports = append(ports, fmt.Sprintf("%s.%s", pod.Name, pod.Namespace))
}
Expand Down

0 comments on commit f8a4e65

Please sign in to comment.