in pkg/apis/frameworkcontroller/v1/completion.go [281:320]
func matchPodPattern(pod *core.Pod, podPattern *PodPattern) *MatchedPod {
matchedPod := &MatchedPod{}
if !podPattern.NameRegex.IsZero() {
if ms := podPattern.NameRegex.FindString(pod.Name); ms != nil {
matchedPod.Name = ms
} else {
return nil
}
}
if !podPattern.ReasonRegex.IsZero() {
if ms := podPattern.ReasonRegex.FindString(pod.Status.Reason); ms != nil {
matchedPod.Reason = *ms
} else {
return nil
}
}
if !podPattern.MessageRegex.IsZero() {
if ms := podPattern.MessageRegex.FindString(pod.Status.Message); ms != nil {
matchedPod.Message = *ms
} else {
return nil
}
}
if len(podPattern.Containers) > 0 {
containers := GetAllContainerStatuses(pod)
for _, containerPattern := range podPattern.Containers {
if mc := matchContainers(containers, containerPattern); mc != nil {
if !reflect.DeepEqual(mc, &MatchedContainer{}) {
matchedPod.Containers = append(matchedPod.Containers, mc)
}
} else {
return nil
}
}
}
return matchedPod
}