Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion pkg/serviceprovider/apireconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/builder"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/apiutil"
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
Expand Down Expand Up @@ -397,7 +398,19 @@ func (r *APIReconciler[T, C]) SetupWithManager(mgr ctrl.Manager, providerName st
}
r.providerName = providerName
controller := ctrl.NewControllerManagedBy(mgr).
For(r.emptyObj()).
For(r.emptyObj(), builder.WithPredicates(
predicate.And(
predicate.Or(
predicate.GenerationChangedPredicate{},
controllerutil2.DeletionTimestampChangedPredicate{},
predicate.LabelChangedPredicate{},
predicate.AnnotationChangedPredicate{},
),
predicate.Not(
controllerutil2.HasAnnotationPredicate(apiconst.OperationAnnotation, apiconst.OperationAnnotationValueIgnore),
),
),
)).
// add provider config watch
WatchesRawSource(source.Kind(
r.platformCluster.Cluster().GetCache(),
Expand Down
3 changes: 0 additions & 3 deletions pkg/serviceprovider/apireconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1295,9 +1295,6 @@ var _ = Describe("API Reconciler", func() {
Expect(onboardingClient.Get(ctx, fooKey, foo)).To(Succeed())
return foo.Status
}).Should(HaveField("Phase", Equal("Ready")))
// consume the finalizer/status update reconcile request to have a quiet update channel for the following test.
// depending on reconciliation timing, the provider config update could otherwise be picked up by during the reconcile request caused by the primary watch.
Eventually(reconciler.createOrUpdateConfig).Should(Receive())
})

It("The Foo resource is reconciled when the provider config changes", func() {
Expand Down