From 835a73cc1fa6e31703047b09a22c0a3a27f28bdd Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 13 Dec 2022 16:04:35 -0800 Subject: [PATCH] cmd/k8s-operator: remove unnecessary timed requeue. Previously, we had to do blind timed requeues while waiting for the tailscale hostname, because we looked up the hostname through the API. But now the proxy container image writes back its hostname to the k8s secret, so we get an event-triggered reconcile automatically when the time is right. Updates #502 Signed-off-by: David Anderson --- cmd/k8s-operator/operator.go | 2 +- cmd/k8s-operator/operator_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/k8s-operator/operator.go b/cmd/k8s-operator/operator.go index 9c0f7562c..62ce961b1 100644 --- a/cmd/k8s-operator/operator.go +++ b/cmd/k8s-operator/operator.go @@ -380,7 +380,7 @@ func (a *ServiceReconciler) Reconcile(ctx context.Context, req reconcile.Request if err := a.Status().Update(ctx, svc); err != nil { return reconcile.Result{}, fmt.Errorf("failed to update service status: %w", err) } - return reconcile.Result{RequeueAfter: 10 * time.Second}, nil + return reconcile.Result{}, nil } logger.Debugf("setting ingress hostname to %q", tsHost) diff --git a/cmd/k8s-operator/operator_test.go b/cmd/k8s-operator/operator_test.go index 4c0461354..68fd20880 100644 --- a/cmd/k8s-operator/operator_test.go +++ b/cmd/k8s-operator/operator_test.go @@ -60,7 +60,7 @@ func TestLoadBalancerClass(t *testing.T) { }, }) - expectRequeue(t, sr, "default", "test") + expectReconciled(t, sr, "default", "test") fullName, shortName := findGenName(t, fc, "default", "test") @@ -394,7 +394,7 @@ func TestLBIntoAnnotation(t *testing.T) { }, }) - expectRequeue(t, sr, "default", "test") + expectReconciled(t, sr, "default", "test") fullName, shortName := findGenName(t, fc, "default", "test")