loop over communication sis now outside loop over namespaces.

This commit is contained in:
Erik Brakkee 2025-01-12 16:32:20 +01:00
parent ea6eb4e9ae
commit a640b726bf

View File

@ -76,30 +76,27 @@ func validate(files []string, options *Options) error {
}
}
}
for _, communication := range config.Communications {
if len(communication.Ports) == 0 {
}
for _, communication := range config.Communications {
if len(communication.Ports) == 0 {
continue
}
for _, applicationName := range communication.To {
application, _, _ := config.GetApplication(applicationName)
if application == nil {
continue
}
for _, applicationName := range communication.To {
application, _, _ := config.GetApplication(applicationName)
if application == nil {
continue
}
for _, port := range communication.Ports {
pods := FindPods(application, clientset)
for _, pod := range pods {
if !HasPort(pod, port) {
LogValidationMsg(Error, "communication %v -> %v: port %v is not configured in pod %s/%s",
communication.From, communication.To, port, pod.Namespace, pod.Name)
}
for _, port := range communication.Ports {
pods := FindPods(application, clientset)
for _, pod := range pods {
if !HasPort(pod, port) {
LogValidationMsg(Error, "communication %v -> %v: port %v is not configured in pod %s/%s",
communication.From, communication.To, port, pod.Namespace, pod.Name)
}
}
}
}
}
return nil
}