From f683cabd6febdc9adc53ebca5388a62b6d8c8b75 Mon Sep 17 00:00:00 2001 From: Jason Madigan Date: Mon, 29 Apr 2024 11:22:29 +0100 Subject: [PATCH] SIGSEGV on generating resources with a spec without x-kuadrant extensions --- pkg/gatewayapi/http_route.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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") }