-
Notifications
You must be signed in to change notification settings - Fork 367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exclude terminated Pods from group members #6508
Conversation
pkg/util/k8s/pod.go
Outdated
|
||
import v1 "k8s.io/api/core/v1" | ||
|
||
func IsPodTerminal(pod *v1.Pod) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IsPodTerminated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw this function name in kubernetes several times, e.g. https://github.com/kubernetes/kubernetes/blob/release-1.30/staging/src/k8s.io/endpointslice/util/controller_utils.go#L95-L98.
I just found there is a public util function IsPodTerminal
in "k8s.io/kubernetes/pkg/api/v1/pod" and changed to use it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just realized this is in an internal package of kubernetes, so still have to define our own one.
pkg/controller/egress/controller.go
Outdated
@@ -371,9 +372,9 @@ func (c *EgressController) syncEgress(key string) error { | |||
egressGroup := egressGroupObj.(*antreatypes.EgressGroup) | |||
pods, _ := c.groupingInterface.GetEntities(egressGroupType, key) | |||
for _, pod := range pods { | |||
// Ignore Pod if it's not scheduled or not running. And Egress does not support HostNetwork Pods, so also ignore | |||
// Ignore Pod if it's not scheduled or is already terminal. And Egress does not support HostNetwork Pods, so also ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
terminated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
When calculating AddressGroups, terminated Pods should be excluded because their IPs can be recycled and reused by other active Pods. When calculating AppliedToGroups and EgressGroups, terminated Pods could be excluded as their network resources including network interfaces have been deleted. Signed-off-by: Quan Tian <quan.tian@broadcom.com>
/test-all |
/test-all |
When calculating AddressGroups, terminated Pods should be excluded because their IPs can be recycled and reused by other active Pods. When calculating AppliedToGroups and EgressGroups, terminated Pods could be excluded as their network resources including network interfaces have been deleted. Signed-off-by: Quan Tian <quan.tian@broadcom.com>
When calculating AddressGroups, terminated Pods should be excluded because their IPs can be recycled and reused by other active Pods. When calculating AppliedToGroups and EgressGroups, terminated Pods could be excluded as their network resources including network interfaces have been deleted. Signed-off-by: Quan Tian <quan.tian@broadcom.com>
When calculating AddressGroups, terminated Pods should be excluded because their IPs can be recycled and reused by other active Pods. When calculating AppliedToGroups and EgressGroups, terminated Pods could be excluded as their network resources including network interfaces have been deleted. Signed-off-by: Quan Tian <quan.tian@broadcom.com>
When calculating AddressGroups, terminated Pods should be excluded because their IPs can be recycled and reused by other active Pods. When calculating AppliedToGroups and EgressGroups, terminated Pods could be excluded as their network resources including network interfaces have been deleted. Signed-off-by: Quan Tian <quan.tian@broadcom.com>
When calculating AddressGroups, terminated Pods should be excluded because their IPs can be recycled and reused by other active Pods.
When calculating AppliedToGroups and EgressGroups, terminated Pods could be excluded as their network resources including network interfaces have been deleted.
Fixes #6507