tunnel

package
v1.15.4 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cell = cell.Module(
	"datapath-tunnel-config",
	"Tunneling configurations",

	cell.Config(userCfg{TunnelProtocol: defaults.TunnelProtocol}),

	cell.Provide(
		newConfig,

		Config.datapathConfigProvider,

		func(dcfg *option.DaemonConfig) EnablerOut {
			return NewEnabler(dcfg.TunnelingEnabled())
		},

		func(dcfg *option.DaemonConfig) EnablerOut {
			return NewEnabler(
				(dcfg.EnableNodePort ||
					dcfg.KubeProxyReplacement == option.KubeProxyReplacementStrict ||
					dcfg.KubeProxyReplacement == option.KubeProxyReplacementTrue) &&
					dcfg.LoadBalancerUsesDSR() &&
					dcfg.LoadBalancerDSRDispatch == option.DSRDispatchGeneve,

				WithoutMTUAdaptation(),
			)
		},

		func(dcfg *option.DaemonConfig) EnablerOut {
			return NewEnabler(dcfg.EnableHighScaleIPcache)
		},
	),
)

Cell is a cell that provides the parameters for the Cilium tunnel, based on user configuration and requests from external modules.

Functions

func WithValidator

func WithValidator(validator func(Protocol) error) enablerOpt

WithValidator allows to register extra validation functions to assert that the configured tunnel protocol matches the one expected by the given feature.

func WithoutMTUAdaptation

func WithoutMTUAdaptation() enablerOpt

WithoutMTUAdaptation conveys that the given feature request to enable tunneling, but the MTU adaptation is already handled externally.

Types

type Config

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

Config represents the materialized tunneling configuration to be used, depending on the user configuration and optional overrides required by additional features.

func NewTestConfig

func NewTestConfig(proto Protocol) Config

NewTestConfig returns a new TunnelConfig for testing purposes.

func (Config) DeviceName

func (cfg Config) DeviceName() string

DeviceName returns the name of the tunnel device (empty if disabled).

func (Config) Port

func (cfg Config) Port() uint16

Port returns the port used by the tunnel (0 if disabled).

func (Config) Protocol

func (cfg Config) Protocol() Protocol

Protocol returns the enabled tunnel protocol. The tunnel protocol may be set to either VXLAN or Geneve even when the primary mode is native routing, in case an additional feature (e.g., egress gateway) may request some traffic to be routed through a tunnel.

func (Config) ShouldAdaptMTU

func (cfg Config) ShouldAdaptMTU() bool

ShouldAdaptMTU returns whether we should adapt the MTU calculation to account for encapsulation.

type EnablerOut

type EnablerOut struct {
	cell.Out
	Enabler enabler `group:"request-enable-tunneling"`
}

EnablerOut allows requesting to enable tunneling functionalities.

func NewEnabler

func NewEnabler(enable bool, opts ...enablerOpt) EnablerOut

NewEnabler returns an object to be injected through hive to request to enable tunneling functionalities. Extra options are meaningful only when enable is set to true, and are ignored otherwise.

type Protocol

type Protocol string

Protocol represents the valid types of encapsulation protocols.

const (
	// VXLAN specifies VXLAN encapsulation
	VXLAN Protocol = "vxlan"

	// Geneve specifies Geneve encapsulation
	Geneve Protocol = "geneve"

	// Disabled specifies to disable encapsulation
	Disabled Protocol = ""
)

func (Protocol) String

func (tp Protocol) String() string

Jump to

Keyboard shortcuts

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