INNER CODE UNIT · Go

isIgnoredPod

airwallex/k8s-pod-restart-info-collector · helpers.go:47

func isIgnoredPod(name string) bool {
	ignoredPodNamePrefixesEnv := os.Getenv("IGNORED_POD_NAME_PREFIXES")
	if ignoredPodNamePrefixesEnv == "" {
		return false
	}
	ignoredPodNamePrefixes := strings.Split(ignoredPodNamePrefixesEnv, ",")
	for _, ignoredPodNamePrefix := range ignoredPodNamePrefixes {
		match, _ := regexp.MatchString(ignoredPodNamePrefix, name)
		if match {
			klog.Infof("Ignore: pod %s has ignored name prefix: %s\n", name, ignoredPodNamePrefix)
			return true
		}
	}
	return false
}

func isWatchedNamespace(namespace string) bool {
	watchedNamespacesEnv := os.Getenv("WATCHED_NAMESPACES")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…