Add optional label selector to KubeList for server-side pod filtering#4772
Open
Add optional label selector to KubeList for server-side pod filtering#4772
Conversation
mrWinston
requested changes
Apr 15, 2026
Collaborator
mrWinston
left a comment
There was a problem hiding this comment.
Nice PR! I do like using a variadic arg to have the labelSelector optional.
However, instead of requiring the array to have either 0 or 1 elements, I think it'd be more intuitive to support an arbitrary number of label selectors and join them to create the final one, eg:
i pass in something like []string{"app=frontend", "env=prod"} and they get combined into app=frontend,env=prod.
So basically, just calling
selector := strings.Join(labelSelector, ",")|
Please rebase pull request. |
Collaborator
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it
This PR enhances the
KubeListfunction to support server-side label selector filtering and uses this capability to improve the API server pod validation in the control plane VM resize pre-flight checks.Changes
Extended
KubeListwith optional label selector parameterlabelSelector ...stringparameter toKubeListin theKubeActionsinterfaceImproved API server pod validation
app=openshift-kube-apiserverlabel selector to fetch only relevant podsWhich issue this PR addresses
Follow-up improvement to the control plane VM resize pre-validation feature, addressing reviewer feedback to use server-side filtering for pod selection.
Test plan
KubeListvalidateAPIServerPodsupdated to reflect server-side filtering behaviormake unit-test-go,make lint-go)Is there any documentation that needs to be updated for this PR?
No documentation changes required. This is an internal implementation improvement.
How do you know this will function as expected in production?