tunnel: Allow one tunnel per profile

pull/16839/head
Steven Powell 2023-07-07 10:12:11 -07:00
parent 629498259e
commit 763215d496
1 changed files with 3 additions and 3 deletions

View File

@ -76,7 +76,7 @@ var tunnelCmd = &cobra.Command{
}
}
mustLockOrExit()
mustLockOrExit(cname)
defer cleanupLock()
// Tunnel uses the k8s clientset to query the API server for services in the LoadBalancerEmulator.
@ -131,8 +131,8 @@ func cleanupLock() {
}
}
func mustLockOrExit() {
tunnelLockPath := filepath.Join(localpath.MiniPath(), ".tunnel_lock")
func mustLockOrExit(profile string) {
tunnelLockPath := filepath.Join(localpath.Profile(profile), ".tunnel_lock")
lockHandle = fslock.New(tunnelLockPath)
err := lockHandle.TryLock()