endpointmanager

package
v1.11.7 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2022 License: Apache-2.0 Imports: 27 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 EndpointCheckerFunc added in v0.15.7

type EndpointCheckerFunc func(*endpoint.Endpoint) error

EndpointCheckerFunc can verify whether an endpoint is currently healthy.

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,
	policyGetter policyRepoGetter,
	proxy endpoint.EndpointProxy,
	allocator cache.IdentityAllocator,
	reason, 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) InitHostEndpointLabels added in v0.15.7

func (mgr *EndpointManager) InitHostEndpointLabels(ctx context.Context)

InitHostEndpointLabels initializes the host endpoint's labels with the node's known labels.

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) OnAddNode added in v1.11.0

func (mgr *EndpointManager) OnAddNode(node *v1.Node,
	swg *lock.StoppableWaitGroup) error

OnAddNode implements the EndpointManager's logic for reacting to new nodes from K8s. It is currently not implemented as the EndpointManager has not need for it. This adheres to the subscriber.NodeHandler interface.

func (*EndpointManager) OnDeleteNode added in v1.11.0

func (mgr *EndpointManager) OnDeleteNode(node *v1.Node,
	swg *lock.StoppableWaitGroup) error

OnDeleteNode implements the EndpointManager's logic for reacting to node deletions from K8s. It is currently not implemented as the EndpointManager has not need for it. This adheres to the subscriber.NodeHandler interface.

func (*EndpointManager) OnUpdateNode added in v1.11.0

func (mgr *EndpointManager) OnUpdateNode(oldNode, newNode *v1.Node,
	swg *lock.StoppableWaitGroup) error

OnUpdateNode implements the EndpointManager's logic for reacting to updated nodes in K8s. It is currently not implemented as the EndpointManager has not need for it. This adheres to the subscriber.NodeHandler interface.

func (*EndpointManager) OverrideEndpointOpts added in v0.15.7

func (mgr *EndpointManager) OverrideEndpointOpts(om option.OptionMap)

OverrideEndpointOpts applies the given options to all endpoints.

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) RemoveEndpoint added in v1.10.0

func (mgr *EndpointManager) RemoveEndpoint(ep *endpoint.Endpoint, conf endpoint.DeleteConfig) []error

RemoveEndpoint stops the active handling of events by the specified endpoint, and prevents the endpoint from being globally acccessible via other packages.

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) RestoreEndpoint added in v1.10.0

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

RestoreEndpoint exposes the specified endpoint to other subsystems via the manager.

func (*EndpointManager) Subscribe added in v0.15.7

func (mgr *EndpointManager) Subscribe(s Subscriber)

func (*EndpointManager) Unsubscribe added in v0.15.7

func (mgr *EndpointManager) Unsubscribe(s Subscriber)

func (*EndpointManager) UpdatePolicyMaps added in v0.15.7

func (mgr *EndpointManager) UpdatePolicyMaps(ctx context.Context, notifyWg *sync.WaitGroup) *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(ep *endpoint.Endpoint) error

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

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.

func (*EndpointManager) WithPeriodicEndpointGC added in v1.7.13

func (mgr *EndpointManager) WithPeriodicEndpointGC(ctx context.Context, checkHealth EndpointCheckerFunc, interval time.Duration) *EndpointManager

WithPeriodicEndpointGC runs a controller to periodically garbage collect endpoints that match the specified EndpointCheckerFunc.

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.

type Subscriber added in v0.15.7

type Subscriber interface {
	// EndpointCreated is called at the end of endpoint creation.
	// Implementations must not attempt write operations on the
	// EndpointManager from this callback.
	EndpointCreated(ep *endpoint.Endpoint)

	// EndpointDeleted is called at the end of endpoint deletion.
	// Implementations must not attempt write operations on the
	// EndpointManager from this callback.
	EndpointDeleted(ep *endpoint.Endpoint, conf endpoint.DeleteConfig)
}

Subscribers may register via Subscribe() to be notified when events occur.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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