common

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 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 CreateAllocationForTask added in v1.5.0

func CreateAllocationForTask(appID, taskID, nodeID string, resource *si.Resource, placeholder bool, taskGroupName string, pod *v1.Pod, originator bool, preemptionPolicy *si.PreemptionPolicy) *si.AllocationRequest

func CreateAllocationRequestForTask

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

func CreatePriorityForTask added in v1.1.0

func CreatePriorityForTask(pod *v1.Pod) int32

func CreateReleaseRequestForTask added in v1.5.1

func CreateReleaseRequestForTask(appID, taskID, partition, terminationType string) *si.AllocationRequest

func CreateTagsForTask

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

func CreateUpdateRequestForDeleteOrRestoreNode

func CreateUpdateRequestForDeleteOrRestoreNode(nodeID string, action si.NodeInfo_ActionFromRM) *si.NodeRequest

CreateUpdateRequestForDeleteOrRestoreNode builds a NodeRequest for Node actions like drain, decommissioning & restore

func CreateUpdateRequestForRemoveApplication

func CreateUpdateRequestForRemoveApplication(appID, partition string) *si.ApplicationRequest

func CreateUpdateRequestForUpdatedNode

func CreateUpdateRequestForUpdatedNode(nodeID string, capacity *si.Resource, occupied *si.Resource) *si.NodeRequest

CreateUpdateRequestForUpdatedNode builds a NodeRequest for capacity and occupied resource updates

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)

GetPodResource from a pod's containers and convert that into an internal resource. Scheduling only accounts for requests. Convert the pod into a resource to allow for pod count checks in quotas and nodes.

func GetResource added in v1.2.0

func GetResource(resMap map[string]string) *si.Resource

func GetTGResource

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

func GetTerminationTypeFromString

func GetTerminationTypeFromString(terminationTypeStr string) si.TerminationType

func IsZero

func IsZero(r *si.Resource) bool

func ParseResource

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 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