Documentation ¶
Index ¶
- Constants
- Variables
- func ExtEnv(extension string, envar string) (s string)
- func SoftErr(err error) (matched, retry bool)
- type AddonNotFound
- type AddonNotSelected
- type BadRequest
- type Cluster
- func (k *Cluster) Addon(name string) (r *crd.Addon, found bool)
- func (k *Cluster) Addons() (list []*crd.Addon)
- func (k *Cluster) Extension(name string) (r *crd.Extension, found bool)
- func (k *Cluster) Extensions() (list []*crd.Extension)
- func (k *Cluster) Pod(name string) (r *core.Pod, found bool)
- func (k *Cluster) Pods() (list []*core.Pod)
- func (k *Cluster) Refresh() (err error)
- func (k *Cluster) Tackle() (r *crd.Tackle)
- func (k *Cluster) Task(name string) (r *crd.Task, found bool)
- type Event
- type ExtensionNotFound
- type ExtensionNotValid
- type Injector
- type KindNotFound
- type Manager
- type NotReady
- type NotReconciled
- type PodRejected
- type Predicate
- type Preempt
- type Priority
- type PriorityNotFound
- type QuotaExceeded
- type Rule
- type RuleDeps
- type RuleIsolated
- type RulePreempted
- type RuleUnique
- type Selector
- type SelectorNotValid
- type SeqInjector
- type SoftError
- type TagPredicate
- type Task
- func (r *Task) Cancel(client k8s.Client) (err error)
- func (r *Task) Delete(client k8s.Client) (err error)
- func (r *Task) Error(severity, description string, x ...any)
- func (r *Task) Event(kind string, p ...any)
- func (r *Task) FindEvent(kind string) (matched []*model.TaskEvent)
- func (r *Task) LastEvent(kind string) (event *model.TaskEvent, found bool)
- func (r *Task) Reflect(cluster *Cluster) (pod *core.Pod, found bool)
- func (r *Task) Run(cluster *Cluster) (started bool, err error)
- func (r *Task) StateIn(states ...string) (matched bool)
- func (r *Task) With(m *model.Task)
- type Validator
Constants ¶
const ( Created = "Created" Ready = "Ready" Postponed = "Postponed" QuotaBlocked = "QuotaBlocked" Pending = "Pending" Running = "Running" Succeeded = "Succeeded" Failed = "Failed" Canceled = "Canceled" )
States also used as events: - Postponed - QuotaBlocked
const ( AddonSelected = "AddonSelected" ExtSelected = "ExtensionSelected" ImageError = "ImageError" PodNotFound = "PodNotFound" PodCreated = "PodCreated" PodPending = "PodPending" PodRunning = "PodRunning" Preempted = "Preempted" PodSucceeded = "PodSucceeded" PodFailed = "PodFailed" PodDeleted = "PodDeleted" Escalated = "Escalated" Released = "Released" ContainerKilled = "ContainerKilled" )
Events
const ( TaskLabel = "task" AppLabel = "app" RoleLabel = "role" )
k8s labels.
const ( Cache = "cache" )
const (
Unit = time.Second
)
Variables ¶
var ( Settings = &settings.Settings Log = logr.WithName("task-scheduler") )
var (
PredRegex = regexp.MustCompile(`(\w+)\:([\w/=]+)`)
)
var (
SeqRegex = regexp.MustCompile(`(\${seq:)([0-9]+)}`)
)
Functions ¶
Types ¶
type AddonNotFound ¶
type AddonNotFound struct {
Name string
}
AddonNotFound used to report addon referenced by a task but cannot be found.
func (*AddonNotFound) Error ¶
func (e *AddonNotFound) Error() string
func (*AddonNotFound) Is ¶
func (e *AddonNotFound) Is(err error) (matched bool)
func (*AddonNotFound) Retry ¶ added in v0.5.0
func (e *AddonNotFound) Retry() (r bool)
type AddonNotSelected ¶ added in v0.5.0
type AddonNotSelected struct { }
AddonNotSelected report that an addon has not been selected.
func (*AddonNotSelected) Error ¶ added in v0.5.0
func (e *AddonNotSelected) Error() string
func (*AddonNotSelected) Is ¶ added in v0.5.0
func (e *AddonNotSelected) Is(err error) (matched bool)
func (*AddonNotSelected) Retry ¶ added in v0.5.0
func (e *AddonNotSelected) Retry() (r bool)
type BadRequest ¶ added in v0.5.0
type BadRequest struct {
Reason string
}
BadRequest report bad request.
func (*BadRequest) Error ¶ added in v0.5.0
func (e *BadRequest) Error() string
func (*BadRequest) Is ¶ added in v0.5.0
func (e *BadRequest) Is(err error) (matched bool)
type Cluster ¶ added in v0.5.0
Cluster provides cached cluster resources. Maps must NOT be accessed directly.
func (*Cluster) Extensions ¶ added in v0.5.0
Extensions returns an addon my name.
type ExtensionNotFound ¶ added in v0.5.0
type ExtensionNotFound struct {
Name string
}
ExtensionNotFound used to report an extension referenced by a task but cannot be found.
func (*ExtensionNotFound) Error ¶ added in v0.5.0
func (e *ExtensionNotFound) Error() string
func (*ExtensionNotFound) Is ¶ added in v0.5.0
func (e *ExtensionNotFound) Is(err error) (matched bool)
func (*ExtensionNotFound) Retry ¶ added in v0.5.0
func (e *ExtensionNotFound) Retry() (r bool)
type ExtensionNotValid ¶ added in v0.5.0
ExtensionNotValid used to report extension referenced by a task not valid with addon.
func (*ExtensionNotValid) Error ¶ added in v0.5.0
func (e *ExtensionNotValid) Error() string
func (*ExtensionNotValid) Is ¶ added in v0.5.0
func (e *ExtensionNotValid) Is(err error) (matched bool)
func (*ExtensionNotValid) Retry ¶ added in v0.5.0
func (e *ExtensionNotValid) Retry() (r bool)
type Injector ¶ added in v0.5.0
type Injector struct {
// contains filtered or unexported fields
}
Injector macro processor.
type KindNotFound ¶ added in v0.5.0
type KindNotFound struct {
Name string
}
KindNotFound used to report task (kind) referenced by a task but cannot be found.
func (*KindNotFound) Error ¶ added in v0.5.0
func (e *KindNotFound) Error() string
func (*KindNotFound) Is ¶ added in v0.5.0
func (e *KindNotFound) Is(err error) (matched bool)
func (*KindNotFound) Retry ¶ added in v0.5.0
func (e *KindNotFound) Retry() (r bool)
type Manager ¶
type Manager struct { // DB DB *gorm.DB // k8s client. Client k8s.Client // Addon token scopes. Scopes []string // contains filtered or unexported fields }
Manager provides task management.
type NotReconciled ¶ added in v0.5.0
NotReconciled report as resource has not been reconciled.
func (*NotReconciled) Error ¶ added in v0.5.0
func (e *NotReconciled) Error() string
func (*NotReconciled) Is ¶ added in v0.5.0
func (e *NotReconciled) Is(err error) (matched bool)
func (*NotReconciled) Retry ¶ added in v0.5.0
func (e *NotReconciled) Retry() (r bool)
type PodRejected ¶ added in v0.5.0
type PodRejected struct {
Reason string
}
PodRejected report pod rejected..
func (*PodRejected) Error ¶ added in v0.5.0
func (e *PodRejected) Error() string
func (*PodRejected) Is ¶ added in v0.5.0
func (e *PodRejected) Is(err error) (matched bool)
func (*PodRejected) Match ¶ added in v0.5.0
func (e *PodRejected) Match(err error) (matched bool)
Match returns true when pod is rejected.
func (*PodRejected) Retry ¶ added in v0.5.0
func (e *PodRejected) Retry() (r bool)
type Preempt ¶ added in v0.5.0
type Preempt struct {
// contains filtered or unexported fields
}
Preempt request.
type Priority ¶ added in v0.5.0
type Priority struct {
// contains filtered or unexported fields
}
Priority escalator.
type PriorityNotFound ¶ added in v0.5.0
PriorityNotFound report priority class not found.
func (*PriorityNotFound) Error ¶ added in v0.5.0
func (e *PriorityNotFound) Error() string
func (*PriorityNotFound) Is ¶ added in v0.5.0
func (e *PriorityNotFound) Is(err error) (matched bool)
func (*PriorityNotFound) Retry ¶ added in v0.5.0
func (e *PriorityNotFound) Retry() (r bool)
type QuotaExceeded ¶ added in v0.3.2
type QuotaExceeded struct {
Reason string
}
QuotaExceeded report quota exceeded.
func (*QuotaExceeded) Error ¶ added in v0.3.2
func (e *QuotaExceeded) Error() string
func (*QuotaExceeded) Is ¶ added in v0.3.2
func (e *QuotaExceeded) Is(err error) (matched bool)
func (*QuotaExceeded) Match ¶ added in v0.3.2
func (e *QuotaExceeded) Match(err error) (matched bool)
Match returns true when the error is Forbidden due to quota exceeded.
func (*QuotaExceeded) Retry ¶ added in v0.5.0
func (e *QuotaExceeded) Retry() (r bool)
type RuleDeps ¶ added in v0.5.0
type RuleDeps struct {
// contains filtered or unexported fields
}
RuleDeps - Task kind dependencies.
type RulePreempted ¶ added in v0.5.0
type RulePreempted struct { }
RulePreempted - preempted tasks postponed to prevent thrashing.
type RuleUnique ¶
type RuleUnique struct {
// contains filtered or unexported fields
}
RuleUnique running tasks must be unique by:
- application
- addon.
type Selector ¶ added in v0.5.0
type Selector struct {
// contains filtered or unexported fields
}
Selector used to match addons and extensions.
func NewSelector ¶ added in v0.5.0
NewSelector returns a selector.
type SelectorNotValid ¶ added in v0.5.0
SelectorNotValid reports selector errors.
func (*SelectorNotValid) Error ¶ added in v0.5.0
func (e *SelectorNotValid) Error() string
func (*SelectorNotValid) Is ¶ added in v0.5.0
func (e *SelectorNotValid) Is(err error) (matched bool)
func (*SelectorNotValid) Retry ¶ added in v0.5.0
func (e *SelectorNotValid) Retry() (r bool)
type SeqInjector ¶ added in v0.5.0
type SeqInjector struct {
// contains filtered or unexported fields
}
SeqInjector provides ${seq:<pool>} sequence injection.
type SoftError ¶ added in v0.5.0
type SoftError interface { // Retry determines if the task should be // retried or failed immediately. Retry() (r bool) }
SoftError used to report errors specific to one task rather than systemic issues.
type TagPredicate ¶ added in v0.5.0
type TagPredicate struct {
// contains filtered or unexported fields
}
TagPredicate evaluates application tag references.
type Task ¶
Task is an runtime task.
func (*Task) Event ¶ added in v0.5.0
Event appends an event. Duplicates result in count incremented and Last updated.