errormatch

package
v0.20.39 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

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) are also defined here for use by the retry engine but are not included in KnownConditions.

Index

Constants

View Source
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).

View Source
const (
	ConditionPreempted     = "Preempted"
	ConditionLeaseReturned = "LeaseReturned"
)

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.

Variables

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).

func MatchPattern

func MatchPattern(re *regexp.Regexp, value string) bool

MatchPattern returns true if the value matches the compiled regex. Empty values never match.

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 RegexMatcher

type RegexMatcher struct {
	Pattern string `yaml:"pattern"`
}

RegexMatcher specifies a regex pattern as a string.

Jump to

Keyboard shortcuts

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