diff --git a/pkg/gatewayapi/http_route.go b/pkg/gatewayapi/http_route.go index 68c2ea4..b9da6da 100644 --- a/pkg/gatewayapi/http_route.go +++ b/pkg/gatewayapi/http_route.go @@ -19,6 +19,10 @@ func HTTPRouteObjectMetaFromOAS(doc *openapi3.T) metav1.ObjectMeta { panic(err) } + if kuadrantInfoExtension == nil { + return metav1.ObjectMeta{} + } + if kuadrantInfoExtension.Route == nil { panic("info kuadrant extension route not found") } @@ -45,10 +49,15 @@ func HTTPRouteGatewayParentRefsFromOAS(doc *openapi3.T) []gatewayapiv1beta1.Pare } kuadrantInfoExtension, err := utils.NewKuadrantOASInfoExtension(doc.Info) + if err != nil { panic(err) } + if kuadrantInfoExtension == nil { + return nil + } + if kuadrantInfoExtension.Route == nil { panic("info kuadrant extension route not found") } @@ -66,6 +75,10 @@ func HTTPRouteHostnamesFromOAS(doc *openapi3.T) []gatewayapiv1beta1.Hostname { panic(err) } + if kuadrantInfoExtension == nil { + return nil + } + if kuadrantInfoExtension.Route == nil { panic("info kuadrant extension route not found") }