mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 09:49:50 +00:00
Migrate Count to Kubernetes client
This commit is contained in:
parent
2fcd321c42
commit
e192ac31a4
@ -573,12 +573,12 @@ func (s *store) Count(key string) (int64, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
startTime := time.Now()
|
startTime := time.Now()
|
||||||
getResp, err := s.client.KV.Get(context.Background(), preparedKey, clientv3.WithRange(clientv3.GetPrefixRangeEnd(preparedKey)), clientv3.WithCountOnly())
|
count, err := s.client.Kubernetes.Count(context.Background(), preparedKey, kubernetes.CountOptions{})
|
||||||
metrics.RecordEtcdRequest("listWithCount", preparedKey, err, startTime)
|
metrics.RecordEtcdRequest("listWithCount", preparedKey, err, startTime)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
return getResp.Count, nil
|
return count, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReadinessCheck implements storage.Interface.
|
// ReadinessCheck implements storage.Interface.
|
||||||
|
Loading…
Reference in New Issue
Block a user