当前位置: 首页>>代码示例>>Golang>>正文


Golang MetricsGrabber.GrabFromScheduler方法代码示例

本文整理汇总了Golang中k8s/io/kubernetes/pkg/metrics.MetricsGrabber.GrabFromScheduler方法的典型用法代码示例。如果您正苦于以下问题:Golang MetricsGrabber.GrabFromScheduler方法的具体用法?Golang MetricsGrabber.GrabFromScheduler怎么用?Golang MetricsGrabber.GrabFromScheduler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在k8s/io/kubernetes/pkg/metrics.MetricsGrabber的用法示例。


在下文中一共展示了MetricsGrabber.GrabFromScheduler方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1:

		By("Proxying to Pod through the API server")
		// Check if master Node is registered
		nodes, err := c.Core().Nodes().List(v1.ListOptions{})
		framework.ExpectNoError(err)

		var masterRegistered = false
		for _, node := range nodes.Items {
			if strings.HasSuffix(node.Name, "master") {
				masterRegistered = true
			}
		}
		if !masterRegistered {
			framework.Logf("Master is node api.Registry. Skipping testing Scheduler metrics.")
			return
		}
		response, err := grabber.GrabFromScheduler()
		framework.ExpectNoError(err)
		Expect(response).NotTo(BeEmpty())
	})

	It("should grab all metrics from a ControllerManager.", func() {
		By("Proxying to Pod through the API server")
		// Check if master Node is registered
		nodes, err := c.Core().Nodes().List(v1.ListOptions{})
		framework.ExpectNoError(err)

		var masterRegistered = false
		for _, node := range nodes.Items {
			if strings.HasSuffix(node.Name, "master") {
				masterRegistered = true
			}
开发者ID:kubernetes,项目名称:kubernetes,代码行数:31,代码来源:metrics_grabber_test.go

示例2:

		// Check if master Node is registered
		nodes, err := c.Nodes().List(api.ListOptions{})
		framework.ExpectNoError(err)

		var masterRegistered = false
		for _, node := range nodes.Items {
			if strings.HasSuffix(node.Name, "master") {
				masterRegistered = true
			}
		}
		if !masterRegistered {
			framework.Logf("Master is node registered. Skipping testing Scheduler metrics.")
			return
		}
		unknownMetrics := sets.NewString()
		response, err := grabber.GrabFromScheduler(unknownMetrics)
		framework.ExpectNoError(err)
		Expect(unknownMetrics).To(BeEmpty())

		checkMetrics(metrics.Metrics(response), metrics.KnownSchedulerMetrics)
	})

	It("should grab all metrics from a ControllerManager.", func() {
		By("Proxying to Pod through the API server")
		// Check if master Node is registered
		nodes, err := c.Nodes().List(api.ListOptions{})
		framework.ExpectNoError(err)

		var masterRegistered = false
		for _, node := range nodes.Items {
			if strings.HasSuffix(node.Name, "master") {
开发者ID:Clarifai,项目名称:kubernetes,代码行数:31,代码来源:metrics_grabber_test.go


注:本文中的k8s/io/kubernetes/pkg/metrics.MetricsGrabber.GrabFromScheduler方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。