forked from kiali/kiali
-
Notifications
You must be signed in to change notification settings - Fork 0
/
service_entry_checker.go
41 lines (33 loc) · 1021 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
37
38
39
40
41
package checkers
import (
"github.com/kiali/kiali/business/checkers/serviceentries"
"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 {
validations := models.IstioValidations{}
checks, valid := serviceentries.PortChecker{
ServiceEntry: se,
}.Check()
if !valid {
key := models.IstioValidationKey{ObjectType: ServiceEntryCheckerType, Name: se.GetObjectMeta().Name}
validations[key] = &models.IstioValidation{
Name: key.Name,
ObjectType: key.ObjectType,
Checks: checks,
Valid: valid,
}
}
return validations
}