controller

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2024 License: Apache-2.0 Imports: 86 Imported by: 9

Documentation

Index

Constants

View Source
const (
	Backup                = "backup"
	BackupOperations      = "backup-operations"
	BackupDeletion        = "backup-deletion"
	BackupFinalizer       = "backup-finalizer"
	BackupRepo            = "backup-repo"
	BackupStorageLocation = "backup-storage-location"
	BackupSync            = "backup-sync"
	DownloadRequest       = "download-request"
	GarbageCollection     = "gc"
	PodVolumeBackup       = "pod-volume-backup"
	PodVolumeRestore      = "pod-volume-restore"
	Restore               = "restore"
	RestoreOperations     = "restore-operations"
	Schedule              = "schedule"
	ServerStatusRequest   = "server-status-request"
	RestoreFinalizer      = "restore-finalizer"
)
View Source
const (
	DataUploadDownloadFinalizer = "velero.io/data-upload-download-finalizer"
)
View Source
const (
	PVPatchMaximumDuration = 10 * time.Minute
)

Variables

DisableableControllers is a list of controllers that can be disabled

View Source
var ExternalResourcesFinalizer = "restores.velero.io/external-resources-finalizer"

Functions

func NewBackupDeletionReconciler added in v1.9.0

func NewBackupDeletionReconciler(
	logger logrus.FieldLogger,
	client client.Client,
	backupTracker BackupTracker,
	repoMgr repository.Manager,
	metrics *metrics.ServerMetrics,
	helper discovery.Helper,
	newPluginManager func(logrus.FieldLogger) clientmgmt.Manager,
	backupStoreGetter persistence.ObjectBackupStoreGetter,
	credentialStore credentials.FileStore,
	repoEnsurer *repository.Ensurer,
) *backupDeletionReconciler

NewBackupDeletionReconciler creates a new backup deletion reconciler.

func NewBackupFinalizerReconciler added in v1.11.0

func NewBackupFinalizerReconciler(
	client kbclient.Client,
	globalCRClient kbclient.Client,
	clock clocks.WithTickerAndDelayedExecution,
	backupper pkgbackup.Backupper,
	newPluginManager func(logrus.FieldLogger) clientmgmt.Manager,
	backupTracker BackupTracker,
	backupStoreGetter persistence.ObjectBackupStoreGetter,
	log logrus.FieldLogger,
	metrics *metrics.ServerMetrics,
) *backupFinalizerReconciler

NewBackupFinalizerReconciler initializes and returns backupFinalizerReconciler struct.

func NewBackupOperationsReconciler added in v1.11.0

func NewBackupOperationsReconciler(
	logger logrus.FieldLogger,
	client client.Client,
	frequency time.Duration,
	newPluginManager func(logrus.FieldLogger) clientmgmt.Manager,
	backupStoreGetter persistence.ObjectBackupStoreGetter,
	metrics *metrics.ServerMetrics,
	itemOperationsMap *itemoperationmap.BackupItemOperationsMap,
) *backupOperationsReconciler

func NewBackupReconciler added in v1.11.0

func NewBackupReconciler(
	ctx context.Context,
	discoveryHelper discovery.Helper,
	backupper pkgbackup.Backupper,
	logger logrus.FieldLogger,
	backupLogLevel logrus.Level,
	newPluginManager func(logrus.FieldLogger) clientmgmt.Manager,
	backupTracker BackupTracker,
	kbClient kbclient.Client,
	defaultBackupLocation string,
	defaultVolumesToFsBackup bool,
	defaultBackupTTL time.Duration,
	defaultCSISnapshotTimeout time.Duration,
	resourceTimeout time.Duration,
	defaultItemOperationTimeout time.Duration,
	defaultSnapshotLocations map[string]string,
	metrics *metrics.ServerMetrics,
	backupStoreGetter persistence.ObjectBackupStoreGetter,
	formatFlag logging.Format,
	credentialStore credentials.FileStore,
	maxConcurrentK8SConnections int,
	defaultSnapshotMoveData bool,
	globalCRClient kbclient.Client,
) *backupReconciler

func NewBackupStorageLocationReconciler added in v1.10.0

func NewBackupStorageLocationReconciler(
	ctx context.Context,
	client client.Client,
	defaultBackupLocationInfo storage.DefaultBackupLocationInfo,
	newPluginManager func(logrus.FieldLogger) clientmgmt.Manager,
	backupStoreGetter persistence.ObjectBackupStoreGetter,
	log logrus.FieldLogger) *backupStorageLocationReconciler

NewBackupStorageLocationReconciler initialize and return a backupStorageLocationReconciler struct

func NewBackupSyncReconciler added in v1.10.0

func NewBackupSyncReconciler(
	client client.Client,
	namespace string,
	defaultBackupSyncPeriod time.Duration,
	newPluginManager func(logrus.FieldLogger) clientmgmt.Manager,
	backupStoreGetter persistence.ObjectBackupStoreGetter,
	logger logrus.FieldLogger) *backupSyncReconciler

NewBackupSyncReconciler is used to generate BackupSync reconciler structure.

func NewDownloadRequestReconciler added in v1.10.0

func NewDownloadRequestReconciler(
	client kbclient.Client,
	clock clocks.Clock,
	newPluginManager func(logrus.FieldLogger) clientmgmt.Manager,
	backupStoreGetter persistence.ObjectBackupStoreGetter,
	log logrus.FieldLogger,
	backupItemOperationsMap *itemoperationmap.BackupItemOperationsMap,
	restoreItemOperationsMap *itemoperationmap.RestoreItemOperationsMap,
) *downloadRequestReconciler

NewDownloadRequestReconciler initializes and returns downloadRequestReconciler struct.

func NewGCReconciler added in v1.10.0

func NewGCReconciler(
	logger logrus.FieldLogger,
	client client.Client,
	frequency time.Duration,
) *gcReconciler

NewGCReconciler constructs a new gcReconciler.

func NewRestoreFinalizerReconciler added in v1.14.0

func NewRestoreFinalizerReconciler(
	logger logrus.FieldLogger,
	namespace string,
	client client.Client,
	newPluginManager func(logrus.FieldLogger) clientmgmt.Manager,
	backupStoreGetter persistence.ObjectBackupStoreGetter,
	metrics *metrics.ServerMetrics,
	crClient client.Client,
	multiHookTracker *hook.MultiHookTracker,
) *restoreFinalizerReconciler

func NewRestoreOperationsReconciler added in v1.11.0

func NewRestoreOperationsReconciler(
	logger logrus.FieldLogger,
	namespace string,
	client client.Client,
	frequency time.Duration,
	newPluginManager func(logrus.FieldLogger) clientmgmt.Manager,
	backupStoreGetter persistence.ObjectBackupStoreGetter,
	metrics *metrics.ServerMetrics,
	itemOperationsMap *itemoperationmap.RestoreItemOperationsMap,
) *restoreOperationsReconciler

func NewRestoreReconciler added in v1.11.0

func NewRestoreReconciler(
	ctx context.Context,
	namespace string,
	restorer pkgrestore.Restorer,
	kbClient client.Client,
	logger logrus.FieldLogger,
	restoreLogLevel logrus.Level,
	newPluginManager func(logrus.FieldLogger) clientmgmt.Manager,
	backupStoreGetter persistence.ObjectBackupStoreGetter,
	metrics *metrics.ServerMetrics,
	logFormat logging.Format,
	defaultItemOperationTimeout time.Duration,
	disableInformerCache bool,
	globalCrClient client.Client,
) *restoreReconciler

func NewScheduleReconciler added in v1.9.0

func NewScheduleReconciler(
	namespace string,
	logger logrus.FieldLogger,
	client client.Client,
	metrics *metrics.ServerMetrics,
	skipImmediately bool,
) *scheduleReconciler

func NewServerStatusRequestReconciler added in v1.10.0

func NewServerStatusRequestReconciler(
	ctx context.Context,
	client client.Client,
	pluginRegistry PluginLister,
	clock clocks.WithTickerAndDelayedExecution,
	log logrus.FieldLogger) *serverStatusRequestReconciler

NewServerStatusRequestReconciler initializes and returns serverStatusRequestReconciler struct.

func UpdateDataDownloadWithRetry added in v1.12.0

func UpdateDataDownloadWithRetry(ctx context.Context, client client.Client, namespacedName types.NamespacedName, log *logrus.Entry, updateFunc func(dataDownload *velerov2alpha1api.DataDownload)) error

func UpdateDataUploadWithRetry added in v1.12.0

func UpdateDataUploadWithRetry(ctx context.Context, client client.Client, namespacedName types.NamespacedName, log *logrus.Entry, updateFunc func(dataUpload *velerov2alpha1api.DataUpload)) error

func UpdatePVBStatusToFailed added in v1.9.6

func UpdatePVBStatusToFailed(ctx context.Context, c client.Client, pvb *velerov1api.PodVolumeBackup, errOut error, msg string, time time.Time, log logrus.FieldLogger) error

func UpdatePVRStatusToFailed added in v1.9.6

func UpdatePVRStatusToFailed(ctx context.Context, c client.Client, pvb *velerov1api.PodVolumeRestore, errString string, time time.Time, log logrus.FieldLogger) error

Types

type BackupRepoReconciler added in v1.10.0

type BackupRepoReconciler struct {
	client.Client
	// contains filtered or unexported fields
}

func NewBackupRepoReconciler added in v1.10.0

func NewBackupRepoReconciler(namespace string, logger logrus.FieldLogger, client client.Client,
	maintenanceFrequency time.Duration, repositoryManager repository.Manager) *BackupRepoReconciler

func (*BackupRepoReconciler) Reconcile added in v1.10.0

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

func (*BackupRepoReconciler) SetupWithManager added in v1.10.0

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

type BackupTracker added in v0.8.0

type BackupTracker interface {
	// Add informs the tracker that a backup is in progress.
	Add(ns, name string)
	// Delete informs the tracker that a backup is no longer in progress.
	Delete(ns, name string)
	// Contains returns true if the tracker is tracking the backup.
	Contains(ns, name string) bool
}

BackupTracker keeps track of in-progress backups.

func NewBackupTracker added in v0.8.0

func NewBackupTracker() BackupTracker

NewBackupTracker returns a new BackupTracker.

type DataDownloadReconciler added in v1.12.0

type DataDownloadReconciler struct {
	Clock clock.WithTickerAndDelayedExecution
	// contains filtered or unexported fields
}

DataDownloadReconciler reconciles a DataDownload object

func NewDataDownloadReconciler added in v1.12.0

func NewDataDownloadReconciler(client client.Client, kubeClient kubernetes.Interface, dataPathMgr *datapath.Manager,
	repoEnsurer *repository.Ensurer, credentialGetter *credentials.CredentialGetter, nodeName string, preparingTimeout time.Duration, logger logrus.FieldLogger, metrics *metrics.ServerMetrics) *DataDownloadReconciler

func (*DataDownloadReconciler) AttemptDataDownloadResume added in v1.12.3

func (r *DataDownloadReconciler) AttemptDataDownloadResume(ctx context.Context, cli client.Client, logger *logrus.Entry, ns string) error

func (*DataDownloadReconciler) CancelAcceptedDataDownload added in v1.12.3

func (r *DataDownloadReconciler) CancelAcceptedDataDownload(ctx context.Context, cli client.Client, ns string)

CancelAcceptedDataDownload will cancel the accepted data download

func (*DataDownloadReconciler) FindDataDownloads added in v1.12.0

func (*DataDownloadReconciler) OnDataDownloadCancelled added in v1.12.0

func (r *DataDownloadReconciler) OnDataDownloadCancelled(ctx context.Context, namespace string, ddName string)

func (*DataDownloadReconciler) OnDataDownloadCompleted added in v1.12.0

func (r *DataDownloadReconciler) OnDataDownloadCompleted(ctx context.Context, namespace string, ddName string, result datapath.Result)

func (*DataDownloadReconciler) OnDataDownloadFailed added in v1.12.0

func (r *DataDownloadReconciler) OnDataDownloadFailed(ctx context.Context, namespace string, ddName string, err error)

func (*DataDownloadReconciler) OnDataDownloadProgress added in v1.12.0

func (r *DataDownloadReconciler) OnDataDownloadProgress(ctx context.Context, namespace string, ddName string, progress *uploader.Progress)

func (*DataDownloadReconciler) Reconcile added in v1.12.0

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

func (*DataDownloadReconciler) SetupWithManager added in v1.12.0

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

SetupWithManager registers the DataDownload controller. The fresh new DataDownload CR first created will trigger to create one pod (long time, maybe failure or unknown status) by one of the datadownload controllers then the request will get out of the Reconcile queue immediately by not blocking others' CR handling, in order to finish the rest data download process we need to re-enqueue the previous related request once the related pod is in running status to keep going on the rest logic. and below logic will avoid handling the unwanted pod status and also avoid block others CR handling

func (*DataDownloadReconciler) TryCancelDataDownload added in v1.12.0

func (r *DataDownloadReconciler) TryCancelDataDownload(ctx context.Context, dd *velerov2alpha1api.DataDownload, message string)

type DataUploadReconciler added in v1.12.0

type DataUploadReconciler struct {
	Clock clocks.WithTickerAndDelayedExecution
	// contains filtered or unexported fields
}

DataUploadReconciler reconciles a DataUpload object

func NewDataUploadReconciler added in v1.12.0

func NewDataUploadReconciler(client client.Client, kubeClient kubernetes.Interface, csiSnapshotClient snapshotter.SnapshotV1Interface,
	dataPathMgr *datapath.Manager, loadAffinity *nodeagent.LoadAffinity, repoEnsurer *repository.Ensurer, clock clocks.WithTickerAndDelayedExecution,
	cred *credentials.CredentialGetter, nodeName string, fs filesystem.Interface, preparingTimeout time.Duration, log logrus.FieldLogger, metrics *metrics.ServerMetrics) *DataUploadReconciler

func (*DataUploadReconciler) AttemptDataUploadResume added in v1.12.3

func (r *DataUploadReconciler) AttemptDataUploadResume(ctx context.Context, cli client.Client, logger *logrus.Entry, ns string) error

func (*DataUploadReconciler) CancelAcceptedDataupload added in v1.12.3

func (r *DataUploadReconciler) CancelAcceptedDataupload(ctx context.Context, cli client.Client, ns string)

func (*DataUploadReconciler) FindDataUploadsByPod added in v1.12.3

func (r *DataUploadReconciler) FindDataUploadsByPod(ctx context.Context, cli client.Client, ns string) ([]velerov2alpha1api.DataUpload, error)

func (*DataUploadReconciler) OnDataUploadCancelled added in v1.12.0

func (r *DataUploadReconciler) OnDataUploadCancelled(ctx context.Context, namespace string, duName string)

func (*DataUploadReconciler) OnDataUploadCompleted added in v1.12.0

func (r *DataUploadReconciler) OnDataUploadCompleted(ctx context.Context, namespace string, duName string, result datapath.Result)

func (*DataUploadReconciler) OnDataUploadFailed added in v1.12.0

func (r *DataUploadReconciler) OnDataUploadFailed(ctx context.Context, namespace, duName string, err error)

func (*DataUploadReconciler) OnDataUploadProgress added in v1.12.0

func (r *DataUploadReconciler) OnDataUploadProgress(ctx context.Context, namespace string, duName string, progress *uploader.Progress)

func (*DataUploadReconciler) Reconcile added in v1.12.0

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

func (*DataUploadReconciler) SetupWithManager added in v1.12.0

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

SetupWithManager registers the DataUpload controller. The fresh new DataUpload CR first created will trigger to create one pod (long time, maybe failure or unknown status) by one of the dataupload controllers then the request will get out of the Reconcile queue immediately by not blocking others' CR handling, in order to finish the rest data upload process we need to re-enqueue the previous related request once the related pod is in running status to keep going on the rest logic. and below logic will avoid handling the unwanted pod status and also avoid block others CR handling

func (*DataUploadReconciler) TryCancelDataUpload added in v1.12.0

func (r *DataUploadReconciler) TryCancelDataUpload(ctx context.Context, du *velerov2alpha1api.DataUpload, message string)

TryCancelDataUpload clear up resources only when update success

type Interface

type Interface interface {
	// Run runs the component.
	Run(ctx context.Context, workers int) error
}

Interface represents a runnable component.

type PluginLister added in v1.5.1

type PluginLister interface {
	// List returns all PluginIdentifiers for kind.
	List(kind common.PluginKind) []framework.PluginIdentifier
}

type PodVolumeBackupReconciler added in v1.9.0

type PodVolumeBackupReconciler struct {
	client.Client
	// contains filtered or unexported fields
}

PodVolumeBackupReconciler reconciles a PodVolumeBackup object

func NewPodVolumeBackupReconciler added in v1.12.0

func NewPodVolumeBackupReconciler(client client.Client, dataPathMgr *datapath.Manager, ensurer *repository.Ensurer, credentialGetter *credentials.CredentialGetter,
	nodeName string, scheme *runtime.Scheme, metrics *metrics.ServerMetrics, logger logrus.FieldLogger) *PodVolumeBackupReconciler

NewPodVolumeBackupReconciler creates the PodVolumeBackupReconciler instance

func (*PodVolumeBackupReconciler) OnDataPathCancelled added in v1.12.0

func (r *PodVolumeBackupReconciler) OnDataPathCancelled(ctx context.Context, namespace string, pvbName string)

func (*PodVolumeBackupReconciler) OnDataPathCompleted added in v1.12.0

func (r *PodVolumeBackupReconciler) OnDataPathCompleted(ctx context.Context, namespace string, pvbName string, result datapath.Result)

func (*PodVolumeBackupReconciler) OnDataPathFailed added in v1.12.0

func (r *PodVolumeBackupReconciler) OnDataPathFailed(ctx context.Context, namespace, pvbName string, err error)

func (*PodVolumeBackupReconciler) OnDataPathProgress added in v1.12.0

func (r *PodVolumeBackupReconciler) OnDataPathProgress(ctx context.Context, namespace string, pvbName string, progress *uploader.Progress)

func (*PodVolumeBackupReconciler) Reconcile added in v1.9.0

func (*PodVolumeBackupReconciler) SetupWithManager added in v1.9.0

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

SetupWithManager registers the PVB controller.

type PodVolumeRestoreReconciler added in v1.9.0

type PodVolumeRestoreReconciler struct {
	client.Client
	// contains filtered or unexported fields
}

func NewPodVolumeRestoreReconciler added in v1.9.0

func NewPodVolumeRestoreReconciler(client client.Client, dataPathMgr *datapath.Manager, ensurer *repository.Ensurer,
	credentialGetter *credentials.CredentialGetter, logger logrus.FieldLogger) *PodVolumeRestoreReconciler

func (*PodVolumeRestoreReconciler) OnDataPathCancelled added in v1.12.0

func (c *PodVolumeRestoreReconciler) OnDataPathCancelled(ctx context.Context, namespace string, pvrName string)

func (*PodVolumeRestoreReconciler) OnDataPathCompleted added in v1.12.0

func (c *PodVolumeRestoreReconciler) OnDataPathCompleted(ctx context.Context, namespace string, pvrName string, result datapath.Result)

func (*PodVolumeRestoreReconciler) OnDataPathFailed added in v1.12.0

func (c *PodVolumeRestoreReconciler) OnDataPathFailed(ctx context.Context, namespace string, pvrName string, err error)

func (*PodVolumeRestoreReconciler) OnDataPathProgress added in v1.12.0

func (c *PodVolumeRestoreReconciler) OnDataPathProgress(ctx context.Context, namespace string, pvrName string, progress *uploader.Progress)

func (*PodVolumeRestoreReconciler) Reconcile added in v1.9.0

func (*PodVolumeRestoreReconciler) SetupWithManager added in v1.9.0

func (c *PodVolumeRestoreReconciler) SetupWithManager(mgr ctrl.Manager) error

Jump to

Keyboard shortcuts

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