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

[feature request]improve discardcloudservice filter in yurthub component #1924

Closed
rambohe-ch opened this issue Jan 16, 2024 · 3 comments · Fixed by #1926
Closed

[feature request]improve discardcloudservice filter in yurthub component #1924

rambohe-ch opened this issue Jan 16, 2024 · 3 comments · Fixed by #1926
Labels
kind/feature kind/feature

Comments

@rambohe-ch
Copy link
Member

What would you like to be added:
Because clients on edges nodes can not connect cloud applications through pod ip, so LoadBalancer service for cloud application is discarded in yurthub component in order to make kube-proxy unaware of LoadBalancer service on edge nodes. and only LoadBalancer service with annotation openyurt.io/skip-discard=true will be skipped.
the following are detail codes:

if svc.Spec.Type == v1.ServiceTypeLoadBalancer {
if svc.Annotations[filter.SkipDiscardServiceAnnotation] != "true" {
klog.V(2).Infof("load balancer service(%s) is discarded in StreamResponseFilter of discardCloudServiceFilterHandler", nsName)
return nil
}
}

but in the proposal: https://github.com/openyurtio/openyurt/blob/master/docs/proposals/20231121-high-availability-of-edge-services.md, LoadBalancer service across NodePools will be supported, this means that LoadBalancer service should be aware of on edge nodes.

so we will improve discardcloudservice filter in yurthub component, and only discard LoadBalancer service which has annotation svc.openyurt.io/discard=true, this means that LoadBalancer service will not be discarded by default.

others
/kind feature

@rambohe-ch rambohe-ch added the kind/feature kind/feature label Jan 16, 2024
@rambohe-ch
Copy link
Member Author

@gnunu @JameKeal @YTGhost Do you have any comments?

@huangchenzhao
Copy link
Member

huangchenzhao commented Jan 17, 2024

It seems we first need to add a new annotation svc.openyurt.io/discard=true after line 48 in the following code

SkipDiscardServiceAnnotation = "openyurt.io/skip-discard"

and then we need to modify the following code, discard LoadBalancer service which has svc.openyurt.io/discard=true, instead of which doesn't have openyurt.io/skip-discard=true.
if svc.Spec.Type == v1.ServiceTypeLoadBalancer {
if svc.Annotations[filter.SkipDiscardServiceAnnotation] != "true" {
klog.V(2).Infof("load balancer service(%s) is discarded in StreamResponseFilter of discardCloudServiceFilterHandler", nsName)
return nil
}
}

I have raised a pr to implement the logic described above to fix this issue.

huangchenzhao added a commit to huangchenzhao/openyurt that referenced this issue Jan 17, 2024
huangchenzhao added a commit to huangchenzhao/openyurt that referenced this issue Jan 17, 2024
huangchenzhao added a commit to huangchenzhao/openyurt that referenced this issue Jan 17, 2024
@rambohe-ch
Copy link
Member Author

It seems we first need to add a new annotation svc.openyurt.io/discard=true after line 48 in the following code

SkipDiscardServiceAnnotation = "openyurt.io/skip-discard"

and then we need to modify the following code, discard LoadBalancer service which has svc.openyurt.io/discard=true, instead of which doesn't have openyurt.io/skip-discard=true.

if svc.Spec.Type == v1.ServiceTypeLoadBalancer {
if svc.Annotations[filter.SkipDiscardServiceAnnotation] != "true" {
klog.V(2).Infof("load balancer service(%s) is discarded in StreamResponseFilter of discardCloudServiceFilterHandler", nsName)
return nil
}
}

I have raised a pr to implement the logic described above to fix this issue.

@huangchenzhao yes, you're right. by the way, unit tests also should be tuned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature kind/feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants