endpointmanager

package
v1.9.4 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2021 License: Apache-2.0 Imports: 26 Imported by: 30

Documentation

Overview

Package endpointmanager manages the list of all local endpoints

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnsupportedID represents an error of unsupported IP address format.
	ErrUnsupportedID = errors.New("unsupported IP address format")
)

Functions

func IsErrInvalidPrefix added in v0.15.7

func IsErrInvalidPrefix(err error) bool

IsErrInvalidPrefix returns true if the given error is the type of ErrInvalidPrefix.

func IsErrUnsupportedID added in v0.15.7

func IsErrUnsupportedID(err error) bool

IsErrUnsupportedID returns true if the given error is the type of ErrUnsupportedID.

Types

type EndpointManager added in v0.15.7

type EndpointManager struct {

	// EndpointSynchronizer updates external resources (e.g., Kubernetes) with
	// up-to-date information about endpoints managed by the endpoint manager.
	EndpointResourceSynchronizer
	// contains filtered or unexported fields
}

EndpointManager is a structure designed for containing state about the collection of locally running endpoints.

func NewEndpointManager added in v1.7.0

func NewEndpointManager(epSynchronizer EndpointResourceSynchronizer) *EndpointManager

NewEndpointManager creates a new EndpointManager.

func (*EndpointManager) AddEndpoint added in v1.7.0

func (mgr *EndpointManager) AddEndpoint(owner regeneration.Owner, ep *endpoint.Endpoint, reason string) (err error)

AddEndpoint takes the prepared endpoint object and starts managing it.

func (*EndpointManager) AddHostEndpoint added in v1.8.0

func (mgr *EndpointManager) AddHostEndpoint(ctx context.Context, owner regeneration.Owner,
	proxy endpoint.EndpointProxy, allocator cache.IdentityAllocator, reason string, nodeName string) error

func (*EndpointManager) AddIPv6Address added in v1.9.0

func (mgr *EndpointManager) AddIPv6Address(ipv6 addressing.CiliumIPv6)

AddIPv6Address notifies an addition of an IPv6 address

func (*EndpointManager) AllocateID added in v1.7.0

func (mgr *EndpointManager) AllocateID(currID uint16) (uint16, error)

AllocateID checks if the ID can be reused. If it cannot, returns an error. If an ID of 0 is provided, a new ID is allocated. If a new ID cannot be allocated, returns an error.

func (*EndpointManager) CallbackForEndpointsAtPolicyRev added in v0.15.7

func (mgr *EndpointManager) CallbackForEndpointsAtPolicyRev(ctx context.Context, rev uint64, done func(time.Time)) error

CallbackForEndpointsAtPolicyRev registers a callback on all endpoints that exist when invoked. It is similar to WaitForEndpointsAtPolicyRevision but each endpoint that reaches the desired revision calls 'done' independently. The provided callback should not block and generally be lightweight.

func (*EndpointManager) EndpointExists added in v1.7.0

func (mgr *EndpointManager) EndpointExists(id uint16) bool

EndpointExists returns whether the endpoint with id exists.

func (*EndpointManager) GetEndpoints added in v1.7.0

func (mgr *EndpointManager) GetEndpoints() []*endpoint.Endpoint

GetEndpoints returns a slice of all endpoints present in endpoint manager.

func (*EndpointManager) GetHostEndpoint added in v1.8.0

func (mgr *EndpointManager) GetHostEndpoint() *endpoint.Endpoint

GetHostEndpoint returns the host endpoint.

func (*EndpointManager) GetPolicyEndpoints added in v0.15.7

func (mgr *EndpointManager) GetPolicyEndpoints() map[policy.Endpoint]struct{}

GetPolicyEndpoints returns a map of all endpoints present in endpoint manager as policy.Endpoint interface set for the map key.

func (*EndpointManager) HasGlobalCT added in v0.15.7

func (mgr *EndpointManager) HasGlobalCT() bool

HasGlobalCT returns true if the endpoints have a global CT, false otherwise.

func (*EndpointManager) HostEndpointExists added in v1.8.0

func (mgr *EndpointManager) HostEndpointExists() bool

HostEndpointExists returns true if the host endpoint exists.

func (*EndpointManager) InitMetrics added in v1.7.0

func (mgr *EndpointManager) InitMetrics()

InitMetrics hooks the EndpointManager into the metrics subsystem. This can only be done once, globally, otherwise the metrics library will panic.

func (*EndpointManager) Lookup added in v1.7.0

func (mgr *EndpointManager) Lookup(id string) (*endpoint.Endpoint, error)

Lookup looks up the endpoint by prefix id

func (*EndpointManager) LookupCiliumID added in v1.7.0

func (mgr *EndpointManager) LookupCiliumID(id uint16) *endpoint.Endpoint

LookupCiliumID looks up endpoint by endpoint ID

func (*EndpointManager) LookupContainerID added in v1.7.0

func (mgr *EndpointManager) LookupContainerID(id string) *endpoint.Endpoint

LookupContainerID looks up endpoint by Docker ID

func (*EndpointManager) LookupIP added in v1.7.0

func (mgr *EndpointManager) LookupIP(ip net.IP) (ep *endpoint.Endpoint)

LookupIP looks up endpoint by IP address

func (*EndpointManager) LookupIPv4 added in v1.7.0

func (mgr *EndpointManager) LookupIPv4(ipv4 string) *endpoint.Endpoint

LookupIPv4 looks up endpoint by IPv4 address

func (*EndpointManager) LookupIPv6 added in v1.7.0

func (mgr *EndpointManager) LookupIPv6(ipv6 string) *endpoint.Endpoint

LookupIPv6 looks up endpoint by IPv6 address

func (*EndpointManager) LookupPodName added in v1.7.0

func (mgr *EndpointManager) LookupPodName(name string) *endpoint.Endpoint

LookupPodName looks up endpoint by namespace + pod name

func (*EndpointManager) RegenerateAllEndpoints added in v0.15.7

func (mgr *EndpointManager) RegenerateAllEndpoints(regenMetadata *regeneration.ExternalRegenerationMetadata) *sync.WaitGroup

RegenerateAllEndpoints calls a setState for each endpoint and regenerates if state transaction is valid. During this process, the endpoint list is locked and cannot be modified. Returns a waiting group that can be used to know when all the endpoints are regenerated.

func (*EndpointManager) ReleaseID added in v1.7.0

func (mgr *EndpointManager) ReleaseID(ep *endpoint.Endpoint) error

ReleaseID releases the ID of the specified endpoint from the EndpointManager. Returns an error if the ID cannot be released.

func (*EndpointManager) RemoveAll added in v1.7.0

func (mgr *EndpointManager) RemoveAll()

RemoveAll removes all endpoints from the global maps.

func (*EndpointManager) RemoveID added in v1.7.0

func (mgr *EndpointManager) RemoveID(currID uint16)

RemoveID removes the id from the endpoints map in the EndpointManager.

func (*EndpointManager) RemoveIPv6Address added in v1.9.0

func (mgr *EndpointManager) RemoveIPv6Address(ipv6 addressing.CiliumIPv6)

RemoveAIPv6ddress notifies a removal of an IPv6 address

func (*EndpointManager) RemoveReferences added in v1.7.0

func (mgr *EndpointManager) RemoveReferences(mappings map[endpointid.PrefixType]string)

RemoveReferences removes the mappings from the endpointmanager.

func (*EndpointManager) UpdateIDReference added in v1.7.0

func (mgr *EndpointManager) UpdateIDReference(ep *endpoint.Endpoint)

UpdateIDReference updates the endpoints map in the EndpointManager for the given Endpoint.

func (*EndpointManager) UpdatePolicyMaps added in v0.15.7

func (mgr *EndpointManager) UpdatePolicyMaps(ctx context.Context) *sync.WaitGroup

UpdatePolicyMaps returns a WaitGroup which is signaled upon once all endpoints have had their PolicyMaps updated against the Endpoint's desired policy state.

func (*EndpointManager) UpdateReferences added in v1.7.0

func (mgr *EndpointManager) UpdateReferences(mappings map[endpointid.PrefixType]string, ep *endpoint.Endpoint)

UpdateReferences updates maps the contents of mappings to the specified endpoint.

func (*EndpointManager) WaitEndpointRemoved added in v1.7.0

func (mgr *EndpointManager) WaitEndpointRemoved(ep *endpoint.Endpoint)

WaitEndpointRemoved waits until all operations associated with Remove of the endpoint have been completed. Note: only used for unit tests

func (*EndpointManager) WaitForEndpointsAtPolicyRev added in v0.15.7

func (mgr *EndpointManager) WaitForEndpointsAtPolicyRev(ctx context.Context, rev uint64) error

WaitForEndpointsAtPolicyRev waits for all endpoints which existed at the time this function is called to be at a given policy revision. New endpoints appearing while waiting are ignored.

type EndpointResourceSynchronizer added in v0.15.7

type EndpointResourceSynchronizer interface {
	RunK8sCiliumEndpointSync(ep *endpoint.Endpoint, conf endpoint.EndpointStatusConfiguration)
	DeleteK8sCiliumEndpointSync(e *endpoint.Endpoint)
}

EndpointResourceSynchronizer is an interface which synchronizes CiliumEndpoint resources with Kubernetes.

type ErrInvalidPrefix added in v0.15.7

type ErrInvalidPrefix struct {
	// InvalidPrefix contains the invalid prefix.
	InvalidPrefix string
}

ErrInvalidPrefix represents the error of an invalid prefix.

func (ErrInvalidPrefix) Error added in v0.15.7

func (e ErrInvalidPrefix) Error() string

Error returns the string representation of the ErrInvalidPrefix.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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