controller

package
v0.0.0-...-fbca919 Latest Latest
Warning

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

Go to latest
Published: May 20, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package controller contains all controllers of the project

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NonAdminBackupReconciler

type NonAdminBackupReconciler struct {
	client.Client
	Scheme  *runtime.Scheme
	Context context.Context
}

NonAdminBackupReconciler reconciles a NonAdminBackup object

func (*NonAdminBackupReconciler) CreateVeleroBackupSpec

func (r *NonAdminBackupReconciler) CreateVeleroBackupSpec(ctx context.Context, logrLogger logr.Logger, nab *nacv1alpha1.NonAdminBackup) (exitReconcile bool, requeueReconcile bool, errorReconcile error)

CreateVeleroBackupSpec creates or updates a Velero Backup object based on the provided NonAdminBackup object.

Parameters:

ctx: Context for the request.
log: Logger instance for logging messages.
nab: Pointer to the NonAdminBackup object.

The function generates a name for the Velero Backup object based on the provided namespace and name. It then checks if a Velero Backup object with that name already exists. If it does not exist, it creates a new one. The function returns boolean values indicating whether the reconciliation loop should exit or requeue

func (*NonAdminBackupReconciler) InitNonAdminBackup

func (r *NonAdminBackupReconciler) InitNonAdminBackup(ctx context.Context, logrLogger logr.Logger, nab *nacv1alpha1.NonAdminBackup) (exitReconcile bool, requeueReconcile bool, errorReconcile error)

InitNonAdminBackup sets the New Phase on a NonAdminBackup object if it is not already set.

Parameters:

ctx: Context for the request.
logrLogger: Logger instance for logging messages.
nab: Pointer to the NonAdminBackup object.

The function checks if the Phase of the NonAdminBackup object is empty. If it is empty, it sets the Phase to "New". It then returns boolean values indicating whether the reconciliation loop should requeue and whether the status was updated.

func (*NonAdminBackupReconciler) 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. TODO(user): Modify the Reconcile function to compare the state specified by the NonAdminBackup object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.17.0/pkg/reconcile

func (*NonAdminBackupReconciler) SetupWithManager

func (r *NonAdminBackupReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

func (*NonAdminBackupReconciler) ValidateVeleroBackupSpec

func (r *NonAdminBackupReconciler) ValidateVeleroBackupSpec(ctx context.Context, logrLogger logr.Logger, nab *nacv1alpha1.NonAdminBackup) (exitReconcile bool, requeueReconcile bool, errorReconcile error)

ValidateVeleroBackupSpec validates the VeleroBackup Spec from the NonAdminBackup.

Parameters:

ctx: Context for the request.
logrLogger: Logger instance for logging messages.
nab: Pointer to the NonAdminBackup object.

The function attempts to get the BackupSpec from the NonAdminBackup object. If an error occurs during this process, the function sets the NonAdminBackup status to "BackingOff" and updates the corresponding condition accordingly. If the BackupSpec is invalid, the function sets the NonAdminBackup condition to "InvalidBackupSpec". If the BackupSpec is valid, the function sets the NonAdminBackup condition to "BackupAccepted".

Jump to

Keyboard shortcuts

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