Skip to content

Commit fe6426c

Browse files
committed
Use driver feature instead of the name
Other container drivers with dynamic addresses and static ports also want to set the port after start. Signed-off-by: Anders F Björklund <[email protected]>
1 parent 9d815d5 commit fe6426c

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

pkg/driver/driver.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ type Info struct {
105105
type DriverFeatures struct {
106106
CanRunGUI bool `json:"canRunGui,omitempty"`
107107
DynamicSSHAddress bool `json:"dynamicSSHAddress"`
108+
StaticSSHPort bool `json:"staticSSHPort"`
108109
SkipSocketForwarding bool `json:"skipSocketForwarding"`
109110
NoCloudInit bool `json:"noCloudInit"`
110111
RosettaEnabled bool `json:"rosettaEnabled"`

pkg/driver/wsl2/wsl_driver_windows.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ func (l *LimaWslDriver) Info() driver.Info {
309309

310310
info.Features = driver.DriverFeatures{
311311
DynamicSSHAddress: true,
312+
StaticSSHPort: true,
312313
SkipSocketForwarding: true,
313314
NoCloudInit: true,
314315
CanRunGUI: l.canRunGUI(),

pkg/hostagent/hostagent.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ func New(ctx context.Context, instName string, stdout io.Writer, signalCh chan o
139139
if err != nil {
140140
return nil, err
141141
}
142-
if *inst.Config.VMType == limatype.WSL2 {
142+
// WSL instance does not use the random port
143+
if a.driver.Info().Features.StaticSSHPort {
143144
sshLocalPort = inst.SSHLocalPort
144145
}
145146

0 commit comments

Comments
 (0)