@@ -89,6 +89,7 @@ func newListenerConfiguratorFactory(
89
89
},
90
90
http : & listenerConfigurator {
91
91
validators : []listenerValidator {
92
+ validateListenerAllowedRouteKind ,
92
93
validateListenerLabelSelector ,
93
94
validateListenerHostname ,
94
95
validateHTTPListener ,
@@ -158,8 +159,7 @@ func (c *listenerConfigurator) configure(listener v1beta1.Listener) *Listener {
158
159
}
159
160
}
160
161
161
- cnds , supportedKinds := getAndValidateSupportedKinds (listener )
162
- conds = append (conds , cnds ... )
162
+ supportedKinds := getListenerSupportedKinds (listener )
163
163
164
164
if len (conds ) > 0 {
165
165
return & Listener {
@@ -211,7 +211,10 @@ func validateListenerHostname(listener v1beta1.Listener) []conditions.Condition
211
211
return nil
212
212
}
213
213
214
- func getAndValidateSupportedKinds (listener v1beta1.Listener ) ([]conditions.Condition , []v1beta1.RouteGroupKind ) {
214
+ func getAndValidateListenerSupportedKinds (listener v1beta1.Listener ) (
215
+ []conditions.Condition ,
216
+ []v1beta1.RouteGroupKind ,
217
+ ) {
215
218
if listener .AllowedRoutes == nil || listener .AllowedRoutes .Kinds == nil {
216
219
return nil , []v1beta1.RouteGroupKind {
217
220
{
@@ -247,6 +250,16 @@ func getAndValidateSupportedKinds(listener v1beta1.Listener) ([]conditions.Condi
247
250
return conds , supportedKinds
248
251
}
249
252
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
+
250
263
func validateListenerLabelSelector (listener v1beta1.Listener ) []conditions.Condition {
251
264
if listener .AllowedRoutes != nil &&
252
265
listener .AllowedRoutes .Namespaces != nil &&
0 commit comments