Documentation ¶
Index ¶
- type DummyIdentityNotifier
- func (d *DummyIdentityNotifier) Lock()
- func (d *DummyIdentityNotifier) MapSelectorsToIPsLocked(fqdnSelectors map[api.FQDNSelector]struct{}) (selectorsMissingIPs []api.FQDNSelector, ...)
- func (d *DummyIdentityNotifier) RegisterForIdentityUpdatesLocked(selector api.FQDNSelector)
- func (d *DummyIdentityNotifier) Unlock()
- func (d *DummyIdentityNotifier) UnregisterForIdentityUpdatesLocked(selector api.FQDNSelector)
- type IdentityAllocatorOwnerMock
- type MockIdentityAllocator
- func (f *MockIdentityAllocator) AllocateCIDRsForIPs(IPs []net.IP, _ map[netip.Prefix]*identity.Identity) ([]*identity.Identity, error)
- func (f *MockIdentityAllocator) AllocateIdentity(_ context.Context, lbls labels.Labels, _ bool, oldNID identity.NumericIdentity) (*identity.Identity, bool, error)
- func (f *MockIdentityAllocator) GetIdentities() cache.IdentitiesModel
- func (f *MockIdentityAllocator) GetIdentityCache() cache.IdentityCache
- func (f *MockIdentityAllocator) LookupIdentity(ctx context.Context, lbls labels.Labels) *identity.Identity
- func (f *MockIdentityAllocator) LookupIdentityByID(ctx context.Context, id identity.NumericIdentity) *identity.Identity
- func (f *MockIdentityAllocator) Release(_ context.Context, id *identity.Identity, _ bool) (released bool, err error)
- func (f *MockIdentityAllocator) ReleaseCIDRIdentitiesByID(ctx context.Context, identities []identity.NumericIdentity)
- func (f *MockIdentityAllocator) ReleaseSlice(ctx context.Context, _ cache.IdentityAllocatorOwner, ...) error
- func (f *MockIdentityAllocator) WaitForInitialGlobalIdentities(context.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DummyIdentityNotifier ¶
type DummyIdentityNotifier struct {
// contains filtered or unexported fields
}
func NewDummyIdentityNotifier ¶
func NewDummyIdentityNotifier() *DummyIdentityNotifier
func (*DummyIdentityNotifier) Lock ¶
func (d *DummyIdentityNotifier) Lock()
Lock must be held during any calls to RegisterForIdentityUpdatesLocked or UnregisterForIdentityUpdatesLocked.
func (*DummyIdentityNotifier) MapSelectorsToIPsLocked ¶
func (d *DummyIdentityNotifier) MapSelectorsToIPsLocked(fqdnSelectors map[api.FQDNSelector]struct{}) (selectorsMissingIPs []api.FQDNSelector, selectorIPMapping map[api.FQDNSelector][]net.IP)
MapSelectorsToIPsLocked is a dummy implementation that does not implement the selectors of the real implementation.
func (*DummyIdentityNotifier) RegisterForIdentityUpdatesLocked ¶
func (d *DummyIdentityNotifier) RegisterForIdentityUpdatesLocked(selector api.FQDNSelector)
RegisterForIdentityUpdatesLocked starts managing this selector.
It doesn't implement the identity allocation semantics of the interface.
func (*DummyIdentityNotifier) Unlock ¶
func (d *DummyIdentityNotifier) Unlock()
Unlock must be called after calls to RegisterForIdentityUpdatesLocked or UnregisterForIdentityUpdatesLocked are done.
func (*DummyIdentityNotifier) UnregisterForIdentityUpdatesLocked ¶
func (d *DummyIdentityNotifier) UnregisterForIdentityUpdatesLocked(selector api.FQDNSelector)
UnregisterForIdentityUpdatesLocked stops managing this selector.
type IdentityAllocatorOwnerMock ¶
type IdentityAllocatorOwnerMock struct{}
func (*IdentityAllocatorOwnerMock) GetNodeSuffix ¶
func (i *IdentityAllocatorOwnerMock) GetNodeSuffix() string
func (*IdentityAllocatorOwnerMock) UpdateIdentities ¶
func (i *IdentityAllocatorOwnerMock) UpdateIdentities(added, deleted cache.IdentityCache)
type MockIdentityAllocator ¶
type MockIdentityAllocator struct { cache.IdentityCache // contains filtered or unexported fields }
MockIdentityAllocator is used as a mock identity allocator for unit tests.
func NewMockIdentityAllocator ¶
func NewMockIdentityAllocator(c cache.IdentityCache) *MockIdentityAllocator
NewMockIdentityAllocator returns a new mock identity allocator to be used for unit testing purposes. It can be used as a drop-in for "real" identity allocation in a testing context.
func (*MockIdentityAllocator) AllocateCIDRsForIPs ¶
func (f *MockIdentityAllocator) AllocateCIDRsForIPs(IPs []net.IP, _ map[netip.Prefix]*identity.Identity) ([]*identity.Identity, error)
AllocateCIDRsForIPs allocates CIDR identities for the given IPs. It is meant to generally mock the CIDR identity allocator logic.
func (*MockIdentityAllocator) AllocateIdentity ¶
func (f *MockIdentityAllocator) AllocateIdentity(_ context.Context, lbls labels.Labels, _ bool, oldNID identity.NumericIdentity) (*identity.Identity, bool, error)
AllocateIdentity allocates a fake identity. It is meant to generally mock the canonical identity allocator logic.
func (*MockIdentityAllocator) GetIdentities ¶
func (f *MockIdentityAllocator) GetIdentities() cache.IdentitiesModel
GetIdentities returns the identities from the identity cache.
func (*MockIdentityAllocator) GetIdentityCache ¶
func (f *MockIdentityAllocator) GetIdentityCache() cache.IdentityCache
GetIdentityCache returns the identity cache.
func (*MockIdentityAllocator) LookupIdentity ¶
func (f *MockIdentityAllocator) LookupIdentity(ctx context.Context, lbls labels.Labels) *identity.Identity
LookupIdentity looks up the labels in the mock identity store.
func (*MockIdentityAllocator) LookupIdentityByID ¶
func (f *MockIdentityAllocator) LookupIdentityByID(ctx context.Context, id identity.NumericIdentity) *identity.Identity
LookupIdentityByID returns the identity corresponding to the id if the identity is a reserved identity. Otherwise, returns nil.
func (*MockIdentityAllocator) Release ¶
func (f *MockIdentityAllocator) Release(_ context.Context, id *identity.Identity, _ bool) (released bool, err error)
Release releases a fake identity. It is meant to generally mock the canonical identity release logic.
func (*MockIdentityAllocator) ReleaseCIDRIdentitiesByID ¶
func (f *MockIdentityAllocator) ReleaseCIDRIdentitiesByID(ctx context.Context, identities []identity.NumericIdentity)
func (*MockIdentityAllocator) ReleaseSlice ¶
func (f *MockIdentityAllocator) ReleaseSlice(ctx context.Context, _ cache.IdentityAllocatorOwner, identities []*identity.Identity) error
ReleaseSlice wraps Release for slices.
func (*MockIdentityAllocator) WaitForInitialGlobalIdentities ¶
func (f *MockIdentityAllocator) WaitForInitialGlobalIdentities(context.Context) error
WaitForInitialGlobalIdentities does nothing.