當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。