Files
kubesphere/vendor/github.com/kiali/kiali/business/checkers/gateway_checker.go
jeff 4ac20ffc2b add service mesh controller
add service mesh metrics

remove unused circle yaml

fix travis misconfiguration

fix travis misconfiguration

fix travis misconfiguration
2019-03-17 17:28:52 +08:00

52 lines
1.3 KiB
Go

package checkers
import (
"github.com/kiali/kiali/business/checkers/gateways"
"github.com/kiali/kiali/kubernetes"
"github.com/kiali/kiali/models"
)
const GatewayCheckerType = "gateway"
type GatewayChecker struct {
GatewaysPerNamespace [][]kubernetes.IstioObject
Namespace string
}
// Check runs checks for the all namespaces actions as well as for the single namespace validations
func (g GatewayChecker) Check() models.IstioValidations {
// Multinamespace checkers
validations := gateways.MultiMatchChecker{
GatewaysPerNamespace: g.GatewaysPerNamespace,
}.Check()
// Single namespace
for _, nssGw := range g.GatewaysPerNamespace {
for _, gw := range nssGw {
if gw.GetObjectMeta().Namespace == g.Namespace {
validations.MergeValidations(runSingleChecks(gw))
}
}
}
return validations
}
func runSingleChecks(gw kubernetes.IstioObject) models.IstioValidations {
validations := models.IstioValidations{}
checks, valid := gateways.PortChecker{
Gateway: gw,
}.Check()
if !valid {
key := models.IstioValidationKey{ObjectType: GatewayCheckerType, Name: gw.GetObjectMeta().Name}
validations[key] = &models.IstioValidation{
Name: key.Name,
ObjectType: key.ObjectType,
Checks: checks,
Valid: valid,
}
}
return validations
}