intermediate

package
v1.6.1-0...-f207c0f Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackendRef

type BackendRef struct {
	Name
	BackendRef gwtypes.HTTPBackendRef
}

BackendRef represents a backend reference within an HTTPRoute rule. It defines the target backend service that should handle requests matching this reference.

type ControlPlaneRef

type ControlPlaneRef struct {
	Name
	ControlPlaneRef *commonv1alpha1.ControlPlaneRef
}

ControlPlaneRef represents a control plane reference for Kong configuration. It associates Kong entities with their corresponding control plane instance.

type HTTPRouteRepresentation

type HTTPRouteRepresentation struct {
	Rules            map[string]Rule
	Hostnames        map[string]Hostnames
	ControlPlaneRefs map[string]ControlPlaneRef
	ParentRefs       map[string]ParentReference
	StripPath        bool
}

HTTPRouteRepresentation provides an intermediate representation of an HTTPRoute resource. It organizes HTTPRoute data into a structured format that facilitates conversion to Kong entities. This representation includes rules, hostnames, control plane references, parent references, and routing options.

func NewHTTPRouteRepresentation

func NewHTTPRouteRepresentation(route *gwtypes.HTTPRoute) *HTTPRouteRepresentation

NewHTTPRouteRepresentation creates a new HTTPRouteRepresentation from an HTTPRoute resource. It initializes all the internal maps and extracts configuration like strip-path from annotations.

func (*HTTPRouteRepresentation) AddBackenRefForRule

func (t *HTTPRouteRepresentation) AddBackenRefForRule(rName Name, backendRef BackendRef)

AddBackenRefForRule adds a backend reference to a specific rule in the HTTPRoute representation. If the rule doesn't exist, it creates a new rule with the provided name. The backend reference is stored using its name as the key for easy retrieval.

func (*HTTPRouteRepresentation) AddControlPlaneRef

func (t *HTTPRouteRepresentation) AddControlPlaneRef(cpr ControlPlaneRef)

AddControlPlaneRef adds a control plane reference to the HTTPRoute representation. Control plane references associate Kong entities with their corresponding control plane instance.

func (*HTTPRouteRepresentation) AddHostnames

func (t *HTTPRouteRepresentation) AddHostnames(hostnames Hostnames)

AddHostnames adds a hostname to the HTTPRoute representation.

func (*HTTPRouteRepresentation) AddMatchForRule

func (t *HTTPRouteRepresentation) AddMatchForRule(rName Name, match Match)

AddMatchForRule adds a match condition to a specific rule in the HTTPRoute representation. If the rule doesn't exist, it creates a new rule with the provided name. The match is stored using its name as the key for easy retrieval.

func (*HTTPRouteRepresentation) AddParentRef

func (t *HTTPRouteRepresentation) AddParentRef(parentRef ParentReference)

AddParentRef adds a parent reference to the HTTPRoute representation. Parent references define the Gateway or other parent resource that this HTTPRoute is attached to.

func (*HTTPRouteRepresentation) GetControlPlaneRefByName

func (t *HTTPRouteRepresentation) GetControlPlaneRefByName(name Name) *commonv1alpha1.ControlPlaneRef

GetControlPlaneRefByName retrieves a control plane reference by name from the HTTPRoute representation. It normalizes the name by keeping only the parent reference index to ensure proper matching. Returns nil if no control plane reference is found with the given name.

func (*HTTPRouteRepresentation) GetHostnamesByName

func (t *HTTPRouteRepresentation) GetHostnamesByName(name Name) *Hostnames

GetHostnamesByName retrieves hostnames by name from the HTTPRoute representation. Returns nil if no hostnames are found with the given name.

func (*HTTPRouteRepresentation) GetParentRefByName

func (t *HTTPRouteRepresentation) GetParentRefByName(name Name) *gwtypes.ParentReference

GetParentRefByName retrieves a parent reference by name from the HTTPRoute representation. It normalizes the name by keeping only the parent reference index to ensure proper matching. Returns nil if no parent reference is found with the given name.

type Hostnames

type Hostnames struct {
	Name
	Hostnames []string
}

Hostnames represents a collection of hostnames associated with an HTTPRoute.

type Match

type Match struct {
	Name
	Match gwtypes.HTTPRouteMatch
}

Match represents a single HTTPRoute match condition. It contains the match criteria that determine when a request should be processed by this match.

type Name

type Name struct {
	// contains filtered or unexported fields
}

Name represents a structured naming scheme for Kong entities derived from HTTPRoute resources. It provides a hierarchical naming structure with prefix, namespace, name, and optional indexes for parent references, rules, and matches. The String() method ensures names stay within Kubernetes resource name length limits through intelligent truncation.

func NameFromHTTPRoute

func NameFromHTTPRoute(route *gwtypes.HTTPRoute, prefix string, indexes ...int) Name

NameFromHTTPRoute creates a Name instance from an HTTPRoute resource with optional prefix and indexes. The prefix defaults to "httproute" if empty. Indexes are limited to 3 elements maximum. This function is used to generate consistent names for Kong entities derived from HTTPRoute resources.

func (*Name) GetMatchIndex

func (n *Name) GetMatchIndex() int

GetMatchIndex returns the match index from the indexes array. Returns -1 if the Name is nil or if no match index is available.

func (*Name) GetParentRefIndex

func (n *Name) GetParentRefIndex() int

GetParentRefIndex returns the parent reference index from the indexes array. Returns -1 if the Name is nil or if no parent reference index is available.

func (*Name) GetRuleIndex

func (n *Name) GetRuleIndex() int

GetRuleIndex returns the rule index from the indexes array. Returns -1 if the Name is nil or if no rule index is available.

func (*Name) String

func (n *Name) String() string

String returns the full name as a dot-separated string, truncating if necessary to stay within the 253 character limit for Kubernetes resource names. It preserves the prefix and indexes while proportionally truncating namespace and name if needed.

type ParentReference

type ParentReference struct {
	Name
	ParentReference gwtypes.ParentReference
}

ParentReference represents a parent reference in an HTTPRoute. It defines the Gateway or other parent resource that this HTTPRoute is attached to.

type Rule

type Rule struct {
	Name
	Matches     map[string]Match
	BackendRefs map[string]BackendRef
}

Rule represents a single HTTPRoute rule with its associated matches and backend references. It encapsulates the routing logic for a specific rule within an HTTPRoute.

Jump to

Keyboard shortcuts

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