Skip to content

Commit b8be5f6

Browse files
authored
fix: Re-create tunnel if forwardsTo or appProto changes (#527)
1 parent 984ca2a commit b8be5f6

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

pkg/tunneldriver/driver.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,14 @@ func (td *TunnelDriver) CreateTunnel(ctx context.Context, name string, spec ingr
261261
log := log.FromContext(ctx)
262262

263263
if tun, ok := td.tunnels[name]; ok {
264-
if maps.Equal(tun.Labels(), spec.Labels) {
265-
log.Info("Tunnel labels match existing tunnel, doing nothing")
264+
// Check if the tunnel matches the spec
265+
var appProto string
266+
if fwdProto, ok := tun.(interface{ ForwardsProto() string }); ok {
267+
appProto = fwdProto.ForwardsProto()
268+
}
269+
270+
if maps.Equal(tun.Labels(), spec.Labels) && tun.ForwardsTo() == spec.ForwardsTo && appProto == spec.AppProtocol {
271+
log.Info("Tunnel already exists and matches spec")
266272
return nil
267273
}
268274
// There is already a tunnel with this name, start the new one and defer closing the old one

0 commit comments

Comments
 (0)