endpointmanager

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2019 License: Apache-2.0 Imports: 19 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 AddEndpoint added in v1.5.0

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

AddEndpoint takes the prepared endpoint object and starts managing it.

func CallbackForEndpointsAtPolicyRev added in v1.5.0

func 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 EnableConntrackGC

func EnableConntrackGC(ipv4, ipv6 bool, restoredEndpoints []*endpoint.Endpoint)

EnableConntrackGC enables the connection tracking garbage collection.

func GetEndpoints added in v1.5.0

func GetEndpoints() []*endpoint.Endpoint

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

func HasGlobalCT added in v1.5.0

func HasGlobalCT() bool

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

func Insert

func Insert(ep *endpoint.Endpoint) error

Insert inserts the endpoint into the global maps.

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.

func Lookup

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

Lookup looks up the endpoint by prefix id

func LookupCiliumID

func LookupCiliumID(id uint16) *endpoint.Endpoint

LookupCiliumID looks up endpoint by endpoint ID

func LookupContainerID added in v1.5.0

func LookupContainerID(id string) *endpoint.Endpoint

LookupContainerID looks up endpoint by Docker ID

func LookupIPv4

func LookupIPv4(ipv4 string) *endpoint.Endpoint

LookupIPv4 looks up endpoint by IPv4 address

func LookupIPv6 added in v1.5.0

func LookupIPv6(ipv6 string) *endpoint.Endpoint

LookupIPv6 looks up endpoint by IPv6 address

func LookupPodName added in v1.5.0

func LookupPodName(name string) *endpoint.Endpoint

LookupPodName looks up endpoint by namespace + pod name

func RegenerateAllEndpoints added in v1.5.0

func RegenerateAllEndpoints(owner endpoint.Owner, regenMetadata *endpoint.ExternalRegenerationMetadata) *sync.WaitGroup

RegenerateAllEndpoints calls a SetStateLocked 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 RegenerateEndpointSetSignalWhenEnqueued added in v1.5.0

func RegenerateEndpointSetSignalWhenEnqueued(owner endpoint.Owner, regenMetadata *endpoint.ExternalRegenerationMetadata, endpointIDs map[uint16]struct{}, wg *sync.WaitGroup)

RegenerateEndpointSetSignalWhenEnqueued regenerates the endpoints represented by endpointIDs. It signals to the provided WaitGroup when all of the endpoints in said set have had regenerations queued up.

func Remove added in v1.5.0

func Remove(ep *endpoint.Endpoint, owner RuleCacheOwner) <-chan struct{}

Remove removes the endpoint from the global maps and releases the node-local ID allocated for the endpoint. Must be called with ep.Mutex.RLock held. Releasing of the ID of the endpoint is done asynchronously. Once the ID of the endpoint is released, the returned channel is closed.

func RemoveAll added in v1.5.0

func RemoveAll()

RemoveAll removes all endpoints from the global maps.

func UpdateReferences

func UpdateReferences(ep *endpoint.Endpoint)

UpdateReferences makes an endpoint available by all possible reference fields as available for this endpoint (containerID, IPv4 address, ...) Must be called with ep.Mutex.RLock held.

func WaitEndpointRemoved added in v1.5.0

func WaitEndpointRemoved(ep *endpoint.Endpoint, owner RuleCacheOwner)

WaitEndpointRemoved waits until all operations associated with Remove of the endpoint have been completed.

func WaitForEndpointsAtPolicyRev added in v1.5.0

func 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.

Types

type EndpointResourceSynchronizer added in v0.15.7

type EndpointResourceSynchronizer interface {
	RunK8sCiliumEndpointSync(ep *endpoint.Endpoint)
}

EndpointResourceSynchronizer is an interface which synchronizes CiliumEndpoint resources with Kubernetes.

var (

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

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 RuleCacheOwner added in v1.5.0

type RuleCacheOwner interface {
	// ClearPolicyConsumers removes references to the specified id from the
	// policy rules managed by RuleCacheOwner.
	ClearPolicyConsumers(id uint16) *sync.WaitGroup
}

RuleCacheOwner is an interface representing anything which needs to be notified upon endpoint removal from the endpointmanager.

Jump to

Keyboard shortcuts

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