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

     1  // SPDX-License-Identifier: Apache-2.0
     2  // Copyright Authors of Cilium
     3  
     4  package routechecks
     5  
     6  import (
     7  	"context"
     8  
     9  	"github.com/sirupsen/logrus"
    10  	corev1 "k8s.io/api/core/v1"
    11  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
    12  	"k8s.io/apimachinery/pkg/runtime/schema"
    13  	"sigs.k8s.io/controller-runtime/pkg/client"
    14  	gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
    15  	gatewayv1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1"
    16  )
    17  
    18  const (
    19  	// controllerName is the gateway controller name used in cilium.
    20  	controllerName = "io.cilium/gateway-controller"
    21  )
    22  
    23  type GenericRule interface {
    24  	GetBackendRefs() []gatewayv1.BackendRef
    25  }
    26  
    27  type Input interface {
    28  	GetRules() []GenericRule
    29  	GetNamespace() string
    30  	GetClient() client.Client
    31  	GetContext() context.Context
    32  	GetGVK() schema.GroupVersionKind
    33  	GetGrants() []gatewayv1beta1.ReferenceGrant
    34  	GetGateway(parent gatewayv1.ParentReference) (*gatewayv1.Gateway, error)
    35  	GetParentGammaService(parent gatewayv1.ParentReference) (*corev1.Service, error)
    36  	GetHostnames() []gatewayv1.Hostname
    37  
    38  	SetParentCondition(ref gatewayv1.ParentReference, condition metav1.Condition)
    39  	SetAllParentCondition(condition metav1.Condition)
    40  	Log() *logrus.Entry
    41  }
    42  
    43  type (
    44  	CheckRuleFunc   func(input Input) (bool, error)
    45  	CheckParentFunc func(input Input, ref gatewayv1.ParentReference) (bool, error)
    46  )