shadow

package
v0.0.0-...-7949e55 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildUnresolvablePort

func BuildUnresolvablePort() corev1.ServicePort

BuildUnresolvablePort builds a service port with a fake port. This fake port can be used as a placeholder when a service doesn't have any compatible ports.

func Name

func Name(namespace, name string) (string, error)

Name returns the shadow service name corresponding to the given service namespace and name.

Types

type Manager

type Manager struct {
	Table *PortStateTable
}

Manager manages shadow services.

func (*Manager) CleanupShadowServicePorts

func (s *Manager) CleanupShadowServicePorts(log logr.Logger, svc, shadowSvc *corev1.Service, trafficType string)

CleanupShadowServicePorts unmap ports that have changed since the last update of the service.

func (*Manager) GetServicePorts

func (s *Manager) GetServicePorts(log logr.Logger, svc *corev1.Service, trafficType string) []corev1.ServicePort

GetServicePorts returns the ports of the given user service, mapped with port opened on the proxy.

func (*Manager) LoadPortMapping

func (s *Manager) LoadPortMapping(log logr.Logger, shadowSvcs []*corev1.Service) error

LoadPortMapping loads the port mapping of existing shadow services into the different port mappers.

func (*Manager) LoadShadowServicePorts

func (s *Manager) LoadShadowServicePorts(log logr.Logger, shadowSvc *corev1.Service, trafficType string)

LoadShadowServicePorts loads the port mapping of the given shadow service into the different port mappers.

func (*Manager) UnmapPort

func (s *Manager) UnmapPort(log logr.Logger, namespace, name, trafficType string, port int32) error

UnmapPort releases the port on the proxy associated with the given port. This released port can then be remapped later on. Port releasing is delegated to the different port mappers, following the given traffic type.

type PortMapper

type PortMapper interface {
	Find(namespace, name string, port int32) (int32, bool)
	Add(namespace, name string, port int32) (int32, error)
	Set(namespace, name string, port, targetPort int32) error
	Remove(namespace, name string, port int32) (int32, bool)
}

PortMapper is capable of storing and retrieving a port mapping for a given service.

type PortStateTable

type PortStateTable struct {
	TCP PortMapper
	UDP PortMapper
}

Jump to

Keyboard shortcuts

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