Documentation ¶
Index ¶
- Constants
- Variables
- func AllNamespace() func(string) bool
- func IterateIndices(f func(client.Object, string, client.IndexerFunc) error) error
- func ProcessBackendError(err error, reporter reports.ParentRefReporter)
- func ProcessBackendRef(obj client.Object, err error, reporter reports.ParentRefReporter, ...) *string
- func ReferenceAllowed(ctx context.Context, fromgk metav1.GroupKind, fromns string, ...) bool
- func SameNamespace(ns string) func(string) bool
- type BackendMap
- type Error
- type From
- type FromGkNs
- type FromObject
- type GatewayQueries
- type GroupKindNs
- type HTTPRouteInfo
- func (hr *HTTPRouteInfo) Clone() *HTTPRouteInfo
- func (hr *HTTPRouteInfo) GetBackendForRef(backendRef gwv1.BackendObjectReference) (client.Object, error)
- func (hr *HTTPRouteInfo) GetChildrenForRef(backendRef gwv1.BackendObjectReference) ([]*HTTPRouteInfo, error)
- func (h HTTPRouteInfo) GetName() string
- func (h HTTPRouteInfo) GetNamespace() string
- func (hr *HTTPRouteInfo) Hostnames() []string
- type ListenerResult
- type Namespaced
- type RouteError
- type RoutesForGwResult
Constants ¶
View Source
const ( HttpRouteTargetField = "http-route-target" ReferenceGrantFromField = "ref-grant-from" )
Variables ¶
View Source
var ( ErrMissingReferenceGrant = fmt.Errorf("missing reference grant") ErrUnknownKind = fmt.Errorf("unknown kind") ErrNoMatchingListenerHostname = fmt.Errorf("no matching listener hostname") ErrNoMatchingParent = fmt.Errorf("no matching parent") ErrNotAllowedByListeners = fmt.Errorf("not allowed by listeners") ErrLocalObjRefMissingKind = fmt.Errorf("localObjRef provided with empty kind") ErrCyclicReference = fmt.Errorf("cyclic reference detected while evaluating delegated routes") ErrUnresolvedReference = fmt.Errorf("unresolved reference") )
Functions ¶
func AllNamespace ¶
func IterateIndices ¶
func ProcessBackendError ¶ added in v1.18.0
func ProcessBackendError(err error, reporter reports.ParentRefReporter)
func ProcessBackendRef ¶
func ProcessBackendRef(obj client.Object, err error, reporter reports.ParentRefReporter, backendRef gwv1.BackendObjectReference) *string
ProcessBackendRef is meant to take the result of a call to `GetBackendForRef` as well as a reporter and the original ref. The return value is a pointer to a string which is the cluster_name of the upstream that the ref resolved to. This function will return nil if the ref is not valid. This function will also set the appropriate condition on the parent via the reporter.
func ReferenceAllowed ¶
func SameNamespace ¶
Types ¶
type BackendMap ¶ added in v1.18.0
type BackendMap[T any] struct { // contains filtered or unexported fields }
func NewBackendMap ¶ added in v1.18.0
func NewBackendMap[T any]() BackendMap[T]
func (BackendMap[T]) Add ¶ added in v1.18.0
func (bm BackendMap[T]) Add(backendRef gwv1.BackendObjectReference, value T)
func (BackendMap[T]) AddError ¶ added in v1.18.0
func (bm BackendMap[T]) AddError(backendRef gwv1.BackendObjectReference, err error)
type Error ¶
type Error struct { Reason apiv1.RouteConditionReason E error }
type FromObject ¶
func (FromObject) Namespace ¶
func (f FromObject) Namespace() string
type GatewayQueries ¶
type GatewayQueries interface { ObjToFrom(obj client.Object) From // Given a backendRef that resides in namespace obj, return the service that backs it. // This will error with `ErrMissingReferenceGrant` if there is no reference grant allowing the reference // return value depends on the group/kind in the backendRef. GetBackendForRef(ctx context.Context, obj From, backendRef *apiv1.BackendObjectReference) (client.Object, error) GetSecretForRef(ctx context.Context, obj From, secretRef apiv1.SecretObjectReference) (client.Object, error) GetLocalObjRef(ctx context.Context, from From, localObjRef apiv1.LocalObjectReference) (client.Object, error) // GetRoutesForGateway finds the top level HTTPRoutes attached to a Gateway GetRoutesForGateway(ctx context.Context, gw *apiv1.Gateway) (RoutesForGwResult, error) // GetHTTPRouteChain resolves backends and delegated routes for a HTTPRoute GetHTTPRouteChain(ctx context.Context, route apiv1.HTTPRoute, hostnames []string, parentRef apiv1.ParentReference) *HTTPRouteInfo }
type GroupKindNs ¶
type GroupKindNs struct {
// contains filtered or unexported fields
}
func NewGroupKindNs ¶
func NewGroupKindNs(gk metav1.GroupKind, ns string) *GroupKindNs
func (*GroupKindNs) Namespace ¶
func (g *GroupKindNs) Namespace() string
type HTTPRouteInfo ¶
type HTTPRouteInfo struct { // HTTPRoute with rules and matches filtered to only those // that are valid based on the parent rule. gwv1.HTTPRoute // ParentRef points to the Gateway (and optionally Listener) or HTTPRoute ParentRef gwv1.ParentReference // hostnameOverrides can replace the HTTPRoute hostnames with those that intersect // the attached listener's hostname(s). HostnameOverrides []string // Backends are pre-resolved here. This list will not contain delegates. // Map values are either client.Object or error (errors can be passed to ProcessBackendRef). // TODO should we ProcessBackendRef early and put cluster names here?) Backends BackendMap[client.Object] // Children contains all delegate HTTPRoutes referenced in any rule of this // HTTPRoute, keyed by the backend ref for easy lookup. // This tree structure can have cyclic references. Check them when recursing through the tree. Children BackendMap[[]*HTTPRouteInfo] }
HTTPRouteInfo contains pre-resolved backends (Services, Upstreams and delegate HTTPRoutes) This allows all querying to happen upfront, and detailed logic for delegation to happen as part of translation.
func (*HTTPRouteInfo) Clone ¶
func (hr *HTTPRouteInfo) Clone() *HTTPRouteInfo
func (*HTTPRouteInfo) GetBackendForRef ¶
func (hr *HTTPRouteInfo) GetBackendForRef(backendRef gwv1.BackendObjectReference) (client.Object, error)
func (*HTTPRouteInfo) GetChildrenForRef ¶
func (hr *HTTPRouteInfo) GetChildrenForRef(backendRef gwv1.BackendObjectReference) ([]*HTTPRouteInfo, error)
func (HTTPRouteInfo) GetName ¶
func (h HTTPRouteInfo) GetName() string
func (HTTPRouteInfo) GetNamespace ¶
func (h HTTPRouteInfo) GetNamespace() string
func (*HTTPRouteInfo) Hostnames ¶
func (hr *HTTPRouteInfo) Hostnames() []string
type ListenerResult ¶
type ListenerResult struct { Error error Routes []*HTTPRouteInfo }
type Namespaced ¶ added in v1.18.0
type RouteError ¶
type RouteError struct { Route apiv1.HTTPRoute ParentRef apiv1.ParentReference Error Error }
type RoutesForGwResult ¶
type RoutesForGwResult struct { // key is listener name ListenerResults map[string]*ListenerResult RouteErrors []*RouteError }
Click to show internal directories.
Click to hide internal directories.