-
Notifications
You must be signed in to change notification settings - Fork 408
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
fix: cache the server version info of kubernetes #936
fix: cache the server version info of kubernetes #936
Conversation
@Sodawyx: GitHub didn't allow me to assign the following users: your_reviewer. Note that only openyurtio members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time. In response to this:
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. |
Thanks for your contribution, I'll take a look. |
Hi, I have fixed the codes and commit again! Please have a look and take a review! |
@Sodawyx beside |
Codecov Report
@@ Coverage Diff @@
## master #936 +/- ##
=========================================
Coverage ? 39.69%
=========================================
Files ? 83
Lines ? 11234
Branches ? 0
=========================================
Hits ? 4459
Misses ? 6444
Partials ? 331
Flags with carried forward coverage won't be shown. Click here to find out more. Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
@Sodawyx I think it's not a good idea to modify
|
@rambohe-ch Sounds good, it can simplify the logic in CacheManager. Since proxyServer and yurthub server listen at different port, it may need another redirection in local proxy. And for |
@Congrool we need to add new handler for ProxyServer not yurthub server. and |
Well, I mean all requests from edge will be sent to proxy server. If we want to handle them in yurthub server, we need another redirection to send them to yurthub server. |
By the way, if we handle So why not add the |
@Congrool yes, we need to add |
OK, my misundertanding😢. |
@Sodawyx small modifications for comments:
|
Yeah, I got it! |
Hi @Congrool @rambohe-ch , I have update the code in the new commits. |
I think the disscussion above means to add a new http handler for proxy server to handle mux := http.NewServeMux()
mux.HandleFunc("/version", versionHandleFunc)
mux.HandleFunc("/apis/discovery.k8s.io/v1", discoveryFunc)
... |
@Sodawyx yes, i agree with the @Congrool's opinion that we should add new handlers based on proxy handler like as following:
|
Very appreciate for your suggestions, I will try to improve it. |
Hi @Congrool and @rambohe-ch, I have update a commit according to your suggestions. Please take a review and I will implement the unit test later! |
@Sodawyx please add unit tests for newly added code. |
pkg/yurthub/server/server.go
Outdated
restCfg := rest.GetRestConfig(false) | ||
clientSet, err := kubernetes.NewForConfig(restCfg) | ||
if err != nil { | ||
klog.Warningf("cannot create the client set: %v", clientSet) |
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 the kube-client can not created, it's more reasonable to return here, not just log warning.
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 the network is disconnected, the program will be continue to execute and query the cache for the non-resource info. And I think the error should not be return.
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 think kubernetes.NewForConfig
is used for creating client only, and do not access the remote kube-apiserver.
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 think you are right! And I will return the error.
@Sodawyx please fix errors from github ci pipeline. |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rambohe-ch, Sodawyx The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rambohe-ch, Sodawyx The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/backport release-v0.7 |
Successfully created backport PR #977 for |
What type of PR is this?
What this PR does / why we need it:
cache the server version info of the kubernetes, and fix the issue of coreDNS is abnormal when edge node restart
Which issue(s) this PR fixes:
Fixes #880
Special notes for your reviewer:
Does this PR introduce a user-facing change?
other Note