backend

package
v2.5.5 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("backend not found")

Functions

func GetTrafficProxyNodeSelector

func GetTrafficProxyNodeSelector(tgb *elbv2api.TargetGroupBinding) (labels.Selector, error)

GetTrafficProxyNodeSelector returns the trafficProxy node label selector for specific targetGroupBinding.

func IsNodeSuitableAsTrafficProxy

func IsNodeSuitableAsTrafficProxy(node *corev1.Node) bool

IsNodeSuitableAsTrafficProxy check whether node is suitable as a traffic proxy. This should be checked in additional to the nodeSelector defined in TargetGroupBinding.

func NewDefaultEndpointResolver

func NewDefaultEndpointResolver(k8sClient client.Client, podInfoRepo k8s.PodInfoRepo, failOpenEnabled bool, endpointSliceEnabled bool, logger logr.Logger) *defaultEndpointResolver

NewDefaultEndpointResolver constructs new defaultEndpointResolver

Types

type EndpointResolveOption

type EndpointResolveOption func(opts *EndpointResolveOptions)

func WithNodeSelector

func WithNodeSelector(nodeSelector labels.Selector) EndpointResolveOption

WithNodeSelector is a option that sets nodeSelector.

func WithPodReadinessGate

func WithPodReadinessGate(cond corev1.PodConditionType) EndpointResolveOption

WithPodReadinessGate is a option that appends podReadinessGate into EndpointResolveOptions.

type EndpointResolveOptions

type EndpointResolveOptions struct {
	// [NodePort Endpoint] only nodes that are matched by nodeSelector will be included.
	// By default, no node will be selected.
	NodeSelector labels.Selector

	// [Pod Endpoint] if pod readinessGates is defined, then pods from unready addresses with any of these readinessGates and containersReady condition will be included as well.
	// By default, no readinessGate is specified.
	PodReadinessGates []corev1.PodConditionType
}

options for Endpoints resolve APIs

func (*EndpointResolveOptions) ApplyOptions

func (opts *EndpointResolveOptions) ApplyOptions(options []EndpointResolveOption)

type EndpointResolver

type EndpointResolver interface {
	// ResolvePodEndpoints will resolve endpoints backed by pods directly.
	// returns resolved podEndpoints and whether there are unready endpoints that can potentially turn ready in future reconciles.
	ResolvePodEndpoints(ctx context.Context, svcKey types.NamespacedName, port intstr.IntOrString,
		opts ...EndpointResolveOption) ([]PodEndpoint, bool, error)

	// ResolveNodePortEndpoints will resolve endpoints backed by nodePort.
	ResolveNodePortEndpoints(ctx context.Context, svcKey types.NamespacedName, port intstr.IntOrString,
		opts ...EndpointResolveOption) ([]NodePortEndpoint, error)
}

EndpointResolver resolves the endpoints for specific service & service Port.

type EndpointsData

type EndpointsData struct {
	Ports     []discv1.EndpointPort
	Endpoints []discv1.Endpoint
}

type NodePortEndpoint

type NodePortEndpoint struct {
	// Node's instanceID.
	InstanceID string
	// Node's NodePort.
	Port int64
	// Node that provides this endpoint.
	Node *corev1.Node
}

An endpoint provided by nodePort as traffic proxy.

type PodEndpoint

type PodEndpoint struct {
	// Pod's IP.
	IP string
	// Pod's container port.
	Port int64
	// Pod that provides this endpoint.
	Pod k8s.PodInfo
}

An endpoint provided by pod directly.

Jump to

Keyboard shortcuts

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