mirror of
https://github.com/kubernetes-sigs/prometheus-adapter.git
synced 2026-04-06 01:38:10 +00:00
Fix empty pod or node list resulting in an error
This commit is contained in:
parent
1e5a868378
commit
e9ef0bb4d0
1 changed files with 2 additions and 2 deletions
|
|
@ -120,7 +120,7 @@ type nsQueryResults struct {
|
|||
|
||||
func (p *resourceProvider) GetContainerMetrics(pods ...apitypes.NamespacedName) ([]provider.TimeInfo, [][]metrics.ContainerMetrics, error) {
|
||||
if len(pods) == 0 {
|
||||
return nil, nil, fmt.Errorf("no pods to fetch metrics for")
|
||||
return nil, nil, nil
|
||||
}
|
||||
|
||||
// TODO(directxman12): figure out how well this scales if we go to list 1000+ pods
|
||||
|
|
@ -240,7 +240,7 @@ func (p *resourceProvider) assignForPod(pod apitypes.NamespacedName, resultsByNs
|
|||
|
||||
func (p *resourceProvider) GetNodeMetrics(nodes ...string) ([]provider.TimeInfo, []corev1.ResourceList, error) {
|
||||
if len(nodes) == 0 {
|
||||
return nil, nil, fmt.Errorf("no nodes to fetch metrics for")
|
||||
return nil, nil, nil
|
||||
}
|
||||
|
||||
now := pmodel.Now()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue