mirror of
https://github.com/zalando-incubator/kube-metrics-adapter.git
synced 2024-12-22 19:16:06 +00:00
return early if backendName is empty
Signed-off-by: Mikkel Oscar Lyderik Larsen <mikkel.larsen@zalando.de>
This commit is contained in:
parent
a08860d06c
commit
c618494177
@ -139,17 +139,17 @@ func getRouteGroupWeight(backends []rgv1.RouteGroupBackendReference, backendName
|
||||
return 1.0, nil
|
||||
}
|
||||
|
||||
if backendName == "" {
|
||||
return 0.0, errBackendNameMissing
|
||||
}
|
||||
|
||||
for _, backend := range backends {
|
||||
if backend.BackendName == backendName {
|
||||
return float64(backend.Weight) / 100.0, nil
|
||||
}
|
||||
}
|
||||
|
||||
if backendName != "" {
|
||||
return 0.0, nil
|
||||
}
|
||||
|
||||
return 0.0, errBackendNameMissing
|
||||
return 0.0, nil
|
||||
}
|
||||
|
||||
// getCollector returns a collector for getting the metrics.
|
||||
|
Loading…
x
Reference in New Issue
Block a user