Skip to content

Commit

Permalink
Poll for assemblage updates in the downstream
Browse files Browse the repository at this point in the history
The ProxyAssemblage controller does not have the opportunity to be
notified of changes in a downstream cluster (or at least, this would
be tricky to arrange, especially at scale), so it won't in general see
when its Assemblage counterpart changes status.

A dumb but effective way to make sure updates are seen is to simply
requeue each ProxyAssemblage to be re-examined after a small
interval. This will be OK at moderate scale (I would guess O(100)
clusters), since more worker threads can be configured to cope with
polling. Larger scales may need a less brute force approach to be
figured out.

Signed-off-by: Michael Bridgen <mikeb@squaremobius.net>
  • Loading branch information
squaremo committed Apr 13, 2022
1 parent 10e23fe commit 77bddb3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion module/controllers/proxyassemblage_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"context"
"fmt"
"strings"
"time"

"k8s.io/apimachinery/pkg/runtime"
"sigs.k8s.io/cluster-api/controllers/remote"
Expand All @@ -20,6 +21,8 @@ import (
fleetv1 "github.com/squaremo/fleeet/module/api/v1alpha1"
)

const proxyPollInterval = 20 * time.Second

// ProxyAssemblageReconciler reconciles a ProxyAssemblage object
type ProxyAssemblageReconciler struct {
client.Client
Expand Down Expand Up @@ -84,7 +87,8 @@ func (r *ProxyAssemblageReconciler) Reconcile(ctx context.Context, req ctrl.Requ
return ctrl.Result{}, err
}

return ctrl.Result{}, nil
// We don't get notified of things happening in the downstream cluster; so, requeue to poll instead.
return ctrl.Result{RequeueAfter: proxyPollInterval}, nil
}

// SetupWithManager sets up the controller with the Manager.
Expand Down

0 comments on commit 77bddb3

Please sign in to comment.