namespacesmapping

package
v0.3.0-rc.4 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package namespacesmapping implements the virtual-kubelet namespace reflection and namespace translation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MapperController

type MapperController interface {
	NamespaceReflectionController
	NamespaceMirroringController
	NamespaceNatter

	PollStartMapper() chan struct{}
	PollStopMapper() chan struct{}
	ReadyForRestart()
}

MapperController is the interface used to implement the MapperController. It encapsulates methods to control: - Outgoing Reflection - Incoming Reflection (NamespaceMirroringController) - Namespace Mapping.

type NamespaceMapper

type NamespaceMapper struct {
	Controller chan struct{}
	// contains filtered or unexported fields
}

NamespaceMapper embeds data and clients for namespace mapping.

func (*NamespaceMapper) ForeignToLocalNamespace

func (m *NamespaceMapper) ForeignToLocalNamespace(namespaceName string) (string, error)

ForeignToLocalNamespace returns the local namespace name associated to a remote namespaceName reading from the namespaceReadyMapCache. It returns an error if the namespace is not found.

func (*NamespaceMapper) HomeToForeignNamespace

func (m *NamespaceMapper) HomeToForeignNamespace(namespaceName string) (string, error)

HomeToForeignNamespace returns the foreign namespace name associated to a local namespaceName reading from the namespaceReadyMapCache. It returns an error if the namespace is not found.

func (*NamespaceMapper) MappedNamespaces

func (m *NamespaceMapper) MappedNamespaces() map[string]string

MappedNamespaces returns the whole namespaceReadyMapCache map.

func (*NamespaceMapper) WaitNamespaceNattingTableSync

func (m *NamespaceMapper) WaitNamespaceNattingTableSync(ctx context.Context)

WaitNamespaceNattingTableSync waits until internal caches are synchronized.

type NamespaceMapperController

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

NamespaceMapperController handles namespace translation and reflection by implementing NamespaceNatter,NamespaceMirroringController and NamespaceReflectionController interface.

func NewNamespaceMapperController

func NewNamespaceMapperController(ctx context.Context, config *rest.Config,
	homeClusterID, foreignClusterID, namespace string) (*NamespaceMapperController, error)

NewNamespaceMapperController builds and returns a new NewNamespaceMapperController.

func (*NamespaceMapperController) DeNatNamespace

func (c *NamespaceMapperController) DeNatNamespace(namespace string) (string, error)

DeNatNamespace handles the foreign to home namespace translation. It returns an error if the mapping is not found.

func (*NamespaceMapperController) MappedNamespaces

func (c *NamespaceMapperController) MappedNamespaces() map[string]string

MappedNamespaces returns the entire namespace mapping map.

func (*NamespaceMapperController) NatNamespace

func (c *NamespaceMapperController) NatNamespace(namespace string) (string, error)

NatNamespace handles the home to foreign namespace translation. It returns an error if the mapping is not found.

func (*NamespaceMapperController) PollStartIncomingReflection

func (c *NamespaceMapperController) PollStartIncomingReflection() chan string

PollStartIncomingReflection returns the startIncomingReflection channel. It is used to receive elements to start new incoming reflection routines on pushed namespace names.

func (*NamespaceMapperController) PollStartMapper

func (c *NamespaceMapperController) PollStartMapper() chan struct{}

PollStartMapper returns the startMapper channel.

func (*NamespaceMapperController) PollStartOutgoingReflection

func (c *NamespaceMapperController) PollStartOutgoingReflection() chan string

PollStartOutgoingReflection returns the startOutgoingReflection channel. It is used to receive elements to start new outgoing reflection routines on pushed namespace names.

func (*NamespaceMapperController) PollStopIncomingReflection

func (c *NamespaceMapperController) PollStopIncomingReflection() chan string

PollStopIncomingReflection returns the stopIncomingReflection channel. It is used to receive elements to stop new incoming reflection routines on pushed namespace names.

func (*NamespaceMapperController) PollStopMapper

func (c *NamespaceMapperController) PollStopMapper() chan struct{}

PollStopMapper returns the stopMapper channel.

func (*NamespaceMapperController) PollStopOutgoingReflection

func (c *NamespaceMapperController) PollStopOutgoingReflection() chan string

PollStopOutgoingReflection returns the stopOutgoingReflectionMapper channel. It is used to receive elements to stop new outgoing reflection routines on pushed namespace names.

func (*NamespaceMapperController) ReadyForRestart

func (c *NamespaceMapperController) ReadyForRestart()

ReadyForRestart emits a signal to restart the OutgoingReflection.

func (*NamespaceMapperController) WaitForSync

func (c *NamespaceMapperController) WaitForSync()

WaitForSync waits until internal caches are synchronized.

type NamespaceMirroringController

type NamespaceMirroringController interface {
	PollStartIncomingReflection() chan string
	PollStopIncomingReflection() chan string
}

NamespaceMirroringController defines the interface incoming reflection (mirroring), defining methods to extract items to start/stop incoming reflections.

type NamespaceNatter

type NamespaceNatter interface {
	NatNamespace(namespace string) (string, error)
	DeNatNamespace(namespace string) (string, error)
	MappedNamespaces() map[string]string
}

NamespaceNatter defines the interface for namespace translation, defining methods to obtain home/foreign namespace from the corresponding one.

type NamespaceReflectionController

type NamespaceReflectionController interface {
	PollStartOutgoingReflection() chan string
	PollStopOutgoingReflection() chan string
}

NamespaceReflectionController defines the interface outgoing reflection, defining methods to extract items to start/stop outgoing reflections.

Directories

Path Synopsis
Package test implements a mock namespace reflection and namespace translation mechanism
Package test implements a mock namespace reflection and namespace translation mechanism

Jump to

Keyboard shortcuts

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