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
cache crd objects to speed up VpaTargetSelectorFetcher and ControllerFetcher #3412
Conversation
Wow! The performance improvement looks amazing. |
/assign @krzysied |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
I'm not sure if we can do it differently. The best solution would be having watch on scale subresource, but k8s doesn't prove such option. |
@@ -108,7 +109,8 @@ func NewClusterStateFeeder(config *rest.Config, clusterState *model.ClusterState | |||
kubeClient := kube_client.NewForConfigOrDie(config) | |||
podLister, oomObserver := NewPodListerAndOOMObserver(kubeClient, namespace) | |||
factory := informers.NewSharedInformerFactoryWithOptions(kubeClient, defaultResyncPeriod, informers.WithNamespace(namespace)) | |||
controllerFetcher := controllerfetcher.NewControllerFetcher(config, kubeClient, factory) | |||
crdCache := crdcache.NewCrdCache(config, make(chan struct{}), defaultResyncPeriod) |
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.
stop channel should provided via function params.
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 don't know what you mean. I deleted stop chan param and follow the rules in other package to create stop chan in crdcache.
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 was thinking about having stop channel as an input parameter. This would be helpful if cluster feeder was recreated many times during recommender life.
However, I looked at the recommender code and it didn't seem like a use case. Moreover other informers are also not propagating stop channels.
Deleting stop channel seems ok.
04ede85
to
f4ff989
Compare
vertical-pod-autoscaler/pkg/recommender/input/controller_fetcher/controller_fetcher.go
Outdated
Show resolved
Hide resolved
/hold |
From investigation by @krzysied, the current understanding is that giving VPA read access to all objects is a no-go from security perspective (gives access to secrets) and there is no way to express "give access to everything but secrets". Unfortunately, I don't see how we can make this PR work without that so I'm closing it, but feel free to reopen if you see an alternative. |
@bskiba: Closed this PR. 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. |
I find kubernetes/kubernetes#85963 talks about this. |
Sadly, looks like kubernetes/kubernetes#85963 is rejected. We're looking currently at a different way of tackling this, I'm hoping #3589 will help. |
Fixes #3266
Without this patch, it takes 1m41s (from
I0806 07:50:08.676461
toI0806 07:51:49.018659
) to get all selectors for each of 3111 vpas (mostly crd workload targets).With this patch, it takes 1s (from
I0806 08:02:49.137257
toI0806 08:02:50.266574
).We also save 3111*3/2/60 qps of scale http calls to kube-apiserver and speed up vpa admission.