// matchPodFailurePolicy returns information about matching a given failed pod // against the pod failure policy rules. The information is represented as an // - optional job failure message (present in case the pod matched a 'FailJob' rule), // - a boolean indicating if the failure should be counted towards backoffLimit // (and backoffLimitPerIndex if specified). It should not be counted // if the pod matched an 'Ignore' rule, // - a pointer to the matched pod failure policy action. func matchPodFailurePolicy(podFailurePolicy *batch.PodFailurePolicy, failedPod *v1.Pod) (*string, bool, *batch.PodFailurePolicyAction) { … } // matchOnExitCodes returns a terminated container status that matches the error code requirement, if any exists. // If the returned status is non-nil, it has a non-nil Terminated field. func matchOnExitCodes(podStatus *v1.PodStatus, requirement *batch.PodFailurePolicyOnExitCodesRequirement) *v1.ContainerStatus { … } func matchOnPodConditions(podStatus *v1.PodStatus, requirement []batch.PodFailurePolicyOnPodConditionsPattern) *v1.PodCondition { … } // getMatchingContainerFromList returns the first terminated container status in the list that matches the error code requirement, or nil if none match. // If the returned status is non-nil, it has a non-nil Terminated field func getMatchingContainerFromList(containerStatuses []v1.ContainerStatus, requirement *batch.PodFailurePolicyOnExitCodesRequirement) *v1.ContainerStatus { … } func isOnExitCodesOperatorMatching(exitCode int32, requirement *batch.PodFailurePolicyOnExitCodesRequirement) bool { … }