core

package
v1.4.7-rc3 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculatePodSliceSize

func CalculatePodSliceSize(pods []*v1.Pod, replicas int) int

CalculatePodSliceSize compare max pod index with desired replicas and return larger size

func CalculateServiceSliceSize

func CalculateServiceSliceSize(services []*v1.Service, replicas int) int

CalculateServiceSliceSize compare max pod index with desired replicas and return larger size

func FilterPodsForReplicaType

func FilterPodsForReplicaType(pods []*v1.Pod, replicaType string) ([]*v1.Pod, error)

FilterPodsForReplicaType returns pods belong to a replicaType.

func FilterServicesForReplicaType

func FilterServicesForReplicaType(services []*v1.Service, replicaType string) ([]*v1.Service, error)

FilterServicesForReplicaType returns service belong to a replicaType.

func GenGeneralName

func GenGeneralName(jobName string, rtype string, index string) string

func GetPodSlices

func GetPodSlices(pods []*v1.Pod, replicas int, logger *log.Entry) [][]*v1.Pod

GetPodSlices returns a slice, which element is the slice of pod. It gives enough information to caller to make decision to up/down scale resources.

func GetPortsFromJob

func GetPortsFromJob(spec *apiv1.ReplicaSpec, defaultContainerName string) (map[string]int32, error)

GetPortsFromJob gets the ports of job container. Port could be nil, if distributed communication strategy doesn't need and no other ports that need to be exposed.

func GetServiceSlices

func GetServiceSlices(services []*v1.Service, replicas int, logger *log.Entry) [][]*v1.Service

GetServiceSlices returns a slice, which element is the slice of service. Assume the return object is serviceSlices, then serviceSlices[i] is an array of pointers to services corresponding to Services for replica i.

func InitializeReplicaStatuses

func InitializeReplicaStatuses(jobStatus *apiv1.JobStatus, rtype apiv1.ReplicaType)

InitializeReplicaStatuses initializes the ReplicaStatuses for replica.

func MaxInt

func MaxInt(x, y int) int

func PastActiveDeadline

func PastActiveDeadline(runPolicy *apiv1.RunPolicy, jobStatus apiv1.JobStatus) bool

PastActiveDeadline checks if job has ActiveDeadlineSeconds field set and if it is exceeded.

func PastBackoffLimit

func PastBackoffLimit(jobName string, runPolicy *apiv1.RunPolicy,
	replicas map[apiv1.ReplicaType]*apiv1.ReplicaSpec, pods []*v1.Pod,
	podFilterFunc func(pods []*v1.Pod, replicaType string) ([]*v1.Pod, error)) (bool, error)

PastBackoffLimit checks if container restartCounts sum exceeds BackoffLimit this method applies only to pods when restartPolicy is one of OnFailure, Always or ExitCode

func RecordAbnormalPods

func RecordAbnormalPods(activePods []*v1.Pod, object runtime.Object, recorder record.EventRecorder)

RecordAbnormalPods records the active pod whose latest condition is not in True status.

func SetRestartPolicy

func SetRestartPolicy(podTemplateSpec *v1.PodTemplateSpec, spec *apiv1.ReplicaSpec)

SetRestartPolicy check the RestartPolicy defined in job spec and overwrite RestartPolicy in podTemplate if necessary

func UpdateJobReplicaStatuses

func UpdateJobReplicaStatuses(jobStatus *apiv1.JobStatus, rtype apiv1.ReplicaType, pod *corev1.Pod)

UpdateJobReplicaStatuses updates the JobReplicaStatuses according to the pod.

Types

This section is empty.

Jump to

Keyboard shortcuts

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