Documentation ¶
Index ¶
- func AugmentLabels(locality PodLocality, labels map[string]string)
- func CreateLBEndpoint(address string, port uint32, podLabels map[string]string, enableAutoMtls bool) *envoy_config_endpoint_v3.LbEndpoint
- func GetEndpointClusterName(upstream *v1.Upstream) string
- func NewGlooK8sEndpoints(ctx context.Context, inputs EndpointsInputs) krt.Collection[EndpointsForUpstream]
- func NewLocalityPodsCollection(nodes krt.Collection[NodeMetadata], pods krt.Collection[*corev1.Pod], ...) krt.Collection[LocalityPod]
- func NewNodeMetadataCollection(nodes krt.Collection[*corev1.Node]) krt.Collection[NodeMetadata]
- func NewPodsCollection(ctx context.Context, istioClient kube.Client, dbg *krt.DebugHandler) krt.Collection[LocalityPod]
- type ConnectedClient
- type EndpointMetadata
- type EndpointWithMd
- type EndpointsForUpstream
- type EndpointsInputs
- type EndpointsSettings
- type FlattenedSyncers
- type GlooResource
- type KRTExtensions
- type LocalityLbMap
- type LocalityPod
- type NodeMetadata
- type PodLocality
- type ResourceWrapper
- type UniqlyConnectedClient
- type UniquelyConnectedClientsBulider
- type UpstreamWrapper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AugmentLabels ¶
func AugmentLabels(locality PodLocality, labels map[string]string)
func CreateLBEndpoint ¶
func CreateLBEndpoint(address string, port uint32, podLabels map[string]string, enableAutoMtls bool) *envoy_config_endpoint_v3.LbEndpoint
func GetEndpointClusterName ¶
TODO: use exported version from translator?
func NewGlooK8sEndpoints ¶
func NewGlooK8sEndpoints(ctx context.Context, inputs EndpointsInputs) krt.Collection[EndpointsForUpstream]
func NewLocalityPodsCollection ¶
func NewLocalityPodsCollection(nodes krt.Collection[NodeMetadata], pods krt.Collection[*corev1.Pod], dbg *krt.DebugHandler) krt.Collection[LocalityPod]
func NewNodeMetadataCollection ¶
func NewNodeMetadataCollection(nodes krt.Collection[*corev1.Node]) krt.Collection[NodeMetadata]
func NewPodsCollection ¶
func NewPodsCollection(ctx context.Context, istioClient kube.Client, dbg *krt.DebugHandler) krt.Collection[LocalityPod]
Types ¶
type ConnectedClient ¶
type ConnectedClient struct {
// contains filtered or unexported fields
}
type EndpointMetadata ¶
type EndpointWithMd ¶
type EndpointWithMd struct { *envoy_config_endpoint_v3.LbEndpoint EndpointMd EndpointMetadata }
type EndpointsForUpstream ¶
type EndpointsForUpstream struct { LbEps LocalityLbMap // Note - in theory, cluster name should be a function of the UpstreamRef. // But due to an upstream envoy bug, the cluster name also includes the upstream hash. ClusterName string UpstreamRef types.NamespacedName Port uint32 Hostname string LbEpsEqualityHash uint64 // contains filtered or unexported fields }
func NewEndpointsForUpstream ¶
func NewEndpointsForUpstream(us UpstreamWrapper, logger *zap.Logger) *EndpointsForUpstream
func (*EndpointsForUpstream) Add ¶
func (e *EndpointsForUpstream) Add(l PodLocality, emd EndpointWithMd)
func (EndpointsForUpstream) Equals ¶
func (c EndpointsForUpstream) Equals(in EndpointsForUpstream) bool
func (EndpointsForUpstream) ResourceName ¶
func (c EndpointsForUpstream) ResourceName() string
type EndpointsInputs ¶
type EndpointsInputs struct { Upstreams krt.Collection[UpstreamWrapper] EndpointSlices krt.Collection[*discoveryv1.EndpointSlice] EndpointSlicesByService krt.Index[types.NamespacedName, *discoveryv1.EndpointSlice] Pods krt.Collection[LocalityPod] EndpointsSettings krt.Singleton[EndpointsSettings] Services krt.Collection[*corev1.Service] Debugger *krt.DebugHandler }
func NewGlooK8sEndpointInputs ¶
func NewGlooK8sEndpointInputs( settings krt.Singleton[glookubev1.Settings], istioClient kube.Client, dbg *krt.DebugHandler, pods krt.Collection[LocalityPod], services krt.Collection[*corev1.Service], finalUpstreams krt.Collection[UpstreamWrapper], ) EndpointsInputs
type EndpointsSettings ¶
type EndpointsSettings struct {
EnableAutoMtls bool
}
func (EndpointsSettings) Equals ¶
func (p EndpointsSettings) Equals(in EndpointsSettings) bool
func (EndpointsSettings) ResourceName ¶
func (p EndpointsSettings) ResourceName() string
type FlattenedSyncers ¶
func (FlattenedSyncers) HasSynced ¶
func (f FlattenedSyncers) HasSynced() bool
func (FlattenedSyncers) WaitUntilSynced ¶
func (f FlattenedSyncers) WaitUntilSynced(stop <-chan struct{}) bool
type GlooResource ¶
type KRTExtensions ¶
type KRTExtensions interface { Synced() krt.Syncer Endpoints() []krt.Collection[EndpointsForUpstream] Upstreams() []krt.Collection[UpstreamWrapper] }
KRTExtensions allows appending to the core KRT collections used for XDS.
func Aggregate ¶
func Aggregate( extensions ...KRTExtensions, ) KRTExtensions
Aggregate will append the outputs of each extension
type LocalityLbMap ¶
type LocalityLbMap map[PodLocality][]EndpointWithMd
func (LocalityLbMap) MarshalJSON ¶
func (l LocalityLbMap) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler. for krt.DebugHandler
type LocalityPod ¶
type LocalityPod struct { krt.Named Locality PodLocality AugmentedLabels map[string]string Addresses []string }
func (LocalityPod) Equals ¶
func (c LocalityPod) Equals(in LocalityPod) bool
func (LocalityPod) IP ¶
func (c LocalityPod) IP() string
type NodeMetadata ¶
type NodeMetadata struct {
// contains filtered or unexported fields
}
func (NodeMetadata) Equals ¶
func (c NodeMetadata) Equals(in NodeMetadata) bool
func (NodeMetadata) ResourceName ¶
func (c NodeMetadata) ResourceName() string
type PodLocality ¶
func LocalityFromLabels ¶
func LocalityFromLabels(labels map[string]string) PodLocality
func (PodLocality) String ¶
func (c PodLocality) String() string
type ResourceWrapper ¶
type ResourceWrapper[T GlooResource] struct { Inner T }
func (ResourceWrapper[T]) Equals ¶
func (us ResourceWrapper[T]) Equals(in ResourceWrapper[T]) bool
func (ResourceWrapper[T]) GetMetadata ¶
func (us ResourceWrapper[T]) GetMetadata() *core.Metadata
func (ResourceWrapper[T]) ResourceName ¶
func (us ResourceWrapper[T]) ResourceName() string
func (ResourceWrapper[T]) String ¶
func (us ResourceWrapper[T]) String() string
type UniqlyConnectedClient ¶
type UniqlyConnectedClient struct { Role string Labels map[string]string Locality PodLocality Namespace string // contains filtered or unexported fields }
Certain parts of translation (mainly priority failover) require different translation for different clients (for example, 2 envoys on different AZs). This collection represents the unique clients (envoys) that are connected to the xds server. by unique we mean same namespace, role, labels (which include locality). This collection is populated using xds server callbacks. When an envoy connects to us, we grab it's pod name/namesspace from the requests node->id. We then fetch that pod to get its labels, create a UniqlyConnectedClient and it them to the collection.
func (UniqlyConnectedClient) Equals ¶
func (c UniqlyConnectedClient) Equals(k UniqlyConnectedClient) bool
func (UniqlyConnectedClient) ResourceName ¶
func (c UniqlyConnectedClient) ResourceName() string
type UniquelyConnectedClientsBulider ¶
type UniquelyConnectedClientsBulider func(ctx context.Context, handler *krt.DebugHandler, augmentedPods krt.Collection[LocalityPod]) krt.Collection[UniqlyConnectedClient]
If augmentedPods is nil, we won't use the pod locality info, and all pods for the same gateway will receive the same config.
func NewUniquelyConnectedClients ¶
func NewUniquelyConnectedClients() (xdsserver.Callbacks, UniquelyConnectedClientsBulider)
type UpstreamWrapper ¶
type UpstreamWrapper = ResourceWrapper[*gloov1.Upstream]
UpstreamWrapper provides a keying function for Gloo's `v1.Upstream`