Documentation ¶
Index ¶
- Constants
- func Failed(ctx context.Context, r common.Reconciler, obj client.Object, issue error) (reconcile.Result, error)
- func GroupedJobs(totalJobs int, state ClassifierReader, lf *v1alpha1.Lifecycle, ...) bool
- func Pending(ctx context.Context, r common.Reconciler, obj client.Object, msg string) (reconcile.Result, error)
- func SingleJob(state ClassifierReader, lf *v1alpha1.Lifecycle) bool
- func VirtualExecution(ctx context.Context, reconciler common.Reconciler, parent client.Object, ...) error
- type Classifier
- func (in *Classifier) Classify(name string, obj client.Object)
- func (in *Classifier) ClassifyExternal(name string, obj client.Object, conv Convertor)
- func (in *Classifier) Count() int
- func (in *Classifier) GetFailedJobs(jobNames ...string) []client.Object
- func (in *Classifier) GetPendingJobs(jobNames ...string) []client.Object
- func (in *Classifier) GetRunningJobs(jobNames ...string) []client.Object
- func (in *Classifier) GetSuccessfulJobs(jobNames ...string) []client.Object
- func (in *Classifier) GetTerminatingJobs(jobNames ...string) []client.Object
- func (in *Classifier) IsFailed(job ...string) bool
- func (in *Classifier) IsPending(job ...string) bool
- func (in *Classifier) IsRunning(job ...string) bool
- func (in *Classifier) IsSuccessful(job ...string) bool
- func (in *Classifier) IsTerminating(job ...string) bool
- func (in *Classifier) ListAll() string
- func (in *Classifier) ListFailedJobs() []string
- func (in *Classifier) ListPendingJobs() []string
- func (in *Classifier) ListRunningJobs() []string
- func (in *Classifier) ListSuccessfulJobs() []string
- func (in *Classifier) ListTerminatingJobs() []string
- func (in *Classifier) NumAll() string
- func (in Classifier) NumFailedJobs() int
- func (in *Classifier) NumPendingJobs() int
- func (in *Classifier) NumRunningJobs() int
- func (in *Classifier) NumSuccessfulJobs() int
- func (in Classifier) NumTerminatingJobs() int
- func (in *Classifier) Reset()
- func (in *Classifier) SystemState() (abort bool, err error)
- type ClassifierReader
- type Convertor
Constants ¶
const ( // AtLeastOneJobHasFailed is used when at least one job has failed, and there is toleration defined. AtLeastOneJobHasFailed = "AtLeastOneJobHasFailed" // TooManyJobsHaveFailed is used when the number of failures exceed the number of toleration. TooManyJobsHaveFailed = "TooManyJobsHaveFailed" // ExactlyOneJobIsFailed indicate that the only scheduled job is in the Failed Phase. ExactlyOneJobIsFailed = "ExactlyOneJobIsFailed" )
Reasons for Failure.
const ( // AllJobsAreSuccessful is when all the scheduled jobs are successfully completed. AllJobsAreSuccessful = "AllJobsAreSuccessful" // ExactlyOneJobIsSuccessful indicate that the only scheduled job is in the Success Phase. ExactlyOneJobIsSuccessful = "ExactlyOneJobIsSuccessful" // ToleratedJobsAreSuccessful indicate that despite (tolerated) failures, a required number of jobs are successful. ToleratedJobsAreSuccessful = "JobSuccessfulDespiteErrors" )
Reasons for Success.
const ( // AtLeastOneJobIsRunning indicate that all jobs are created, and at least one is still running. AtLeastOneJobIsRunning = "AtLeastOneJobIsRunning" // ExactlyOneJobIsRunning indicate that the only scheduled job is in the Running phase. ExactlyOneJobIsRunning = "ExactlyOneJobIsRunning" )
Reasons for Running.
const ( // AtLeastOneJobIsNotScheduled indicate that there is at least one job that is not yet scheduled. AtLeastOneJobIsNotScheduled = "AtLeastOneJobIsNotScheduled" // ExactlyOneJobIsPending indicate that the only scheduled job is in the Pending phase. ExactlyOneJobIsPending = "ExactlyOneJobIsPending" )
Reasons for Pending.
Variables ¶
This section is empty.
Functions ¶
func Failed ¶
func Failed(ctx context.Context, r common.Reconciler, obj client.Object, issue error) (reconcile.Result, error)
Failed is a wrap that logs the error, updates the status, and does not requeue the request.
func GroupedJobs ¶
func GroupedJobs(totalJobs int, state ClassifierReader, lf *v1alpha1.Lifecycle, tolerate *v1alpha1.TolerateSpec) bool
GroupedJobs calculate the lifecycle for action with multiple sub-jobs, such as Clusters, Cascade, Calls, ...
func Pending ¶
func Pending(ctx context.Context, r common.Reconciler, obj client.Object, msg string) (reconcile.Result, error)
Pending is a wrapper that sets Phase to Pending and does not requeue the request.
func VirtualExecution ¶
func VirtualExecution(ctx context.Context, reconciler common.Reconciler, parent client.Object, jobName string, callable func(vobj *v1alpha1.VirtualObject) error, ) error
VirtualExecution wraps a call into a virtual object. This is used for operations that do not create external resources. Examples: Deletions, Calls, ... The behavior of VirtualExecution is practically asynchronous. If the callback function fails, it will be reflected in the created virtual jobs and should be captured by the parent's lifecycle. The VirtualExecution will return nil. If the VirtualExecution fails (e.g, cannot create a virtual object), it will return an error.
Types ¶
type Classifier ¶
type Classifier struct {
// contains filtered or unexported fields
}
Classifier splits jobs into Pending, Running, Successful, and Failed. To relief the garbage collector, we use a embeddable structure that we reset at every reconciliation cycle.
func (*Classifier) Classify ¶
func (in *Classifier) Classify(name string, obj client.Object)
Classify the object based on the standard Frisbee lifecycle.
func (*Classifier) ClassifyExternal ¶
func (in *Classifier) ClassifyExternal(name string, obj client.Object, conv Convertor)
ClassifyExternal classifies the object based on the custom lifecycle.
func (*Classifier) Count ¶
func (in *Classifier) Count() int
func (*Classifier) GetFailedJobs ¶
func (in *Classifier) GetFailedJobs(jobNames ...string) []client.Object
func (*Classifier) GetPendingJobs ¶
func (in *Classifier) GetPendingJobs(jobNames ...string) []client.Object
func (*Classifier) GetRunningJobs ¶
func (in *Classifier) GetRunningJobs(jobNames ...string) []client.Object
func (*Classifier) GetSuccessfulJobs ¶
func (in *Classifier) GetSuccessfulJobs(jobNames ...string) []client.Object
func (*Classifier) GetTerminatingJobs ¶
func (in *Classifier) GetTerminatingJobs(jobNames ...string) []client.Object
func (*Classifier) IsFailed ¶
func (in *Classifier) IsFailed(job ...string) bool
func (*Classifier) IsPending ¶
func (in *Classifier) IsPending(job ...string) bool
func (*Classifier) IsRunning ¶
func (in *Classifier) IsRunning(job ...string) bool
func (*Classifier) IsSuccessful ¶
func (in *Classifier) IsSuccessful(job ...string) bool
func (*Classifier) IsTerminating ¶
func (in *Classifier) IsTerminating(job ...string) bool
func (*Classifier) ListAll ¶
func (in *Classifier) ListAll() string
func (*Classifier) ListFailedJobs ¶
func (in *Classifier) ListFailedJobs() []string
func (*Classifier) ListPendingJobs ¶
func (in *Classifier) ListPendingJobs() []string
func (*Classifier) ListRunningJobs ¶
func (in *Classifier) ListRunningJobs() []string
func (*Classifier) ListSuccessfulJobs ¶
func (in *Classifier) ListSuccessfulJobs() []string
func (*Classifier) ListTerminatingJobs ¶
func (in *Classifier) ListTerminatingJobs() []string
func (*Classifier) NumAll ¶
func (in *Classifier) NumAll() string
func (Classifier) NumFailedJobs ¶
func (in Classifier) NumFailedJobs() int
func (*Classifier) NumPendingJobs ¶
func (in *Classifier) NumPendingJobs() int
func (*Classifier) NumRunningJobs ¶
func (in *Classifier) NumRunningJobs() int
func (*Classifier) NumSuccessfulJobs ¶
func (in *Classifier) NumSuccessfulJobs() int
func (Classifier) NumTerminatingJobs ¶
func (in Classifier) NumTerminatingJobs() int
func (*Classifier) Reset ¶
func (in *Classifier) Reset()
func (*Classifier) SystemState ¶
func (in *Classifier) SystemState() (abort bool, err error)
type ClassifierReader ¶
type ClassifierReader interface { v1alpha1.StateAggregationFunctions // ListAll returns a printable form of the names of classified objects ListAll() string // NumAll returns a printable form of the cardinality of classified objects NumAll() string // Count returns the number of all registered entities. Count() int // SystemState returns the state of the SYS services. If all services are running, it should return (false, nil). SystemState() (abort bool, err error) GetPendingJobs(jobName ...string) []client.Object GetRunningJobs(jobName ...string) []client.Object GetSuccessfulJobs(jobName ...string) []client.Object GetFailedJobs(jobName ...string) []client.Object }