translators

package
v2.9.3 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// KongPathRegexPrefix is the reserved prefix string that instructs Kong 3.0+ to interpret a path as a regex.
	KongPathRegexPrefix = "~"

	// ControllerPathRegePrefix is the prefix string used to indicate that the controller should treat a path as a
	// regular expression. The controller replaces this prefix with KongPathRegexPrefix when sending routes to Kong.
	ControllerPathRegexPrefix = "/~"
)

Variables

This section is empty.

Functions

func PathsFromIngressPaths added in v2.6.0

func PathsFromIngressPaths(httpIngressPath netv1.HTTPIngressPath, addRegexPrefix bool) []*string

PathsFromIngressPaths takes a path and Ingress path type and returns a set of Kong route paths that satisfy that path type. It optionally adds the Kong 3.x regex path prefix for path types that require a regex path. It rejects unknown path types with an error.

func PortDefFromIntStr added in v2.8.1

func PortDefFromIntStr(is intstr.IntOrString) kongstate.PortDef

func PortDefFromServiceBackendPort added in v2.8.1

func PortDefFromServiceBackendPort(sbp *netv1.ServiceBackendPort) kongstate.PortDef

func TranslateIngress

func TranslateIngress(ingress *netv1.Ingress, addRegexPrefix bool) []*kongstate.Service

TranslateIngress receives a Kubernetes ingress object and from it will produce a translated set of kong.Services and kong.Routes which will come wrapped in a kongstate.Service object.

Types

type KongRouteTranslation added in v2.8.0

type KongRouteTranslation struct {
	Name    string
	Matches []gatewayv1beta1.HTTPRouteMatch
	Filters []gatewayv1beta1.HTTPRouteFilter
}

KongRouteTranslation is a translation of a single HTTPRoute rule into metadata that can be used to instantiate Kong routes.

type KongServiceTranslation added in v2.8.0

type KongServiceTranslation struct {
	Name        string
	BackendRefs []gatewayv1beta1.HTTPBackendRef
	KongRoutes  []KongRouteTranslation
}

KongServiceTranslation is a translation of a single HTTPRoute into metadata that can be used to instantiate Kong routes and services. Routes from this object should route traffic to BackendRefs from this object.

func TranslateHTTPRoute added in v2.8.0

func TranslateHTTPRoute(route *gatewayv1beta1.HTTPRoute) []*KongServiceTranslation

TranslateHTTPRoute translates a list of HTTPRoutes into a list of HTTPRouteTranslationMeta objects that can be used to instantiate Kong routes and services. The translation is done by grouping the HTTPRoutes by their backendRefs. This means that all the rules of a single HTTPRoute will be grouped together if they share the same backendRefs.

Jump to

Keyboard shortcuts

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