本文整理汇总了Golang中k8s/io/kubernetes/plugin/pkg/scheduler/schedulercache.NodeInfo.MemoryPressureCondition方法的典型用法代码示例。如果您正苦于以下问题:Golang NodeInfo.MemoryPressureCondition方法的具体用法?Golang NodeInfo.MemoryPressureCondition怎么用?Golang NodeInfo.MemoryPressureCondition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类k8s/io/kubernetes/plugin/pkg/scheduler/schedulercache.NodeInfo
的用法示例。
在下文中一共展示了NodeInfo.MemoryPressureCondition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: CheckNodeMemoryPressurePredicate
// CheckNodeMemoryPressurePredicate checks if a pod can be scheduled on a node
// reporting memory pressure condition.
func CheckNodeMemoryPressurePredicate(pod *v1.Pod, meta interface{}, nodeInfo *schedulercache.NodeInfo) (bool, []algorithm.PredicateFailureReason, error) {
var podBestEffort bool
if predicateMeta, ok := meta.(*predicateMetadata); ok {
podBestEffort = predicateMeta.podBestEffort
} else {
// We couldn't parse metadata - fallback to computing it.
podBestEffort = isPodBestEffort(pod)
}
// pod is not BestEffort pod
if !podBestEffort {
return true, nil, nil
}
// is node under presure?
if nodeInfo.MemoryPressureCondition() == v1.ConditionTrue {
return false, []algorithm.PredicateFailureReason{ErrNodeUnderMemoryPressure}, nil
}
return true, nil, nil
}