Documentation
      ¶
    
    
  
    
  
    Index ¶
- Constants
 - Variables
 - func GenerateKongRouteFromTranslation(httproute *gatewayapi.HTTPRoute, ...) ([]kongstate.Route, error)
 - func GetPermittedForReferenceGrantFrom(from gatewayapi.ReferenceGrantFrom, grants []*gatewayapi.ReferenceGrant) map[gatewayapi.Namespace][]gatewayapi.ReferenceGrantTo
 - type FeatureFlags
 - type KongConfigBuildingResult
 - type ObjectsCollector
 - type SNIs
 - type SchemaServiceProvider
 - type SecretNameToSNIs
 - type Translator
 - type UnavailableSchemaService
 
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 subtranslator.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.
func GetPermittedForReferenceGrantFrom ¶ added in v3.2.0
func GetPermittedForReferenceGrantFrom( from gatewayapi.ReferenceGrantFrom, grants []*gatewayapi.ReferenceGrant, ) map[gatewayapi.Namespace][]gatewayapi.ReferenceGrantTo
GetPermittedForReferenceGrantFrom takes a ReferenceGrant From (a namespace, group, and kind) and returns a map from a namespace to a slice of ReferenceGrant Tos. When a To is included in the slice, the key namespace has a ReferenceGrant with those Tos and the input From.
Types ¶
type FeatureFlags ¶
type FeatureFlags struct {
	// ReportConfiguredKubernetesObjects turns on object reporting for this translator:
	// each subsequent call to BuildKongConfig() will track the Kubernetes objects which
	// were successfully translated.
	ReportConfiguredKubernetesObjects bool
	// ExpressionRoutes indicates whether to translate Kubernetes objects to expression based Kong Routes.
	ExpressionRoutes bool
	// EnterpriseEdition indicates whether to translate objects that are only available in the Kong enterprise edition.
	EnterpriseEdition bool
	// FillIDs enables the translator 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 translator to translate the konghq.com/rewrite annotation to the proper set of Kong plugins.
	RewriteURIs bool
	// KongServiceFacade indicates whether we should support KongServiceFacades as Ingress backends.
	KongServiceFacade bool
	// KongCustomEntity indicates whether we should support translating custom entities from KongCustomEntity CRs.
	KongCustomEntity bool
}
    FeatureFlags are used to control the behavior of the translator.
func NewFeatureFlags ¶
func NewFeatureFlags( featureGates featuregates.FeatureGates, routerFlavor dpconf.RouterFlavor, updateStatusFlag bool, enterpriseEdition 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 translated.
	ConfiguredKubernetesObjects []client.Object
}
    KongConfigBuildingResult is a result of Translator.BuildKongConfig method.
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 SchemaServiceProvider ¶ added in v3.2.0
type SchemaServiceProvider interface {
	GetSchemaService() kong.AbstractSchemaService
}
    SchemaServiceProvider returns a kong schema service required for translating custom entities.
type SecretNameToSNIs ¶
type SecretNameToSNIs struct {
	// contains filtered or unexported fields
}
    func (SecretNameToSNIs) Hosts ¶
func (m SecretNameToSNIs) Hosts(secretKey string) []string
type Translator ¶
type Translator struct {
	// contains filtered or unexported fields
}
    Translator translates Kubernetes objects and configurations into their equivalent Kong objects and configurations, producing a complete state configuration for the Kong Admin API.
func NewTranslator ¶
func NewTranslator( logger logr.Logger, storer store.Storer, workspace string, featureFlags FeatureFlags, schemaServiceProvider SchemaServiceProvider, ) (*Translator, error)
NewTranslator produces a new Translator object provided a logging mechanism and a Kubernetes object store.
func (*Translator) BuildKongConfig ¶
func (t *Translator) BuildKongConfig() KongConfigBuildingResult
BuildKongConfig creates a Kong configuration from Ingress and Custom resources defined in Kubernetes.
func (*Translator) InjectLicenseGetter ¶
func (t *Translator) InjectLicenseGetter(licenseGetter license.Getter)
InjectLicenseGetter sets a license getter to be used by the translator.
func (*Translator) UpdateCache ¶ added in v3.2.0
func (t *Translator) UpdateCache(c store.CacheStores)
UpdateCache updates the store cache used by the translator. This method can be used to swap the cache with another one (e.g. the last valid snapshot).
type UnavailableSchemaService ¶ added in v3.2.0
type UnavailableSchemaService struct{}
    UnavailableSchemaService is a fake schema service used when no gateway admin API clients available. It always returns error in its Get and Validate methods.
      
      Source Files
      ¶
    
- backendref.go
 - ingressrules.go
 - objects.go
 - service_names.go
 - translate_certs.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_upstreams.go
 - translate_utils.go
 - translate_vars.go
 - translator.go