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

refactor: introduce 'byClusterName' secret index to speedup cluster server URL lookup #8133

Merged
merged 1 commit into from Jan 10, 2022

Conversation

alexmt
Copy link
Collaborator

@alexmt alexmt commented Jan 10, 2022

Signed-off-by: Alexander Matyushentsev AMatyushentsev@gmail.com

Closes #8132

PR introduces 'byClusterName' secret index to speedup cluster server URL lookup

Copy link
Contributor

@yeya24 yeya24 left a comment

Choose a reason for hiding this comment

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

LGTM

return nil, err
}

if len(localClusterSecrets) == 0 && name == string(localClusterSecrets[0].(*apiv1.Secret).Data["name"]) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be len(localClusterSecrets) > 0?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ops, good catch! Fixed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Unit test also catch it so I had to modify implementation only

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

…erver URL lookup

Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
Copy link
Contributor

@mayzhang2000 mayzhang2000 left a comment

Choose a reason for hiding this comment

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

LGTM

@yeya24
Copy link
Contributor

yeya24 commented Jan 10, 2022

Just double checking that it will be cheery picked to 2.2 right?

@codecov
Copy link

codecov bot commented Jan 10, 2022

Codecov Report

Merging #8133 (0d5ace4) into master (5da1522) will increase coverage by 0.01%.
The diff coverage is 60.71%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #8133      +/-   ##
==========================================
+ Coverage   41.51%   41.53%   +0.01%     
==========================================
  Files         174      174              
  Lines       22712    22736      +24     
==========================================
+ Hits         9430     9443      +13     
- Misses      11941    11949       +8     
- Partials     1341     1344       +3     
Impacted Files Coverage Δ
util/db/db.go 84.61% <ø> (ø)
util/settings/settings.go 47.01% <58.33%> (+0.16%) ⬆️
util/db/cluster.go 59.25% <60.00%> (+0.05%) ⬆️
util/argo/argo.go 62.73% <100.00%> (-0.31%) ⬇️

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 5da1522...0d5ace4. Read the comment docs.

@alexmt
Copy link
Collaborator Author

alexmt commented Jan 10, 2022

@yeya24 , that is correct.

@alexmt alexmt merged commit 27af0b4 into argoproj:master Jan 10, 2022
@alexmt alexmt deleted the cluster-lookup-performance branch January 10, 2022 20:38
@yeya24
Copy link
Contributor

yeya24 commented Jan 12, 2022

Hello @alexmt, thanks for the quick fix and good work! Can I ask when will it get into v2.2? Anything else is blocking now?

}

// if local cluster name is not overridden and specified name is local cluster name, return local cluster server
localClusterSecrets, err := informer.GetIndexer().ByIndex(settings.ByClusterURLIndexer, appv1.KubernetesInternalAPIServerAddr)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we check db.getLocalCluster().Name == name first and fetch the local cluster index later? I think it is not necessary to do this if the specified name is not local

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This check is required because the local cluster can be renamed. So we cannot assume it is named "in-cluster" and have to check cluster secrets.

alexmt pushed a commit that referenced this pull request Jan 18, 2022
…erver URL lookup (#8133)

Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
@alexmt
Copy link
Collaborator Author

alexmt commented Jan 18, 2022

cyrilix pushed a commit to cyrilix/argo-cd that referenced this pull request Feb 15, 2022
…erver URL lookup (argoproj#8133)

Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
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.

Cluster name in application destination affects controller performance
3 participants