forked from kiali/kiali
-
Notifications
You must be signed in to change notification settings - Fork 0
/
service_entry_checker.go
36 lines (26 loc) · 964 Bytes
/
service_entry_checker.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package checkers
import (
"github.com/kiali/kiali/kubernetes"
"github.com/kiali/kiali/models"
)
const ServiceEntryCheckerType = "serviceentry"
type ServiceEntryChecker struct {
ServiceEntries []kubernetes.IstioObject
}
func (s ServiceEntryChecker) Check() models.IstioValidations {
validations := models.IstioValidations{}
for _, se := range s.ServiceEntries {
validations.MergeValidations(s.runSingleChecks(se))
}
return validations
}
func (s ServiceEntryChecker) runSingleChecks(se kubernetes.IstioObject) models.IstioValidations {
key, validations := EmptyValidValidation(se.GetObjectMeta().Name, se.GetObjectMeta().Namespace, ServiceEntryCheckerType)
enabledCheckers := []Checker{}
for _, checker := range enabledCheckers {
checks, validChecker := checker.Check()
validations.Checks = append(validations.Checks, checks...)
validations.Valid = validations.Valid && validChecker
}
return models.IstioValidations{key: validations}
}