java
java copied to clipboard
Further filter Pod Metrics using labels
trafficstars
Describe the bug
For efficiency, it would be very beneficial to enable the labelSelector when querying the Metrics for Pods.
Client Version
e.g. 24.0.0-SNAPSHOT
Kubernetes Version
e.g. 1.27.10
Java Version e.g. Java 11
To Reproduce Calling this:
final ApiClient client = Config.fromCluster();
final PodMetricsList = new Metrics(client).getPodMetrics("namespace");
Which could potentially query hundreds of Pods that are out of context, could be adapted to either use the ListOption directly, or, in my case, just the labelSelector:
final String labelSelector = "foo=bar, xyz!=abc"
final ApiClient client = Config.fromCluster();
final PodMetricsList = new Metrics(client).getPodMetrics("namespace", labelSelector);
Expected behavior
Reduce the items() in the PodMetricsList to just those that match the Namespace and Label Selector.
KubeConfig Not applicable
Server (please complete the following information):
- OS: Debian Linux 12
- Environment: Docker
- Cloud: Self-hosted OpenStack
Additional context