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


Golang stats.SummaryProvider类代码示例

本文整理汇总了Golang中k8s/io/kubernetes/pkg/kubelet/server/stats.SummaryProvider的典型用法代码示例。如果您正苦于以下问题:Golang SummaryProvider类的具体用法?Golang SummaryProvider怎么用?Golang SummaryProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: makeSignalObservations

// makeSignalObservations derives observations using the specified summary provider.
func makeSignalObservations(summaryProvider stats.SummaryProvider) (signalObservations, statsFunc, error) {
	summary, err := summaryProvider.Get()
	if err != nil {
		return nil, nil, err
	}
	// build the function to work against for pod stats
	statsFunc := cachedStatsFunc(summary.Pods)
	// build an evaluation context for current eviction signals
	result := signalObservations{}

	if memory := summary.Node.Memory; memory != nil && memory.AvailableBytes != nil && memory.WorkingSetBytes != nil {
		result[SignalMemoryAvailable] = signalObservation{
			available: resource.NewQuantity(int64(*memory.AvailableBytes), resource.BinarySI),
			capacity:  resource.NewQuantity(int64(*memory.AvailableBytes+*memory.WorkingSetBytes), resource.BinarySI),
		}
	}
	if nodeFs := summary.Node.Fs; nodeFs != nil && nodeFs.AvailableBytes != nil && nodeFs.CapacityBytes != nil {
		result[SignalNodeFsAvailable] = signalObservation{
			available: resource.NewQuantity(int64(*nodeFs.AvailableBytes), resource.BinarySI),
			capacity:  resource.NewQuantity(int64(*nodeFs.CapacityBytes), resource.BinarySI),
		}
	}
	if summary.Node.Runtime != nil {
		if imageFs := summary.Node.Runtime.ImageFs; imageFs != nil && imageFs.AvailableBytes != nil && imageFs.CapacityBytes != nil {
			result[SignalImageFsAvailable] = signalObservation{
				available: resource.NewQuantity(int64(*imageFs.AvailableBytes), resource.BinarySI),
				capacity:  resource.NewQuantity(int64(*imageFs.CapacityBytes), resource.BinarySI),
			}
		}
	}
	return result, statsFunc, nil
}
开发者ID:invenfantasy,项目名称:kubernetes,代码行数:33,代码来源:helpers.go

示例2: makeSignalObservations

// makeSignalObservations derives observations using the specified summary provider.
func makeSignalObservations(summaryProvider stats.SummaryProvider) (signalObservations, statsFunc, error) {
	summary, err := summaryProvider.Get()
	if err != nil {
		return nil, nil, err
	}
	// build the function to work against for pod stats
	statsFunc := cachedStatsFunc(summary.Pods)
	// build an evaluation context for current eviction signals
	result := signalObservations{}
	result[SignalMemoryAvailable] = resource.NewQuantity(int64(*summary.Node.Memory.AvailableBytes), resource.BinarySI)
	return result, statsFunc, nil
}
开发者ID:Cloven,项目名称:minikube,代码行数:13,代码来源:helpers.go


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