job

package
v0.36.2 Latest Latest
Warning

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

Go to latest
Published: May 24, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AreAllJobsCompleted

func AreAllJobsCompleted(jobPrefix, namespace string) (bool, error)

AreAllJobsCompleted will return true if all jobs with a common prefix in a given namespace are in a Completed State

func WaitOnDeleted added in v0.36.0

func WaitOnDeleted(jobPrefix, namespace string, sleep, duration time.Duration) (bool, error)

WaitOnDeleted returns when a job is successfully deleted

func WaitOnReady

func WaitOnReady(jobPrefix, namespace string, sleep, duration time.Duration) (bool, error)

WaitOnReady is used when you dont have a handle on a job but want to wait until its in a Succeeded state.

Types

type Job

type Job struct {
	Metadata pod.Metadata `json:"metadata"`
	Spec     Spec         `json:"spec"`
	Status   Status       `json:"status"`
}

Job is used to parse data from kubectl get jobs

func CreateJobFromFile

func CreateJobFromFile(filename, name, namespace string) (*Job, error)

CreateJobFromFile will create a Job from file with a name

func CreateJobFromFileDeleteIfExists added in v0.36.0

func CreateJobFromFileDeleteIfExists(filename, name, namespace string) (*Job, error)

CreateJobFromFileDeleteIfExists will create a Job from file, deleting any pre-existing job with the same name

func Get

func Get(jobName, namespace string) (*Job, error)

Get will return a job with a given name and namespace

func GetAllByPrefix added in v0.36.0

func GetAllByPrefix(prefix, namespace string) ([]Job, error)

GetAllByPrefix will return all jobs in a given namespace that match a prefix

func (*Job) Delete

func (j *Job) Delete(retries int) error

Delete will delete a Job in a given namespace

func (*Job) WaitOnReady

func (j *Job) WaitOnReady(sleep, duration time.Duration) (bool, error)

WaitOnReady will call the static method WaitOnReady passing in p.Metadata.Name and p.Metadata.Namespace

type List

type List struct {
	Jobs []Job `json:"items"`
}

List is a container that holds all jobs returned from doing a kubectl get jobs

func GetAll

func GetAll(namespace string) (*List, error)

GetAll will return all jobs in a given namespace

type Spec

type Spec struct {
	Completions int `json:"completions"`
	Parallelism int `json:"parallelism"`
}

Spec holds job spec metadata

type Status

type Status struct {
	Active    int `json:"active"`
	Succeeded int `json:"succeeded"`
}

Status holds job status information

Jump to

Keyboard shortcuts

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