INNER CODE UNIT · Go
isWatchedPod
airwallex/k8s-pod-restart-info-collector · helpers.go:81
func isWatchedPod(name string) bool {
watchedPodNamePrefixesEnv := os.Getenv("WATCHED_POD_NAME_PREFIXES")
if watchedPodNamePrefixesEnv == "" {
return true
}
watchedPodNamePrefixes := strings.Split(watchedPodNamePrefixesEnv, ",")
for _, watchedPodNamePrefix := range watchedPodNamePrefixes {
match, _ := regexp.MatchString(watchedPodNamePrefix, name)
if match {
return true
}
}
// klog.Infof("Ignore: pod %s doesn't have the watched pod name prefixes\n", name)
return false
}
func shouldIgnoreRestartsWithExitCodeZero(status v1.ContainerStatus) bool {
if os.Getenv("IGNORE_RESTARTS_WITH_EXIT_CODE_ZERO") != "true" {