Documentation
¶
Index ¶
- func BuildRoleBindingForBackupConfig(cluster *cnpgv1.Cluster) *rbacv1.RoleBinding
- func BuildRoleForBackupConfigs(role *rbacv1.Role, cluster *cnpgv1.Cluster, ...)
- func GetRoleNameForBackupConfig(clusterName string) string
- type BackupConfigReconciler
- type BackupConfigStatusController
- type BackupDeletionController
- func (b *BackupDeletionController) EnqueueBackupConfigDeletion(ctx context.Context, backupConfig *v1beta1.BackupConfig) error
- func (b *BackupDeletionController) EnqueueBackupDeletion(ctx context.Context, backup *cnpgv1.Backup) error
- func (b *BackupDeletionController) NeedLeaderElection() bool
- func (b *BackupDeletionController) Start(ctx context.Context) error
- type BackupReconciler
- type ConfigMapReconciler
- type DeletionRequest
- type ResourceType
- type RetentionController
- type SecretReconciler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildRoleBindingForBackupConfig ¶
func BuildRoleBindingForBackupConfig( cluster *cnpgv1.Cluster, ) *rbacv1.RoleBinding
BuildRoleBinding builds the role binding object for this cluster
func BuildRoleForBackupConfigs ¶
func BuildRoleForBackupConfigs( role *rbacv1.Role, cluster *cnpgv1.Cluster, backupConfigs []v1beta1.BackupConfig, )
BuildRole builds the Role object for this cluster It collects all BackupConfig objects used by cluster and grants read/watch permissions on them only It also finds all secrets referenced by these BackupConfig and grants read permission on them
func GetRoleNameForBackupConfig ¶ added in v0.2.0
GetRBACName returns the name of the RBAC entities for the wal-g backup configs
Types ¶
type BackupConfigReconciler ¶
type BackupConfigReconciler struct {
client.Client
Scheme *runtime.Scheme
BackupDeletionController *BackupDeletionController
}
BackupConfigReconciler reconciles a BackupConfig object
func (*BackupConfigReconciler) Reconcile ¶
func (r *BackupConfigReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.20.4/pkg/reconcile
func (*BackupConfigReconciler) SetupWithManager ¶
func (r *BackupConfigReconciler) SetupWithManager(mgr ctrl.Manager, backupDeletionController *BackupDeletionController) error
SetupWithManager sets up the controller with the Manager.
type BackupConfigStatusController ¶ added in v0.3.0
type BackupConfigStatusController struct {
// contains filtered or unexported fields
}
BackupConfigStatusController periodically reconciles BackupConfigStatus fields for all BackupConfig resources. It uses a static goroutine pool with a single shared queue to limit concurrency and prevent overloading S3 storage.
Per-BackupConfig deduplication ensures that the same resource is not reconciled concurrently by multiple workers. Manual status updates can be enqueued via EnqueueStatusUpdate.
func NewBackupConfigStatusController ¶ added in v0.3.0
func NewBackupConfigStatusController(client client.Client, checkInterval time.Duration) *BackupConfigStatusController
NewBackupConfigStatusController creates a new BackupConfigStatusController
func (*BackupConfigStatusController) EnqueueStatusUpdate ¶ added in v0.3.0
func (c *BackupConfigStatusController) EnqueueStatusUpdate(key types.NamespacedName)
EnqueueStatusUpdate enqueues a status reconciliation for a specific BackupConfig. This can be called externally (e.g. after backup creation or BackupConfig changes) to trigger an immediate status update. Non-blocking: if the queue is full, the request is dropped (the periodic reconciliation will pick it up later).
func (*BackupConfigStatusController) NeedLeaderElection ¶ added in v0.3.0
func (c *BackupConfigStatusController) NeedLeaderElection() bool
NeedLeaderElection returns true if the Runnable needs to be run in the leader election mode. e.g. controllers need to be run in leader election mode, while webhook server doesn't.
type BackupDeletionController ¶ added in v0.2.0
BackupDeletionController handles Backup and BackupConfig deletion requests and processes them sequentially per BackupConfig to prevent operator from overloading and wal-g collisions at deleting backups at the same storage
func NewBackupDeletionController ¶ added in v0.2.0
func NewBackupDeletionController(client client.Client) *BackupDeletionController
NewBackupDeletionController creates a new BackupDeletionController
func (*BackupDeletionController) EnqueueBackupConfigDeletion ¶ added in v0.2.2
func (b *BackupDeletionController) EnqueueBackupConfigDeletion(ctx context.Context, backupConfig *v1beta1.BackupConfig) error
EnqueueBackupConfigDeletion adds a BackupConfig to the deletion queue If the queue doesn't exist, it creates a new one and starts a goroutine to process it
func (*BackupDeletionController) EnqueueBackupDeletion ¶ added in v0.2.0
func (b *BackupDeletionController) EnqueueBackupDeletion(ctx context.Context, backup *cnpgv1.Backup) error
EnqueueBackupDeletion adds a Backup to the deletion queue for its BackupConfig If the queue doesn't exist, it creates a new one and starts a goroutine to process it
func (*BackupDeletionController) NeedLeaderElection ¶ added in v0.3.0
func (b *BackupDeletionController) NeedLeaderElection() bool
NeedLeaderElection returns true if the Runnable needs to be run in the leader election mode. e.g. controllers need to be run in leader election mode, while webhook server doesn't.
type BackupReconciler ¶ added in v0.2.0
type BackupReconciler struct {
client.Client
Scheme *runtime.Scheme
DeletionController *BackupDeletionController
}
BackupReconciler reconciles a Backup object
func (*BackupReconciler) SetupWithManager ¶ added in v0.2.0
func (r *BackupReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
type ConfigMapReconciler ¶ added in v0.2.2
ConfigMapReconciler reconciles ConfigMap objects to protect them from accidental deletion when they are referenced by BackupConfig resources
func (*ConfigMapReconciler) SetupWithManager ¶ added in v0.2.2
func (r *ConfigMapReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
type DeletionRequest ¶ added in v0.2.2
type DeletionRequest struct {
// Type of resource to delete
Type ResourceType
// NamespacedName of the resource
Key types.NamespacedName
}
DeletionRequest represents a request to delete a resource
type ResourceType ¶ added in v0.2.2
type ResourceType string
ResourceType defines the type of resource being deleted
const ( // ResourceTypeBackup represents a Backup resource ResourceTypeBackup ResourceType = "Backup" // ResourceTypeBackupConfig represents a BackupConfig resource ResourceTypeBackupConfig ResourceType = "BackupConfig" // Timeout for resource cleanup, if exceeded - deletion process will be aborted and retried // Needed to prevent stuck on deletion when incorrect BackupConfig / etc. DeletionRequestTimeout time.Duration = 5 * time.Minute )
type RetentionController ¶ added in v0.2.0
type RetentionController struct {
// contains filtered or unexported fields
}
RetentionController periodically checks all BackupConfig resources and applies retention policies to delete old backups
func NewRetentionController ¶ added in v0.2.0
func NewRetentionController(client client.Client, checkInterval time.Duration) *RetentionController
NewRetentionController creates a new RetentionController
type SecretReconciler ¶ added in v0.2.2
SecretReconciler reconciles Secret objects to protect them from accidental deletion when they are referenced by BackupConfig resources
func (*SecretReconciler) SetupWithManager ¶ added in v0.2.2
func (r *SecretReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.