Skip to content

Commit

Permalink
Merge pull request projectcalico#7713 from gaopeiliang/master
Browse files Browse the repository at this point in the history
ipam gc worker release IP resource of Evicted Failed status Pod
  • Loading branch information
marvin-tigera authored Jun 4, 2024
2 parents ce84ce2 + 823ed30 commit 465b2df
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions kube-controllers/pkg/controllers/node/ipam.go
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,12 @@ func (c *ipamController) allocationIsValid(a *allocation, preferCache bool) bool
return true
}

// Pod evicted by agent like kubelet, failed forever, safe to release IP resource
if p.Status.Phase == v1.PodFailed && p.Status.Reason == "Evicted" {
logc.Debugf("Pod has failed with Evicted. Allocation no longer valid")
return false
}

// Convert the pod to a workload endpoint. This takes advantage of the IP
// gathering logic already implemented in the converter, and handles exceptional cases like
// additional WEPs attached to Multus networks.
Expand Down

0 comments on commit 465b2df

Please sign in to comment.