github.com/cilium/cilium@v1.16.2/pkg/endpointmanager/ingress.go (about) 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright Authors of Cilium 3 4 package endpointmanager 5 6 import ( 7 "github.com/cilium/cilium/pkg/endpoint" 8 "github.com/cilium/cilium/pkg/labels" 9 ) 10 11 // GetIngressEndpoint returns the ingress endpoint. 12 func (mgr *endpointManager) GetIngressEndpoint() *endpoint.Endpoint { 13 mgr.mutex.RLock() 14 defer mgr.mutex.RUnlock() 15 for _, ep := range mgr.endpoints { 16 if ep.HasLabels(labels.LabelIngress) { 17 return ep 18 } 19 } 20 return nil 21 } 22 23 // IngressEndpointExists returns true if the ingress endpoint exists. 24 func (mgr *endpointManager) IngressEndpointExists() bool { 25 return mgr.GetIngressEndpoint() != nil 26 }