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 ¶
- Variables
- type LabelerController
- type NatMappingController
- type TunnelController
- func (tc *TunnelController) CleanUpConfiguration(netnsName string)
- func (tc *TunnelController) EnsureIPTablesRulesPerCluster(tep *netv1alpha1.TunnelEndpoint) error
- func (tc *TunnelController) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
- func (tc *TunnelController) RemoveAllTunnels()
- func (tc *TunnelController) SetUpIPTablesHandler() error
- func (tc *TunnelController) SetUpRouteManager() error
- func (tc *TunnelController) SetUpTunnelDrivers(config tunnel.Config) error
- func (tc *TunnelController) SetupSignalHandlerForTunnelOperator() context.Context
- func (tc *TunnelController) SetupWithManager(mgr ctrl.Manager) error
Constants ¶
This section is empty.
Variables ¶
var ( // LabelSelector instructs the informer to only cache the pod objects that satisfy the selector. // Only the pod objects with the right labels will be reconciled. LabelSelector = cache.SelectorsByObject{ &corev1.Pod{}: { Label: labels.SelectorFromSet(labels.Set{ podComponentLabelKey: podComponentLabelValue, podNameLabelKey: podNameLabelValue, }), }, } )
Functions ¶
This section is empty.
Types ¶
type LabelerController ¶ added in v0.3.0
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
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 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(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) (*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 ¶
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() 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.