-
Notifications
You must be signed in to change notification settings - Fork 133
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
Take notReadyAddresses of endpoints into consideration #198
base: main
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
4eeb05d
to
f721964
Compare
|
||
for _, addr := range subset.NotReadyAddresses { | ||
pod, err := controller.APIConn.GetPodLister().Pods(addr.TargetRef.Namespace).Get(addr.TargetRef.Name) | ||
if err != nil { |
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.
if err != nil { | |
if err != nil { | |
klog.Warningf("list pod %s err: %s", addr.IP, err) | |
continue | |
} | |
if pod == nil || pod.Status.Phase != v1.PodRunning { | |
klog.V(4).Infof("pod %s is nil or not running.", addr.IP) | |
continue | |
} |
agent/pkg/proxy/iptables.go
Outdated
@@ -126,6 +127,20 @@ func (proxier *Proxier) ignoreRuleByService(svc *corev1.Service) iptablesJumpCha | |||
klog.V(4).Infof("eps: %s.%s, endpointAddress.IP:%s", endpoints.Namespace, endpoints.Name, epAddress.IP) | |||
endpointIPs = append(endpointIPs, epAddress.IP) | |||
} | |||
|
|||
for _, endpointAddress := range epSubset.NotReadyAddresses { | |||
pod, err := chassisController.APIConn.GetPodLister().Pods(endpointAddress.TargetRef.Namespace).Get(endpointAddress.TargetRef.Name) |
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.
use proxyController.APIConn replace chassisController.APIConn
|
||
for _, endpointAddress := range epSubset.NotReadyAddresses { | ||
pod, err := chassisController.APIConn.GetPodLister().Pods(endpointAddress.TargetRef.Namespace).Get(endpointAddress.TargetRef.Name) | ||
if err != nil { |
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.
if err != nil { | |
if err != nil { | |
klog.Warningf("list pod %s err: %s", endpointAddress.IP, err) | |
continue | |
} | |
if pod == nil || pod.Status.Phase != corev1.PodRunning { | |
klog.V(4).Infof("pod %s is nil or not running.", endpointAddress.IP) | |
continue | |
} |
for _, addr := range subset.NotReadyAddresses { | ||
pod, err := controller.APIConn.GetPodLister().Pods(addr.TargetRef.Namespace).Get(addr.TargetRef.Name) | ||
if err != nil { | ||
klog.Warningf("list pod %s err:%s", addr.IP, err) |
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.
'list pod' change to 'get pod'
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.
done
Signed-off-by: muxuelan <[email protected]>
@muxuelan: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Sometimes, for example, edge node is not ready while no-eviction-pod status is still running.
注:节点ready时,对应的pod可以在endpoints中的address中找到;节点not ready时,对应的pod存储在endpoints中的notReadyAddress,若节点再次恢复ready状态,pod自动回到address地址中。
适用场景:节点由于网络等原因和云端断开处于not ready状态,但是pod没有被驱逐,其状态依然是running的时候,这些处于not ready节点的pod应该不被影响流量负载,支持离线访问。