util

package
v0.3.75-rc-5d79600 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2023 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventReasonPreempted = "Preempted"
)

Variables

This section is empty.

Functions

func CountPodsByPhase

func CountPodsByPhase(pods []*v1.Pod) map[string]uint32

func CreateIngress

func CreateIngress(
	name string,
	job *api.Job,
	pod *v1.Pod,
	service *v1.Service,
	executorIngressConfig *configuration.IngressConfiguration,
	jobConfig *IngressServiceConfig,
) *networking.Ingress

func CreateOwnerReference

func CreateOwnerReference(pod *v1.Pod) metav1.OwnerReference

func CreatePod

func CreatePod(job *api.Job, defaults *configuration.PodDefaults) *v1.Pod

func CreatePodFromExecutorApiJob added in v0.3.47

func CreatePodFromExecutorApiJob(job *executorapi.JobRunLease, defaults *configuration.PodDefaults) (*v1.Pod, error)

func CreateService

func CreateService(
	job *api.Job,
	pod *v1.Pod,
	ports []v1.ServicePort,
	ingSvcType IngressServiceType,
	useClusterIP bool,
) *v1.Service

func ExtractFailedPodContainerStatuses

func ExtractFailedPodContainerStatuses(pod *v1.Pod) []*api.ContainerStatus

func ExtractIngresses added in v0.3.47

func ExtractIngresses(job *executorapi.JobRunLease, pod *v1.Pod, executorIngressConfig *configuration.IngressConfiguration) []*networking.Ingress

func ExtractJobId

func ExtractJobId(pod *v1.Pod) string

func ExtractJobIdFromName

func ExtractJobIdFromName(name string) (string, error)

ExtractJobIdFromName extracts job id from the Armada Job pod Pods are named using the convention armada-<UID>-0(-<suffix>)

func ExtractJobIds

func ExtractJobIds(pods []*v1.Pod) []string

func ExtractJobRunId added in v0.3.47

func ExtractJobRunId(pod *v1.Pod) string

func ExtractJobRunIds added in v0.3.47

func ExtractJobRunIds(pods []*v1.Pod) []string

func ExtractJobSet added in v0.3.50

func ExtractJobSet(pod *v1.Pod) string

func ExtractNames

func ExtractNames(pods []*v1.Pod) []string

func ExtractNodeNames

func ExtractNodeNames(nodes []*v1.Node) []string

func ExtractPodExitCodes

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

func ExtractPodFailedCause

func ExtractPodFailedCause(pod *v1.Pod) api.Cause

func ExtractPodFailedReason

func ExtractPodFailedReason(pod *v1.Pod) string

func ExtractPodKey

func ExtractPodKey(pod *v1.Pod) string

func ExtractPodNumber

func ExtractPodNumber(pod *v1.Pod) int

func ExtractQueue added in v0.3.50

func ExtractQueue(pod *v1.Pod) string

func ExtractServices added in v0.3.47

func ExtractServices(job *executorapi.JobRunLease, pod *v1.Pod) []*v1.Service

func FilterCompletedPods

func FilterCompletedPods(pods []*v1.Pod) []*v1.Pod

func FilterNodes

func FilterNodes(nodes []*v1.Node, filter func(node *v1.Node) bool) []*v1.Node

func FilterNonCompletedPods

func FilterNonCompletedPods(pods []*v1.Pod) []*v1.Pod

func FilterPods

func FilterPods(pods []*v1.Pod, filter func(*v1.Pod) bool) []*v1.Pod

func FilterPodsWithPhase

func FilterPodsWithPhase(pods []*v1.Pod, podPhase v1.PodPhase) []*v1.Pod

func FindLastContainerStartTime

func FindLastContainerStartTime(pod *v1.Pod) time.Time

func GenerateIngresses

func GenerateIngresses(job *api.Job, pod *v1.Pod, ingressConfig *configuration.IngressConfiguration) ([]*v1.Service, []*networking.Ingress)

func GetDeletionGracePeriodOrDefault

func GetDeletionGracePeriodOrDefault(pod *v1.Pod) time.Duration

GetDeletionGracePeriodOrDefault returns the pod's DeletionGracePeriodSeconds seconds (if populated) or the K8s default value of 30 seconds (if it isn't)

func GetExpectedNumberOfAssociatedIngresses

func GetExpectedNumberOfAssociatedIngresses(pod *v1.Pod) int

func GetExpectedNumberOfAssociatedServices

func GetExpectedNumberOfAssociatedServices(pod *v1.Pod) int

func GetManagedPodSelector

func GetManagedPodSelector() labels.Selector

func GetPodContainerStatuses

func GetPodContainerStatuses(pod *v1.Pod) []v1.ContainerStatus

func GetPodsOnNodes

func GetPodsOnNodes(pods []*v1.Pod, nodes []*v1.Node) []*v1.Pod

func GetServicePorts

func GetServicePorts(svcConfigs []*IngressServiceConfig, podSpec *v1.PodSpec) []v1.ServicePort

func GroupByQueue

func GroupByQueue(pods []*v1.Pod) map[string][]*v1.Pod

GroupByQueue Any pod without a queue label set is excluded from the output

func HasCurrentClusterEventBeenReported

func HasCurrentClusterEventBeenReported(clusterEvent *v1.Event) bool

func HasCurrentStateBeenReported

func HasCurrentStateBeenReported(pod *v1.Pod) bool

func HasIngress

func HasIngress(pod *v1.Pod) bool

func HasPodBeenInStateForLongerThanGivenDuration

func HasPodBeenInStateForLongerThanGivenDuration(pod *v1.Pod, duration time.Duration) bool

func IsArmadaJobPod

func IsArmadaJobPod(name string) bool

func IsInTerminalState

func IsInTerminalState(pod *v1.Pod) bool

func IsLegacyManagedPod added in v0.3.61

func IsLegacyManagedPod(pod *v1.Pod) bool

func IsManagedPod

func IsManagedPod(pod *v1.Pod) bool

func IsMarkedForDeletion

func IsMarkedForDeletion(pod *v1.Pod) bool

func IsPodFinishedAndReported

func IsPodFinishedAndReported(pod *v1.Pod) bool

func IsPreemptedEvent

func IsPreemptedEvent(event *v1.Event) bool

func IsReady

func IsReady(node *v1.Node) bool

func IsReportedDone

func IsReportedDone(pod *v1.Pod) bool

func IsReportedPreempted added in v0.3.57

func IsReportedPreempted(pod *v1.Pod) bool

func IsReportingPhaseRequired

func IsReportingPhaseRequired(podPhase v1.PodPhase) bool

func LastStatusChange

func LastStatusChange(pod *v1.Pod) (time.Time, error)

func MergeNodeList

func MergeNodeList(list1 []*v1.Node, list2 []*v1.Node) []*v1.Node

func MergePodList

func MergePodList(list1 []*v1.Pod, list2 []*v1.Pod) []*v1.Pod

func NewTimeExpiringPodCache

func NewTimeExpiringPodCache(expiry time.Duration, cleanUpInterval time.Duration, metricName string) *mapPodCache

func ProcessItemsWithThreadPool added in v0.3.49

func ProcessItemsWithThreadPool[K any](ctx context.Context, maxThreadCount int, itemsToProcess []K, processFunc func(K))

func RemoveDuplicates

func RemoveDuplicates(pods []*v1.Pod) []*v1.Pod

func RemoveNodesFromList

func RemoveNodesFromList(list1 []*v1.Node, list2 []*v1.Node) []*v1.Node

func RemovePodsFromList

func RemovePodsFromList(list1 []*v1.Pod, list2 []*v1.Pod) []*v1.Pod

func StringUuidsToUuids added in v0.3.47

func StringUuidsToUuids(uuidStrings []string) ([]armadaevents.Uuid, error)

Types

type IngressServiceConfig

type IngressServiceConfig struct {
	Type         IngressServiceType
	Ports        []uint32
	Annotations  map[string]string
	TlsEnabled   bool
	CertName     string
	UseClusterIp bool
}

func CombineIngressService

func CombineIngressService(ingresses []*api.IngressConfig, services []*api.ServiceConfig) []*IngressServiceConfig

type IngressServiceType

type IngressServiceType int
const (
	Ingress IngressServiceType = iota
	NodePort
	Headless
)

func (IngressServiceType) String

func (st IngressServiceType) String() string

type PodCache

type PodCache interface {
	Add(pod *v1.Pod)
	AddIfNotExists(pod *v1.Pod) bool
	Update(key string, pod *v1.Pod) bool
	Delete(podId string)
	Get(podId string) *v1.Pod
	GetAll() []*v1.Pod
}

type PodStartupStatus

type PodStartupStatus int

type PreemptiveJobInfo

type PreemptiveJobInfo struct {
	Namespace string
	Name      string
	Node      string
}

func ParsePreemptionMessage

func ParsePreemptionMessage(msg string) (*PreemptiveJobInfo, error)

ParsePreemptionMessage parses the message field from a Preempted Cluster Event Message format is 'Preempted by <pod_namespace>/<pod_name> on node <node>'

Jump to

Keyboard shortcuts

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