mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-03 03:35:22 +00:00
Make the backup repository controller doesn't invalidate the BSL on restart.
Signed-off-by: Xun Jiang <xun.jiang@broadcom.com>
This commit is contained in:
committed by
Xun Jiang/Bruce Jiang
parent
b7ffcf64cc
commit
b5426516da
@@ -28,6 +28,7 @@ import (
|
||||
"github.com/petar/GoLLRB/llrb"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
corev1api "k8s.io/api/core/v1"
|
||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
@@ -38,8 +39,6 @@ import (
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
"sigs.k8s.io/controller-runtime/pkg/reconcile"
|
||||
|
||||
corev1api "k8s.io/api/core/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"
|
||||
@@ -119,7 +118,22 @@ func (r *BackupRepoReconciler) SetupWithManager(mgr ctrl.Manager) error {
|
||||
// BSL may be recreated after deleting, so also include the create event
|
||||
&velerov1api.BackupStorageLocation{},
|
||||
kube.EnqueueRequestsFromMapUpdateFunc(r.invalidateBackupReposForBSL),
|
||||
builder.WithPredicates(kube.NewUpdateEventPredicate(r.needInvalidBackupRepo)),
|
||||
builder.WithPredicates(
|
||||
// Combine three predicates together to guarantee
|
||||
// only BSL's Delete Event and Update Event can enqueue.
|
||||
// We don't care about BSL's Generic Event and Create Event,
|
||||
// because BSL's periodical enqueue triggers Generic Event,
|
||||
// and the BackupRepository controller restart will triggers BSL create event.
|
||||
kube.NewUpdateEventPredicate(
|
||||
r.needInvalidBackupRepo,
|
||||
),
|
||||
kube.NewGenericEventPredicate(
|
||||
func(client.Object) bool { return false },
|
||||
),
|
||||
kube.NewCreateEventPredicate(
|
||||
func(client.Object) bool { return false },
|
||||
),
|
||||
),
|
||||
).
|
||||
Complete(r)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user