Skip to content

Commit 0848501

Browse files
dilyevskyclaude
andcommitted
[cli] bootstrap reconcile on tunnel startup
Trigger a reconcile after cache sync so the tunnel connects immediately when the TunnelNode already exists and no update event fires. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a34284f commit 0848501

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

pkg/cmd/run/tunnel.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"k8s.io/apimachinery/pkg/api/errors"
1616
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1717
"k8s.io/apimachinery/pkg/runtime"
18+
"k8s.io/apimachinery/pkg/types"
1819
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
1920
"k8s.io/apimachinery/pkg/util/wait"
2021
k8srest "k8s.io/client-go/rest"
@@ -490,6 +491,19 @@ func runTunnel(ctx context.Context, cfg *configv1alpha1.Config, tc *configv1alph
490491
return mgr.Start(gctx)
491492
})
492493

494+
// Trigger one bootstrap reconcile after the manager cache is ready so the
495+
// tunnel connects even when the TunnelNode already exists and doesn't emit
496+
// an update event after startup.
497+
g.Go(func() error {
498+
if !mgr.GetCache().WaitForCacheSync(gctx) {
499+
return gctx.Err()
500+
}
501+
_, err := rec.reconcile(gctx, ctrl.Request{
502+
NamespacedName: types.NamespacedName{Name: tn.Name},
503+
})
504+
return err
505+
})
506+
493507
// Start health endpoint server if configured.
494508
if tc.HealthAddr != "" {
495509
mux := http.NewServeMux()

0 commit comments

Comments
 (0)