Documentation ¶
Index ¶
- func BuildUnresolvablePort() corev1.ServicePort
- func Name(namespace, name string) (string, error)
- type Manager
- func (s *Manager) CleanupShadowServicePorts(log logr.Logger, svc, shadowSvc *corev1.Service, trafficType string)
- func (s *Manager) GetServicePorts(log logr.Logger, svc *corev1.Service, trafficType string) []corev1.ServicePort
- func (s *Manager) LoadPortMapping(log logr.Logger, shadowSvcs []*corev1.Service) error
- func (s *Manager) LoadShadowServicePorts(log logr.Logger, shadowSvc *corev1.Service, trafficType string)
- func (s *Manager) UnmapPort(log logr.Logger, namespace, name, trafficType string, port int32) error
- type PortMapper
- type PortStateTable
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.
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 ¶
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.
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 }