controllers

package
v1.23.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 64 Imported by: 0

Documentation

Overview

Package controllers contains the controller of the CRD

Package controllers contains the controller of the CRD

Index

Constants

View Source
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

View Source
var ErrNextLoop = utils.ErrNextLoop

ErrNextLoop see utils.ErrNextLoop

View Source
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

View Source
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 added in v1.19.0

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 added in v1.17.0

func IsOwnedByCluster(obj client.Object) (string, bool)

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
	// contains filtered or unexported fields
}

BackupReconciler reconciles a Backup object

func NewBackupReconciler added in v1.19.0

func NewBackupReconciler(mgr manager.Manager, discoveryClient *discovery.DiscoveryClient) *BackupReconciler

NewBackupReconciler properly initializes the BackupReconciler

func (*BackupReconciler) Reconcile

func (r *BackupReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile is the main reconciliation loop nolint: gocognit

func (*BackupReconciler) SetupWithManager

func (r *BackupReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) error

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

	*instance.StatusClient
}

ClusterReconciler reconciles a Cluster objects

func NewClusterReconciler

func NewClusterReconciler(mgr manager.Manager, discoveryClient *discovery.DiscoveryClient) *ClusterReconciler

NewClusterReconciler creates a new ClusterReconciler initializing it

func (*ClusterReconciler) Reconcile

func (r *ClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile is the operator reconcile loop

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) error

SetupWithManager creates a ClusterReconciler

type PoolerReconciler

type PoolerReconciler struct {
	client.Client
	DiscoveryClient discovery.DiscoveryInterface
	Scheme          *runtime.Scheme
	Recorder        record.EventRecorder
}

PoolerReconciler reconciles a Pooler object

func (*PoolerReconciler) Reconcile

func (r *PoolerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile implements the main reconciliation loop for pooler objects

func (*PoolerReconciler) SetupWithManager

func (r *PoolerReconciler) SetupWithManager(mgr ctrl.Manager) 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

Reconcile is the main reconciler logic

func (*ScheduledBackupReconciler) SetupWithManager

func (r *ScheduledBackupReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) error

SetupWithManager install this controller in the controller manager

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL