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

Avoid calling k8s api for each resource kind on the cluster #1712

Merged
merged 7 commits into from
Jan 20, 2022

Conversation

rubenvp8510
Copy link
Collaborator

@rubenvp8510 rubenvp8510 commented Jan 19, 2022

Signed-off-by: Ruben Vargas ruben.vp8510@gmail.com

Which problem is this PR solving?

  • This PR should fixes Issue-1684 or at least alleviate the problem, The message of "Waited for Xs due to client-side throttling, not priority and fairness" is caused because a lot of API calls to K8s. It seems like calling PreferedServerResources does a lot of calls to the API when the cluster has a lot of different resource Kinds.

Short description of the changes

  • To avoid this, in this PR we ask for ServerGroups and then only get the resources for our interested Groups.

Note: I still see one line in the log with the error "Waited Xs.." but one single time, I don't see the same error repeating in logs each N seconds. so I think this can be considered a fix.

Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
@codecov
Copy link

codecov bot commented Jan 19, 2022

Codecov Report

Merging #1712 (8d1170c) into master (343c4f2) will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1712      +/-   ##
==========================================
+ Coverage   87.71%   87.74%   +0.02%     
==========================================
  Files          98       98              
  Lines        5958     5972      +14     
==========================================
+ Hits         5226     5240      +14     
  Misses        556      556              
  Partials      176      176              
Impacted Files Coverage Δ
pkg/autodetect/main.go 87.34% <100.00%> (+1.16%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 343c4f2...8d1170c. Read the comment docs.

@@ -109,8 +111,29 @@ func (b *Background) autoDetectCapabilities() {
b.cleanDeployments(ctx)
}

func (b *Background) isInListenedGroups(group *metav1.APIGroup) bool {
for _, groupName := range groupsListened {
Copy link
Member

Choose a reason for hiding this comment

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

map might be more efficient here. The code checks if a given group should be handled or not.

@@ -109,8 +111,29 @@ func (b *Background) autoDetectCapabilities() {
b.cleanDeployments(ctx)
}

func (b *Background) isInListenedGroups(group *metav1.APIGroup) bool {
Copy link
Member

Choose a reason for hiding this comment

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

passing group by value seems better here

if b.isInListenedGroups(&sg) {
groupAPIList, err := b.dcl.ServerResourcesForGroupVersion(sg.PreferredVersion.GroupVersion)
if err != nil {
return apiLists, err
Copy link
Member

Choose a reason for hiding this comment

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

I would either return empty apiList or accumulate errors and return the error with gathered groups once all calls are done.

Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
pkg/autodetect/main.go Outdated Show resolved Hide resolved
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
pavolloffay
pavolloffay previously approved these changes Jan 19, 2022
@rubenvp8510 rubenvp8510 enabled auto-merge (squash) January 19, 2022 17:11
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
@rubenvp8510 rubenvp8510 merged commit b024532 into jaegertracing:master Jan 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Jaeger operator is spamming logs with "Waited for Xs due to client-side throttling, not priority and fairness"
2 participants