mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 11:21:47 +00:00
SetClientFactory in FederatedInformer
This commit is contained in:
parent
9fe15e7376
commit
8dbe762e6f
@ -96,6 +96,13 @@ type FederatedInformer interface {
|
|||||||
Stop()
|
Stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FederatedInformer with extra method for setting fake clients.
|
||||||
|
type FederatedInformerForTestOnly interface {
|
||||||
|
FederatedInformer
|
||||||
|
|
||||||
|
SetClientFactory(func(*federation_api.Cluster) (federation_release_1_4.Interface, error))
|
||||||
|
}
|
||||||
|
|
||||||
// A function that should be used to create an informer on the target object. Store should use
|
// A function that should be used to create an informer on the target object. Store should use
|
||||||
// framework.DeletionHandlingMetaNamespaceKeyFunc as a keying function.
|
// framework.DeletionHandlingMetaNamespaceKeyFunc as a keying function.
|
||||||
type TargetInformerFactory func(*federation_api.Cluster, federation_release_1_4.Interface) (cache.Store, framework.ControllerInterface)
|
type TargetInformerFactory func(*federation_api.Cluster, federation_release_1_4.Interface) (cache.Store, framework.ControllerInterface)
|
||||||
@ -261,6 +268,13 @@ func (f *federatedInformerImpl) Start() {
|
|||||||
go f.clusterInformer.controller.Run(f.clusterInformer.stopChan)
|
go f.clusterInformer.controller.Run(f.clusterInformer.stopChan)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (f *federatedInformerImpl) SetClientFactory(clientFactory func(*federation_api.Cluster) (federation_release_1_4.Interface, error)) {
|
||||||
|
f.Lock()
|
||||||
|
defer f.Unlock()
|
||||||
|
|
||||||
|
f.clientFactory = clientFactory
|
||||||
|
}
|
||||||
|
|
||||||
// GetClientsetForCluster returns a clientset for the cluster, if present.
|
// GetClientsetForCluster returns a clientset for the cluster, if present.
|
||||||
func (f *federatedInformerImpl) GetClientsetForCluster(clusterName string) (federation_release_1_4.Interface, error) {
|
func (f *federatedInformerImpl) GetClientsetForCluster(clusterName string) (federation_release_1_4.Interface, error) {
|
||||||
f.Lock()
|
f.Lock()
|
||||||
|
Loading…
Reference in New Issue
Block a user