github.com/cilium/cilium@v1.16.2/operator/pkg/gateway-api/helpers/namespaces.go (about)

     1  // SPDX-License-Identifier: Apache-2.0
     2  // Copyright Authors of Cilium
     3  
     4  package helpers
     5  
     6  import (
     7  	gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
     8  )
     9  
    10  func NamespaceDerefOr(namespace *gatewayv1.Namespace, defaultNamespace string) string {
    11  	if namespace != nil && *namespace != "" {
    12  		return string(*namespace)
    13  	}
    14  	return defaultNamespace
    15  }