v3

package
v0.0.0-...-39db037 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrRequireFurtherEDS means the translation of Cluster is not complete
	// since it depends on EDS to fetch the load assignment (endpoints).
	// Once this error was given, the Cluster should keep invisible until
	// the EDS config arrived.
	ErrRequireFurtherEDS = errors.New("required further EDS config")
	// ErrFeatureNotSupportedYet means a non-supported feature exists in the
	// xDS resource so the Adaptor goes ahead.
	ErrFeatureNotSupportedYet = errors.New("feature not supported yet")
)

Functions

This section is empty.

Types

type Adaptor

type Adaptor interface {
	// TranslateRouteConfiguration translates a RouteConfiguration to a series APISIX
	// Routes.
	TranslateRouteConfiguration(*routev3.RouteConfiguration, *TranslateOptions) ([]*apisix.Route, error)
	// TranslateCluster translates a Cluster to an APISIX Upstreams.
	TranslateCluster(*clusterv3.Cluster) (*apisix.Upstream, error)
	// TranslateClusterLoadAssignment translate the ClusterLoadAssignement resources to APISIX
	// Upstream Nodes.
	TranslateClusterLoadAssignment(*endpointv3.ClusterLoadAssignment) ([]*apisix.Node, error)
	// CollectRouteNamesAndConfigs collects Rds route names and static route configurations
	// from listener.
	CollectRouteNamesAndConfigs(*listenerv3.Listener) ([]string, []*routev3.RouteConfiguration, error)
}

Adaptor translates xDS resources like Route, Cluster to the equivalent configs in Apache APISIX. WARNING: not all fields are translated, only the necessary parts are used, others can be added in the future.

func NewAdaptor

func NewAdaptor(cfg *config.Config) (Adaptor, error)

NewAdaptor creates a XDS based adaptor.

type TranslateOptions

type TranslateOptions struct {
	// RouteOriginalDestination is a map which key is the name of RouteConfiguration
	// and value is the original destination address that a connection should have
	// to match this route. The original destination just happens to be the address
	// of the listener.
	// This is to obey the xDS specification as route configs are configured on listeners
	// explicitly while there is no listener configuration on APISIX, so this is necessary
	// to avoid the cross-listener-use of routes.
	// An extra `vars` expression will be added only if the listener address can be found here.
	RouteOriginalDestination map[string]string
}

TranslateOptions contains some options to customize the translate process.

Jump to

Keyboard shortcuts

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