tunneloperator

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 49 Imported by: 0

Documentation

Overview

Package tunneloperator contains the tunnel controller which configures the vpn tunnels, natting rules and routes in order to comunicate with the remote peering clusters and also the natmapping controller that configures nat rules for ExternalCIDR.

Index

Constants

View Source
const ManagedByK8sEndpointsliceControllerValue = "endpointslice-controller.k8s.io"

ManagedByK8sEndpointsliceControllerValue is the label value used to indicate that a given resource is managed by K8s Endpointslice controller.

Variables

This section is empty.

Functions

func EnforceIP added in v0.6.0

func EnforceIP(link netlink.Link, ip string) error

EnforceIP enforce the presence of an ip on an interface.

Types

type LabelerController added in v0.3.0

type LabelerController struct {
	client.Client
	PodIP string
}

LabelerController reconciles pods objects, in our case the tunnel operator pods.

func NewLabelerController added in v0.3.0

func NewLabelerController(podIP string, cl client.Client) *LabelerController

NewLabelerController returns a new controller ready to be setup and started with the controller manager.

func (*LabelerController) Reconcile added in v0.3.0

func (lbc *LabelerController) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile for a given pod, replica of the current operator, it checks if it is the current pod meaning the pod where this code is running. If it is our pod, it checks that it is labels as the active replica of the gateway. It ensures that the label "net.liqo.io/gateway=active" is present. If the pod is not the current one, we make sure that the pod has the label "net.liqo.io/gateway=standby".

func (*LabelerController) SetupWithManager added in v0.3.0

func (lbc *LabelerController) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager used to set up the controller with a given manager.

type NatMappingController added in v0.3.0

type NatMappingController struct {
	client.Client
	iptables.IPTHandler
	// contains filtered or unexported fields
}

NatMappingController reconciles a NatMapping object.

func NewNatMappingController added in v0.3.0

func NewNatMappingController(cl client.Client, readyClustersMutex *sync.Mutex,
	readyClusters map[string]struct{}, gatewayNetns ns.NetNS) (*NatMappingController, error)

NewNatMappingController returns a NAT mapping controller istance.

func (*NatMappingController) Reconcile added in v0.3.0

func (npc *NatMappingController) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile function handles requests made on NatMapping resource by guaranteeing the proper set of DNAT rules are updated.

func (*NatMappingController) SetupWithManager added in v0.3.0

func (npc *NatMappingController) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type OffloadedPodController added in v0.10.0

type OffloadedPodController struct {
	client.Client
	liqoiptables.IPTHandler
	*liqoipset.IPSHandler
	// contains filtered or unexported fields
}

OffloadedPodController reconciles an offloaded Pod object.

func NewOffloadedPodController added in v0.10.0

func NewOffloadedPodController(cl client.Client, gatewayNetns ns.NetNS, podsInfo, endpointslicesInfo *sync.Map) (*OffloadedPodController, error)

NewOffloadedPodController instantiates and initializes the offloaded pod controller.

func (*OffloadedPodController) Reconcile added in v0.10.0

func (r *OffloadedPodController) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile pods offloaded from other clusters to the local one.

func (*OffloadedPodController) SetupWithManager added in v0.10.0

func (r *OffloadedPodController) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type ReflectedEndpointsliceController added in v0.10.0

type ReflectedEndpointsliceController struct {
	client.Client
	liqoiptables.IPTHandler
	Scheme *runtime.Scheme

	*liqoipset.IPSHandler
	// contains filtered or unexported fields
}

ReflectedEndpointsliceController reconciles an offloaded Service object.

func NewReflectedEndpointsliceController added in v0.10.0

func NewReflectedEndpointsliceController(
	cl client.Client,
	scheme *runtime.Scheme,
	gatewayNetns ns.NetNS,
	podsInfo, endpointslicesInfo *sync.Map,
) (*ReflectedEndpointsliceController, error)

NewReflectedEndpointsliceController instantiates and initializes the reflected endpointslice controller.

func (*ReflectedEndpointsliceController) Reconcile added in v0.10.0

Reconcile local endpointslices that are also reflected on remote clusters as a result of offloading.

func (*ReflectedEndpointsliceController) SetupWithManager added in v0.10.0

func (r *ReflectedEndpointsliceController) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type TunnelController

type TunnelController struct {
	client.Client
	record.EventRecorder
	tunnel.Driver
	liqorouting.Routing
	iptables.IPTHandler
	// contains filtered or unexported fields
}

TunnelController type of the tunnel controller.

func NewTunnelController

func NewTunnelController(ctx context.Context, wg *sync.WaitGroup,
	podIP, namespace string, er record.EventRecorder, k8sClient k8s.Interface, cl client.Client,
	readyClustersMutex *sync.Mutex, readyClusters map[string]struct{}, gatewayNetns, hostNetns ns.NetNS, mtu, port int,
	updateStatusInterval time.Duration, securityMode liqoconst.SecurityModeType) (*TunnelController, error)

NewTunnelController instantiates and initializes the tunnel controller.

func (*TunnelController) CleanUpConfiguration added in v0.3.0

func (tc *TunnelController) CleanUpConfiguration(netnsName string)

CleanUpConfiguration removes the veth pair existing in the host network and then removes the custom network namespace.

func (*TunnelController) EnsureIPTablesRulesPerCluster

func (tc *TunnelController) EnsureIPTablesRulesPerCluster(tep *netv1alpha1.TunnelEndpoint) error

EnsureIPTablesRulesPerCluster ensures the iptables rules needed to configure the network for a given remote cluster.

func (*TunnelController) Reconcile

func (tc *TunnelController) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile reconciles requests occurred on TunnelEndpoint objects.

func (*TunnelController) RemoveAllTunnels

func (tc *TunnelController) RemoveAllTunnels()

RemoveAllTunnels used to remove all the tunnel interfaces when the controller is closed. It does not return an error, but just logs them, cause we can not recover from them at exit time.

func (*TunnelController) SetUpIPTablesHandler

func (tc *TunnelController) SetUpIPTablesHandler() error

SetUpIPTablesHandler initializes the IPTables handler of TunnelController.

func (*TunnelController) SetUpRouteManager

func (tc *TunnelController) SetUpRouteManager() error

SetUpRouteManager initializes the Route manager of TunnelController.

func (*TunnelController) SetUpTunnelDrivers

func (tc *TunnelController) SetUpTunnelDrivers(config tunnel.Config) error

SetUpTunnelDrivers for each registered tunnel implementation it creates and initializes the driver.

func (*TunnelController) SetupSignalHandlerForTunnelOperator

func (tc *TunnelController) SetupSignalHandlerForTunnelOperator(ctx context.Context, wg *sync.WaitGroup) context.Context

SetupSignalHandlerForTunnelOperator registers for SIGTERM, SIGINT, SIGKILL. A context is returned which is closed on one of these signals.

func (*TunnelController) SetupWithManager

func (tc *TunnelController) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager configures the current controller to be managed by the given manager.

Jump to

Keyboard shortcuts

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