Documentation ¶
Overview ¶
Package translation building block for translation from model to CiliumEnvoyConfig, Service, etc. Translator is the interface to take the model and generate required CiliumEnvoyConfig, LoadBalancer Service, Endpoint, etc.
Additional, this package also contains a bare minimum constructors for common Envoy resources: - Cluster - Listener - HTTP Connection Manager - RouteConfiguration - VirtualHost
Each type of resource can be extended to support more features and use cases with mutation functions.
Index ¶
- func NewHTTPCluster(clusterName string, clusterServiceName string, mutationFunc ...ClusterMutator) (ciliumv2.XDSResource, error)
- func NewHTTPConnectionManager(name, routeName string, mutationFunc ...HttpConnectionManagerMutator) (ciliumv2.XDSResource, error)
- func NewHTTPListener(name string, ciliumSecretNamespace string, tls map[model.TLSSecret][]string, ...) (ciliumv2.XDSResource, error)
- func NewHTTPListenerWithDefaults(name string, ciliumSecretNamespace string, tls map[model.TLSSecret][]string, ...) (ciliumv2.XDSResource, error)
- func NewRouteConfiguration(name string, virtualhosts []*envoy_config_route_v3.VirtualHost, ...) (ciliumv2.XDSResource, error)
- func NewSNIListener(name string, backendsForHost map[string][]string, ...) (ciliumv2.XDSResource, error)
- func NewSNIListenerWithDefaults(name string, backendsForHost map[string][]string, ...) (ciliumv2.XDSResource, error)
- func NewTCPCluster(clusterName string, clusterServiceName string, mutationFunc ...ClusterMutator) (ciliumv2.XDSResource, error)
- func NewTCPClusterWithDefaults(clusterName string, clusterServiceName string, mutationFunc ...ClusterMutator) (ciliumv2.XDSResource, error)
- func NewVirtualHost(httpRoutes []model.HTTPRoute, param VirtualHostParameter, ...) (*envoy_config_route_v3.VirtualHost, error)
- func NewVirtualHostWithDefaults(httpRoutes []model.HTTPRoute, param VirtualHostParameter, ...) (*envoy_config_route_v3.VirtualHost, error)
- type ClusterMutator
- type HttpConnectionManagerMutator
- type ListenerMutator
- type RouteConfigurationMutator
- type SortableRoute
- type Translator
- type VirtualHostMutator
- type VirtualHostParameter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHTTPCluster ¶
func NewHTTPCluster(clusterName string, clusterServiceName string, mutationFunc ...ClusterMutator) (ciliumv2.XDSResource, error)
NewHTTPCluster creates a new Envoy cluster.
func NewHTTPConnectionManager ¶
func NewHTTPConnectionManager(name, routeName string, mutationFunc ...HttpConnectionManagerMutator) (ciliumv2.XDSResource, error)
NewHTTPConnectionManager returns a new HTTP connection manager filter with the given name and route. Mutation functions can be passed to modify the filter based on the caller's needs.
func NewHTTPListener ¶
func NewHTTPListener(name string, ciliumSecretNamespace string, tls map[model.TLSSecret][]string, mutatorFunc ...ListenerMutator) (ciliumv2.XDSResource, error)
NewHTTPListener creates a new Envoy listener with the given name. The listener will have both secure and insecure filters. Secret Discovery Service (SDS) is used to fetch the TLS certificates.
func NewHTTPListenerWithDefaults ¶
func NewHTTPListenerWithDefaults(name string, ciliumSecretNamespace string, tls map[model.TLSSecret][]string, mutatorFunc ...ListenerMutator) (ciliumv2.XDSResource, error)
NewHTTPListenerWithDefaults same as NewListener but with default mutators applied.
func NewRouteConfiguration ¶
func NewRouteConfiguration(name string, virtualhosts []*envoy_config_route_v3.VirtualHost, mutators ...RouteConfigurationMutator) (ciliumv2.XDSResource, error)
NewRouteConfiguration returns a new route configuration for a given list of http routes.
func NewSNIListener ¶
func NewSNIListener(name string, backendsForHost map[string][]string, mutatorFunc ...ListenerMutator) (ciliumv2.XDSResource, error)
NewSNIListener creates a new Envoy listener with the given name. The listener will be configured to use SNI to determine thhe backend
func NewSNIListenerWithDefaults ¶
func NewSNIListenerWithDefaults(name string, backendsForHost map[string][]string, mutatorFunc ...ListenerMutator) (ciliumv2.XDSResource, error)
NewSNIListenerWithDefaults same as NewSNIListener but with default mutators applied.
func NewTCPCluster ¶
func NewTCPCluster(clusterName string, clusterServiceName string, mutationFunc ...ClusterMutator) (ciliumv2.XDSResource, error)
NewTCPCluster creates a new Envoy cluster.
func NewTCPClusterWithDefaults ¶
func NewTCPClusterWithDefaults(clusterName string, clusterServiceName string, mutationFunc ...ClusterMutator) (ciliumv2.XDSResource, error)
NewTCPClusterWithDefaults same as NewTCPCluster but has default mutation functions applied. currently this is only used for TLSRoutes to create a passthrough proxy
func NewVirtualHost ¶
func NewVirtualHost(httpRoutes []model.HTTPRoute, param VirtualHostParameter, mutators ...VirtualHostMutator) (*envoy_config_route_v3.VirtualHost, error)
NewVirtualHost creates a new VirtualHost with the given host and routes.
func NewVirtualHostWithDefaults ¶
func NewVirtualHostWithDefaults(httpRoutes []model.HTTPRoute, param VirtualHostParameter, mutators ...VirtualHostMutator) (*envoy_config_route_v3.VirtualHost, error)
NewVirtualHostWithDefaults is same as NewVirtualHost but with a few default mutator function. If there are multiple http routes having the same path matching (e.g. exact, prefix or regex), the incoming request will be load-balanced to multiple backends equally.
Types ¶
type ClusterMutator ¶
type ClusterMutator func(*envoy_config_cluster_v3.Cluster) *envoy_config_cluster_v3.Cluster
func WithClusterLbPolicy ¶
func WithClusterLbPolicy(lbPolicy int32) ClusterMutator
WithClusterLbPolicy sets the cluster's load balancing policy. https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/upstream/load_balancing/load_balancers
func WithConnectionTimeout ¶
func WithConnectionTimeout(seconds int) ClusterMutator
WithConnectionTimeout sets the cluster's connection timeout.
func WithIdleTimeout ¶
func WithIdleTimeout(seconds int) ClusterMutator
WithIdleTimeout sets the cluster's connection idle timeout.
func WithOutlierDetection ¶
func WithOutlierDetection(splitExternalLocalOriginErrors bool) ClusterMutator
WithOutlierDetection enables outlier detection on the cluster.
type HttpConnectionManagerMutator ¶
type HttpConnectionManagerMutator func(*httpConnectionManagerv3.HttpConnectionManager) *httpConnectionManagerv3.HttpConnectionManager
type ListenerMutator ¶
type ListenerMutator func(*envoy_config_listener.Listener) *envoy_config_listener.Listener
func WithSocketOption ¶
func WithSocketOption(tcpKeepAlive, tcpKeepIdleInSeconds, tcpKeepAliveProbeIntervalInSeconds, tcpKeepAliveMaxFailures int64) ListenerMutator
type RouteConfigurationMutator ¶
type RouteConfigurationMutator func(*envoy_config_route_v3.RouteConfiguration) *envoy_config_route_v3.RouteConfiguration
type SortableRoute ¶
type SortableRoute []*envoy_config_route_v3.Route
SortableRoute is a slice of envoy Route, which can be sorted based on matching order as per Ingress requirement.
- Exact Match must have the highest priority
- If multiple prefix matches are satisfied, the longest path is having higher priority
As Envoy route matching logic is done sequentially, we need to enforce such sorting order.
func (SortableRoute) Len ¶
func (s SortableRoute) Len() int
func (SortableRoute) Less ¶
func (s SortableRoute) Less(i, j int) bool
func (SortableRoute) Swap ¶
func (s SortableRoute) Swap(i, j int)
type Translator ¶
type Translator interface {
Translate(model *model.Model) (*ciliumv2.CiliumEnvoyConfig, *v1.Service, *v1.Endpoints, error)
}
Translator is the interface to take the model and generate required CiliumEnvoyConfig, LoadBalancer Service, Endpoint, etc.
Different use cases (e.g. Ingress, Gateway API) can provide its own generation logic.
func NewTranslator ¶
func NewTranslator(name, namespace, secretsNamespace string, enforceHTTPs bool, hostNameSuffixMatch bool, idleTimeoutSeconds int) Translator
NewTranslator returns a new translator
type VirtualHostMutator ¶
type VirtualHostMutator func(*envoy_config_route_v3.VirtualHost) *envoy_config_route_v3.VirtualHost
func WithMaxStreamDuration ¶
func WithMaxStreamDuration(seconds int64) VirtualHostMutator
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package ingress contains the translation logic from Ingress to CiliumEnvoyConfig and related resources.
|
Package ingress contains the translation logic from Ingress to CiliumEnvoyConfig and related resources. |