remapping

package
v0.11.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package remapping contains the logic to remap the CIDRs in case of repeated ones.

Index

Constants

View Source
const (
	// IPCategoryTargetKey is the key used by the IPAM controller to reconcile only resources related to a group.
	IPCategoryTargetKey = "ipam.liqo.io/ip-category"
	// IPCategoryTargetValueMapping is the value used by the IPAM controller to reconcile only resources related to a group.
	IPCategoryTargetValueMapping = "ip-mapping"

	// FirewallCategoryTargetValueGw is the value used by the firewallconfiguration controller to reconcile only resources related to a gateway.
	FirewallCategoryTargetValueGw = "gateway"
	// FirewallCategoryTargetValueFabric is the value used by the firewallconfiguration controller to reconcile only resources related to fabric.
	FirewallCategoryTargetValueFabric = "fabric"
	// FirewallSubCategoryTargetValueIPMapping is the value used by the firewallconfiguration controller
	// to reconcile only resources related to the IP mapping.
	FirewallSubCategoryTargetValueIPMapping = "ip-mapping"
)

Variables

View Source
var (
	// TablePodCIDRName is the name of the table for the pod CIDR.
	TablePodCIDRName = "remap-podcidr"
	// TableExternalCIDRName is the name of the table for the external CIDR.
	TableExternalCIDRName = "remap-externalcidr"
	// TableIPMappingGwName is the name of the table for the IP mapping.
	TableIPMappingGwName = "remap-ipmapping-gw"
	// TableIPMappingFabricName is the name of the table for the IP mapping.
	TableIPMappingFabricName = "remap-ipmapping-fabric"

	// DNATChainName is the name of the chain for the output traffic.
	DNATChainName = "outgoing"
	// SNATChainName is the name of the chain for the input traffic.
	SNATChainName = "incoming"

	// PreroutingChainName is the name of the chain for the IP mapping.
	PreroutingChainName = "prerouting"
	// PostroutingChainName is the name of the chain for the IP mapping.
	PostroutingChainName = "postrouting"
)

Functions

func CreateOrUpdateNatMappingCIDR

func CreateOrUpdateNatMappingCIDR(ctx context.Context, cl client.Client, opts *Options,
	cfg *networkingv1alpha1.Configuration, scheme *runtime.Scheme, cidrtype CIDRType) error

CreateOrUpdateNatMappingCIDR creates or updates the NAT mapping for a CIDR type.

func CreateOrUpdateNatMappingIP

func CreateOrUpdateNatMappingIP(ctx context.Context, cl client.Client, ip *ipamv1alpha1.IP) error

CreateOrUpdateNatMappingIP creates or updates the NAT mapping for an IP.

func DeleteNatMappingIP

func DeleteNatMappingIP(ctx context.Context, cl client.Client, ip *ipamv1alpha1.IP) error

DeleteNatMappingIP deletes the NAT mapping for an IP.

func ForgeFirewallTargetLabels

func ForgeFirewallTargetLabels(remoteID string) map[string]string

ForgeFirewallTargetLabels returns the labels used by the firewallconfiguration controller to reconcile only resources related to a single gateway.

func ForgeFirewallTargetLabelsIPMappingFabric

func ForgeFirewallTargetLabelsIPMappingFabric() map[string]string

ForgeFirewallTargetLabelsIPMappingFabric returns the labels used by the firewallconfiguration controller to reconcile only resources related to the IP mapping.

func ForgeFirewallTargetLabelsIPMappingGw

func ForgeFirewallTargetLabelsIPMappingGw() map[string]string

ForgeFirewallTargetLabelsIPMappingGw returns the labels used by the firewallconfiguration controller to reconcile only resources related to the IP mapping.

func ForgeIPTargetLabelsMapping

func ForgeIPTargetLabelsMapping() map[string]string

ForgeIPTargetLabelsMapping returns the labels used by the IPAM controller to reconcile only resources related to a single IP.

func GetFirstIPFromMapping

func GetFirstIPFromMapping(ipMapping map[string]networkingv1alpha1.IP) string

GetFirstIPFromMapping returns the first IP from the IP mapping.

Types

type CIDRType

type CIDRType string

CIDRType is the type of the CIDR.

const (
	// PodCIDR is the CIDR type for the pod CIDR.
	PodCIDR CIDRType = "PodCIDR"
	// ExternalCIDR is the CIDR type for the external CIDR.
	ExternalCIDR CIDRType = "ExternalCIDR"
)

type IPReconciler

type IPReconciler struct {
	client.Client
	Scheme *runtime.Scheme
}

IPReconciler manage IP.

func NewIPReconciler

func NewIPReconciler(cl client.Client, s *runtime.Scheme) *IPReconciler

NewIPReconciler returns a new IPReconciler.

func (*IPReconciler) Reconcile

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

Reconcile manage IPs.

func (*IPReconciler) SetupWithManager

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

SetupWithManager register the IPReconciler to the manager.

type Options

type Options struct {
	// DefaultInterfaceName is the name of the interface where the default rout points in main table.
	DefaultInterfaceName string
}

Options contains the options for the remapping controller.

func NewOptions

func NewOptions() (*Options, error)

NewOptions returns a new Options struct.

type RemappingReconciler

type RemappingReconciler struct {
	Client         client.Client
	Scheme         *runtime.Scheme
	EventsRecorder record.EventRecorder
	Options        *Options
}

RemappingReconciler updates the PublicKey resource used to establish the Wireguard configuration.

func NewRemappingReconciler

func NewRemappingReconciler(cl client.Client, s *runtime.Scheme, er record.EventRecorder) (*RemappingReconciler, error)

NewRemappingReconciler returns a new PublicKeysReconciler.

func (*RemappingReconciler) Reconcile

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

Reconcile manage Configuration resources.

func (*RemappingReconciler) SetupWithManager

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

SetupWithManager register the RemappingReconciler to the manager.

Jump to

Keyboard shortcuts

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