gatewayapi

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

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

	// OwningGatewayNamespaceLabel is the owner reference label used for managed infra.
	// The value should be the namespace of the accepted Envoy Gateway.
	OwningGatewayNamespaceLabel = "gateway.envoyproxy.io/owning-gateway-namespace"

	// OwningGatewayNameLabel is the owner reference label used for managed infra.
	// The value should be the name of the accepted Envoy Gateway.
	OwningGatewayNameLabel = "gateway.envoyproxy.io/owning-gateway-name"
)

Variables

This section is empty.

Functions

func DowngradeRouteParentStatuses

func DowngradeRouteParentStatuses(routeParentStatuses []v1beta1.RouteParentStatus) []v1alpha2.RouteParentStatus

func FromNamespacesPtr

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

func GatewayAddressTypePtr

func GatewayAddressTypePtr(addr v1beta1.AddressType) *v1beta1.AddressType

func GatewayOwnerLabels

func GatewayOwnerLabels(namespace, name string) map[string]string

GatewayOwnerLabels returns the Gateway Owner labels using the provided namespace and name as the values.

func GroupDerefOr

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

func GroupPtr

func GroupPtr(name string) *v1beta1.Group

func GroupPtrV1Alpha2

func GroupPtrV1Alpha2(group string) *v1alpha2.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 KindPtrV1Alpha2

func KindPtrV1Alpha2(kind string) *v1alpha2.Kind

func NamespaceDerefOr

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

func NamespaceDerefOrAlpha

func NamespaceDerefOrAlpha(namespace *v1alpha2.Namespace, defaultNamespace string) string

func NamespacePtr

func NamespacePtr(name string) *v1beta1.Namespace

func NamespacePtrV1Alpha2

func NamespacePtrV1Alpha2(namespace string) *v1alpha2.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 PortNumPtrV1Alpha2

func PortNumPtrV1Alpha2(port int) *v1alpha2.PortNumber

func SectionNamePtr

func SectionNamePtr(name string) *v1beta1.SectionName

func SectionNamePtrV1Alpha2

func SectionNamePtrV1Alpha2(sectionName string) *v1alpha2.SectionName

func StringPtr

func StringPtr(val string) *string

func TLSModeTypePtr

func TLSModeTypePtr(mode v1beta1.TLSModeType) *v1beta1.TLSModeType

func UpgradeParentReference

func UpgradeParentReference(old v1alpha2.ParentReference) v1beta1.ParentReference

UpgradeParentReference converts v1alpha2.ParentReference to v1beta1.ParentReference

func UpgradeParentReferences

func UpgradeParentReferences(old []v1alpha2.ParentReference) []v1beta1.ParentReference

func UpgradeRouteParentStatuses

func UpgradeRouteParentStatuses(routeParentStatuses []v1alpha2.RouteParentStatus) []v1beta1.RouteParentStatus

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

GetListenerContext returns the ListenerContext with listenerName. If the listener exists in the Gateway Spec but NOT yet in the GatewayContext, this creates a new ListenerContext for the listener and attaches it to the GatewayContext.

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) GetHostnames

func (h *HTTPRouteContext) GetHostnames() []string

func (*HTTPRouteContext) GetParentReferences

func (h *HTTPRouteContext) GetParentReferences() []v1beta1.ParentReference

func (*HTTPRouteContext) GetRouteParentContext

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

func (*HTTPRouteContext) GetRouteType

func (h *HTTPRouteContext) GetRouteType() string

type InfraIRMap

type InfraIRMap map[string]*ir.Infra

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) ResetAttachedRoutes

func (l *ListenerContext) ResetAttachedRoutes()

func (*ListenerContext) ResetConditions

func (l *ListenerContext) ResetConditions()

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
	TLSRoutes       []*v1alpha2.TLSRoute
	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 RouteContext

type RouteContext interface {
	client.Object

	// GetRouteType returns the Kind of the Route object, HTTPRoute,
	// TLSRoute, TCPRoute, UDPRoute etc.
	GetRouteType() string

	// TODO: [v1alpha2-v1beta1] This should not be required once all Route
	// objects being implemented are of type v1beta1.
	// GetHostnames returns the hosts targeted by the Route object.
	GetHostnames() []string

	// TODO: [v1alpha2-v1beta1] This should not be required once all Route
	// objects being implemented are of type v1beta1.
	// GetParentReferences returns the ParentReference of the Route object.
	GetParentReferences() []v1beta1.ParentReference

	// GetRouteParentContext returns RouteParentContext by using the Route
	// objects' ParentReference.
	GetRouteParentContext(forParentRef v1beta1.ParentReference) *RouteParentContext
}

RouteContext represents a generic Route object (HTTPRoute, TLSRoute, etc.) that can reference Gateway objects.

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, TLSRoute etc.

func (*RouteParentContext) IsAccepted

func (r *RouteParentContext) IsAccepted(route RouteContext) bool

func (*RouteParentContext) ResetConditions

func (r *RouteParentContext) ResetConditions(route RouteContext)

func (*RouteParentContext) SetCondition

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

func (*RouteParentContext) SetListeners

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

type TLSRouteContext

type TLSRouteContext struct {
	*v1alpha2.TLSRoute
	// contains filtered or unexported fields
}

TLSRouteContext wraps a TLSRoute and provides helper methods for accessing the route's parents.

func (*TLSRouteContext) GetHostnames

func (t *TLSRouteContext) GetHostnames() []string

func (*TLSRouteContext) GetParentReferences

func (t *TLSRouteContext) GetParentReferences() []v1beta1.ParentReference

func (*TLSRouteContext) GetRouteParentContext

func (t *TLSRouteContext) GetRouteParentContext(forParentRef v1beta1.ParentReference) *RouteParentContext

func (*TLSRouteContext) GetRouteType

func (t *TLSRouteContext) GetRouteType() string

type TranslateResult

type TranslateResult struct {
	Gateways   []*v1beta1.Gateway
	HTTPRoutes []*v1beta1.HTTPRoute
	TLSRoutes  []*v1alpha2.TLSRoute
	XdsIR      XdsIRMap
	InfraIR    InfraIRMap
}

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 XdsIRMap) []*HTTPRouteContext

func (*Translator) ProcessListeners

func (t *Translator) ProcessListeners(gateways []*GatewayContext, xdsIR XdsIRMap, infraIR InfraIRMap, resources *Resources)

func (*Translator) ProcessTLSRoutes

func (t *Translator) ProcessTLSRoutes(tlsRoutes []*v1alpha2.TLSRoute, gateways []*GatewayContext, resources *Resources, xdsIR XdsIRMap) []*TLSRouteContext

func (*Translator) Translate

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

type XdsIRMap

type XdsIRMap map[string]*ir.Xds

type XdsIRRoutes

type XdsIRRoutes []*ir.HTTPRoute

func (XdsIRRoutes) Len

func (x XdsIRRoutes) Len() int

func (XdsIRRoutes) Less

func (x XdsIRRoutes) Less(i, j int) bool

func (XdsIRRoutes) Swap

func (x XdsIRRoutes) Swap(i, j int)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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