Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

muxuelan
Copy link
Member

@muxuelan muxuelan commented Nov 23, 2021

Sometimes, for example, edge node is not ready while no-eviction-pod status is still running.
image
image

注:节点ready时,对应的pod可以在endpoints中的address中找到;节点not ready时,对应的pod存储在endpoints中的notReadyAddress,若节点再次恢复ready状态,pod自动回到address地址中。

适用场景:节点由于网络等原因和云端断开处于not ready状态,但是pod没有被驱逐,其状态依然是running的时候,这些处于not ready节点的pod应该不被影响流量负载,支持离线访问。

@kubeedge-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign poorunga after the PR has been reviewed.
You can assign the PR to them by writing /assign @poorunga in a comment when ready.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubeedge-bot kubeedge-bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Nov 23, 2021
@muxuelan muxuelan force-pushed the test003 branch 2 times, most recently from 4eeb05d to f721964 Compare November 23, 2021 02:56
@kubeedge-bot kubeedge-bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 23, 2021

for _, addr := range subset.NotReadyAddresses {
pod, err := controller.APIConn.GetPodLister().Pods(addr.TargetRef.Namespace).Get(addr.TargetRef.Name)
if err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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
}

@@ -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)
Copy link
Member

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 {
Copy link
Member

@Poorunga Poorunga Nov 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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)
Copy link
Member

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'

Copy link
Member Author

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]>
@kubeedge-bot kubeedge-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 19, 2022
@kubeedge-bot
Copy link
Collaborator

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants