Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Callbacks ¶
type Callbacks struct {
// OnMonitorRunning is a callback that is called after the watch is set up for the secret.
OnMonitorRunning func()
// OnMonitorShuttingDown is a callback that is called before the watch is shut down.
OnMonitorShuttingDown func()
// OnCredentialChange is called when the oVirt credentials change.
OnCredentialChange func(OVirtConnection)
}
Callbacks is a configuration structure that holds the possible callbacks for the monitor. The OnCredentialChange callback is required.
type ConnectionConfig ¶
ConnectionConfig contains the configuration for the Kubernetes API.
type Logger ¶ added in v0.2.0
type Logger interface {
Debugf(format string, args ...interface{})
Infof(format string, args ...interface{})
Warningf(format string, args ...interface{})
Errorf(format string, args ...interface{})
}
Logger provides pluggable logging for this library.
func NewTestLogger ¶ added in v0.2.0
type OVirtConnection ¶
type OVirtConnection interface {
// GetSDK returns a direct connection from the oVirt Go SDK.
GetSDK() *ovirtsdk.Connection
}
OVirtConnection holds the created connection(s). This interface is added for extensibility.
type OVirtCredentialMonitor ¶
type OVirtCredentialMonitor interface {
// GetConnection returns the client from the latest credential update. It is recommended that this function should
// only be called under a lock shared with the callback to avoid race conditions.
GetConnection() OVirtConnection
// Run runs in foreground until the context expires.
Run(ctx context.Context)
}
OVirtCredentialMonitor is a utility to monitor a Kubernetes secret and call a callback function with a new connection whenever the credentials change.
func New ¶
func New( connectionConfig ConnectionConfig, secretConfig OVirtSecretConfig, callbacks Callbacks, logger Logger, ) (OVirtCredentialMonitor, error)
type OVirtSecretConfig ¶
type OVirtSecretConfig struct {
// Name is the name of the secret to be read.
Name string
// Namespace is the optional namespace specification.
Namespace string
}
func (OVirtSecretConfig) String ¶ added in v0.2.0
func (o OVirtSecretConfig) String() string
func (OVirtSecretConfig) Validate ¶
func (o OVirtSecretConfig) Validate() error
Click to show internal directories.
Click to hide internal directories.