Documentation
¶
Overview ¶
Package controller contains the controller of the CRD
Package controller contains the controller of the CRD ¶
Package controller contains the controller of the CRD
Index ¶
- Constants
- Variables
- func GetManagedInstances(ctx context.Context, cluster *apiv1.Cluster, r client.Client) (corev1.PodList, error)
- func GetPodsNotOnPrimaryNode(status postgres.PostgresqlStatusList, primaryPod *postgres.PostgresqlStatus) postgres.PostgresqlStatusList
- func IsOwnedByCluster(obj client.Object) (string, bool)
- func ReconcileScheduledBackup(ctx context.Context, event record.EventRecorder, cli client.Client, ...) (ctrl.Result, error)
- type BackupReconciler
- type ClusterReconciler
- func (r *ClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
- func (r *ClusterReconciler) RegisterPhase(ctx context.Context, cluster *apiv1.Cluster, phase string, reason string) error
- func (r *ClusterReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, maxConcurrentReconciles int) error
- type PluginReconciler
- type PoolerReconciler
- type ScheduledBackupReconciler
- func (r *ScheduledBackupReconciler) GetChildBackups(ctx context.Context, scheduledBackup apiv1.ScheduledBackup) ([]apiv1.Backup, error)
- func (r *ScheduledBackupReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
- func (r *ScheduledBackupReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, maxConcurrentReconciles int) error
Constants ¶
const ( // ImmediateBackupLabelName label is applied to backups to tell if a backup // is immediate or not ImmediateBackupLabelName = utils.ImmediateBackupLabelName // ParentScheduledBackupLabelName label is applied to backups to easily tell the scheduled backup // it was created from. ParentScheduledBackupLabelName = utils.ParentScheduledBackupLabelName )
Variables ¶
var ErrNextLoop = utils.ErrNextLoop
ErrNextLoop see utils.ErrNextLoop
var ErrWaitingOnFailOverDelay = fmt.Errorf("current primary isn't healthy, waiting for the delay before triggering a failover") //nolint: lll
ErrWaitingOnFailOverDelay is raised when the primary server can't be elected because the .spec.failoverDelay hasn't elapsed yet
var ErrWalReceiversRunning = fmt.Errorf("wal receivers are still running")
ErrWalReceiversRunning is raised when a new primary server can't be elected because there is a WAL receiver running in our Pod list
Functions ¶
func GetManagedInstances ¶
func GetManagedInstances(ctx context.Context, cluster *apiv1.Cluster, r client.Client) (corev1.PodList, error)
GetManagedInstances gets all the instances associated with the given Cluster
func GetPodsNotOnPrimaryNode ¶
func GetPodsNotOnPrimaryNode( status postgres.PostgresqlStatusList, primaryPod *postgres.PostgresqlStatus, ) postgres.PostgresqlStatusList
GetPodsNotOnPrimaryNode filters out only pods that are not on the same node as the primary one
func IsOwnedByCluster ¶
IsOwnedByCluster checks that an object is owned by a Cluster and returns the owner name
func ReconcileScheduledBackup ¶
func ReconcileScheduledBackup( ctx context.Context, event record.EventRecorder, cli client.Client, scheduledBackup *apiv1.ScheduledBackup, ) (ctrl.Result, error)
ReconcileScheduledBackup is the main reconciliation logic for a scheduled backup
Types ¶
type BackupReconciler ¶
type BackupReconciler struct {
client.Client
DiscoveryClient discovery.DiscoveryInterface
Scheme *runtime.Scheme
Recorder record.EventRecorder
Plugins repository.Interface
// contains filtered or unexported fields
}
BackupReconciler reconciles a Backup object
func NewBackupReconciler ¶
func NewBackupReconciler( mgr manager.Manager, discoveryClient *discovery.DiscoveryClient, plugins repository.Interface, ) *BackupReconciler
NewBackupReconciler properly initializes the BackupReconciler
func (*BackupReconciler) Reconcile ¶
Reconcile is the main reconciliation loop nolint: gocognit,gocyclo
func (*BackupReconciler) SetupWithManager ¶
SetupWithManager sets up this controller given a controller manager
type ClusterReconciler ¶
type ClusterReconciler struct {
client.Client
DiscoveryClient discovery.DiscoveryInterface
Scheme *runtime.Scheme
Recorder record.EventRecorder
InstanceClient remote.InstanceClient
Plugins repository.Interface
// contains filtered or unexported fields
}
ClusterReconciler reconciles a Cluster objects
func NewClusterReconciler ¶
func NewClusterReconciler( mgr manager.Manager, discoveryClient *discovery.DiscoveryClient, plugins repository.Interface, drainTaints []string, ) *ClusterReconciler
NewClusterReconciler creates a new ClusterReconciler initializing it
func (*ClusterReconciler) RegisterPhase ¶
func (r *ClusterReconciler) RegisterPhase(ctx context.Context, cluster *apiv1.Cluster, phase string, reason string, ) error
RegisterPhase update phase in the status cluster with the proper reason
func (*ClusterReconciler) SetupWithManager ¶
func (r *ClusterReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, maxConcurrentReconciles int) error
SetupWithManager creates a ClusterReconciler
type PluginReconciler ¶ added in v1.24.0
type PluginReconciler struct {
client.Client
Scheme *runtime.Scheme
Plugins repository.Interface
OperatorNamespace string
}
PluginReconciler reconciles CNPG-i plugins
func NewPluginReconciler ¶ added in v1.24.0
func NewPluginReconciler( mgr manager.Manager, operatorNamespace string, plugins repository.Interface, ) *PluginReconciler
NewPluginReconciler creates a new PluginReconciler initializing it
func (*PluginReconciler) SetupWithManager ¶ added in v1.24.0
func (r *PluginReconciler) SetupWithManager( mgr ctrl.Manager, maxConcurrentReconciles int, ) error
SetupWithManager adds this PluginReconciler to the passed controller manager
type PoolerReconciler ¶
type PoolerReconciler struct {
client.Client
DiscoveryClient discovery.DiscoveryInterface
Scheme *runtime.Scheme
Recorder record.EventRecorder
}
PoolerReconciler reconciles a Pooler object
func (*PoolerReconciler) Reconcile ¶
Reconcile implements the main reconciliation loop for pooler objects
func (*PoolerReconciler) SetupWithManager ¶
func (r *PoolerReconciler) SetupWithManager(mgr ctrl.Manager, maxConcurrentReconciles int) error
SetupWithManager setup this controller inside the controller manager
type ScheduledBackupReconciler ¶
type ScheduledBackupReconciler struct {
client.Client
Scheme *runtime.Scheme
Recorder record.EventRecorder
}
ScheduledBackupReconciler reconciles a ScheduledBackup object
func (*ScheduledBackupReconciler) GetChildBackups ¶
func (r *ScheduledBackupReconciler) GetChildBackups( ctx context.Context, scheduledBackup apiv1.ScheduledBackup, ) ([]apiv1.Backup, error)
GetChildBackups gets all the backups scheduled by a certain scheduler
func (*ScheduledBackupReconciler) Reconcile ¶
func (r *ScheduledBackupReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
Reconcile is the main reconciler logic
func (*ScheduledBackupReconciler) SetupWithManager ¶
func (r *ScheduledBackupReconciler) SetupWithManager( ctx context.Context, mgr ctrl.Manager, maxConcurrentReconciles int, ) error
SetupWithManager install this controller in the controller manager
Source Files
¶
- backup_controller.go
- backup_predicates.go
- cluster_cleanup.go
- cluster_controller.go
- cluster_create.go
- cluster_delete.go
- cluster_image.go
- cluster_pki.go
- cluster_plugins.go
- cluster_predicates.go
- cluster_restore.go
- cluster_scale.go
- cluster_status.go
- cluster_upgrade.go
- finalizers_delete.go
- plugin_controller.go
- plugin_predicates.go
- plugins.go
- pooler_controller.go
- pooler_predicates.go
- pooler_resources.go
- pooler_status.go
- pooler_update.go
- replicas.go
- scheduledbackup_controller.go