natmappinginflater

package
v0.5.0-beta.4 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package natmappinginflater contains the NatMappingInflater, an object in charge of notify the Gateway component that a NAT mapping has to be carried out.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ForgeNatMapping

func ForgeNatMapping(clusterID, podCIDR, externalCIDR string, mappings map[string]string) (*unstructured.Unstructured, error)

ForgeNatMapping forges a NatMapping resource for a cluster received as parameter.

Types

type Interface

type Interface interface {
	// InitNatMappingsPerCluster does everything necessary to set up NAT mappings for a remote cluster.
	// podCIDR is the network used for remote pods in the local cluster:
	// it can be either the RemotePodCIDR or the RemoteNATPodCIDR.
	// externalCIDR is the ExternalCIDR used in the remote cluster for local exported resources:
	// it can be either the LocalExternalCIDR or the LocalNATExternalCIDR.
	InitNatMappingsPerCluster(podCIDR, externalCIDR, clusterID string) error
	// TerminateNatMappingsPerCluster frees/deletes resources allocated for remote cluster.
	TerminateNatMappingsPerCluster(clusterID string) error
	// GetNatMappings returns the set of mappings related to a remote cluster.
	GetNatMappings(clusterID string) (map[string]string, error)
	// AddMapping adds a NAT mapping.
	AddMapping(oldIP, newIP, clusterID string) error
	// RemoveMapping removes a NAT mapping.
	RemoveMapping(oldIP, clusterID string) error
}

Interface is the interface to be implemented for managing NAT mappings for a remote cluster.

type NatMappingInflater

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

NatMappingInflater is an implementation of the NatMappingInflaterInterface that makes use of a CR, called NatMapping.

func NewInflater

func NewInflater(dynClient dynamic.Interface) *NatMappingInflater

NewInflater returns a NatMappingInflater istance.

func (*NatMappingInflater) AddMapping

func (inflater *NatMappingInflater) AddMapping(oldIP, newIP, clusterID string) error

AddMapping adds a mapping in the resource related to a remote cluster. It also adds the mapping in natMappingsPerCluster.

func (*NatMappingInflater) GetNatMappings

func (inflater *NatMappingInflater) GetNatMappings(clusterID string) (map[string]string, error)

GetNatMappings returns the set of NAT mappings related to a remote cluster.

func (*NatMappingInflater) InitNatMappingsPerCluster

func (inflater *NatMappingInflater) InitNatMappingsPerCluster(podCIDR, externalCIDR, clusterID string) error

InitNatMappingsPerCluster creates a NatMapping resource for the remote cluster.

func (*NatMappingInflater) RemoveMapping

func (inflater *NatMappingInflater) RemoveMapping(oldIP, clusterID string) error

RemoveMapping removes a mapping from both resource and in-memory structure.

func (*NatMappingInflater) TerminateNatMappingsPerCluster

func (inflater *NatMappingInflater) TerminateNatMappingsPerCluster(clusterID string) error

TerminateNatMappingsPerCluster deletes the NatMapping resource for remote cluster.

Jump to

Keyboard shortcuts

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