egressselector

package
v0.0.0-...-d88c8b5 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2021 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadEgressSelectorConfiguration

func ReadEgressSelectorConfiguration(configFilePath string) (*apiserver.EgressSelectorConfiguration, error)

ReadEgressSelectorConfiguration reads the egress selector configuration at the specified path. It returns the loaded egress selector configuration if the input file aligns with the required syntax. If it does not align with the provided syntax, it returns a default configuration which should function as a no-op. It does this by returning a nil configuration, which preserves backward compatibility. This works because prior to this there was no egress selector configuration. It returns an error if the file did not exist.

func ValidateEgressSelectorConfiguration

func ValidateEgressSelectorConfiguration(config *apiserver.EgressSelectorConfiguration) field.ErrorList

ValidateEgressSelectorConfiguration checks the apiserver.EgressSelectorConfiguration for common configuration errors. It will return error for problems such as configuring mtls/cert settings for protocol which do not support security. It will also try to catch errors such as incorrect file paths. It will return nil if it does not find anything wrong.

Types

type EgressSelector

type EgressSelector struct {
	// contains filtered or unexported fields
}

EgressSelector is the map of network context type to context dialer, for network egress.

func NewEgressSelector

func NewEgressSelector(config *apiserver.EgressSelectorConfiguration) (*EgressSelector, error)

NewEgressSelector configures lookup mechanism for Lookup. It does so based on a EgressSelectorConfiguration which was read at startup.

func (*EgressSelector) Lookup

func (cs *EgressSelector) Lookup(networkContext NetworkContext) (utilnet.DialFunc, error)

Lookup gets the dialer function for the network context. This is configured for the Kubernetes API Server at startup.

type EgressType

type EgressType int

EgressType is an indicator of which egress selection should be used for sending traffic. See https://github.com/kubernetes/enhancements/blob/master/keps/sig-api-machinery/20190226-network-proxy.md#network-context

const (
	// ControlPlane is the EgressType for traffic intended to go to the control plane.
	ControlPlane EgressType = iota
	// Etcd is the EgressType for traffic intended to go to Kubernetes persistence store.
	Etcd
	// Cluster is the EgressType for traffic intended to go to the system being managed by Kubernetes.
	Cluster
)

func (EgressType) AsNetworkContext

func (s EgressType) AsNetworkContext() NetworkContext

AsNetworkContext is a helper function to make it easy to get the basic NetworkContext objects.

func (EgressType) String

func (s EgressType) String() string

String returns the canonical string representation of the egress type

type Lookup

type Lookup func(networkContext NetworkContext) (utilnet.DialFunc, error)

Lookup is the interface to get the dialer function for the network context.

type NetworkContext

type NetworkContext struct {
	// EgressSelectionName is the unique name of the
	// EgressSelectorConfiguration which determines
	// the network we route the traffic to.
	EgressSelectionName EgressType
}

NetworkContext is the struct used by Kubernetes API Server to indicate where it intends traffic to be sent.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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