endpointcontroller

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RequestTimeout = 15 * time.Second
	MaxWorkers     = 20
)

Variables

View Source
var Cell = cell.Module(
	"endpointcontroller",
	"controller for cilium endpoint and identity creation and updates",
	cell.Invoke(registerEndpointController),
)
View Source
var ErrClientsetDisabled = errors.New("failure due to clientset disabled")

Functions

This section is empty.

Types

type IdentityManager

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

IdentityManager is analogous to Cilium Daemon's identity allocation. Cilium has an IPCacche holding IP to Identity mapping. In IPCache.InjectLabels(), IPCacche is told of IPs which have been updated. Within this function, identities are allocated/released via CachingIdentityAllocator.

func NewIdentityManager

func NewIdentityManager(l logrus.FieldLogger, client versioned.Interface) (*IdentityManager, error)

func (*IdentityManager) DecrementReference

func (im *IdentityManager) DecrementReference(ctx context.Context, lbls labels.Labels)

DecrementReference modifies the corresponding identity's reference count in the allocator's store. For proper garbage collection of stale identities, this must be called exactly once per deleted/relabeled Pod. Whenever reference count is not 0, then the identity will exist in the local store, and syncLocalKeys() will make sure it exists.

func (*IdentityManager) GetIdentityAndIncrementReference

func (im *IdentityManager) GetIdentityAndIncrementReference(ctx context.Context, lbls labels.Labels) (int64, error)

GetIdentityAndIncrementReference will create/get an identity ID and increment the reference count in the allocator's store. For proper garbage collection of stale identities, this must be called exactly once per created/relabeled Pod. Whenever reference count is not 0, then the identity will exist in the local store, and syncLocalKeys() will make sure it exists.

type PodEndpoint

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

PodEndpoint represents a Pod/CiliumEndpoint

type Store

type Store struct {
	*sync.RWMutex

	// Pods is a map of Pod key to PodEndpoint
	// this is the expected endpoint state for the pod
	// and is used to determine if the pod needs to be updated
	Pods map[resource.Key]*PodEndpoint

	// Namespaces is a map of Namespace name to Namespace
	// this is used to determine if the namespace needs to be updated
	Namespaces map[string]*slim_corev1.Namespace
}

func NewStore

func NewStore() *Store

func (*Store) AddNamespace

func (s *Store) AddNamespace(namespace *slim_corev1.Namespace)

func (*Store) AddPod

func (s *Store) AddPod(pod *PodEndpoint)

func (*Store) DeleteNamespace

func (s *Store) DeleteNamespace(key string)

func (*Store) DeletePod

func (s *Store) DeletePod(key resource.Key)

func (*Store) GetNamespace

func (s *Store) GetNamespace(key string) (*slim_corev1.Namespace, bool)

func (*Store) GetPod

func (s *Store) GetPod(key resource.Key) (*PodEndpoint, bool)

func (*Store) GetToDeletePod

func (s *Store) GetToDeletePod(key resource.Key) (*PodEndpoint, bool)

func (*Store) ListPodKeysByNamespace

func (s *Store) ListPodKeysByNamespace(namespace string) []resource.Key

Jump to

Keyboard shortcuts

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