Documentation
¶
Overview ¶
Package errormatch provides types and functions for matching job failure signals: exit codes, termination messages, and Kubernetes conditions.
ExitCodeMatcher supports In/NotIn set membership against container exit codes. Exit code 0 never matches. RegexMatcher holds a pattern string that callers compile at construction time and pass to MatchPattern.
Condition constants (ConditionOOMKilled, ConditionEvicted, ConditionDeadlineExceeded) and the KnownConditions map are provided for config validation. Non-pod conditions (ConditionPreempted, ConditionLeaseReturned, ConditionLeaseExpired, ConditionAppError) are also defined here for use by the retry engine but are not included in KnownConditions.
Index ¶
Constants ¶
const ( ConditionOOMKilled = "OOMKilled" ConditionEvicted = "Evicted" ConditionDeadlineExceeded = "DeadlineExceeded" )
Condition constants derived from KubernetesReason. OOMKilled is a container-level condition (container.State.Terminated.Reason). Evicted and DeadlineExceeded are pod-level conditions (pod.Status.Reason).
const ( ConditionPreempted = "Preempted" ConditionLeaseReturned = "LeaseReturned" ConditionLeaseExpired = "LeaseExpired" ConditionAppError = "AppError" )
Condition constants for non-pod error types (used by the retry engine). These are not observable from Kubernetes pod status, so the executor categorizer cannot match them. ConditionAppError is the catch-all for a PodError whose KubernetesReason is AppError (i.e. container failed without a recognised pod-level reason).
const ( SubcategoryJobCreationFailed = "job-creation-failed" // executor failed to build the runnable job from the lease SubcategoryPodMissing = "pod-missing" // reconciliation: pod vanished from Kubernetes for an active run SubcategoryLeaseExpired = "lease-expired" // run cancelled because its executor went stale or was lost SubcategoryMaxRunsExceeded = "max-runs-exceeded" // job exhausted its run attempts SubcategoryJobRejected = "job-rejected" // submitcheck or validation rejected the job SubcategoryStuckTerminating = "stuck-terminating" // node issue: the pod will not terminate SubcategoryExternallyDeleted = "externally-deleted" // pod deleted by something other than Armada SubcategoryIssueHandlerError = "issue-handler-error" // pod unexpectedly changed state mid issue-handling SubcategoryActiveDeadline = "active-deadline" // pod exceeded its user-set activeDeadlineSeconds )
const CategoryInternal = "internal"
CategoryInternal is the failure category for Armada-generated failures. It is hard-coded at the Error-construction site, not assigned by the operator categorizer.
Variables ¶
var KnownConditions = map[string]bool{ ConditionOOMKilled: true, ConditionEvicted: true, ConditionDeadlineExceeded: true, }
KnownConditions is the set of condition strings accepted by the executor error categorizer. Only conditions that map to real Kubernetes reason strings are included.
Functions ¶
func MatchExitCode ¶
func MatchExitCode(matcher *ExitCodeMatcher, exitCode int32) bool
MatchExitCode returns true if the exit code matches the matcher. Exit code 0 never matches (successful containers are not failures).
Types ¶
type ExitCodeMatcher ¶
type ExitCodeMatcher struct {
Operator ExitCodeOperator `yaml:"operator"`
Values []int32 `yaml:"values"`
}
ExitCodeMatcher specifies an operator and a set of exit code values.
type ExitCodeOperator ¶
type ExitCodeOperator string
ExitCodeOperator is a set membership operator: In or NotIn.
const ( ExitCodeOperatorIn ExitCodeOperator = "In" ExitCodeOperatorNotIn ExitCodeOperator = "NotIn" )
type PodEventMatcher ¶ added in v0.22.5
type PodEventMatcher struct {
// Regexp must match the event message.
Regexp string `yaml:"regexp"`
// Reason, when set, must equal the event reason exactly.
Reason string `yaml:"reason,omitempty"`
// Type must equal the event type: Normal or Warning.
Type string `yaml:"type"`
}
PodEventMatcher matches one Kubernetes event on the pod. The fields mirror the failedPodChecks PodEventCheck so existing check configs migrate by copy.
type RegexMatcher ¶
type RegexMatcher struct {
Pattern string `yaml:"pattern"`
}
RegexMatcher specifies a regex pattern as a string.