github.com/kiali/kiali@v1.84.0/business/checkers/serviceentries/port_checker.go (about) 1 package serviceentries 2 3 import ( 4 "fmt" 5 6 networking_v1beta1 "istio.io/client-go/pkg/apis/networking/v1beta1" 7 8 "github.com/kiali/kiali/kubernetes" 9 "github.com/kiali/kiali/models" 10 ) 11 12 type PortChecker struct { 13 ServiceEntry *networking_v1beta1.ServiceEntry 14 } 15 16 func (p PortChecker) Check() ([]*models.IstioCheck, bool) { 17 validations := make([]*models.IstioCheck, 0) 18 19 for portIndex, port := range p.ServiceEntry.Spec.Ports { 20 if port == nil { 21 continue 22 } 23 if !kubernetes.ValidateServicePort(port) { 24 validation := models.Build("port.name.mismatch", 25 fmt.Sprintf("spec/ports[%d]/name", portIndex)) 26 validations = append(validations, &validation) 27 } 28 } 29 return validations, len(validations) == 0 30 }