Documentation ¶
Overview ¶
Package glue glues Kubernetes to Envoy
Index ¶
- Variables
- type ClusterConfig
- func (c *ClusterConfig) ApplyOverride(cluster *envoy_config_cluster_v3.Cluster, svc *v1.Service, ...) *envoy_config_cluster_v3.Cluster
- func (c *ClusterConfig) ClustersFromService(svc *v1.Service) []*envoy_config_cluster_v3.Cluster
- func (c *ClusterConfig) GetBaseConfig() *envoy_config_cluster_v3.Cluster
- func (c *ClusterConfig) Store(s *cds.Server) *ClusterStore
- func (c *ClusterConfig) UnmarshalJSON(b []byte) error
- type ClusterOverride
- type ClusterStore
- func (cs *ClusterStore) Add(obj interface{}) error
- func (cs *ClusterStore) Delete(obj interface{}) error
- func (cs *ClusterStore) Get(obj interface{}) (item interface{}, exists bool, err error)
- func (cs *ClusterStore) GetByKey(key string) (item interface{}, exists bool, err error)
- func (cs *ClusterStore) List() []interface{}
- func (cs *ClusterStore) ListKeys() []string
- func (cs *ClusterStore) Replace(objs []interface{}, _ string) error
- func (cs *ClusterStore) Resync() error
- func (cs *ClusterStore) Update(obj interface{}) error
- type Config
- type EndpointConfig
- type EndpointStore
- func (s *EndpointStore) Add(obj interface{}) error
- func (s *EndpointStore) Delete(obj interface{}) error
- func (s *EndpointStore) Get(obj interface{}) (item interface{}, exists bool, err error)
- func (s *EndpointStore) GetByKey(key string) (item interface{}, exists bool, err error)
- func (s *EndpointStore) List() []interface{}
- func (s *EndpointStore) ListKeys() []string
- func (s *EndpointStore) Replace(objs []interface{}, _ string) error
- func (s *EndpointStore) Resync() error
- func (s *EndpointStore) Update(obj interface{}) error
- type Field
- type LocalityConfig
- type Matcher
Constants ¶
This section is empty.
Variables ¶
var ( // Logger is the default logger for glue events; for extreme debugging, you can overwrite this. Logger = zap.NewNop() )
Functions ¶
This section is empty.
Types ¶
type ClusterConfig ¶
type ClusterConfig struct { // The base configuration that should be used for all clusters. BaseConfig *envoy_config_cluster_v3.Cluster `json:"base"` // Any rule-based overrides. Overrides []*ClusterOverride `json:"overrides"` }
ClusterConfig configures creation of Envoy clusters from Kubernetes services.
func (*ClusterConfig) ApplyOverride ¶
func (c *ClusterConfig) ApplyOverride(cluster *envoy_config_cluster_v3.Cluster, svc *v1.Service, port *v1.ServicePort) *envoy_config_cluster_v3.Cluster
ApplyOverride returns the cluster after applying any configured overrides. It will return nil if the cluster is suppressed.
func (*ClusterConfig) ClustersFromService ¶
func (c *ClusterConfig) ClustersFromService(svc *v1.Service) []*envoy_config_cluster_v3.Cluster
ClustersFromService translates a Kubernetes service into a set of Envoy clusters according to the config (1 cluster per service port).
func (*ClusterConfig) GetBaseConfig ¶
func (c *ClusterConfig) GetBaseConfig() *envoy_config_cluster_v3.Cluster
Base returns a deep copy of the base cluster configuration.
func (*ClusterConfig) Store ¶
func (c *ClusterConfig) Store(s *cds.Server) *ClusterStore
Store returns a cache.Store that allows a Kubernetes reflector to sync service changes to a CDS server.
func (*ClusterConfig) UnmarshalJSON ¶
func (c *ClusterConfig) UnmarshalJSON(b []byte) error
type ClusterOverride ¶
type ClusterOverride struct { // Match specifies a cluster to match; multiple items are OR'd. Match []*Matcher // Configuration to override if a matcher matches. Override *envoy_config_cluster_v3.Cluster // If true, suppress the cluster completely. Suppress bool }
func (*ClusterOverride) UnmarshalJSON ¶
func (o *ClusterOverride) UnmarshalJSON(b []byte) error
type ClusterStore ¶
type ClusterStore struct {
// contains filtered or unexported fields
}
ClusterStore is a cache.Store that receives updates about the status of Kubernetes services, translates the services to Envoy cluster objects with the provided config, and reports those clusters to the xDS server.
func (*ClusterStore) Add ¶
func (cs *ClusterStore) Add(obj interface{}) error
func (*ClusterStore) Delete ¶
func (cs *ClusterStore) Delete(obj interface{}) error
func (*ClusterStore) Get ¶
func (cs *ClusterStore) Get(obj interface{}) (item interface{}, exists bool, err error)
func (*ClusterStore) GetByKey ¶
func (cs *ClusterStore) GetByKey(key string) (item interface{}, exists bool, err error)
func (*ClusterStore) List ¶
func (cs *ClusterStore) List() []interface{}
func (*ClusterStore) ListKeys ¶
func (cs *ClusterStore) ListKeys() []string
func (*ClusterStore) Replace ¶
func (cs *ClusterStore) Replace(objs []interface{}, _ string) error
func (*ClusterStore) Resync ¶
func (cs *ClusterStore) Resync() error
func (*ClusterStore) Update ¶
func (cs *ClusterStore) Update(obj interface{}) error
type Config ¶
type Config struct { // The API version of this config file; not related to the Envoy dataplane API version. APIVersion string `json:"apiVersion"` // Configuration for converting services to clusters. ClusterConfig *ClusterConfig `json:"cluster_config"` // Configuration for converting endpoints to cluster load assignments. EndpointConfig *EndpointConfig `json:"endpoint_config"` }
Config configures how to turn k8s resources into Envoy Clusters and ClusterLoadAssignments.
func DefaultConfig ¶
func DefaultConfig() *Config
func LoadConfig ¶
type EndpointConfig ¶
type EndpointConfig struct { IncludeNotReady bool `json:"include_not_ready"` Locality *LocalityConfig `json:"locality"` }
EndpointConfig configures creation of Envoy cluster load assignments from Kubernetes endpoints.
func (*EndpointConfig) LoadAssignmentsFromEndpointSlices ¶
func (c *EndpointConfig) LoadAssignmentsFromEndpointSlices(nodeStore cache.Store, endpointSlices []*discoveryv1.EndpointSlice) []*envoy_config_endpoint_v3.ClusterLoadAssignment
LoadAssignmentFromEndpoints translates a Kubernetes endpoints object into a set of Envoy ClusterLoadAssignments.
func (*EndpointConfig) Store ¶
func (c *EndpointConfig) Store(nodeStore cache.Store, s *cds.Server) *EndpointStore
Store returns a cache.Store that allows a Kubernetes reflector to sync endpoint changes to an EDS server.
type EndpointStore ¶
type EndpointStore struct {
// contains filtered or unexported fields
}
EndpointStore is a cache.Store that receives endpoints and converts them to ClusterLoadAssignment objects for EDS.
func (*EndpointStore) Add ¶
func (s *EndpointStore) Add(obj interface{}) error
func (*EndpointStore) Delete ¶
func (s *EndpointStore) Delete(obj interface{}) error
func (*EndpointStore) Get ¶
func (s *EndpointStore) Get(obj interface{}) (item interface{}, exists bool, err error)
func (*EndpointStore) GetByKey ¶
func (s *EndpointStore) GetByKey(key string) (item interface{}, exists bool, err error)
func (*EndpointStore) List ¶
func (s *EndpointStore) List() []interface{}
func (*EndpointStore) ListKeys ¶
func (s *EndpointStore) ListKeys() []string
func (*EndpointStore) Replace ¶
func (s *EndpointStore) Replace(objs []interface{}, _ string) error
func (*EndpointStore) Resync ¶
func (s *EndpointStore) Resync() error
func (*EndpointStore) Update ¶
func (s *EndpointStore) Update(obj interface{}) error
type Field ¶
type Field struct { Literal string `json:"literal"` // Specify a literal string to use. Label string `json:"label"` // Select the value of the named label. UseHostname bool `json:"use_hostname"` // If true, use the hostname as the value of the field. }
Field specifies a value to be selected from a Kubernetes resource.
A non-empty Literal will override any Label selector.
type LocalityConfig ¶
type LocalityConfig struct { RegionFrom *Field `json:"region_from"` ZoneFrom *Field `json:"zone_from"` SubZoneFrom *Field `json:"sub_zone_from"` }
LocalityConfig configures how to determine the locality of an endpoint.
func (*LocalityConfig) LocalitiesAsYAML ¶
func (l *LocalityConfig) LocalitiesAsYAML(nodes cache.Store) ([]byte, error)
LocalitiesAsYAML returns a YAML string showing the configured locality for every node in the provided cache.Store.
func (*LocalityConfig) LocalityFromHost ¶
func (l *LocalityConfig) LocalityFromHost(hosts cache.Store, hostname string) *envoy_config_core_v3.Locality
LocalityFromHost returns a locality record for the provided host, looking in the cache.Store for a v1.Node object that matches the hostname. It returns an empty, non-nil, Locality if there is no way to determine the actual locality.
type Matcher ¶
type Matcher struct { // ClusterName matches the mangled name of a cluster (not the original service name). // // The mangled name is <namespace>:<service name>:<port name or number>[:udp]. ClusterName string `json:"cluster_name"` // PortName matches the name of a port. This exists so that if you have good port naming // hygiene, more configurations can be auto-generated. For example, you could apply // "http2_protocol_options: {}" to all ports named http2. // // You cannot match an unnamed port with an empty port_name. PortName string `json:"port_name"` }
A matcher selects a cluster based on the current state of the generated Cluster object, the and Kubernetes service + port that the Cluster is being created for.
func (*Matcher) Evaluate ¶
func (m *Matcher) Evaluate(cluster *envoy_config_cluster_v3.Cluster, svc *v1.Service, port *v1.ServicePort) bool
Evaluate returns true if the matcher matches the provided objects.