@@ -89,6 +89,7 @@ func newListenerConfiguratorFactory(
8989 },
9090 http : & listenerConfigurator {
9191 validators : []listenerValidator {
92+ validateListenerAllowedRouteKind ,
9293 validateListenerLabelSelector ,
9394 validateListenerHostname ,
9495 validateHTTPListener ,
@@ -158,8 +159,7 @@ func (c *listenerConfigurator) configure(listener v1beta1.Listener) *Listener {
158159 }
159160 }
160161
161- cnds , supportedKinds := getAndValidateSupportedKinds (listener )
162- conds = append (conds , cnds ... )
162+ supportedKinds := getListenerSupportedKinds (listener )
163163
164164 if len (conds ) > 0 {
165165 return & Listener {
@@ -211,7 +211,10 @@ func validateListenerHostname(listener v1beta1.Listener) []conditions.Condition
211211 return nil
212212}
213213
214- func getAndValidateSupportedKinds (listener v1beta1.Listener ) ([]conditions.Condition , []v1beta1.RouteGroupKind ) {
214+ func getAndValidateListenerSupportedKinds (listener v1beta1.Listener ) (
215+ []conditions.Condition ,
216+ []v1beta1.RouteGroupKind ,
217+ ) {
215218 if listener .AllowedRoutes == nil || listener .AllowedRoutes .Kinds == nil {
216219 return nil , []v1beta1.RouteGroupKind {
217220 {
@@ -247,6 +250,16 @@ func getAndValidateSupportedKinds(listener v1beta1.Listener) ([]conditions.Condi
247250 return conds , supportedKinds
248251}
249252
253+ func validateListenerAllowedRouteKind (listener v1beta1.Listener ) []conditions.Condition {
254+ conds , _ := getAndValidateListenerSupportedKinds (listener )
255+ return conds
256+ }
257+
258+ func getListenerSupportedKinds (listener v1beta1.Listener ) []v1beta1.RouteGroupKind {
259+ _ , kinds := getAndValidateListenerSupportedKinds (listener )
260+ return kinds
261+ }
262+
250263func validateListenerLabelSelector (listener v1beta1.Listener ) []conditions.Condition {
251264 if listener .AllowedRoutes != nil &&
252265 listener .AllowedRoutes .Namespaces != nil &&
0 commit comments