Skip to content

Commit

Permalink
clustermesh: Emit identity-change events for remote clusters
Browse files Browse the repository at this point in the history
We redid how remote clusters are handled and watched in
f28f6cd (PR #10185) but did not connect
to the events channel used to update selectors. We now re-use the main
allocator's events channel as the remote clusters are treated as child
allocators and only accessed through the primary.

fixes f28f6cd

Signed-off-by: Ray Bejjani <ray@isovalent.com>
  • Loading branch information
raybejjani authored and aanm committed Feb 25, 2020
1 parent 34b54c2 commit f0d65d6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions pkg/allocator/allocator.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,13 @@ func WithoutGC() AllocatorOption {
return func(a *Allocator) { a.disableGC = true }
}

// GetEvents returns the events channel given to the allocator when
// constructed.
// Note: This channel is not owned by the allocator!
func (a *Allocator) GetEvents() AllocatorEventChan {
return a.events
}

// Delete deletes an allocator and stops the garbage collector
func (a *Allocator) Delete() {
close(a.stopGC)
Expand Down
2 changes: 1 addition & 1 deletion pkg/identity/cache/allocator.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ func (m *CachingIdentityAllocator) WatchRemoteIdentities(backend kvstore.Backend
return nil, fmt.Errorf("Error setting up remote allocator backend: %s", err)
}

remoteAlloc, err := allocator.NewAllocator(GlobalIdentity{}, remoteAllocatorBackend)
remoteAlloc, err := allocator.NewAllocator(GlobalIdentity{}, remoteAllocatorBackend, allocator.WithEvents(m.IdentityAllocator.GetEvents()))
if err != nil {
return nil, fmt.Errorf("Unable to initialize remote Identity Allocator: %s", err)
}
Expand Down

0 comments on commit f0d65d6

Please sign in to comment.