controller

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2019 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DaemonSetJobLabelKey         = "kubernetes.io/DaemonSetJob"
	DaemonSetJobMD5AnnotationKey = "workflow.k8s.io/jobspec-md5"
)

DaemonSetJobLabelKey defines the key of label to be injected by DaemonSetJob controller

View Source
const (
	WorkflowLabelKey     = "kubernetes.io/workflow"
	WorkflowStepLabelKey = "kubernetes.io/workflow-step"
)

WorkflowStepLabelKey defines the key of label to be injected by workflow controller

View Source
const (
	CronWorkflowLabelKey = "kubernetes.io/cronworkflow"
)

Variables

This section is empty.

Functions

func CascadeDeleteOptions

func CascadeDeleteOptions(gracePeriodSeconds int64) *metav1.DeleteOptions

CascadeDeleteOptions returns a DeleteOptions with Cascaded set

func GetStepByName

func GetStepByName(w *wapi.Workflow, stepName string) *wapi.WorkflowStep

GetStepByName returns a pointer to WorkflowStep

func GetStepStatusByName

func GetStepStatusByName(w *wapi.Workflow, stepName string) *wapi.WorkflowStepStatus

GetStepStatusByName return a pointer to WorkflowStepStatus

func InferDaemonSetJobLabelSelectorForJobs

func InferDaemonSetJobLabelSelectorForJobs(daemonsetjob *dapi.DaemonSetJob) labels.Selector

InferDaemonSetJobLabelSelectorForJobs returns labels.Selector corresponding to the associated Jobs

func IsDaemonSetJobFinished

func IsDaemonSetJobFinished(d *dapi.DaemonSetJob) bool

IsDaemonSetJobFinished checks wether a daemonsetjob is finished. A daemonsetjob is finished if one of its condition is Complete or Failed.

func IsJobFinished

func IsJobFinished(j *batch.Job) bool

IsJobFinished checks whether a Job is finished

func IsWorkflowFinished

func IsWorkflowFinished(w *wapi.Workflow) bool

IsWorkflowFinished checks wether a workflow is finished. A workflow is finished if one of its condition is Complete or Failed.

func NewWorkflowControl

func NewWorkflowControl(client wclientset.Interface) *realWorkflowControl

NewWorkflowControl creates a realWorkflowControl

func RemoveStepFromSpec

func RemoveStepFromSpec(w *wapi.Workflow, stepName string) error

RemoveStepFromSpec remove Step from Workflow Spec

Types

type CronWorkflowController

type CronWorkflowController struct {
	Client     wclientset.Interface
	KubeClient clientset.Interface

	Recorder record.EventRecorder
	// contains filtered or unexported fields
}

CronWorkflowController represents the Workflow controller

func NewCronWorkflowController

func NewCronWorkflowController(client wclientset.Interface, kubeClient clientset.Interface) *CronWorkflowController

NewCronWorkflowController creates and initializes the CronWorkflowController instance

func (*CronWorkflowController) AddHealthCheck

func (w *CronWorkflowController) AddHealthCheck(h healthcheck.Handler) error

AddHealthCheck add Readiness and Liveness Checks to the handler

func (*CronWorkflowController) Run

Run simply runs the controller. Assuming Informers are already running: via factories

type CronWorkflowControllerConfig

type CronWorkflowControllerConfig struct {
	RemoveIvalidCronWorkflow bool
	NumberOfWorkers          int
}

CronWorkflowControllerConfig contains info to customize Workflow controller behaviour

type DaemonSetJobController

type DaemonSetJobController struct {
	Client     dclientset.Interface
	KubeClient clientset.Interface

	DaemonSetJobLister dlisters.DaemonSetJobLister
	DaemonSetJobSynced cache.InformerSynced

	JobLister batchv1listers.JobLister
	JobSynced cache.InformerSynced // returns true if job has been synced. Added as member for testing

	JobControl JobControlInterface

	NodeLister corev1Listers.NodeLister
	NodeSynced cache.InformerSynced

	Recorder record.EventRecorder
	// contains filtered or unexported fields
}

DaemonSetJobController represents the DaemonSetJob controller

func NewDaemonSetJobController

func NewDaemonSetJobController(
	client dclientset.Interface,
	kubeClient clientset.Interface,
	kubeInformerFactory kubeinformers.SharedInformerFactory,
	deamonsetJobInformerFactory dinformers.SharedInformerFactory) *DaemonSetJobController

NewDaemonSetJobController creates and initializes the DaemonSetJobController instance

func (*DaemonSetJobController) AddHealthCheck

func (d *DaemonSetJobController) AddHealthCheck(h healthcheck.Handler)

AddHealthCheck add Readiness and Liveness Checks to the handler

func (*DaemonSetJobController) Run

Run simply runs the controller. Assuming Informers are already running: via factories

type DaemonSetJobControllerConfig

type DaemonSetJobControllerConfig struct {
	RemoveInvalidDaemonSetJob bool
	NumberOfWorkers           int
}

DaemonSetJobControllerConfig contains info to customize DaemonSetJob controller behaviour

type FakeJobControl

type FakeJobControl struct {
}

FakeJobControl implements WorkflowJobControl interface for testing purpose

func (*FakeJobControl) CreateJobFromDaemonSetJob

func (f *FakeJobControl) CreateJobFromDaemonSetJob(namespace string, template *batchv2.JobTemplateSpec, workflow *dapi.DaemonSetJob, nodeName string) (*batch.Job, error)

CreateJobFromDaemonSetJob mocks job creation

func (*FakeJobControl) CreateJobFromWorkflow

func (f *FakeJobControl) CreateJobFromWorkflow(namespace string, template *batchv2.JobTemplateSpec, workflow *wapi.Workflow, key string) (*batch.Job, error)

CreateJobFromWorkflow mocks job creation

func (*FakeJobControl) DeleteJob

func (f *FakeJobControl) DeleteJob(namespace, name string, object runtime.Object) error

DeleteJob mocks job deletion

type JobControlInterface

type JobControlInterface interface {
	// CreateJobFromWorkflow
	CreateJobFromWorkflow(namespace string, template *batchv2.JobTemplateSpec, workflow *wapi.Workflow, key string) (*batch.Job, error)
	// CreateJobFromDaemonSetJob
	CreateJobFromDaemonSetJob(namespace string, template *batchv2.JobTemplateSpec, daemonsetjob *dapi.DaemonSetJob, nodeName string) (*batch.Job, error)
	// DeleteJob
	DeleteJob(namespace, name string, object runtime.Object) error
}

JobControlInterface defines interface to control Jobs life-cycle. Interface is needed to mock it in unit tests

type WorkflowController

type WorkflowController struct {
	Client     wclientset.Interface
	KubeClient clientset.Interface

	WorkflowLister wlisters.WorkflowLister
	WorkflowSynced cache.InformerSynced

	JobLister batchv1listers.JobLister
	JobSynced cache.InformerSynced // returns true if job has been synced. Added as member for testing

	JobControl JobControlInterface

	Recorder record.EventRecorder
	// contains filtered or unexported fields
}

WorkflowController represents the Workflow controller

func NewWorkflowController

func NewWorkflowController(
	client wclientset.Interface,
	kubeClient clientset.Interface,
	kubeInformerFactory kubeinformers.SharedInformerFactory,
	workflowInformerFactory winformers.SharedInformerFactory) *WorkflowController

NewWorkflowController creates and initializes the WorkflowController instance

func (*WorkflowController) AddHealthCheck

func (w *WorkflowController) AddHealthCheck(h healthcheck.Handler)

AddHealthCheck add Readiness and Liveness Checks to the handler

func (*WorkflowController) Run

Run simply runs the controller. Assuming Informers are already running: via factories

type WorkflowControllerConfig

type WorkflowControllerConfig struct {
	RemoveInvalidWorkflow bool
	NumberOfWorkers       int
}

WorkflowControllerConfig contains info to customize Workflow controller behaviour

type WorkflowJobControl

type WorkflowJobControl struct {
	KubeClient clientset.Interface
	Recorder   record.EventRecorder
}

WorkflowJobControl implements JobControlInterface

func (WorkflowJobControl) CreateJob

func (w WorkflowJobControl) CreateJob(namespace string, subName string, obj *metav1.ObjectMeta, template *batchv2.JobTemplateSpec, labelsset *labels.Set, owner *metav1.OwnerReference) (*batch.Job, error)

CreateJob creates a Job According to a specific JobTemplateSpec

func (WorkflowJobControl) CreateJobFromDaemonSetJob

func (w WorkflowJobControl) CreateJobFromDaemonSetJob(namespace string, template *batchv2.JobTemplateSpec, daemonsetjob *dapi.DaemonSetJob, nodeName string) (*batch.Job, error)

CreateJobFromDaemonSetJob creates a Job According to a specific JobTemplateSpec

func (WorkflowJobControl) CreateJobFromWorkflow

func (w WorkflowJobControl) CreateJobFromWorkflow(namespace string, template *batchv2.JobTemplateSpec, workflow *wapi.Workflow, stepName string) (*batch.Job, error)

CreateJobFromWorkflow creates a Job According to a specific JobTemplateSpec

func (WorkflowJobControl) DeleteJob

func (w WorkflowJobControl) DeleteJob(namespace, jobName string, object runtime.Object) error

DeleteJob deletes a Job

Jump to

Keyboard shortcuts

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