-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make remote controller access thread safe. #251
Conversation
admiral/pkg/clusters/types.go
Outdated
ServiceEntryAddressStore: &ServiceEntryAddressStore{EntryAddresses: map[string]string{}, Addresses: []string{}}, | ||
GlobalTrafficCache: gtpCache, | ||
SeClusterCache: common.NewMapOfMaps(), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: empty line.
@@ -100,8 +100,8 @@ func TestAddServiceEntriesWithDr(t *testing.T) { | |||
}, | |||
} | |||
|
|||
AddServiceEntriesWithDr(&admiralCache, map[string]string{"cl1": "cl1"}, map[string]*RemoteController{"cl1": rc}, map[string]*istionetworkingv1alpha3.ServiceEntry{"se1": &se}) | |||
AddServiceEntriesWithDr(&admiralCache, map[string]string{"cl1": "cl1"}, map[string]*RemoteController{"cl1": rc}, map[string]*istionetworkingv1alpha3.ServiceEntry{"se1": &emptyEndpointSe}) | |||
AddServiceEntriesWithDr(&RemoteRegistry{AdmiralCache: &admiralCache, remoteControllers: map[string]*RemoteController{"cl1": rc}}, map[string]string{"cl1": "cl1"}, map[string]*istionetworkingv1alpha3.ServiceEntry{"se1": &se}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use constructor (NewRemoteRegistry) here instead?
@@ -62,7 +62,7 @@ func TestDeleteCacheControllerThatDoesntExist(t *testing.T) { | |||
func TestDeleteCacheController(t *testing.T) { | |||
|
|||
w := RemoteRegistry{ | |||
RemoteControllers: make(map[string]*RemoteController), | |||
remoteControllers: make(map[string]*RemoteController), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it will be useful to use the constructor (NewRemoteRegistry) everywhere, and make RemoteRegistry
private.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make it private we will need an interface for RemoteRegistry.
…io-ecosystem#147) * Make remote controller access thread safe. * Lint issue * Code review comments * More initializations fixed Co-authored-by: aattuluri <44482891+aattuluri@users.noreply.github.com>
No description provided.