Documentation ¶
Overview ¶
Package identitymanager tracks which global identities are being used by the currently running cilium-agent
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // GlobalIdentityManager is a singleton instance of an IdentityManager, used // for easy updating / tracking lifecycles of identities on the local node // without having to pass around a specific instance of an IdentityManager // throughout Cilium. GlobalIdentityManager = NewIdentityManager() )
Functions ¶
func GetIdentityModels ¶
func GetIdentityModels() []*models.IdentityEndpoints
GetIdentityModels returns the API model of all identities in the GlobalIdentityManager.
func RemoveOldAddNew ¶
RemoveOldAddNew removes old from and inserts new into the GlobalIdentityManager.
Types ¶
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 NewIdentityManager ¶
func NewIdentityManager() *IdentityManager
NewIdentityManager returns an initialized IdentityManager.
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) RemoveOldAddNew ¶
func (idm *IdentityManager) RemoveOldAddNew(old, new *identity.Identity)
RemoveOldAddNew removes old from the identity manager and inserts new into the IdentityManager.
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.