krtcollections

package
v1.18.2 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

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

func GetEndpointClusterName(upstream *v1.Upstream) string

TODO: use exported version from translator?

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 EndpointMetadata struct {
	Labels map[string]string
}

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 (EndpointsForUpstream) Equals

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 (EndpointsSettings) ResourceName

func (p EndpointsSettings) ResourceName() string

type FlattenedSyncers

type FlattenedSyncers []krt.Syncer

func (FlattenedSyncers) HasSynced

func (f FlattenedSyncers) HasSynced() bool

func (FlattenedSyncers) WaitUntilSynced

func (f FlattenedSyncers) WaitUntilSynced(stop <-chan struct{}) bool

type GlooResource

type GlooResource interface {
	proto.Message
	interface {
		GetMetadata() *core.Metadata
	}
}

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

type PodLocality struct {
	Region  string
	Zone    string
	Subzone string
}

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 (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.

type UpstreamWrapper

type UpstreamWrapper = ResourceWrapper[*gloov1.Upstream]

UpstreamWrapper provides a keying function for Gloo's `v1.Upstream`

Jump to

Keyboard shortcuts

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