Documentation ¶
Index ¶
- type DummyIdentityNotifier
- type IdentityAllocatorOwnerMock
- type MockIdentityAllocator
- 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() identity.IdentityMap
- 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) Observe(ctx context.Context, next func(cache.IdentityChange), complete func(error))
- func (f *MockIdentityAllocator) Reject(lbls labels.Labels)
- func (f *MockIdentityAllocator) Release(_ context.Context, id *identity.Identity, _ bool) (released bool, err error)
- func (f *MockIdentityAllocator) Unreject(lbls labels.Labels)
- func (f *MockIdentityAllocator) UnwithholdLocalIdentities(nids []identity.NumericIdentity)
- func (f *MockIdentityAllocator) WaitForInitialGlobalIdentities(context.Context) error
- func (f *MockIdentityAllocator) WithholdLocalIdentities(nids []identity.NumericIdentity)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DummyIdentityNotifier ¶
type DummyIdentityNotifier struct {
Registered map[api.FQDNSelector]struct{}
}
func NewDummyIdentityNotifier ¶
func NewDummyIdentityNotifier() *DummyIdentityNotifier
func (DummyIdentityNotifier) RegisterFQDNSelector ¶ added in v1.16.0
func (d DummyIdentityNotifier) RegisterFQDNSelector(selector api.FQDNSelector)
func (DummyIdentityNotifier) UnregisterFQDNSelector ¶ added in v1.16.0
func (d DummyIdentityNotifier) UnregisterFQDNSelector(selector api.FQDNSelector)
type IdentityAllocatorOwnerMock ¶
type IdentityAllocatorOwnerMock struct{}
func (*IdentityAllocatorOwnerMock) GetNodeSuffix ¶
func (i *IdentityAllocatorOwnerMock) GetNodeSuffix() string
func (*IdentityAllocatorOwnerMock) UpdateIdentities ¶
func (i *IdentityAllocatorOwnerMock) UpdateIdentities(added, deleted identity.IdentityMap)
type MockIdentityAllocator ¶
type MockIdentityAllocator struct { identity.IdentityMap // contains filtered or unexported fields }
MockIdentityAllocator is used as a mock identity allocator for unit tests.
func NewMockIdentityAllocator ¶
func NewMockIdentityAllocator(c identity.IdentityMap) *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) 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() identity.IdentityMap
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) Observe ¶
func (f *MockIdentityAllocator) Observe(ctx context.Context, next func(cache.IdentityChange), complete func(error))
func (*MockIdentityAllocator) Reject ¶ added in v1.16.0
func (f *MockIdentityAllocator) Reject(lbls labels.Labels)
Reject programs the mock allocator to reject an identity for testing purposes
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) Unreject ¶ added in v1.16.0
func (f *MockIdentityAllocator) Unreject(lbls labels.Labels)
func (*MockIdentityAllocator) UnwithholdLocalIdentities ¶ added in v1.15.0
func (f *MockIdentityAllocator) UnwithholdLocalIdentities(nids []identity.NumericIdentity)
func (*MockIdentityAllocator) WaitForInitialGlobalIdentities ¶
func (f *MockIdentityAllocator) WaitForInitialGlobalIdentities(context.Context) error
WaitForInitialGlobalIdentities does nothing.
func (*MockIdentityAllocator) WithholdLocalIdentities ¶ added in v1.15.0
func (f *MockIdentityAllocator) WithholdLocalIdentities(nids []identity.NumericIdentity)