common

package
v0.12.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 26, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(left *si.Resource, right *si.Resource) *si.Resource

func CreateAllocationRequestForTask added in v0.12.0

func CreateAllocationRequestForTask(appID, taskID string, resource *si.Resource, placeholder bool, taskGroupName string, pod *v1.Pod) si.AllocationRequest

func CreateReleaseAllocationRequestForTask

func CreateReleaseAllocationRequestForTask(appID, allocUUID, partition, terminationType string) si.AllocationRequest

func CreateReleaseAskRequestForTask

func CreateReleaseAskRequestForTask(appID, taskID, partition string) si.AllocationRequest

func CreateTagsForTask added in v0.12.0

func CreateTagsForTask(pod *v1.Pod) map[string]string

func CreateUpdateRequestForDeleteNode

func CreateUpdateRequestForDeleteNode(node Node) si.NodeRequest

func CreateUpdateRequestForNewNode

func CreateUpdateRequestForNewNode(node Node) si.NodeRequest

func CreateUpdateRequestForRemoveApplication added in v0.10.0

func CreateUpdateRequestForRemoveApplication(appID, partition string) si.ApplicationRequest

func CreateUpdateRequestForUpdatedNode

func CreateUpdateRequestForUpdatedNode(node Node) si.NodeRequest

func Equals

func Equals(left *si.Resource, right *si.Resource) bool

func GetNodeResource

func GetNodeResource(nodeStatus *v1.NodeStatus) *si.Resource

func GetPodResource

func GetPodResource(pod *v1.Pod) (resource *si.Resource)

Get the resources from a pod's containers and convert that into a internal resource. A pod has two resource parts: Requests and Limits. Based on the values a pod gets a QOS assigned, as per https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/ QOS class Guaranteed and Burstable are supported. However Burstable is scheduled based on the request values, limits are ignored in the current setup. BestEffort pods are scheduled using a minimum resource of 1MB only.

func GetTGResource added in v0.10.0

func GetTGResource(resMap map[string]resource.Quantity, members int64) *si.Resource

func GetTerminationTypeFromString added in v0.10.0

func GetTerminationTypeFromString(terminationTypeStr string) si.TerminationType

func IsZero

func IsZero(r *si.Resource) bool

func ParseResource added in v0.9.0

func ParseResource(cpuStr, memStr string) *si.Resource

parse cpu and memory from string to si.Resource, both of them are optional if parse failed with some errors, log the error and return a nil

func Sub

func Sub(left *si.Resource, right *si.Resource) *si.Resource

Types

type Node

type Node struct {
	// contains filtered or unexported fields
}

stores info about what scheduler cares about a node

func CreateFrom

func CreateFrom(node *v1.Node) Node

func CreateFromNodeSpec

func CreateFromNodeSpec(nodeName string, nodeUID string, nodeResource *si.Resource) Node

func NewNode

func NewNode(name, uid string, capacity *si.Resource, occupied *si.Resource) Node

type ResourceBuilder

type ResourceBuilder struct {
	// contains filtered or unexported fields
}

resource builder is a helper struct to construct si resources

func NewResourceBuilder

func NewResourceBuilder() *ResourceBuilder

func (*ResourceBuilder) AddResource

func (w *ResourceBuilder) AddResource(name string, value int64) *ResourceBuilder

func (*ResourceBuilder) Build

func (w *ResourceBuilder) Build() *si.Resource

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL