Documentation ¶
Index ¶
- Constants
- Variables
- func GenerateKongExpressionRoutesFromGRPCRouteRule(grpcroute *gatewayv1alpha2.GRPCRoute, ruleNumber int) []kongstate.Route
- func GenerateKongExpressionRoutesFromHTTPRouteMatches(translation KongRouteTranslation, ingressObjectInfo util.K8sObjectInfo, ...) ([]kongstate.Route, error)
- func GenerateKongRoutesFromGRPCRouteRule(grpcroute *gatewayv1alpha2.GRPCRoute, ruleNumber int, prependRegexPrefix bool) []kongstate.Route
- func GeneratePluginsFromHTTPRouteFilters(filters []gatewayv1beta1.HTTPRouteFilter, path string, tags []*string) []kong.Plugin
- func MaybePrependRegexPrefix(path, controllerPrefix string, applyLegacyHeuristic bool) string
- func MaybePrependRegexPrefixForIngressV1Fn(ingress *netv1.Ingress, applyLegacyHeuristic bool) func(path string) *string
- func PathsFromIngressPaths(httpIngressPath netv1.HTTPIngressPath, addRegexPrefix bool) []*string
- func PortDefFromIntStr(is intstr.IntOrString) kongstate.PortDef
- func PortDefFromServiceBackendPort(sbp *netv1.ServiceBackendPort) kongstate.PortDef
- func TranslateIngresses(ingresses []*netv1.Ingress, icp v1alpha1.IngressClassParametersSpec, ...) map[string]kongstate.Service
- type KongRouteTranslation
- type KongServiceTranslation
- type TranslateIngressFeatureFlags
- type TranslatedKubernetesObjectsCollector
Constants ¶
const ( // KongPathRegexPrefix is the reserved prefix string that instructs Kong 3.0+ to interpret a path as a regex. KongPathRegexPrefix = "~" // ControllerPathRegexPrefix 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 ¶
var ( NormalIngressExpressionPriority = 1 IngressDefaultBackendPriority = 0 )
Functions ¶
func GenerateKongExpressionRoutesFromGRPCRouteRule ¶ added in v2.10.0
func GenerateKongExpressionRoutesFromGRPCRouteRule(grpcroute *gatewayv1alpha2.GRPCRoute, ruleNumber int) []kongstate.Route
GenerateKongExpressionRoutesFromGRPCRouteRule generates expression based kong routes from a single GRPCRouteRule.
func GenerateKongExpressionRoutesFromHTTPRouteMatches ¶ added in v2.10.0
func GenerateKongExpressionRoutesFromHTTPRouteMatches( translation KongRouteTranslation, ingressObjectInfo util.K8sObjectInfo, hostnames []string, tags []*string, ) ([]kongstate.Route, error)
GenerateKongExpressionRoutesFromHTTPRouteMatches generates Kong routes from HTTPRouteRule pointing to a specific backend.
func GenerateKongRoutesFromGRPCRouteRule ¶ added in v2.10.0
func GeneratePluginsFromHTTPRouteFilters ¶ added in v2.10.0
func GeneratePluginsFromHTTPRouteFilters(filters []gatewayv1beta1.HTTPRouteFilter, path string, tags []*string) []kong.Plugin
GeneratePluginsFromHTTPRouteFilters converts HTTPRouteFilter into Kong plugins. path is the parameter to be used by the redirect plugin, to perform redirection.
func MaybePrependRegexPrefix ¶ added in v2.10.0
MaybePrependRegexPrefix takes a path, controller regex prefix, and a legacy heuristic toggle. It returns the path with the Kong regex path prefix if it either began with the controller prefix or did not, but matched the legacy heuristic, and the heuristic was enabled.
func MaybePrependRegexPrefixForIngressV1Fn ¶ added in v2.10.0
func MaybePrependRegexPrefixForIngressV1Fn(ingress *netv1.Ingress, applyLegacyHeuristic bool) func(path string) *string
MaybePrependRegexPrefixForIngressV1Fn returns a function that prepends a regex prefix to a path for a given netv1.Ingress.
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 TranslateIngresses ¶ added in v2.10.0
func TranslateIngresses( ingresses []*netv1.Ingress, icp v1alpha1.IngressClassParametersSpec, flags TranslateIngressFeatureFlags, translatedObjectsCollector TranslatedKubernetesObjectsCollector, ) map[string]kongstate.Service
TranslateIngresses receives a slice of Kubernetes Ingress objects and produces 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.
type TranslateIngressFeatureFlags ¶ added in v2.10.0
type TranslateIngressFeatureFlags struct { // RegexPathPrefix enables adding the Kong 3.x+ regex path prefix on regex paths generated by the controller // (to satisfy the Ingress Prefix and Exact path types) or indicated by a resource (e.g. when an HTTPRoute uses a // RegularExpression Match). It does _not_ enable heuristic regex path detection for Ingress ImplementationSpecific // paths, which require an IngressClass setting. RegexPathPrefix bool // ExpressionRoutes indicates whether to translate Kubernetes objects to expression based Kong Routes. ExpressionRoutes bool // CombinedServices enables parser to create a single Kong Service when a Kubernetes Service is referenced // by multiple Ingresses. This is effective only when EnableCombinedServiceRoutes is enabled. CombinedServices bool }