mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Merge pull request #38462 from gmarek/print
Automatic merge from submit-queue Make resource gatherer print the data about resource usage in case of…
This commit is contained in:
		@@ -388,7 +388,9 @@ func (f *Framework) AfterEach() {
 | 
				
			|||||||
	summaries := make([]TestDataSummary, 0)
 | 
						summaries := make([]TestDataSummary, 0)
 | 
				
			||||||
	if TestContext.GatherKubeSystemResourceUsageData != "false" && TestContext.GatherKubeSystemResourceUsageData != "none" && f.gatherer != nil {
 | 
						if TestContext.GatherKubeSystemResourceUsageData != "false" && TestContext.GatherKubeSystemResourceUsageData != "none" && f.gatherer != nil {
 | 
				
			||||||
		By("Collecting resource usage data")
 | 
							By("Collecting resource usage data")
 | 
				
			||||||
		summaries = append(summaries, f.gatherer.stopAndSummarize([]int{90, 99, 100}, f.AddonResourceConstraints))
 | 
							summary, resourceViolationError := f.gatherer.stopAndSummarize([]int{90, 99, 100}, f.AddonResourceConstraints)
 | 
				
			||||||
 | 
							defer ExpectNoError(resourceViolationError)
 | 
				
			||||||
 | 
							summaries = append(summaries, summary)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if TestContext.GatherLogsSizes {
 | 
						if TestContext.GatherLogsSizes {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -28,7 +28,6 @@ import (
 | 
				
			|||||||
	"text/tabwriter"
 | 
						"text/tabwriter"
 | 
				
			||||||
	"time"
 | 
						"time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	. "github.com/onsi/gomega"
 | 
					 | 
				
			||||||
	"k8s.io/kubernetes/pkg/api/v1"
 | 
						"k8s.io/kubernetes/pkg/api/v1"
 | 
				
			||||||
	clientset "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5"
 | 
						clientset "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5"
 | 
				
			||||||
	utilruntime "k8s.io/kubernetes/pkg/util/runtime"
 | 
						utilruntime "k8s.io/kubernetes/pkg/util/runtime"
 | 
				
			||||||
@@ -295,7 +294,7 @@ func (g *containerResourceGatherer) startGatheringData() {
 | 
				
			|||||||
	g.getKubeSystemContainersResourceUsage(g.client)
 | 
						g.getKubeSystemContainersResourceUsage(g.client)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (g *containerResourceGatherer) stopAndSummarize(percentiles []int, constraints map[string]ResourceConstraint) *ResourceUsageSummary {
 | 
					func (g *containerResourceGatherer) stopAndSummarize(percentiles []int, constraints map[string]ResourceConstraint) (*ResourceUsageSummary, error) {
 | 
				
			||||||
	close(g.stopCh)
 | 
						close(g.stopCh)
 | 
				
			||||||
	Logf("Closed stop channel. Waiting for %v workers", len(g.workers))
 | 
						Logf("Closed stop channel. Waiting for %v workers", len(g.workers))
 | 
				
			||||||
	finished := make(chan struct{})
 | 
						finished := make(chan struct{})
 | 
				
			||||||
@@ -318,7 +317,7 @@ func (g *containerResourceGatherer) stopAndSummarize(percentiles []int, constrai
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if len(percentiles) == 0 {
 | 
						if len(percentiles) == 0 {
 | 
				
			||||||
		Logf("Warning! Empty percentile list for stopAndPrintData.")
 | 
							Logf("Warning! Empty percentile list for stopAndPrintData.")
 | 
				
			||||||
		return &ResourceUsageSummary{}
 | 
							return &ResourceUsageSummary{}, nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	data := make(map[int]ResourceUsagePerContainer)
 | 
						data := make(map[int]ResourceUsagePerContainer)
 | 
				
			||||||
	for i := range g.workers {
 | 
						for i := range g.workers {
 | 
				
			||||||
@@ -373,6 +372,8 @@ func (g *containerResourceGatherer) stopAndSummarize(percentiles []int, constrai
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	Expect(violatedConstraints).To(BeEmpty())
 | 
						if len(violatedConstraints) > 0 {
 | 
				
			||||||
	return &summary
 | 
							return &summary, fmt.Errorf(strings.Join(violatedConstraints, "\n"))
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return &summary, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user