Skip to content
Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
49 lines (38 sloc) 1.41 KB
package checkers
import (
"github.com/kiali/kiali/business/checkers/meshpolicies"
"github.com/kiali/kiali/kubernetes"
"github.com/kiali/kiali/models"
)
const MeshPolicyCheckerType = "meshpolicy"
type MeshPolicyChecker struct {
MeshPolicies []kubernetes.IstioObject
MTLSDetails kubernetes.MTLSDetails
}
func (m MeshPolicyChecker) Check() models.IstioValidations {
validations := models.IstioValidations{}
for _, meshPolicy := range m.MeshPolicies {
validations.MergeValidations(m.runChecks(meshPolicy))
}
return validations
}
// runChecks runs all the individual checks for a single mesh policy and appends the result into validations.
func (m MeshPolicyChecker) runChecks(meshPolicy kubernetes.IstioObject) models.IstioValidations {
meshPolicyName := meshPolicy.GetObjectMeta().Name
key := models.IstioValidationKey{Name: meshPolicyName, ObjectType: MeshPolicyCheckerType}
rrValidation := &models.IstioValidation{
Name: meshPolicyName,
ObjectType: MeshPolicyCheckerType,
Valid: true,
Checks: []*models.IstioCheck{},
}
enabledCheckers := []Checker{
meshpolicies.MtlsChecker{MeshPolicy: meshPolicy, MTLSDetails: m.MTLSDetails},
}
for _, checker := range enabledCheckers {
checks, validChecker := checker.Check()
rrValidation.Checks = append(rrValidation.Checks, checks...)
rrValidation.Valid = rrValidation.Valid && validChecker
}
return models.IstioValidations{key: rrValidation}
}
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.