From 842d7220c0c9e76f3df63ad39844c0b318aad0d3 Mon Sep 17 00:00:00 2001 From: Mattia Lavacca Date: Tue, 13 Sep 2022 10:22:20 +0200 Subject: [PATCH] review's comments Signed-off-by: Mattia Lavacca --- internal/annotations/annotations.go | 3 +++ internal/controllers/gateway/gateway_controller.go | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/annotations/annotations.go b/internal/annotations/annotations.go index 6c94ef4074..ef4d8eec7c 100644 --- a/internal/annotations/annotations.go +++ b/internal/annotations/annotations.go @@ -255,6 +255,9 @@ func ExtractHostAliases(anns map[string]string) ([]string, bool) { // ExtractUnmanagedGatewayClassMode extracts the value of the unmanaged gateway // mode annotation. func ExtractUnmanagedGatewayClassMode(anns map[string]string) string { + if anns == nil { + return "" + } return anns[GatewayClassUnmanagedAnnotation] } diff --git a/internal/controllers/gateway/gateway_controller.go b/internal/controllers/gateway/gateway_controller.go index 48a9c39401..44b21fed0c 100644 --- a/internal/controllers/gateway/gateway_controller.go +++ b/internal/controllers/gateway/gateway_controller.go @@ -134,7 +134,7 @@ func (r *GatewayReconciler) SetupWithManager(mgr ctrl.Manager) error { // ----------------------------------------------------------------------------- // gatewayHasMatchingGatewayClass is a watch predicate which filters out reconciliation events for -// gateway objects which aren't supported by this controller and not using an unmanaged GatewayClass. +// gateway objects which aren't supported by this controller or not using an unmanaged GatewayClass. func (r *GatewayReconciler) gatewayHasMatchingGatewayClass(obj client.Object) bool { gateway, ok := obj.(*gatewayv1beta1.Gateway) if !ok { @@ -150,7 +150,7 @@ func (r *GatewayReconciler) gatewayHasMatchingGatewayClass(obj client.Object) bo } // gatewayClassMatchesController is a watch predicate which filters out events for gatewayclasses which -// aren't configured with the required ControllerName and not annotated as unmanaged. +// aren't configured with the required ControllerName or not annotated as unmanaged. func (r *GatewayReconciler) gatewayClassMatchesController(obj client.Object) bool { gatewayClass, ok := obj.(*gatewayv1beta1.GatewayClass) if !ok {