Documentation
¶
Index ¶
- type APIServerAccess
- type APIServerAccessImpl
- func (a *APIServerAccessImpl) GetAdminAccessClient(apiServer *openmcpv1alpha1.APIServer, options client.Options) (client.Client, error)
- func (a *APIServerAccessImpl) GetAdminAccessConfig(apiServer *openmcpv1alpha1.APIServer) (*restclient.Config, error)
- func (a *APIServerAccessImpl) GetAdminAccessRaw(apiServer *openmcpv1alpha1.APIServer) (string, error)
- type OnExit
- type OnNextInterval
- type Options
- type Task
- type Worker
- type WorkerImpl
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIServerAccess ¶
type APIServerAccess interface { // GetAdminAccessClient returns the admin access kubeconfig for the given APIServer. GetAdminAccessClient(as *openmcpv1alpha1.APIServer, options client.Options) (client.Client, error) // GetAdminAccessConfig returns the admin access kubeconfig for the given APIServer. GetAdminAccessConfig(as *openmcpv1alpha1.APIServer) (*restclient.Config, error) // GetAdminAccessRaw returns the admin access kubeconfig for the given APIServer. GetAdminAccessRaw(as *openmcpv1alpha1.APIServer) (string, error) }
APIServerAccess provides access to an APIServer's admin kubeconfig.
type APIServerAccessImpl ¶
type APIServerAccessImpl struct {
NewClient client.NewClientFunc
}
APIServerAccessImpl is the default implementation of APIServerAccess.
func (*APIServerAccessImpl) GetAdminAccessClient ¶
func (a *APIServerAccessImpl) GetAdminAccessClient(apiServer *openmcpv1alpha1.APIServer, options client.Options) (client.Client, error)
GetAdminAccessClient implements APIServerAccess.GetAdminAccessClient.
func (*APIServerAccessImpl) GetAdminAccessConfig ¶
func (a *APIServerAccessImpl) GetAdminAccessConfig(apiServer *openmcpv1alpha1.APIServer) (*restclient.Config, error)
GetAdminAccessConfig implements APIServerAccess.GetAdminAccessConfig.
func (*APIServerAccessImpl) GetAdminAccessRaw ¶
func (a *APIServerAccessImpl) GetAdminAccessRaw(apiServer *openmcpv1alpha1.APIServer) (string, error)
GetAdminAccessRaw implements APIServerAccess.GetAdminAccessRaw.
type OnExit ¶
type OnExit chan bool
OnExit is a channel that is used to signal when the worker is stopped
type OnNextInterval ¶
type OnNextInterval chan bool
OnNextInterval is a channel that is used to signal when the next interval is executed
type Options ¶
type Options struct { // MaxWorkers is the maximum number of workers that can be executed concurrently MaxWorkers *int // Interval is the time between each execution of the tasks Interval *time.Duration // NewClient is the function to create a new client for the APIServer NewClient client.NewClientFunc }
Options is used to configure the Worker
func (*Options) SetDefaultsIfNotSet ¶
func (o *Options) SetDefaultsIfNotSet()
SetDefaultsIfNotSet sets the default values for the options if they are not set
type Task ¶
Task is a function that is executed for each APIServer in the cluster The first client is for the Crate cluster The second client is for the APIServer cluster
type Worker ¶
type Worker interface { // RegisterTask registers a new task with the given name // The name must be unique RegisterTask(name string, task Task) // UnregisterTask removes the task with the given name UnregisterTask(name string) // Start starts the worker // This function will not block. // The worker will be stopped when the context is canceled // The OnExit channel will be used to signal when the worker is stopped (when not nil) // The OnNextInterval channel will be used to signal when the next interval is executed (when not nil) Start(ctx context.Context, onExit OnExit, onNextInterval OnNextInterval, waitFor <-chan struct{}) error }
Worker has a pool of workers which execute all tasks for each APIServer in the cluster
type WorkerImpl ¶
type WorkerImpl struct { NewClient client.NewClientFunc // contains filtered or unexported fields }
WorkerImpl is the implementation of the Worker interface
func (*WorkerImpl) RegisterTask ¶
func (w *WorkerImpl) RegisterTask(name string, task Task)
RegisterTask implements Worker.RegisterTask Thread-safe
func (*WorkerImpl) Start ¶
func (w *WorkerImpl) Start(ctx context.Context, onExit OnExit, onNextInterval OnNextInterval, waitFor <-chan struct{}) error
Start implements Worker.Start
func (*WorkerImpl) UnregisterTask ¶
func (w *WorkerImpl) UnregisterTask(name string)
UnregisterTask implements Worker.UnregisterTask Thread-safe