Documentation ¶
Overview ¶
Package clusterclientstore provides a thread-safe storage for Kubernetes API clients connected to target clusters. The internal storage is updated automatically by watching for Cluster and Secret resources. New Cluster objects trigger a client/informer creation, updates to Secret objects trigger re-creation of a client/informer, and Cluster deletions cause the removal of a client and its associated informer.
Index ¶
- Constants
- type ClientBuilderFunc
- type ClientProvider
- type EventHandlerRegisterFunc
- type Interface
- type Store
- func (s *Store) AddEventHandlerCallback(eventHandler EventHandlerRegisterFunc)
- func (s *Store) AddSubscriptionCallback(subscription SubscriptionRegisterFunc)
- func (s *Store) GetClient(clusterName string, ua string) (kubernetes.Interface, error)
- func (s *Store) GetConfig(clusterName string) (*rest.Config, error)
- func (s *Store) GetInformerFactory(clusterName string) (kubeinformers.SharedInformerFactory, error)
- func (s *Store) Run(stopCh <-chan struct{})
- type SubscriptionRegisterFunc
Constants ¶
const AgentName = "clusterclientstore"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientBuilderFunc ¶
This enables tests to inject an appropriate fake client, which allows us to use the real cluster client store in unit tests.
type ClientProvider ¶
type EventHandlerRegisterFunc ¶
type EventHandlerRegisterFunc func(kubeinformers.SharedInformerFactory, string)
EventHandlerRegisterFunc is called after the caches for the clusters have been built, and provides a hook for a controller to register its event handlers. These will be event handlers for changes to the resources that the controller has subscribed to in the `SubscriptionRegisterFunc` callback.
type Interface ¶
type Interface interface { AddSubscriptionCallback(SubscriptionRegisterFunc) AddEventHandlerCallback(EventHandlerRegisterFunc) GetClient(clusterName string, ua string) (kubernetes.Interface, error) GetInformerFactory(string) (kubeinformers.SharedInformerFactory, error) }
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func NewStore ¶
func NewStore( buildClient ClientBuilderFunc, secretInformer corev1informer.SecretInformer, clusterInformer shipperinformer.ClusterInformer, ns string, restTimeout, resync *time.Duration, ) *Store
NewStore creates a new client store that will use the specified informers to maintain a cache of clientsets, rest.Configs, and informers for target clusters.
func (*Store) AddEventHandlerCallback ¶
func (s *Store) AddEventHandlerCallback(eventHandler EventHandlerRegisterFunc)
func (*Store) AddSubscriptionCallback ¶
func (s *Store) AddSubscriptionCallback(subscription SubscriptionRegisterFunc)
func (*Store) GetClient ¶
GetClient returns a client for the specified cluster name and user agent pair.
func (*Store) GetInformerFactory ¶
func (s *Store) GetInformerFactory(clusterName string) (kubeinformers.SharedInformerFactory, error)
GetInformerFactory returns an informer factory for the specified cluster name.
type SubscriptionRegisterFunc ¶
type SubscriptionRegisterFunc func(kubeinformers.SharedInformerFactory)
SubscriptionRegisterFunc should call the relevant functions on a shared informer factory to set up watches.
Note that there should be no event handlers being assigned to any informers in this function.