gatewayapi

package
v0.2.0-rc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KindGateway   = "Gateway"
	KindHTTPRoute = "HTTPRoute"
	KindService   = "Service"
	KindSecret    = "Secret"
)

Variables

This section is empty.

Functions

func ComputeHosts

func ComputeHosts(routeHostnames []v1beta1.Hostname, listenerHostname *v1beta1.Hostname) []string

ComputeHosts returns a list of the intersecting hostnames between the route and the listener.

func FromNamespacesPtr

func FromNamespacesPtr(fromNamespaces v1beta1.FromNamespaces) *v1beta1.FromNamespaces

func GroupDerefOr

func GroupDerefOr(group *v1beta1.Group, defaultGroup string) string

func GroupPtr

func GroupPtr(name string) *v1beta1.Group

func HasReadyListener

func HasReadyListener(listeners []*ListenerContext) bool

HasReadyListener returns true if at least one Listener in the provided list has a condition of "Ready: true", and false otherwise.

func HeaderMatchTypeDerefOr

func HeaderMatchTypeDerefOr(matchType *v1beta1.HeaderMatchType, defaultType v1beta1.HeaderMatchType) v1beta1.HeaderMatchType

func Int32Ptr

func Int32Ptr(val int32) *int32

func IsRefToGateway

func IsRefToGateway(parentRef v1beta1.ParentReference, gateway types.NamespacedName) bool

IsRefToGateway returns whether the provided parent ref is a reference to a Gateway with the given namespace/name, irrespective of whether a section/listener name has been specified (i.e. a parent ref to a listener on the specified gateway will return "true").

func KindPtr

func KindPtr(name string) *v1beta1.Kind

func NamespaceDerefOr

func NamespaceDerefOr(namespace *v1beta1.Namespace, defaultNamespace string) string

func NamespacePtr

func NamespacePtr(name string) *v1beta1.Namespace

func ObjectNamePtr

func ObjectNamePtr(val string) *v1alpha2.ObjectName

func PathMatchTypeDerefOr

func PathMatchTypeDerefOr(matchType *v1beta1.PathMatchType, defaultType v1beta1.PathMatchType) v1beta1.PathMatchType

func PathMatchTypePtr

func PathMatchTypePtr(pType v1beta1.PathMatchType) *v1beta1.PathMatchType

func PortNumPtr

func PortNumPtr(val int32) *v1beta1.PortNumber

func StringPtr

func StringPtr(val string) *string

Types

type GatewayContext

type GatewayContext struct {
	*v1beta1.Gateway
	// contains filtered or unexported fields
}

GatewayContext wraps a Gateway and provides helper methods for setting conditions, accessing Listeners, etc.

func (*GatewayContext) GetListenerContext

func (g *GatewayContext) GetListenerContext(listenerName v1beta1.SectionName) *ListenerContext

func (*GatewayContext) SetCondition

func (g *GatewayContext) SetCondition(conditionType v1beta1.GatewayConditionType, status metav1.ConditionStatus, reason v1beta1.GatewayConditionReason, message string)

type HTTPRouteContext

type HTTPRouteContext struct {
	*v1beta1.HTTPRoute
	// contains filtered or unexported fields
}

HTTPRouteContext wraps an HTTPRoute and provides helper methods for accessing the route's parents.

func (*HTTPRouteContext) GetRouteParentContext

func (h *HTTPRouteContext) GetRouteParentContext(forParentRef v1beta1.ParentReference) *RouteParentContext

type ListenerContext

type ListenerContext struct {
	*v1beta1.Listener
	// contains filtered or unexported fields
}

ListenerContext wraps a Listener and provides helper methods for setting conditions and other status information on the associated Gateway, etc.

func GetReferencedListeners

func GetReferencedListeners(parentRef v1beta1.ParentReference, gateways []*GatewayContext) (bool, []*ListenerContext)

GetReferencedListeners returns whether a given parent ref references a Gateway in the given list, and if so, a list of the Listeners within that Gateway that are included by the parent ref (either one specific Listener, or all Listeners in the Gateway, depending on whether section name is specified or not).

func (*ListenerContext) AllowsKind

func (l *ListenerContext) AllowsKind(kind v1beta1.RouteGroupKind) bool

func (*ListenerContext) AllowsNamespace

func (l *ListenerContext) AllowsNamespace(namespace *v1.Namespace) bool

func (*ListenerContext) GetConditions

func (l *ListenerContext) GetConditions() []metav1.Condition

func (*ListenerContext) IncrementAttachedRoutes

func (l *ListenerContext) IncrementAttachedRoutes()

func (*ListenerContext) IsReady

func (l *ListenerContext) IsReady() bool

func (*ListenerContext) SetCondition

func (l *ListenerContext) SetCondition(conditionType v1beta1.ListenerConditionType, status metav1.ConditionStatus, reason v1beta1.ListenerConditionReason, message string)

func (*ListenerContext) SetSupportedKinds

func (l *ListenerContext) SetSupportedKinds(kinds ...v1beta1.RouteGroupKind)

func (*ListenerContext) SetTLSSecret

func (l *ListenerContext) SetTLSSecret(tlsSecret *v1.Secret)

type Resources

type Resources struct {
	Gateways        []*v1beta1.Gateway
	HTTPRoutes      []*v1beta1.HTTPRoute
	ReferenceGrants []*v1alpha2.ReferenceGrant
	Namespaces      []*v1.Namespace
	Services        []*v1.Service
	Secrets         []*v1.Secret
}

Resources holds the Gateway API and related resources that the translators needs as inputs.

func (*Resources) GetNamespace

func (r *Resources) GetNamespace(name string) *v1.Namespace

func (*Resources) GetSecret

func (r *Resources) GetSecret(namespace, name string) *v1.Secret

func (*Resources) GetService

func (r *Resources) GetService(namespace, name string) *v1.Service

type RouteParentContext

type RouteParentContext struct {
	*v1beta1.ParentReference
	// contains filtered or unexported fields
}

RouteParentContext wraps a ParentReference and provides helper methods for setting conditions and other status information on the associated HTTPRoute, etc.

func (*RouteParentContext) IsAccepted

func (r *RouteParentContext) IsAccepted() bool

func (*RouteParentContext) SetCondition

func (r *RouteParentContext) SetCondition(conditionType v1beta1.RouteConditionType, status metav1.ConditionStatus, reason v1beta1.RouteConditionReason, message string)

func (*RouteParentContext) SetListeners

func (r *RouteParentContext) SetListeners(listeners ...*ListenerContext)

type TranslateResult

type TranslateResult struct {
	Gateways   []*v1beta1.Gateway
	HTTPRoutes []*v1beta1.HTTPRoute
	XdsIR      *ir.Xds
	InfraIR    *ir.Infra
}

type Translator

type Translator struct {
	GatewayClassName v1beta1.ObjectName
}

Translator translates Gateway API resources to IRs and computes status for Gateway API resources.

func (*Translator) GetRelevantGateways

func (t *Translator) GetRelevantGateways(gateways []*v1beta1.Gateway) []*GatewayContext

func (*Translator) ProcessHTTPRoutes

func (t *Translator) ProcessHTTPRoutes(httpRoutes []*v1beta1.HTTPRoute, gateways []*GatewayContext, resources *Resources, xdsIR *ir.Xds) []*HTTPRouteContext

func (*Translator) ProcessListeners

func (t *Translator) ProcessListeners(gateways []*GatewayContext, xdsIR *ir.Xds, infraIR *ir.Infra, resources *Resources)

func (*Translator) Translate

func (t *Translator) Translate(resources *Resources) *TranslateResult

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL