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.
Additionally, 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 ¶
- Constants
- func ParseNodeLabelSelector(nodeLabelSelectorString string) *slim_metav1.LabelSelector
- type CECTranslator
- type ClusterConfig
- type ClusterMutator
- type Config
- type HTTPVersionType
- type HostNetworkConfig
- type HttpConnectionManagerMutator
- type IPConfig
- type ListenerConfig
- type ListenerMutator
- type OriginalIPDetectionConfig
- type RouteConfig
- type RouteConfigurationMutator
- type ServiceConfig
- type SortableRoute
- type Translator
- type VirtualHostMutator
- type VirtualHostParameter
Constants ¶
const ( AppProtocolH2C = "kubernetes.io/h2c" AppProtocolWS = "kubernetes.io/ws" AppProtocolWSS = "kubernetes.io/wss" )
Variables ¶
This section is empty.
Functions ¶
func ParseNodeLabelSelector ¶ added in v1.16.0
func ParseNodeLabelSelector(nodeLabelSelectorString string) *slim_metav1.LabelSelector
ParseNodeLabelSelector parses a given string representation of a label selector into a metav1.LabelSelector. The representation is a comma-separated list of key-value pairs (key1=value1,key2=value2) that is used as MatchLabels. Values not matching these rules are skipped.
Types ¶
type CECTranslator ¶ added in v1.16.0
type CECTranslator interface { // Translate translates the model to CiliumEnvoyConfig. Translate(namespace string, name string, model *model.Model) (*ciliumv2.CiliumEnvoyConfig, error) }
CECTranslator is the interface to take the model and generate required CiliumEnvoyConfig. It might be used as the base for other Translator implementations.
func NewCECTranslator ¶ added in v1.16.0
func NewCECTranslator(config Config) CECTranslator
NewCECTranslator returns a new translator
type ClusterConfig ¶
type ClusterMutator ¶
type ClusterMutator func(*envoy_config_cluster_v3.Cluster) *envoy_config_cluster_v3.Cluster
type Config ¶
type Config struct { SecretsNamespace string `json:"secrets_namespace,omitempty"` ServiceConfig ServiceConfig `json:"service_config"` HostNetworkConfig HostNetworkConfig `json:"host_network_config"` IPConfig IPConfig `json:"ip_config"` ListenerConfig ListenerConfig `json:"listener_config"` ClusterConfig ClusterConfig `json:"cluster_config"` RouteConfig RouteConfig `json:"route_config"` OriginalIPDetectionConfig OriginalIPDetectionConfig `json:"original_ip_detection_config"` }
type HTTPVersionType ¶ added in v1.15.0
type HTTPVersionType int
const ( HTTPVersionDownstream HTTPVersionType = -1 HTTPVersionAuto HTTPVersionType = 0 HTTPVersion1 HTTPVersionType = 1 HTTPVersion2 HTTPVersionType = 2 HTTPVersion3 HTTPVersionType = 3 )
type HostNetworkConfig ¶
type HostNetworkConfig struct { Enabled bool `json:"enabled,omitempty"` NodeLabelSelector *slim_metav1.LabelSelector `json:"node_label_selector,omitempty"` }
type HttpConnectionManagerMutator ¶
type HttpConnectionManagerMutator func(*httpConnectionManagerv3.HttpConnectionManager) *httpConnectionManagerv3.HttpConnectionManager
func WithInternalAddressConfig ¶ added in v1.14.19
func WithInternalAddressConfig(enableIpv4, enableIpv6 bool) HttpConnectionManagerMutator
type ListenerConfig ¶
type ListenerMutator ¶
type ListenerMutator func(*envoy_config_listener.Listener) *envoy_config_listener.Listener
func WithStreamIdleTimeout ¶
func WithStreamIdleTimeout(streamIdleTimeoutSeconds int) ListenerMutator
type RouteConfig ¶
type RouteConfig struct { // hostNameSuffixMatch is a flag to control whether the host name suffix match. // Hostnames that are prefixed with a wildcard label (`*.`) are interpreted // as a suffix match. That means that a match for `*.example.com` would match // both `test.example.com`, and `foo.test.example.com`, but not `example.com`. HostNameSuffixMatch bool `json:"host_name_suffix_match,omitempty"` }
type RouteConfigurationMutator ¶
type RouteConfigurationMutator func(*envoy_config_route_v3.RouteConfiguration) *envoy_config_route_v3.RouteConfiguration
type ServiceConfig ¶
type ServiceConfig struct {
ExternalTrafficPolicy string `json:"external_traffic_policy,omitempty"`
}
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.
The sorting order is as follows, continuing on ties, and also noting that when Exact, Regex, or Prefix matches are unset, their length is zero:
- Exact Match length
- Regex Match length
- Prefix match length
- Method match
- Number of header matches
- Number of query parameter matches
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, *corev1.Service, *corev1.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.
type VirtualHostMutator ¶
type VirtualHostMutator func(*envoy_config_route_v3.VirtualHost) *envoy_config_route_v3.VirtualHost
type VirtualHostParameter ¶
VirtualHostParameter is the parameter for NewVirtualHost
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. |