From a2409881cdd61cfd7ef74cb535c9aeea8a8754a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Luk=C5=A1a?= Date: Fri, 5 Apr 2024 00:02:03 +0200 Subject: [PATCH] OSSM-6177 Prevent nil pointer dereference when analysis is enabled and GatewayAPI is disabled (#977) --- pilot/pkg/config/kube/crdclient/client.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pilot/pkg/config/kube/crdclient/client.go b/pilot/pkg/config/kube/crdclient/client.go index 266a395b0b..eef8fca229 100644 --- a/pilot/pkg/config/kube/crdclient/client.go +++ b/pilot/pkg/config/kube/crdclient/client.go @@ -339,7 +339,10 @@ func (cl *Client) addCRD(name string) { resourceGVK := s.GroupVersionKind() gvr := s.GroupVersionResource() - if cl.client.IsMultiTenant() && resourceGVK == gvk.GatewayClass { + if !features.EnableGatewayAPI && s.Group() == gvk.KubernetesGateway.Group { + scope.Infof("Skipping CRD %v as GatewayAPI support is not enabled", s.GroupVersionKind()) + return + } else if cl.client.IsMultiTenant() && resourceGVK == gvk.GatewayClass { scope.Infof("Skipping CRD %v as it is not compatible with maistra multi-tenancy", s.GroupVersionKind()) return }