-
Notifications
You must be signed in to change notification settings - Fork 40.7k
discovery: speedup kubectl restmapper cache misses by a two-digit factor #73345
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
discovery: speedup kubectl restmapper cache misses by a two-digit factor #73345
Conversation
@@ -145,27 +145,34 @@ func NewDiscoveryRESTMapper(groupResources []*APIGroupResources) meta.RESTMapper | |||
// GetAPIGroupResources uses the provided discovery client to gather | |||
// discovery information and populate a slice of APIGroupResources. | |||
func GetAPIGroupResources(cl discovery.DiscoveryInterface) ([]*APIGroupResources, error) { | |||
// TODO: we don't want this ServerGroups call. It is only there to get the metav1.APIGroup struct used below. |
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.
we have to fix this
/hold until https://github.com/kubernetes/kubernetes/pull/73345/files#r251196320 is fixed. |
/cc |
/assign @caesarxuchao @logicalhan |
a913a2c
to
5f88a2c
Compare
/hold cancel |
d340629
to
eaaca48
Compare
the ServerGroupsAndResources change looks good (modulo interface documentation). The GetAPIGroupResources change needs thought to either behave the same in partial discovery cases, or to update callers to handle partial discovery results correctly. |
eaaca48
to
4a32ce1
Compare
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.
The current state, including partial discover (previous logic) and tests are in place.
/lgtm
4a32ce1
to
ad4f045
Compare
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.
/lgtm
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.
/approve
ad4f045
to
0fcf5ba
Compare
New changes are detected. LGTM label has been removed. |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: deads2k, soltysh, sttts 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 |
0fcf5ba
to
2cdddd8
Compare
The restmapper code did not call the optimized, parallelized API group resources discovery func, but did its own serial requests, one per API group version. Each took some hundred milliseconds, adding up to >10 sec for cluster with 40ish many API group versions.
Note: the tests in the first commit are also green before the second and third commits are applied.