mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-06 13:26:26 +00:00
Remove additional param, use pkg/constant
Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com>
This commit is contained in:
@@ -8,6 +8,8 @@ const (
|
|||||||
ControllerBackupRepo = "backup-repo"
|
ControllerBackupRepo = "backup-repo"
|
||||||
ControllerBackupStorageLocation = "backup-storage-location"
|
ControllerBackupStorageLocation = "backup-storage-location"
|
||||||
ControllerBackupSync = "backup-sync"
|
ControllerBackupSync = "backup-sync"
|
||||||
|
ControllerDataDownload = "data-download"
|
||||||
|
ControllerDataUpload = "data-upload"
|
||||||
ControllerDownloadRequest = "download-request"
|
ControllerDownloadRequest = "download-request"
|
||||||
ControllerGarbageCollection = "gc"
|
ControllerGarbageCollection = "gc"
|
||||||
ControllerPodVolumeBackup = "pod-volume-backup"
|
ControllerPodVolumeBackup = "pod-volume-backup"
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ func NewBackupDeletionReconciler(
|
|||||||
|
|
||||||
func (r *backupDeletionReconciler) SetupWithManager(mgr ctrl.Manager) error {
|
func (r *backupDeletionReconciler) SetupWithManager(mgr ctrl.Manager) error {
|
||||||
// Make sure the expired requests can be deleted eventually
|
// Make sure the expired requests can be deleted eventually
|
||||||
s := kube.NewPeriodicalEnqueueSource("backupDeletion", r.logger, mgr.GetClient(), &velerov1api.DeleteBackupRequestList{}, time.Hour, kube.PeriodicalEnqueueSourceOption{})
|
s := kube.NewPeriodicalEnqueueSource(r.logger.WithField("controller", constant.ControllerBackupDeletion), mgr.GetClient(), &velerov1api.DeleteBackupRequestList{}, time.Hour, kube.PeriodicalEnqueueSourceOption{})
|
||||||
return ctrl.NewControllerManagedBy(mgr).
|
return ctrl.NewControllerManagedBy(mgr).
|
||||||
For(&velerov1api.DeleteBackupRequest{}).
|
For(&velerov1api.DeleteBackupRequest{}).
|
||||||
WatchesRawSource(s, nil).
|
WatchesRawSource(s, nil).
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import (
|
|||||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||||
|
|
||||||
velerov1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
|
velerov1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
|
||||||
|
"github.com/vmware-tanzu/velero/pkg/constant"
|
||||||
"github.com/vmware-tanzu/velero/pkg/itemoperation"
|
"github.com/vmware-tanzu/velero/pkg/itemoperation"
|
||||||
"github.com/vmware-tanzu/velero/pkg/itemoperationmap"
|
"github.com/vmware-tanzu/velero/pkg/itemoperationmap"
|
||||||
"github.com/vmware-tanzu/velero/pkg/metrics"
|
"github.com/vmware-tanzu/velero/pkg/metrics"
|
||||||
@@ -84,7 +85,7 @@ func NewBackupOperationsReconciler(
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *backupOperationsReconciler) SetupWithManager(mgr ctrl.Manager) error {
|
func (c *backupOperationsReconciler) SetupWithManager(mgr ctrl.Manager) error {
|
||||||
s := kube.NewPeriodicalEnqueueSource("backupOperations", c.logger, mgr.GetClient(), &velerov1api.BackupList{}, c.frequency, kube.PeriodicalEnqueueSourceOption{})
|
s := kube.NewPeriodicalEnqueueSource(c.logger.WithField("controller", constant.ControllerBackupOperations), mgr.GetClient(), &velerov1api.BackupList{}, c.frequency, kube.PeriodicalEnqueueSourceOption{})
|
||||||
gp := kube.NewGenericEventPredicate(func(object client.Object) bool {
|
gp := kube.NewGenericEventPredicate(func(object client.Object) bool {
|
||||||
backup := object.(*velerov1api.Backup)
|
backup := object.(*velerov1api.Backup)
|
||||||
return (backup.Status.Phase == velerov1api.BackupPhaseWaitingForPluginOperations ||
|
return (backup.Status.Phase == velerov1api.BackupPhaseWaitingForPluginOperations ||
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ import (
|
|||||||
"sigs.k8s.io/controller-runtime/pkg/reconcile"
|
"sigs.k8s.io/controller-runtime/pkg/reconcile"
|
||||||
|
|
||||||
velerov1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
|
velerov1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
|
||||||
|
"github.com/vmware-tanzu/velero/pkg/constant"
|
||||||
"github.com/vmware-tanzu/velero/pkg/label"
|
"github.com/vmware-tanzu/velero/pkg/label"
|
||||||
"github.com/vmware-tanzu/velero/pkg/repository"
|
"github.com/vmware-tanzu/velero/pkg/repository"
|
||||||
repoconfig "github.com/vmware-tanzu/velero/pkg/repository/config"
|
repoconfig "github.com/vmware-tanzu/velero/pkg/repository/config"
|
||||||
@@ -75,7 +76,7 @@ func NewBackupRepoReconciler(namespace string, logger logrus.FieldLogger, client
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *BackupRepoReconciler) SetupWithManager(mgr ctrl.Manager) error {
|
func (r *BackupRepoReconciler) SetupWithManager(mgr ctrl.Manager) error {
|
||||||
s := kube.NewPeriodicalEnqueueSource("backupRepo", r.logger, mgr.GetClient(), &velerov1api.BackupRepositoryList{}, repoSyncPeriod, kube.PeriodicalEnqueueSourceOption{})
|
s := kube.NewPeriodicalEnqueueSource(r.logger.WithField("controller", constant.ControllerBackupRepo), mgr.GetClient(), &velerov1api.BackupRepositoryList{}, repoSyncPeriod, kube.PeriodicalEnqueueSourceOption{})
|
||||||
|
|
||||||
return ctrl.NewControllerManagedBy(mgr).
|
return ctrl.NewControllerManagedBy(mgr).
|
||||||
For(&velerov1api.BackupRepository{}, builder.WithPredicates(kube.SpecChangePredicate{})).
|
For(&velerov1api.BackupRepository{}, builder.WithPredicates(kube.SpecChangePredicate{})).
|
||||||
|
|||||||
@@ -191,8 +191,7 @@ func (r *backupStorageLocationReconciler) logReconciledPhase(defaultFound bool,
|
|||||||
|
|
||||||
func (r *backupStorageLocationReconciler) SetupWithManager(mgr ctrl.Manager) error {
|
func (r *backupStorageLocationReconciler) SetupWithManager(mgr ctrl.Manager) error {
|
||||||
g := kube.NewPeriodicalEnqueueSource(
|
g := kube.NewPeriodicalEnqueueSource(
|
||||||
"backupStorageLocation",
|
r.log.WithField("controller", constant.ControllerBackupStorageLocation),
|
||||||
r.log,
|
|
||||||
mgr.GetClient(),
|
mgr.GetClient(),
|
||||||
&velerov1api.BackupStorageLocationList{},
|
&velerov1api.BackupStorageLocationList{},
|
||||||
bslValidationEnqueuePeriod,
|
bslValidationEnqueuePeriod,
|
||||||
|
|||||||
@@ -348,8 +348,7 @@ func (b *backupSyncReconciler) filterBackupOwnerReferences(ctx context.Context,
|
|||||||
// SetupWithManager is used to setup controller and its watching sources.
|
// SetupWithManager is used to setup controller and its watching sources.
|
||||||
func (b *backupSyncReconciler) SetupWithManager(mgr ctrl.Manager) error {
|
func (b *backupSyncReconciler) SetupWithManager(mgr ctrl.Manager) error {
|
||||||
backupSyncSource := kube.NewPeriodicalEnqueueSource(
|
backupSyncSource := kube.NewPeriodicalEnqueueSource(
|
||||||
"backupSync",
|
b.logger.WithField("controller", constant.ControllerBackupSync),
|
||||||
b.logger,
|
|
||||||
mgr.GetClient(),
|
mgr.GetClient(),
|
||||||
&velerov1api.BackupStorageLocationList{},
|
&velerov1api.BackupStorageLocationList{},
|
||||||
backupSyncReconcilePeriod,
|
backupSyncReconcilePeriod,
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ import (
|
|||||||
"github.com/vmware-tanzu/velero/pkg/apis/velero/shared"
|
"github.com/vmware-tanzu/velero/pkg/apis/velero/shared"
|
||||||
velerov1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
|
velerov1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
|
||||||
velerov2alpha1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v2alpha1"
|
velerov2alpha1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v2alpha1"
|
||||||
|
"github.com/vmware-tanzu/velero/pkg/constant"
|
||||||
datamover "github.com/vmware-tanzu/velero/pkg/datamover"
|
datamover "github.com/vmware-tanzu/velero/pkg/datamover"
|
||||||
"github.com/vmware-tanzu/velero/pkg/datapath"
|
"github.com/vmware-tanzu/velero/pkg/datapath"
|
||||||
"github.com/vmware-tanzu/velero/pkg/exposer"
|
"github.com/vmware-tanzu/velero/pkg/exposer"
|
||||||
@@ -497,7 +498,7 @@ func (r *DataDownloadReconciler) OnDataDownloadProgress(ctx context.Context, nam
|
|||||||
// 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
|
// 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
|
// pod status and also avoid block others CR handling
|
||||||
func (r *DataDownloadReconciler) SetupWithManager(mgr ctrl.Manager) error {
|
func (r *DataDownloadReconciler) SetupWithManager(mgr ctrl.Manager) error {
|
||||||
s := kube.NewPeriodicalEnqueueSource("dataDownload", r.logger, r.client, &velerov2alpha1api.DataDownloadList{}, preparingMonitorFrequency, kube.PeriodicalEnqueueSourceOption{})
|
s := kube.NewPeriodicalEnqueueSource(r.logger.WithField("controller", constant.ControllerDataDownload), r.client, &velerov2alpha1api.DataDownloadList{}, preparingMonitorFrequency, kube.PeriodicalEnqueueSourceOption{})
|
||||||
gp := kube.NewGenericEventPredicate(func(object client.Object) bool {
|
gp := kube.NewGenericEventPredicate(func(object client.Object) bool {
|
||||||
dd := object.(*velerov2alpha1api.DataDownload)
|
dd := object.(*velerov2alpha1api.DataDownload)
|
||||||
return (dd.Status.Phase == velerov2alpha1api.DataDownloadPhaseAccepted)
|
return (dd.Status.Phase == velerov2alpha1api.DataDownloadPhaseAccepted)
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ import (
|
|||||||
"github.com/vmware-tanzu/velero/pkg/apis/velero/shared"
|
"github.com/vmware-tanzu/velero/pkg/apis/velero/shared"
|
||||||
velerov1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
|
velerov1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
|
||||||
velerov2alpha1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v2alpha1"
|
velerov2alpha1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v2alpha1"
|
||||||
|
"github.com/vmware-tanzu/velero/pkg/constant"
|
||||||
"github.com/vmware-tanzu/velero/pkg/datamover"
|
"github.com/vmware-tanzu/velero/pkg/datamover"
|
||||||
"github.com/vmware-tanzu/velero/pkg/datapath"
|
"github.com/vmware-tanzu/velero/pkg/datapath"
|
||||||
"github.com/vmware-tanzu/velero/pkg/exposer"
|
"github.com/vmware-tanzu/velero/pkg/exposer"
|
||||||
@@ -534,7 +535,7 @@ func (r *DataUploadReconciler) OnDataUploadProgress(ctx context.Context, namespa
|
|||||||
// 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
|
// 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
|
// pod status and also avoid block others CR handling
|
||||||
func (r *DataUploadReconciler) SetupWithManager(mgr ctrl.Manager) error {
|
func (r *DataUploadReconciler) SetupWithManager(mgr ctrl.Manager) error {
|
||||||
s := kube.NewPeriodicalEnqueueSource("dataUpload", r.logger, r.client, &velerov2alpha1api.DataUploadList{}, preparingMonitorFrequency, kube.PeriodicalEnqueueSourceOption{})
|
s := kube.NewPeriodicalEnqueueSource(r.logger.WithField("controller", constant.ControllerDataUpload), r.client, &velerov2alpha1api.DataUploadList{}, preparingMonitorFrequency, kube.PeriodicalEnqueueSourceOption{})
|
||||||
gp := kube.NewGenericEventPredicate(func(object client.Object) bool {
|
gp := kube.NewGenericEventPredicate(func(object client.Object) bool {
|
||||||
du := object.(*velerov2alpha1api.DataUpload)
|
du := object.(*velerov2alpha1api.DataUpload)
|
||||||
return (du.Status.Phase == velerov2alpha1api.DataUploadPhaseAccepted)
|
return (du.Status.Phase == velerov2alpha1api.DataUploadPhaseAccepted)
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import (
|
|||||||
kbclient "sigs.k8s.io/controller-runtime/pkg/client"
|
kbclient "sigs.k8s.io/controller-runtime/pkg/client"
|
||||||
|
|
||||||
velerov1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
|
velerov1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
|
||||||
|
"github.com/vmware-tanzu/velero/pkg/constant"
|
||||||
"github.com/vmware-tanzu/velero/pkg/itemoperationmap"
|
"github.com/vmware-tanzu/velero/pkg/itemoperationmap"
|
||||||
"github.com/vmware-tanzu/velero/pkg/persistence"
|
"github.com/vmware-tanzu/velero/pkg/persistence"
|
||||||
"github.com/vmware-tanzu/velero/pkg/plugin/clientmgmt"
|
"github.com/vmware-tanzu/velero/pkg/plugin/clientmgmt"
|
||||||
@@ -218,7 +219,7 @@ func (r *downloadRequestReconciler) Reconcile(ctx context.Context, req ctrl.Requ
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *downloadRequestReconciler) SetupWithManager(mgr ctrl.Manager) error {
|
func (r *downloadRequestReconciler) SetupWithManager(mgr ctrl.Manager) error {
|
||||||
downloadRequestSource := kube.NewPeriodicalEnqueueSource("downloadRequest", r.log, mgr.GetClient(),
|
downloadRequestSource := kube.NewPeriodicalEnqueueSource(r.log.WithField("controller", constant.ControllerDownloadRequest), mgr.GetClient(),
|
||||||
&velerov1api.DownloadRequestList{}, defaultDownloadRequestSyncPeriod, kube.PeriodicalEnqueueSourceOption{})
|
&velerov1api.DownloadRequestList{}, defaultDownloadRequestSyncPeriod, kube.PeriodicalEnqueueSourceOption{})
|
||||||
downloadRequestPredicates := kube.NewGenericEventPredicate(func(object kbclient.Object) bool {
|
downloadRequestPredicates := kube.NewGenericEventPredicate(func(object kbclient.Object) bool {
|
||||||
downloadRequest := object.(*velerov1api.DownloadRequest)
|
downloadRequest := object.(*velerov1api.DownloadRequest)
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import (
|
|||||||
velerov1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
|
velerov1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
|
||||||
pkgbackup "github.com/vmware-tanzu/velero/pkg/backup"
|
pkgbackup "github.com/vmware-tanzu/velero/pkg/backup"
|
||||||
veleroclient "github.com/vmware-tanzu/velero/pkg/client"
|
veleroclient "github.com/vmware-tanzu/velero/pkg/client"
|
||||||
|
"github.com/vmware-tanzu/velero/pkg/constant"
|
||||||
"github.com/vmware-tanzu/velero/pkg/label"
|
"github.com/vmware-tanzu/velero/pkg/label"
|
||||||
"github.com/vmware-tanzu/velero/pkg/util/kube"
|
"github.com/vmware-tanzu/velero/pkg/util/kube"
|
||||||
)
|
)
|
||||||
@@ -75,7 +76,7 @@ func NewGCReconciler(
|
|||||||
// Other Events will be filtered to decrease the number of reconcile call. Especially UpdateEvent must be filtered since we removed
|
// Other Events will be filtered to decrease the number of reconcile call. Especially UpdateEvent must be filtered since we removed
|
||||||
// the backup status as the sub-resource of backup in v1.9, every change on it will be treated as UpdateEvent and trigger reconcile call.
|
// the backup status as the sub-resource of backup in v1.9, every change on it will be treated as UpdateEvent and trigger reconcile call.
|
||||||
func (c *gcReconciler) SetupWithManager(mgr ctrl.Manager) error {
|
func (c *gcReconciler) SetupWithManager(mgr ctrl.Manager) error {
|
||||||
s := kube.NewPeriodicalEnqueueSource("gc", c.logger, mgr.GetClient(), &velerov1api.BackupList{}, c.frequency, kube.PeriodicalEnqueueSourceOption{})
|
s := kube.NewPeriodicalEnqueueSource(c.logger.WithField("controller", constant.ControllerGarbageCollection), mgr.GetClient(), &velerov1api.BackupList{}, c.frequency, kube.PeriodicalEnqueueSourceOption{})
|
||||||
return ctrl.NewControllerManagedBy(mgr).
|
return ctrl.NewControllerManagedBy(mgr).
|
||||||
For(&velerov1api.Backup{}, builder.WithPredicates(predicate.Funcs{
|
For(&velerov1api.Backup{}, builder.WithPredicates(predicate.Funcs{
|
||||||
UpdateFunc: func(ue event.UpdateEvent) bool {
|
UpdateFunc: func(ue event.UpdateEvent) bool {
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import (
|
|||||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||||
|
|
||||||
velerov1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
|
velerov1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
|
||||||
|
"github.com/vmware-tanzu/velero/pkg/constant"
|
||||||
"github.com/vmware-tanzu/velero/pkg/itemoperation"
|
"github.com/vmware-tanzu/velero/pkg/itemoperation"
|
||||||
"github.com/vmware-tanzu/velero/pkg/itemoperationmap"
|
"github.com/vmware-tanzu/velero/pkg/itemoperationmap"
|
||||||
"github.com/vmware-tanzu/velero/pkg/metrics"
|
"github.com/vmware-tanzu/velero/pkg/metrics"
|
||||||
@@ -82,7 +83,7 @@ func NewRestoreOperationsReconciler(
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *restoreOperationsReconciler) SetupWithManager(mgr ctrl.Manager) error {
|
func (r *restoreOperationsReconciler) SetupWithManager(mgr ctrl.Manager) error {
|
||||||
s := kube.NewPeriodicalEnqueueSource("restoreOperations", r.logger, mgr.GetClient(), &velerov1api.RestoreList{}, r.frequency, kube.PeriodicalEnqueueSourceOption{})
|
s := kube.NewPeriodicalEnqueueSource(r.logger.WithField("controller", constant.ControllerRestoreOperations), mgr.GetClient(), &velerov1api.RestoreList{}, r.frequency, kube.PeriodicalEnqueueSourceOption{})
|
||||||
gp := kube.NewGenericEventPredicate(func(object client.Object) bool {
|
gp := kube.NewGenericEventPredicate(func(object client.Object) bool {
|
||||||
restore := object.(*velerov1api.Restore)
|
restore := object.(*velerov1api.Restore)
|
||||||
return (restore.Status.Phase == velerov1api.RestorePhaseWaitingForPluginOperations ||
|
return (restore.Status.Phase == velerov1api.RestorePhaseWaitingForPluginOperations ||
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import (
|
|||||||
|
|
||||||
velerov1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
|
velerov1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
|
||||||
"github.com/vmware-tanzu/velero/pkg/builder"
|
"github.com/vmware-tanzu/velero/pkg/builder"
|
||||||
|
"github.com/vmware-tanzu/velero/pkg/constant"
|
||||||
"github.com/vmware-tanzu/velero/pkg/metrics"
|
"github.com/vmware-tanzu/velero/pkg/metrics"
|
||||||
"github.com/vmware-tanzu/velero/pkg/util/kube"
|
"github.com/vmware-tanzu/velero/pkg/util/kube"
|
||||||
)
|
)
|
||||||
@@ -69,7 +70,7 @@ func NewScheduleReconciler(
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *scheduleReconciler) SetupWithManager(mgr ctrl.Manager) error {
|
func (c *scheduleReconciler) SetupWithManager(mgr ctrl.Manager) error {
|
||||||
s := kube.NewPeriodicalEnqueueSource("schedule", c.logger, mgr.GetClient(), &velerov1.ScheduleList{}, scheduleSyncPeriod, kube.PeriodicalEnqueueSourceOption{})
|
s := kube.NewPeriodicalEnqueueSource(c.logger.WithField("controller", constant.ControllerSchedule), mgr.GetClient(), &velerov1.ScheduleList{}, scheduleSyncPeriod, kube.PeriodicalEnqueueSourceOption{})
|
||||||
return ctrl.NewControllerManagedBy(mgr).
|
return ctrl.NewControllerManagedBy(mgr).
|
||||||
// global predicate, works for both For and Watch
|
// global predicate, works for both For and Watch
|
||||||
WithEventFilter(kube.NewAllEventPredicate(func(obj client.Object) bool {
|
WithEventFilter(kube.NewAllEventPredicate(func(obj client.Object) bool {
|
||||||
|
|||||||
@@ -36,16 +36,13 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func NewPeriodicalEnqueueSource(
|
func NewPeriodicalEnqueueSource(
|
||||||
controllerName string,
|
|
||||||
logger logrus.FieldLogger,
|
logger logrus.FieldLogger,
|
||||||
client client.Client,
|
client client.Client,
|
||||||
objList client.ObjectList,
|
objList client.ObjectList,
|
||||||
period time.Duration,
|
period time.Duration,
|
||||||
option PeriodicalEnqueueSourceOption) *PeriodicalEnqueueSource {
|
option PeriodicalEnqueueSourceOption) *PeriodicalEnqueueSource {
|
||||||
return &PeriodicalEnqueueSource{
|
return &PeriodicalEnqueueSource{
|
||||||
logger: logger.
|
logger: logger.WithField("resource", reflect.TypeOf(objList).String()),
|
||||||
WithField("resource", reflect.TypeOf(objList).String()).
|
|
||||||
WithField("controller", controllerName),
|
|
||||||
Client: client,
|
Client: client,
|
||||||
objList: objList,
|
objList: objList,
|
||||||
period: period,
|
period: period,
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ func TestStart(t *testing.T) {
|
|||||||
ctx, cancelFunc := context.WithCancel(context.TODO())
|
ctx, cancelFunc := context.WithCancel(context.TODO())
|
||||||
client := (&fake.ClientBuilder{}).Build()
|
client := (&fake.ClientBuilder{}).Build()
|
||||||
queue := workqueue.NewRateLimitingQueue(workqueue.DefaultItemBasedRateLimiter())
|
queue := workqueue.NewRateLimitingQueue(workqueue.DefaultItemBasedRateLimiter())
|
||||||
source := NewPeriodicalEnqueueSource("PES_TEST", logrus.WithContext(ctx), client, &velerov1.ScheduleList{}, 1*time.Second, PeriodicalEnqueueSourceOption{})
|
source := NewPeriodicalEnqueueSource(logrus.WithContext(ctx).WithField("controller", "PES_TEST"), client, &velerov1.ScheduleList{}, 1*time.Second, PeriodicalEnqueueSourceOption{})
|
||||||
|
|
||||||
require.NoError(t, source.Start(ctx, nil, queue))
|
require.NoError(t, source.Start(ctx, nil, queue))
|
||||||
|
|
||||||
@@ -75,8 +75,7 @@ func TestPredicate(t *testing.T) {
|
|||||||
client := (&fake.ClientBuilder{}).Build()
|
client := (&fake.ClientBuilder{}).Build()
|
||||||
queue := workqueue.NewRateLimitingQueue(workqueue.DefaultItemBasedRateLimiter())
|
queue := workqueue.NewRateLimitingQueue(workqueue.DefaultItemBasedRateLimiter())
|
||||||
source := NewPeriodicalEnqueueSource(
|
source := NewPeriodicalEnqueueSource(
|
||||||
"PES_TEST",
|
logrus.WithContext(ctx).WithField("controller", "PES_TEST"),
|
||||||
logrus.WithContext(ctx),
|
|
||||||
client,
|
client,
|
||||||
&velerov1.BackupStorageLocationList{},
|
&velerov1.BackupStorageLocationList{},
|
||||||
1*time.Second,
|
1*time.Second,
|
||||||
@@ -116,8 +115,7 @@ func TestOrder(t *testing.T) {
|
|||||||
client := (&fake.ClientBuilder{}).Build()
|
client := (&fake.ClientBuilder{}).Build()
|
||||||
queue := workqueue.NewRateLimitingQueue(workqueue.DefaultItemBasedRateLimiter())
|
queue := workqueue.NewRateLimitingQueue(workqueue.DefaultItemBasedRateLimiter())
|
||||||
source := NewPeriodicalEnqueueSource(
|
source := NewPeriodicalEnqueueSource(
|
||||||
"PES_TEST",
|
logrus.WithContext(ctx).WithField("controller", "PES_TEST"),
|
||||||
logrus.WithContext(ctx),
|
|
||||||
client,
|
client,
|
||||||
&velerov1.BackupStorageLocationList{},
|
&velerov1.BackupStorageLocationList{},
|
||||||
1*time.Second,
|
1*time.Second,
|
||||||
|
|||||||
Reference in New Issue
Block a user