egressgateway

package
v1.14.3 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: Apache-2.0 Imports: 37 Imported by: 2

Documentation

Overview

Package egressgateway defines an internal representation of the Cilium Egress Policy. The structures are managed by the Manager.

Index

Constants

This section is empty.

Variables

View Source
var (

	// GatewayNotFoundIPv4 is a special IP value used as gatewayIP in the BPF policy
	// map to indicate no gateway was found for the given policy
	GatewayNotFoundIPv4 = net.ParseIP("0.0.0.0")
	// ExcludedCIDRIPv4 is a special IP value used as gatewayIP in the BPF policy map
	// to indicate the entry is for an excluded CIDR and should skip egress gateway
	ExcludedCIDRIPv4 = net.ParseIP("0.0.0.1")
)
View Source
var Cell = cell.Module(
	"egressgateway",
	"Egress Gateway allows originating traffic from specific IPv4 addresses",
	cell.Config(defaultConfig),
	cell.Provide(NewEgressGatewayManager),
)

Cell provides a Manager for consumption with hive.

Functions

func ParseCEGPConfigID

func ParseCEGPConfigID(cegp *v2.CiliumEgressGatewayPolicy) types.NamespacedName

ParseCEGPConfigID takes a CiliumEgressGatewayPolicy CR and returns only the config id

Types

type Config

type Config struct {
	// Install egress gateway IP rules and routes in order to properly steer
	// egress gateway traffic to the correct ENI interface
	InstallEgressGatewayRoutes bool

	// Default amount of time between triggers of egress gateway state
	// reconciliations are invoked
	EgressGatewayReconciliationTriggerInterval time.Duration
}

func (Config) Flags

func (def Config) Flags(flags *pflag.FlagSet)

type Manager

type Manager struct {
	lock.Mutex
	// contains filtered or unexported fields
}

The egressgateway manager stores the internal data tracking the node, policy, endpoint, and lease mappings. It also hooks up all the callbacks to update egress bpf policy map accordingly.

func NewEgressGatewayManager

func NewEgressGatewayManager(p Params) (*Manager, error)

func (*Manager) OnAddEgressPolicy added in v1.10.6

func (manager *Manager) OnAddEgressPolicy(config PolicyConfig)

OnAddEgressPolicy parses the given policy config, and updates internal state with the config fields.

func (*Manager) OnDeleteEgressPolicy added in v1.10.6

func (manager *Manager) OnDeleteEgressPolicy(configID policyID)

OnDeleteEgressPolicy deletes the internal state associated with the given policy, including egress eBPF map entries.

func (*Manager) OnDeleteEndpoint

func (manager *Manager) OnDeleteEndpoint(endpoint *k8sTypes.CiliumEndpoint)

OnDeleteEndpoint is the event handler for endpoint deletions.

func (*Manager) OnDeleteNode

func (manager *Manager) OnDeleteNode(node nodeTypes.Node)

OnDeleteNode is the event handler for node deletions.

func (*Manager) OnUpdateEndpoint

func (manager *Manager) OnUpdateEndpoint(endpoint *k8sTypes.CiliumEndpoint)

OnUpdateEndpoint is the event handler for endpoint additions and updates.

func (*Manager) OnUpdateNode

func (manager *Manager) OnUpdateNode(node nodeTypes.Node)

OnUpdateNode is the event handler for node additions and updates.

type Params

type Params struct {
	cell.In

	Config            Config
	DaemonConfig      *option.DaemonConfig
	CacheStatus       k8s.CacheStatus
	IdentityAllocator identityCache.IdentityAllocator
	PolicyMap         egressmap.PolicyMap

	Lifecycle hive.Lifecycle
}

type PolicyConfig

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

PolicyConfig is the internal representation of CiliumEgressGatewayPolicy.

func ParseCEGP

func ParseCEGP(cegp *v2.CiliumEgressGatewayPolicy) (*PolicyConfig, error)

ParseCEGP takes a CiliumEgressGatewayPolicy CR and converts to PolicyConfig, the internal representation of the egress gateway policy

Jump to

Keyboard shortcuts

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