Documentation ¶
Index ¶
- Constants
- Variables
- type APIReconciler
- func (a *APIReconciler) GetAPI(ctx context.Context, instanceName types.NamespacedName) (*agent.APIClient, error)
- func (a *APIReconciler) GetDatabase(ctx context.Context, databaseName types.NamespacedName) (*mysqlv1alpha1.Database, error)
- func (a *APIReconciler) GetStore(ctx context.Context, storeName types.NamespacedName) (*mysqlv1alpha1.Store, error)
- func (a *APIReconciler) GetUser(ctx context.Context, userName types.NamespacedName) (*mysqlv1alpha1.User, error)
- type BackupJob
- type BackupManager
- func (bm *BackupManager) CreateBackup(backup *mysqlv1alpha1.Backup) (*mysqlv1alpha1.BackupDetails, error)
- func (bm *BackupManager) GetEnvVars(store mysqlv1alpha1.Store) (map[string]string, error)
- func (bm *BackupManager) MonitorBackup(backup *mysqlv1alpha1.Backup) (*mysqlv1alpha1.BackupDetails, error)
- type BackupReconciler
- type ChatManager
- type ChatReconciler
- type Crontab
- type DatabaseManager
- type DatabaseReconciler
- type DefaultCrontab
- type DefaultSlackConnector
- type EnvManager
- type GrantManager
- type GrantReconciler
- type InstanceManager
- type InstanceReconciler
- type MaintenanceJob
- type MockCrontab
- type OperationManager
- type OperationReconciler
- type SlackConnector
- type StatefulSetProperties
- type StoreManager
- type StoreReconciler
- type TimeManager
- type UnMaintenanceJob
- type UserManager
- type UserReconciler
Constants ¶
const ( // BackupScheduling defines the schedule associated with instance backups BackupScheduling string = "backup" // MaintenanceScheduling defines the schedule associated with maintenance except for backup MaintenanceScheduling string = "maintenance" // MaintenanceUnscheduling defines the schedule associated with maintenance removal MaintenanceUnscheduling string = "removal" )
Variables ¶
var ( // ErrBackupFailed is reported the backup has failed ErrBackupFailed = errors.New("BackupFailed") // ErrBackupRunning is reported the backup is always running ErrBackupRunning = errors.New("BackupRunning") )
var ( // ErrChannelNotFound is reported when the channel does not exist ErrChannelNotFound = errors.New("ChannelNotFound") // ErrChatConnectionFailed is reported when the connection failed ErrChatConnectionFailed = errors.New("ConnectionFailed") )
var ( // ErrNotImplemented is reported when a feature is not implemented ErrNotImplemented = errors.New("NotImplemented") // ErrUserDatabaseMismatch is reported when the user and database do not match for a Grant ErrUserDatabaseMismatch = errors.New("UserDatabaseMismatch") // ErrStoreNotFound is reported when a store is not found ErrStoreNotFound = errors.New("StoreNotFound") // ErrStoreNotReady is reported when a store is not ready ErrStoreNotReady = errors.New("StoreNotReady") // ErrDatabaseNotFound is reported when a database is not found ErrDatabaseNotFound = errors.New("DatabaseNotFound") // ErrDatabaseNotReady is reported when a database is not ready ErrDatabaseNotReady = errors.New("DatabaseNotReady") // ErrUserNotFound is reported when a user is not found ErrUserNotFound = errors.New("UserNotFound") // ErrUserNotReady is reported when a user is not ready ErrUserNotReady = errors.New("UserNotReady") // ErrInstanceNotFound is reported when an instance is not found ErrInstanceNotFound = errors.New("InstanceNotFound") // ErrInstanceNotReady is reported when an instance is not ready ErrInstanceNotReady = errors.New("InstanceNotReady") // ErrPodNotFound is reported when a pod is not found ErrPodNotFound = errors.New("PodNotFound") // ErrAgentAccessFailed is reported when the agent could not be accessed ErrAgentAccessFailed = errors.New("AgentAccessFailed") // ErrAgentRequestFailed is reported when the agent request fails ErrAgentRequestFailed = errors.New("AgentRequestFailed") )
var ( // ErrMissingPassword is reported when a password is missing for a user ErrMissingPassword = errors.New("MissingPassword") // ErrKeyNotFound is reported when a key is not found in configMap or secret ErrKeyNotFound = errors.New("KeyNotFound") // ErrConfigMapNotFound is reported when a configMap is not found ErrConfigMapNotFound = errors.New("ConfigMapNotFound") // ErrSecretNotFound is reported when a secret is not found ErrSecretNotFound = errors.New("SecretNotFound") )
var ( // ErrMissingVariable shows when a variable is missing from the store ErrMissingVariable = errors.New("MissingVariable") )
Functions ¶
This section is empty.
Types ¶
type APIReconciler ¶
APIReconciler reconciles an object
func (*APIReconciler) GetAPI ¶
func (a *APIReconciler) GetAPI(ctx context.Context, instanceName types.NamespacedName) (*agent.APIClient, error)
GetAPI is the script that gets the API from an instance name and namespace
func (*APIReconciler) GetDatabase ¶
func (a *APIReconciler) GetDatabase(ctx context.Context, databaseName types.NamespacedName) (*mysqlv1alpha1.Database, error)
GetDatabase gets a database from the name and namespace
func (*APIReconciler) GetStore ¶
func (a *APIReconciler) GetStore(ctx context.Context, storeName types.NamespacedName) (*mysqlv1alpha1.Store, error)
GetStore gets a store from the name and namespace
func (*APIReconciler) GetUser ¶
func (a *APIReconciler) GetUser(ctx context.Context, userName types.NamespacedName) (*mysqlv1alpha1.User, error)
GetUser gets a user from the name and namespace
type BackupJob ¶
type BackupJob struct { client.Client Instance types.NamespacedName Log logr.Logger Scheme *runtime.Scheme }
BackupJob is a struct that manages Jobs for backups
type BackupManager ¶
type BackupManager struct { Context context.Context Reconciler *BackupReconciler TimeManager *TimeManager }
BackupManager provides methods to manage the backup subcomponents
func (*BackupManager) CreateBackup ¶
func (bm *BackupManager) CreateBackup(backup *mysqlv1alpha1.Backup) (*mysqlv1alpha1.BackupDetails, error)
CreateBackup is the script that creates a user
func (*BackupManager) GetEnvVars ¶
func (bm *BackupManager) GetEnvVars(store mysqlv1alpha1.Store) (map[string]string, error)
GetEnvVars returns the environment variables for the store
func (*BackupManager) MonitorBackup ¶
func (bm *BackupManager) MonitorBackup(backup *mysqlv1alpha1.Backup) (*mysqlv1alpha1.BackupDetails, error)
MonitorBackup watch backup progress and update results
type BackupReconciler ¶
type BackupReconciler struct { client.Client Log logr.Logger Scheme *runtime.Scheme Properties StatefulSetProperties }
BackupReconciler reconciles a Backup object
func (*BackupReconciler) SetupWithManager ¶
func (r *BackupReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager configure type of events the manager should watch
type ChatManager ¶
type ChatManager struct { Context context.Context Reconciler *ChatReconciler TimeManager *TimeManager }
ChatManager provides methods to manage chat subcomponents
type ChatReconciler ¶
type ChatReconciler struct { client.Client Log logr.Logger Scheme *runtime.Scheme Connector SlackConnector Chats map[string]*slack.Client }
ChatReconciler reconciles a Chat object
func (*ChatReconciler) SetupWithManager ¶
func (r *ChatReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
type Crontab ¶
type Crontab interface {
// contains filtered or unexported methods
}
Crontab interface is provided to allow unit tests
func NewDefaultCrontab ¶
func NewDefaultCrontab() Crontab
NewDefaultCrontab provides contrab abilities to the operator
func NewMockCrontabCrontab ¶
func NewMockCrontabCrontab() Crontab
NewMockCrontabCrontab initialize a predictable incarnation to ease tests
type DatabaseManager ¶
type DatabaseManager struct { Context context.Context Reconciler *DatabaseReconciler TimeManager *TimeManager }
DatabaseManager provides methods to manage database subcomponents
func (*DatabaseManager) CreateDatabase ¶
func (dm *DatabaseManager) CreateDatabase(database *mysqlv1alpha1.Database) error
CreateDatabase is the script that creates a database
type DatabaseReconciler ¶
DatabaseReconciler reconciles a Database object
func (*DatabaseReconciler) SetupWithManager ¶
func (r *DatabaseReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager configure type of events the manager should watch
type DefaultCrontab ¶
type DefaultCrontab struct { Cron *cron.Cron Incarnation string }
DefaultCrontab provides a simple struct to manage cron EntryID for instances
type DefaultSlackConnector ¶
type DefaultSlackConnector struct { }
DefaultSlackConnector an implementation of the SlackConnector
func (*DefaultSlackConnector) GetAPIwithChannel ¶
func (cc *DefaultSlackConnector) GetAPIwithChannel(cm *ChatManager, chat *mysqlv1alpha1.Chat) (*slack.Client, string, error)
GetAPIwithChannel returns the API with the Channel ID for a named group or channel
func (*DefaultSlackConnector) PostMessage ¶
func (cc *DefaultSlackConnector) PostMessage(api *slack.Client, channel string, message string) error
PostMessage Post a message on the API
type EnvManager ¶
EnvManager reconciles an Environment object
func (*EnvManager) GetEnvVars ¶
func (em *EnvManager) GetEnvVars(ctx context.Context, store mysqlv1alpha1.Store) (map[string]string, error)
GetEnvVars returns the environment variables for the store
type GrantManager ¶
type GrantManager struct { Context context.Context Reconciler *GrantReconciler TimeManager *TimeManager }
GrantManager provides methods to manage grant subcomponents
func (*GrantManager) CreateGrant ¶
func (gm *GrantManager) CreateGrant(grant *mysqlv1alpha1.Grant) error
CreateGrant is the script that creates a grant
type GrantReconciler ¶
GrantReconciler reconciles a Grant object
func (*GrantReconciler) SetupWithManager ¶
func (r *GrantReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
type InstanceManager ¶
type InstanceManager struct { Context context.Context Reconciler *InstanceReconciler Properties *StatefulSetProperties TimeManager *TimeManager }
InstanceManager provides methods to manage the instance subcomponents
type InstanceReconciler ¶
type InstanceReconciler struct { client.Client Log logr.Logger Scheme *runtime.Scheme Properties *StatefulSetProperties Crontab Crontab }
InstanceReconciler reconciles a Instance object
func (*InstanceReconciler) SetupWithManager ¶
func (r *InstanceReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager configure type of events the manager should watch
type MaintenanceJob ¶
type MaintenanceJob struct { client.Client Instance types.NamespacedName Log logr.Logger Scheme *runtime.Scheme Crontab Crontab }
MaintenanceJob is a struct that manages Jobs for maintenance
func NewMaintenanceJob ¶
func NewMaintenanceJob(client client.Client, instance types.NamespacedName, log logr.Logger, scheme *runtime.Scheme, crontab Crontab) *MaintenanceJob
NewMaintenanceJob creates a MaintenanceJob to schedule it
func (*MaintenanceJob) Run ¶
func (b *MaintenanceJob) Run()
Run implement the Job interface to use with Cron AddFunc()
type MockCrontab ¶
type MockCrontab struct {
Incarnation string
}
MockCrontab provides a simple struct to mock cron EntryID
type OperationManager ¶
type OperationManager struct { Context context.Context Reconciler *OperationReconciler TimeManager *TimeManager }
OperationManager provides methods to manage operations
func (*OperationManager) NoOp ¶
func (om *OperationManager) NoOp() error
NoOp is a No Operation function
type OperationReconciler ¶
OperationReconciler reconciles a Operation object
func (*OperationReconciler) Reconcile ¶
Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state.
func (*OperationReconciler) SetupWithManager ¶
func (r *OperationReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
type SlackConnector ¶
type SlackConnector interface { GetAPIwithChannel(cm *ChatManager, chat *mysqlv1alpha1.Chat) (*slack.Client, string, error) PostMessage(api *slack.Client, channel string, message string) error }
SlackConnector is an interface to the SlackConnector and is used to perform tests
func NewDefaultSlackConnector ¶
func NewDefaultSlackConnector() SlackConnector
NewDefaultSlackConnector generates a Slack connector based on slack-go
type StatefulSetProperties ¶
StatefulSetProperties defines the default agent and mysql versions
func (*StatefulSetProperties) NewStatefulSetForInstance ¶
func (s *StatefulSetProperties) NewStatefulSetForInstance(instance *mysqlv1alpha1.Instance, store *mysqlv1alpha1.Store, location string) *appsv1.StatefulSet
NewStatefulSetForInstance returns a MySQL StatefulSet with the instance name/namespace
type StoreManager ¶
type StoreManager struct { Context context.Context Reconciler *StoreReconciler TimeManager *TimeManager }
StoreManager provides methods to manage the store subcomponents
func (*StoreManager) GetEnvVars ¶
func (sm *StoreManager) GetEnvVars(store mysqlv1alpha1.Store) (map[string]string, error)
GetEnvVars returns the environment variables for the store
type StoreReconciler ¶
type StoreReconciler struct { client.Client Log logr.Logger Scheme *runtime.Scheme Storages map[string]backend.Storage }
StoreReconciler reconciles a Store object
func (*StoreReconciler) SetupWithManager ¶
func (r *StoreReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager configure type of events the manager should watch
type TimeManager ¶
TimeManager manages a set of time durations
func NewTimeManager ¶
func NewTimeManager() *TimeManager
NewTimeManager creates a set of time durations
type UnMaintenanceJob ¶
type UnMaintenanceJob struct { client.Client Instance types.NamespacedName Log logr.Logger Scheme *runtime.Scheme Crontab Crontab }
UnMaintenanceJob is a struct that manages Jobs to stop maintenance
func NewUnMaintenanceJob ¶
func NewUnMaintenanceJob(client client.Client, instance types.NamespacedName, log logr.Logger, scheme *runtime.Scheme, crontab Crontab) *UnMaintenanceJob
NewUnMaintenanceJob creates a MaintenanceJob to schedule it
func (*UnMaintenanceJob) Run ¶
func (b *UnMaintenanceJob) Run()
Run implement the Job interface to use with Cron AddFunc()
type UserManager ¶
type UserManager struct { Context context.Context Reconciler *UserReconciler TimeManager *TimeManager }
UserManager provides methods to manage user subcomponents
func (*UserManager) CreateUser ¶
func (um *UserManager) CreateUser(user *mysqlv1alpha1.User) error
CreateUser is the script that creates a user
func (*UserManager) GetPassword ¶
func (um *UserManager) GetPassword(user *mysqlv1alpha1.User) (string, error)
GetPassword returns the password for the user
type UserReconciler ¶
UserReconciler reconciles a User object
func (*UserReconciler) SetupWithManager ¶
func (r *UserReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager configure type of events the manager should watch
Source Files ¶
- backup_controller.go
- backup_helpers.go
- chat_controller.go
- chat_helpers.go
- database_controller.go
- database_helpers.go
- envs_helpers.go
- grant_controller.go
- grant_helpers.go
- helpers.go
- instance_controller.go
- instance_cron.go
- instance_cron_mock.go
- instance_helpers.go
- instance_jobs.go
- operation_controller.go
- operation_helpers.go
- store_controller.go
- store_helpers.go
- time_manager.go
- user_controller.go
- user_helpers.go