utils

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Convert2ConfigMap added in v1.2.0

func Convert2ConfigMap(obj interface{}) *v1.ConfigMap

func Convert2Pod

func Convert2Pod(obj interface{}) (*v1.Pod, error)

func Convert2PriorityClass added in v1.2.0

func Convert2PriorityClass(obj interface{}) *schedulingv1.PriorityClass

func GenerateApplicationID added in v1.4.0

func GenerateApplicationID(namespace string, generateUniqueAppIds bool, podUID string) string

GenerateApplicationID generates an appID based on the namespace value if configured to generate unique appID, generate appID as <namespace>-<pod-uid> namespace capped at 26chars if not set or configured as false, appID generated as <autogen-prefix>-<namespace>-<autogen-suffix>

func GetApplicationIDFromPod

func GetApplicationIDFromPod(pod *v1.Pod) string

GetApplicationIDFromPod returns the Application for a Pod. If a Pod is marked as schedulable by YuniKorn but is missing an ApplicationID, one will be generated here (if YuniKorn is running in standard mode) or an empty string will be returned (if YuniKorn is running in plugin mode). If an Application ID is returned, the Pod is managed by YuniKorn. Otherwise, it is managed by an external scheduler.

func GetCoreSchedulerConfigFromConfigMap added in v1.2.0

func GetCoreSchedulerConfigFromConfigMap(config map[string]string) string

GetCoreSchedulerConfigFromConfigMap resolves a yunikorn configmap into a core scheduler config. If the configmap is missing or the policy group doesn't exist, uses a default configuration

func GetExtraConfigFromConfigMap added in v1.2.0

func GetExtraConfigFromConfigMap(config map[string]string) map[string]string

GetExtraConfigFromConfigMap filters the configmap entries, returning those that are not yaml

func GetNameSpaceAnnotationValue added in v1.2.0

func GetNameSpaceAnnotationValue(namespace *v1.Namespace, annotationKey string) string

func GetNamespaceGuaranteedFromAnnotation added in v1.4.0

func GetNamespaceGuaranteedFromAnnotation(namespaceObj *v1.Namespace) *si.Resource

get namespace guaranteed resource from namespace annotation

func GetNamespaceQuotaFromAnnotation

func GetNamespaceQuotaFromAnnotation(namespaceObj *v1.Namespace) *si.Resource

func GetPlaceholderFlagFromPodSpec

func GetPlaceholderFlagFromPodSpec(pod *v1.Pod) bool

func GetPodAnnotationValue added in v1.2.0

func GetPodAnnotationValue(pod *v1.Pod, annotationKey string) string

func GetPodLabelValue added in v1.2.0

func GetPodLabelValue(pod *v1.Pod, labelKey string) string

func GetQueueNameFromPod

func GetQueueNameFromPod(pod *v1.Pod) string

func GetTaskGroupFromPodSpec

func GetTaskGroupFromPodSpec(pod *v1.Pod) string

func GetUserFromPod

func GetUserFromPod(pod *v1.Pod) (string, []string)

GetUserFromPod find username from pod annotation or label

func IsAssignedPod

func IsAssignedPod(pod *v1.Pod) bool

assignedPod selects pods that are assigned (scheduled and running).

func IsPluginMode added in v1.4.0

func IsPluginMode() bool

func IsPodRunning

func IsPodRunning(pod *v1.Pod) bool

func IsPodTerminated

func IsPodTerminated(pod *v1.Pod) bool

func MergeMaps

func MergeMaps(first, second map[string]string) map[string]string

merge two string maps if the same key defined in the first and second maps the value will be set by the second map

func PodAlreadyBound added in v1.5.0

func PodAlreadyBound(pod *v1.Pod) bool

PodAlreadyBound returns true if a newly initializing Pod is already assigned to a Node

func PodUnderCondition

func PodUnderCondition(pod *v1.Pod, condition *v1.PodCondition) bool

compare the existing pod condition with the given one, return true if the pod condition remains not changed. return false if pod has no condition set yet, or condition has changed.

func SetPluginMode added in v1.4.0

func SetPluginMode(value bool)

func WaitForCondition

func WaitForCondition(eval func() bool, interval time.Duration, timeout time.Duration) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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