Commit 995b7279 authored by k8s-merge-robot's avatar k8s-merge-robot

Merge pull request #21974 from gmarek/refactor-gatherer

Auto commit by PR queue bot
parents 47986aa0 ff6b3d1f
......@@ -35,6 +35,7 @@ import (
const (
resourceDataGatheringPeriod = 60 * time.Second
probeDuration = 15 * time.Second
)
type resourceConstraint struct {
......@@ -137,7 +138,7 @@ type resourceGatherWorker struct {
func (w *resourceGatherWorker) singleProbe() {
data := make(resourceUsagePerContainer)
nodeUsage, err := getOneTimeResourceUsageOnNode(w.c, w.nodeName, 15*time.Second, func() []string { return w.containerIDs }, true)
nodeUsage, err := getOneTimeResourceUsageOnNode(w.c, w.nodeName, probeDuration, func() []string { return w.containerIDs }, true)
if err != nil {
Logf("Error while reading data from %v: %v", w.nodeName, err)
return
......@@ -168,9 +169,11 @@ func (w *resourceGatherWorker) gather(initialSleep time.Duration) {
}
func (g *containerResourceGatherer) getKubeSystemContainersResourceUsage(c *client.Client) {
delay := resourceDataGatheringPeriod / time.Duration(len(g.workers))
delayPeriod := resourceDataGatheringPeriod / time.Duration(len(g.workers))
delay := time.Duration(0)
for i := range g.workers {
go g.workers[i].gather(delay)
delay += delayPeriod
}
g.workerWg.Wait()
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment