controller

package
v1.4.8 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2022 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ACLEnabled       bool
	DefaultMode      string
	Namespace        string
	WatchNamespaces  []string
	IgnoreNamespaces []string
	MinHTTPPort      int32
	MaxHTTPPort      int32
	MinTCPPort       int32
	MaxTCPPort       int32
	MinUDPPort       int32
	MaxUDPPort       int32
}

Config holds the configuration of the controller.

type Controller

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

Controller hold controller configuration.

func NewMeshController

func NewMeshController(clients k8s.Client, cfg Config, store SharedStore, logger logrus.FieldLogger) *Controller

NewMeshController builds the informers and other required components of the mesh controller, and returns an initialized mesh controller object.

func (*Controller) Run

func (c *Controller) Run() error

Run is the main controller loop.

func (*Controller) Shutdown

func (c *Controller) Shutdown()

Shutdown shut downs the controller.

type PortMapper

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

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

type PortMapping

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

PortMapping is a PortMapper.

func NewPortMapping

func NewPortMapping(namespace string, serviceLister listers.ServiceLister, logger logrus.FieldLogger, minPort, maxPort int32) *PortMapping

NewPortMapping creates and returns a new PortMapping instance.

func (*PortMapping) Add

func (p *PortMapping) Add(namespace, name string, port int32) (int32, error)

Add adds a new mapping between the given service port and the first port available in the range defined within minPort and maxPort. If there's no port left, an error will be returned.

func (*PortMapping) Find

func (p *PortMapping) Find(namespace, name string, port int32) (int32, bool)

Find searches the port mapped to the given service port.

func (*PortMapping) LoadState

func (p *PortMapping) LoadState() error

LoadState initializes the mapping table from the current shadow service state.

func (*PortMapping) Remove

func (p *PortMapping) Remove(namespace, name string, port int32) (int32, error)

Remove removes the mapping associated with the given service port.

type ShadowServiceManager

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

ShadowServiceManager manages shadow services.

func NewShadowServiceManager

func NewShadowServiceManager(logger logrus.FieldLogger, serviceLister listers.ServiceLister, namespace string, tcpStateTable, udpStateTable PortMapper, defaultTrafficType string, minHTTPPort, maxHTTPPort int32, kubeClient kubernetes.Interface) *ShadowServiceManager

NewShadowServiceManager returns new shadow service manager.

func (*ShadowServiceManager) CreateOrUpdate

func (s *ShadowServiceManager) CreateOrUpdate(ctx context.Context, svc *corev1.Service) (*corev1.Service, error)

CreateOrUpdate creates or updates the shadow service corresponding to the given service.

func (*ShadowServiceManager) Delete

func (s *ShadowServiceManager) Delete(ctx context.Context, namespace, name string) error

Delete deletes the shadow service associated with the given service.

type SharedStore

type SharedStore interface {
	SetConfig(cfg *dynamic.Configuration)
	SetTopology(topo *topology.Topology)
	SetReadiness(isReady bool)
}

SharedStore is used to share the controller state.

type TopologyBuilder

type TopologyBuilder interface {
	Build(resourceFilter *k8s.ResourceFilter) (*topology.Topology, error)
}

TopologyBuilder builds Topologies.

Jump to

Keyboard shortcuts

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