identitymanager

package
v1.17.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 8 Imported by: 16

Documentation

Overview

Package identitymanager tracks which global identities are being used by the currently running cilium-agent

Index

Constants

This section is empty.

Variables

View Source
var Cell = cell.Module(
	"identity-manager",
	"Identity manager tracks identities assigned to locally managed endpoints ",
	cell.Provide(NewIDManager),
)

Functions

This section is empty.

Types

type IDManager

type IDManager interface {
	Add(identity *identity.Identity)
	GetIdentityModels() []*models.IdentityEndpoints
	Remove(identity *identity.Identity)
	RemoveAll()
	RemoveOldAddNew(old *identity.Identity, new *identity.Identity)
	Subscribe(o Observer)
}

func NewIDManager

func NewIDManager() IDManager

NewIDManager returns an initialized IdentityManager.

type IdentitiesModel

type IdentitiesModel []*models.IdentityEndpoints

IdentitiesModel is a wrapper so that we can implement the sort.Interface to sort the slice by ID

func (IdentitiesModel) Less

func (s IdentitiesModel) Less(i, j int) bool

Less returns true if the element in index `i` is lower than the element in index `j`

type IdentityManager

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

IdentityManager caches information about a set of identities, currently a reference count of how many users there are for each identity.

func (*IdentityManager) Add

func (idm *IdentityManager) Add(identity *identity.Identity)

Add inserts the identity into the identity manager. If the identity is already in the identity manager, the reference count for the identity is incremented.

func (*IdentityManager) GetIdentityModels

func (idm *IdentityManager) GetIdentityModels() []*models.IdentityEndpoints

GetIdentityModels returns the API representation of the IdentityManager.

func (*IdentityManager) Remove

func (idm *IdentityManager) Remove(identity *identity.Identity)

Remove deletes the identity from the identity manager. If the identity is already in the identity manager, the reference count for the identity is decremented. If the identity is not in the cache, this is a no-op. If the ref count becomes zero, the identity is removed from the cache.

func (*IdentityManager) RemoveAll

func (idm *IdentityManager) RemoveAll()

RemoveAll removes all identities.

func (*IdentityManager) RemoveOldAddNew

func (idm *IdentityManager) RemoveOldAddNew(old, new *identity.Identity)

RemoveOldAddNew removes old from the identity manager and inserts new into the IdentityManager. Caller must have previously added the old identity with Add(). This is a no-op if both identities have the same numeric ID.

func (*IdentityManager) Subscribe

func (idm *IdentityManager) Subscribe(o Observer)

Subscribe adds the specified Observer to the global identity manager, to be notified upon changes to local identity usage.

type Observer

type Observer interface {
	// LocalEndpointIdentityAdded is called when an identity first becomes
	// used on the node. Implementations must ensure that the callback
	// returns within a reasonable period.
	LocalEndpointIdentityAdded(*identity.Identity)

	// LocalEndpointIdentityRemoved is called when an identity is no longer
	// in use on the node. Implementations must ensure that the callback
	// returns within a reasonable period.
	LocalEndpointIdentityRemoved(*identity.Identity)
}

Observer can sign up to receive events whenever local identities are removed.

Jump to

Keyboard shortcuts

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