util

package
v0.3.45 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2023 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventReasonPreempted = "Preempted"
)

Variables

This section is empty.

Functions

func CountPodsByPhase added in v0.2.4

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

func CreateIngress added in v0.2.3

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

func CreateOwnerReference added in v0.2.3

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

func CreatePod added in v0.2.3

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

func CreateService added in v0.2.3

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

func ExtractFailedPodContainerStatuses added in v0.1.24

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

func ExtractJobId

func ExtractJobId(pod *v1.Pod) string

func ExtractJobIdFromName added in v0.3.33

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 ExtractNames

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

func ExtractNodeNames added in v0.2.6

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

func ExtractPodExitCodes added in v0.0.6

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

func ExtractPodFailedCause added in v0.1.24

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

func ExtractPodFailedReason

func ExtractPodFailedReason(pod *v1.Pod) string

func ExtractPodKey added in v0.1.23

func ExtractPodKey(pod *v1.Pod) string

func ExtractPodNumber added in v0.1.23

func ExtractPodNumber(pod *v1.Pod) int

func FilterCompletedPods

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

func FilterNodes added in v0.2.4

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

func FilterNonCompletedPods

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

func FilterPods added in v0.0.11

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 added in v0.0.11

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

func GenerateIngresses added in v0.2.3

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

func GetDeletionGracePeriodOrDefault added in v0.3.37

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 added in v0.2.3

func GetExpectedNumberOfAssociatedIngresses(pod *v1.Pod) int

func GetExpectedNumberOfAssociatedServices added in v0.2.3

func GetExpectedNumberOfAssociatedServices(pod *v1.Pod) int

func GetManagedPodSelector

func GetManagedPodSelector() labels.Selector

func GetPodContainerStatuses added in v0.1.41

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

func GetPodsOnNodes added in v0.2.4

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

func GetServicePorts added in v0.2.3

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

func GroupByQueue added in v0.3.15

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

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

func HasCurrentClusterEventBeenReported added in v0.3.33

func HasCurrentClusterEventBeenReported(clusterEvent *v1.Event) bool

func HasCurrentStateBeenReported added in v0.2.3

func HasCurrentStateBeenReported(pod *v1.Pod) bool

func HasIngress added in v0.1.34

func HasIngress(pod *v1.Pod) bool

func HasPodBeenInStateForLongerThanGivenDuration added in v0.2.6

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

func IsArmadaJobPod added in v0.3.33

func IsArmadaJobPod(name string) bool

func IsInTerminalState

func IsInTerminalState(pod *v1.Pod) bool

func IsManagedPod

func IsManagedPod(pod *v1.Pod) bool

func IsMarkedForDeletion added in v0.2.3

func IsMarkedForDeletion(pod *v1.Pod) bool

func IsPodFinishedAndReported added in v0.2.3

func IsPodFinishedAndReported(pod *v1.Pod) bool

func IsPreemptedEvent added in v0.3.33

func IsPreemptedEvent(event *v1.Event) bool

func IsReady added in v0.3.20

func IsReady(node *v1.Node) bool

func IsReportedDone added in v0.2.3

func IsReportedDone(pod *v1.Pod) bool

func IsReportingPhaseRequired

func IsReportingPhaseRequired(podPhase v1.PodPhase) bool

func LastStatusChange added in v0.0.11

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

func MergeNodeList added in v0.2.6

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 ProcessPodsWithThreadPool added in v0.2.14

func ProcessPodsWithThreadPool(pods []*v1.Pod, maxThreadCount int, processPod func(*v1.Pod))

func RemoveDuplicates added in v0.2.4

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

func RemoveNodesFromList added in v0.2.6

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

func RemovePodsFromList added in v0.3.15

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

Types

type IngressServiceConfig added in v0.2.14

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

func CombineIngressService added in v0.2.14

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

type IngressServiceType added in v0.2.14

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

func (IngressServiceType) String added in v0.2.14

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 added in v0.1.41

type PodStartupStatus int

type PreemptiveJobInfo added in v0.3.33

type PreemptiveJobInfo struct {
	Namespace string
	Name      string
	Node      string
}

func ParsePreemptionMessage added in v0.3.33

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