-
Notifications
You must be signed in to change notification settings - Fork 4k
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
list vpacheckpoint using vpacheckpoint lister #6419
base: master
Are you sure you want to change the base?
Conversation
|
Welcome @yunwang0911! |
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
/remove-lifecycle stale |
@yunwang0911 are you willing to update this with master? I have capacity to review it |
@adrianmoisey Rebased |
Since it can relieve apiserver pressure Beside, it decreases the possibility that vpa recommender is limited by client-go when it accesses the vpacheckpoint # Conflicts: # vertical-pod-autoscaler/pkg/recommender/input/cluster_feeder.go # vertical-pod-autoscaler/pkg/recommender/main.go
/lgtm |
@voelzmo @adrianmoisey @kwiesmueller Could you please approve this PR? |
/assign @raywainman |
/milestone vertical-pod-autoscaler-1.4.0 |
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.
Thanks for the PR. I guess we'll have to do some rebasing between this and #7716 though.
vpa_types "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1" | ||
vpa_clientset "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/client/clientset/versioned" | ||
vpa_api "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling.k8s.io/v1" | ||
vpa_lister "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/client/listers/autoscaling.k8s.io/v1" | ||
controllerfetcher "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/target/controller_fetcher" | ||
"k8s.io/client-go/tools/cache" | ||
"k8s.io/klog/v2" |
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 think we want to re-order these imports to the lower section, please leave them as-is
@@ -284,11 +285,11 @@ func (feeder *clusterStateFeeder) GarbageCollectCheckpoints() { | |||
|
|||
for _, namespaceItem := range namespaceList.Items { | |||
namespace := namespaceItem.Name | |||
checkpointList, err := feeder.vpaCheckpointClient.VerticalPodAutoscalerCheckpoints(namespace).List(context.TODO(), metav1.ListOptions{}) | |||
checkpointList, err := feeder.vpaCheckpointLister.VerticalPodAutoscalerCheckpoints(namespace).List(labels.Everything()) |
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 now that we have a vpaCheckpointLister
inside the cluster_feeder
, we no longer need the list of namespaces here.
Instead, we can just list all checkpoints (already filtered by vpaObjectNamespace
, if that is set) above like this
checkpointList, err := feeder. vpaCheckpointLister.List(labels.Everything())
And then iterate over those checkpoints and filter them, if they are in a namespace that is in vpaIgnoredNamespaces
. Alternatively, we could do the filtering once on the entire list, similar to what is done in filterVPAs
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: yunwang0911 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 |
@@ -284,11 +285,11 @@ func (feeder *clusterStateFeeder) GarbageCollectCheckpoints() { | |||
|
|||
for _, namespaceItem := range namespaceList.Items { | |||
namespace := namespaceItem.Name | |||
checkpointList, err := feeder.vpaCheckpointClient.VerticalPodAutoscalerCheckpoints(namespace).List(context.TODO(), metav1.ListOptions{}) | |||
checkpointList, err := feeder.vpaCheckpointLister.VerticalPodAutoscalerCheckpoints(namespace).List(labels.Everything()) |
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 agree. You can refer to this: cluster_feeder.go#L330 for an example of how to filter the checkpoints based on the desired namespaces.
What type of PR is this?
What this PR does / why we need it:
Use vpacheckpoint lister instead of vpacheckpoint client when vpa recommender lists vpacheckpoint.
As we all know, query objects from kube-apiservice may increase the stress to kube-apiservice. What's more, vpa recommender might be limited when it lists vpacheckpoint by client. This pr changes the vpa recommender to use lister instead of client.
Which issue(s) this PR fixes:
No
Special notes for your reviewer:
Does this PR introduce a user-facing change?
No.