minor change in log output (NOTICE prefix)

This commit is contained in:
Erik Brakkee 2025-01-12 16:42:11 +01:00
parent a640b726bf
commit b3c24048d6

View File

@ -22,7 +22,7 @@ const (
) )
func LogValidationMsg(level ValidationLevel, msg string, v ...any) { func LogValidationMsg(level ValidationLevel, msg string, v ...any) {
fmt.Fprintf(os.Stderr, msg+"\n", v...) fmt.Fprintf(os.Stderr, "NOTICE: "+msg+"\n", v...)
} }
func IterToSlice[K any](i iter.Seq[K]) []K { func IterToSlice[K any](i iter.Seq[K]) []K {
@ -52,13 +52,13 @@ func validate(files []string, options *Options) error {
} }
for _, application := range ns.Applications { for _, application := range ns.Applications {
pods := FindPods(application, clientset) pods := FindPods(application, clientset)
log.Printf(namespace + "/" + application.Name) //log.Printf(namespace + "/" + application.Name)
if len(pods) == 0 { if len(pods) == 0 {
LogValidationMsg(Error, "application %s: no running pods found", application.Name) LogValidationMsg(Error, "application %s: no running pods found", application.Name)
} }
ownerReferences := make(map[string]bool) ownerReferences := make(map[string]bool)
for _, pod := range pods { for _, pod := range pods {
log.Printf(" %s %v", pod.Name, pod.OwnerReferences) //log.Printf(" %s %v", pod.Name, pod.OwnerReferences)
for _, ownerReference := range pod.OwnerReferences { for _, ownerReference := range pod.OwnerReferences {
ownerReferences[ownerReference.Kind+"/"+ownerReference.Name] = true ownerReferences[ownerReference.Kind+"/"+ownerReference.Name] = true
} }
@ -75,6 +75,8 @@ func validate(files []string, options *Options) error {
} }
} }
} }
// Check service accounts
} }
} }
for _, communication := range config.Communications { for _, communication := range config.Communications {