extendedjob

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2019 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddErrand

func AddErrand(ctx context.Context, config *config.Config, mgr manager.Manager) error

AddErrand creates a new ExtendedJob controller to start errands when their trigger strategy matches

func AddJob

func AddJob(ctx context.Context, config *config.Config, mgr manager.Manager) error

AddJob creates a new ExtendedJob controller and adds it to the Manager

func AddOwnership

func AddOwnership(ctx context.Context, config *config.Config, mgr manager.Manager) error

AddOwnership creates a new ExtendedJob controller to update ownership on configs for auto errands.

func AddTrigger

func AddTrigger(ctx context.Context, config *config.Config, mgr manager.Manager) error

AddTrigger creates a new ExtendedJob controller and adds it to the Manager

func InferPodState

func InferPodState(pod corev1.Pod) ejv1.PodState

InferPodState determines our pod state

ready (p:Running,c:[Initialized Ready ContainersReady PodScheduled])
created (p:Pending,c:[Initialized Ready ContainersReady PodScheduled])
notready (p:Pending,c:[PodScheduled])
notready (p:Pending,c:[])
deleted (p:Running,c:[Initialized Ready ContainersReady PodScheduled])
deleted (p:Succeeded,c:[Initialized Ready ContainersReady PodScheduled])

func NewErrandReconciler

func NewErrandReconciler(
	ctx context.Context,
	config *config.Config,
	mgr manager.Manager,
	f setOwnerReferenceFunc,
	owner Owner,
) reconcile.Reconciler

NewErrandReconciler returns a new reconciler for errand jobs

func NewJobReconciler

func NewJobReconciler(ctx context.Context, config *config.Config, mgr manager.Manager, podLogGetter PodLogGetter) (reconcile.Reconciler, error)

NewJobReconciler returns a new Reconciler

func NewOwnershipReconciler

func NewOwnershipReconciler(
	ctx context.Context,
	config *config.Config,
	mgr manager.Manager,
	f setOwnerReferenceFunc,
	owner Owner,
) reconcile.Reconciler

NewOwnershipReconciler returns a new reconciler for errand jobs

func NewTriggerReconciler

func NewTriggerReconciler(
	ctx context.Context,
	config *config.Config,
	mgr manager.Manager,
	query Query,
	f setOwnerReferenceFunc,
) reconcile.Reconciler

NewTriggerReconciler returns a new reconcile to start jobs triggered by pods

func PodStatusString

func PodStatusString(pod corev1.Pod) string

PodStatusString gives a summary of the pods state

Types

type ErrandReconciler

type ErrandReconciler struct {
	// contains filtered or unexported fields
}

ErrandReconciler implements the Reconciler interface

func (*ErrandReconciler) Reconcile

func (r *ErrandReconciler) Reconcile(request reconcile.Request) (reconcile.Result, error)

Reconcile starts jobs for extended jobs of the type errand with Run being set to 'now' manually

type Owner

type Owner interface {
	Sync(context.Context, apis.Object, corev1.PodSpec) error
	RemoveOwnerReferences(context.Context, apis.Object, []apis.Object) error
	ListConfigsOwnedBy(context.Context, apis.Object) ([]apis.Object, error)
}

Owner interface to manage ownership on configs and secrets

type OwnershipReconciler

type OwnershipReconciler struct {
	// contains filtered or unexported fields
}

OwnershipReconciler implements the Reconciler interface

func (*OwnershipReconciler) Reconcile

func (r *OwnershipReconciler) Reconcile(request reconcile.Request) (reconcile.Result, error)

Reconcile keeps track of ownership on all configs, configmaps and secrets, which are used by extended jobs. Only called for CRs, which have UpdateOnConfigChange set to true.

type PodLogGetter

type PodLogGetter interface {
	Get(namespace, podName, containerName string) ([]byte, error)
}

PodLogGetter fetches the logs from a Pod

func NewPodLogGetter

func NewPodLogGetter(client corev1client.CoreV1Interface) PodLogGetter

NewPodLogGetter returns an instance of a PodLogGetterImpl

type PodLogGetterImpl

type PodLogGetterImpl struct {
	// contains filtered or unexported fields
}

PodLogGetterImpl implements the PodLogGetter interface

func (*PodLogGetterImpl) Get

func (p *PodLogGetterImpl) Get(namespace, podName, containerName string) ([]byte, error)

Get fetches the logs for the given pod

type Query

type Query interface {
	Match(ejv1.ExtendedJob, corev1.Pod) bool
	MatchState(ejv1.ExtendedJob, ejv1.PodState) bool
}

Query for events involving pods and filter them

type QueryImpl

type QueryImpl struct {
}

QueryImpl implements the query interface

func NewQuery

func NewQuery() *QueryImpl

NewQuery returns a new Query struct

func (*QueryImpl) Match

func (q *QueryImpl) Match(extJob ejv1.ExtendedJob, pod corev1.Pod) bool

Match pod against label whitelist from extended job

func (*QueryImpl) MatchState

func (q *QueryImpl) MatchState(extJob ejv1.ExtendedJob, podState ejv1.PodState) bool

MatchState checks pod state against state from extended job

type ReconcileJob

type ReconcileJob struct {
	// contains filtered or unexported fields
}

ReconcileJob reconciles an Job object

func (*ReconcileJob) Reconcile

func (r *ReconcileJob) Reconcile(request reconcile.Request) (reconcile.Result, error)

Reconcile reads that state of the cluster for a Job object that is owned by an ExtendedJob and makes changes based on the state read and what is in the ExtendedJob.Spec Note: The Controller will requeue the Request to be processed again if the returned error is non-nil or Result.Requeue is true, otherwise upon completion it will remove the work from the queue.

type TriggerReconciler

type TriggerReconciler struct {
	// contains filtered or unexported fields
}

TriggerReconciler implements the Reconciler interface

func (*TriggerReconciler) Reconcile

func (r *TriggerReconciler) Reconcile(request reconcile.Request) (result reconcile.Result, err error)

Reconcile creates jobs for extended jobs which match the request's pod. When there are multiple extendedjobs, multiple jobs can run for the same pod.

Source Files

  • errand_controller.go
  • errand_reconciler.go
  • job_controller.go
  • job_reconciler.go
  • ownership_controller.go
  • ownership_reconciler.go
  • pod_log_getter.go
  • pod_state.go
  • query.go
  • trigger_controller.go
  • trigger_reconciler.go

Jump to

Keyboard shortcuts

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