parser

package
v2.10.4 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2023 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
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
)
View Source
const (
	KindGateway = gatewayv1beta1.Kind("Gateway")
)

Variables

View Source
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

This section is empty.

Types

type FeatureFlags added in v2.10.0

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

	// CombinedServiceRoutes changes the translation logic from the legacy
	// mode which would create a kong.Route object per each individual path on
	// an Ingress object to a mode that can combine routes for paths where the
	// service name, host and port match for those paths.
	CombinedServiceRoutes bool

	// 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

	// 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
}

FeatureFlags are used to control the behavior of the parser.

func NewFeatureFlags added in v2.10.0

func NewFeatureFlags(
	logger logrus.FieldLogger,
	featureGates featuregates.FeatureGates,
	kongVersion semver.Version,
	routerFlavor string,
	updateStatusFlag bool,
) FeatureFlags

type KongConfigBuildingResult added in v2.10.0

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 LicenseGetter added in v2.10.0

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 added in v2.10.0

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 added in v2.10.0

func NewObjectsCollector() *ObjectsCollector

func (*ObjectsCollector) Add added in v2.10.0

func (p *ObjectsCollector) Add(obj client.Object)

Add adds an object to the collector. Noop if the receiver is nil.

func (*ObjectsCollector) Pop added in v2.10.0

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 added in v2.3.0

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 added in v2.3.0

func NewParser(
	logger logrus.FieldLogger,
	storer store.Storer,
	featureFlags FeatureFlags,
	kongVersion semver.Version,
) (*Parser, error)

NewParser produces a new Parser object provided a logging mechanism and a Kubernetes object store.

func (*Parser) BuildKongConfig added in v2.10.0

func (p *Parser) BuildKongConfig() KongConfigBuildingResult

BuildKongConfig creates a Kong configuration from Ingress and Custom resources defined in Kubernetes.

func (*Parser) InjectLicenseGetter added in v2.10.0

func (p *Parser) InjectLicenseGetter(licenseGetter LicenseGetter)

InjectLicenseGetter sets a license getter to be used by the parser.

type SNIs added in v2.8.0

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

func (SNIs) Hosts added in v2.8.0

func (s SNIs) Hosts() []string

func (SNIs) Parents added in v2.8.0

func (s SNIs) Parents() []client.Object

type SecretNameToSNIs

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

func (SecretNameToSNIs) Hosts added in v2.8.0

func (m SecretNameToSNIs) Hosts(secretKey string) []string

func (SecretNameToSNIs) Parents added in v2.8.0

func (m SecretNameToSNIs) Parents(secretKey string) []client.Object

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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