Documentation
      ¶
    
    
  
    
  
    Index ¶
- Constants
 - Variables
 - func GenerateKongRouteFromTranslation(httproute *gatewayapi.HTTPRoute, translation translators.KongRouteTranslation, ...) ([]kongstate.Route, error)
 - type FeatureFlags
 - type KongConfigBuildingResult
 - type KongServicesCache
 - type LicenseGetter
 - type ObjectsCollector
 - type Parser
 - type SNIs
 - type SecretNameToSNIs
 
Constants ¶
const ( // DefaultServiceTimeout indicates the amount of time (by default) for // connections, reads and writes to a service over a network should // be given before timing out by default. DefaultServiceTimeout = 60000 // DefaultRetries indicates the number of times a connection should be // retried by default. DefaultRetries = 5 // DefaultHTTPPort is the network port that should be assumed by default // for HTTP traffic to services. DefaultHTTPPort = 80 )
const (
	KindGateway = gatewayapi.Kind("Gateway")
)
    Variables ¶
var LegacyRegexPathExpression = regexp.MustCompile(`^[a-zA-Z0-9\.\-_~/%]*$`)
    LegacyRegexPathExpression is the regular expression used by Kong <3.0 to determine if a path is not a regex.
Functions ¶
func GenerateKongRouteFromTranslation ¶
func GenerateKongRouteFromTranslation( httproute *gatewayapi.HTTPRoute, translation translators.KongRouteTranslation, expressionRoutes bool, ) ([]kongstate.Route, error)
GenerateKongRouteFromTranslation generates Kong routes from HTTPRoute pointing to a specific backend. It is used for both traditional and expression based routes.
Types ¶
type FeatureFlags ¶
type FeatureFlags struct {
	// ReportConfiguredKubernetesObjects turns on object reporting for this parser:
	// each subsequent call to BuildKongConfig() will track the Kubernetes objects which
	// were successfully parsed.
	ReportConfiguredKubernetesObjects bool
	// ExpressionRoutes indicates whether to translate Kubernetes objects to expression based Kong Routes.
	ExpressionRoutes bool
	// FillIDs enables the parser to fill in the IDs fields of Kong entities - Services, Routes, and Consumers - based
	// on their names. It ensures that IDs remain stable across restarts of the controller.
	FillIDs bool
	// RewriteURIs enables the parser to translate the konghq.com/rewrite annotation to the proper set of Kong plugins.
	RewriteURIs bool
}
    FeatureFlags are used to control the behavior of the parser.
func NewFeatureFlags ¶
func NewFeatureFlags( logger logr.Logger, featureGates featuregates.FeatureGates, routerFlavor string, updateStatusFlag bool, ) FeatureFlags
type KongConfigBuildingResult ¶
type KongConfigBuildingResult struct {
	// KongState is the Kong configuration used to configure the Gateway(s).
	KongState *kongstate.KongState
	// TranslationFailures is a list of resource failures that occurred during parsing.
	// They should be used to provide users with feedback on Kubernetes objects validity.
	TranslationFailures []failures.ResourceFailure
	// ConfiguredKubernetesObjects is a list of Kubernetes objects that were successfully parsed.
	ConfiguredKubernetesObjects []client.Object
}
    KongConfigBuildingResult is a result of Parser.BuildKongConfig method.
type KongServicesCache ¶
KongServicesCache is a cache of Kong Services indexed by their name.
func IngressesV1ToKongServices ¶
func IngressesV1ToKongServices( featureFlags FeatureFlags, ingresses []*netv1.Ingress, icp kongv1alpha1.IngressClassParametersSpec, parsedObjectsCollector *ObjectsCollector, ) KongServicesCache
IngressesV1ToKongServices translates IngressV1 object into Kong Service, returns them indexed by name. Argument parsedObjectsCollector is used to register all successfully parsed objects. In case of a failure, the object is registered in failuresCollector.
type LicenseGetter ¶
type LicenseGetter interface {
	// GetLicense returns an optional license.
	GetLicense() mo.Option[kong.License]
}
    LicenseGetter is an interface for getting the Kong Enterprise license.
type ObjectsCollector ¶
type ObjectsCollector struct {
	// contains filtered or unexported fields
}
    ObjectsCollector collects objects for later use. Its methods are safe to call with a nil receiver.
func NewObjectsCollector ¶
func NewObjectsCollector() *ObjectsCollector
func (*ObjectsCollector) Add ¶
func (p *ObjectsCollector) Add(obj client.Object)
Add adds an object to the collector. Noop if the receiver is nil.
func (*ObjectsCollector) Pop ¶
func (p *ObjectsCollector) Pop() []client.Object
Pop returns the objects collected so far and resets the collector. Returns nil if the receiver is nil.
type Parser ¶
type Parser struct {
	// contains filtered or unexported fields
}
    Parser parses Kubernetes objects and configurations into their equivalent Kong objects and configurations, producing a complete state configuration for the Kong Admin API.
func NewParser ¶
func NewParser( logger logr.Logger, storer store.Storer, featureFlags FeatureFlags, ) (*Parser, error)
NewParser produces a new Parser object provided a logging mechanism and a Kubernetes object store.
func (*Parser) BuildKongConfig ¶
func (p *Parser) BuildKongConfig() KongConfigBuildingResult
BuildKongConfig creates a Kong configuration from Ingress and Custom resources defined in Kubernetes.
func (*Parser) InjectLicenseGetter ¶
func (p *Parser) InjectLicenseGetter(licenseGetter LicenseGetter)
InjectLicenseGetter sets a license getter to be used by the parser.
type SecretNameToSNIs ¶
type SecretNameToSNIs struct {
	// contains filtered or unexported fields
}
    func (SecretNameToSNIs) Hosts ¶
func (m SecretNameToSNIs) Hosts(secretKey string) []string
      
      Source Files
      ¶
    
- backendref.go
 - ingressrules.go
 - objects.go
 - parser.go
 - service_names.go
 - translate_grpcroute.go
 - translate_httproute.go
 - translate_ingress.go
 - translate_kong_l4.go
 - translate_routes_helpers.go
 - translate_secrets.go
 - translate_tcproute.go
 - translate_tlsroute.go
 - translate_udproute.go
 - translate_utils.go
 - translate_vars.go
 - wrappers_refchecker.go