Documentation ¶
Index ¶
- func CalculatePodSliceSize(pods []*v1.Pod, replicas int) int
- func CalculateServiceSliceSize(services []*v1.Service, replicas int) int
- func FilterPodsForReplicaType(pods []*v1.Pod, replicaType string) ([]*v1.Pod, error)
- func FilterServicesForReplicaType(services []*v1.Service, replicaType string) ([]*v1.Service, error)
- func GenGeneralName(jobName string, rtype string, index string) string
- func GetPodSlices(pods []*v1.Pod, replicas int, logger *log.Entry) [][]*v1.Pod
- func GetPortsFromJob(spec *apiv1.ReplicaSpec, defaultContainerName string) (map[string]int32, error)
- func GetServiceSlices(services []*v1.Service, replicas int, logger *log.Entry) [][]*v1.Service
- func InitializeReplicaStatuses(jobStatus *apiv1.JobStatus, rtype apiv1.ReplicaType)
- func MaxInt(x, y int) int
- func PastActiveDeadline(runPolicy *apiv1.RunPolicy, jobStatus apiv1.JobStatus) bool
- func PastBackoffLimit(jobName string, runPolicy *apiv1.RunPolicy, ...) (bool, error)
- func RecordAbnormalPods(activePods []*v1.Pod, object runtime.Object, recorder record.EventRecorder)
- func SetRestartPolicy(podTemplateSpec *v1.PodTemplateSpec, spec *apiv1.ReplicaSpec)
- func UpdateJobReplicaStatuses(jobStatus *apiv1.JobStatus, rtype apiv1.ReplicaType, pod *corev1.Pod)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculatePodSliceSize ¶
CalculatePodSliceSize compare max pod index with desired replicas and return larger size
func CalculateServiceSliceSize ¶
CalculateServiceSliceSize compare max pod index with desired replicas and return larger size
func FilterPodsForReplicaType ¶
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 GetPodSlices ¶
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 ¶
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 PastActiveDeadline ¶
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 ¶
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 ¶
UpdateJobReplicaStatuses updates the JobReplicaStatuses according to the pod.
Types ¶
This section is empty.