@@ -4,7 +4,6 @@ package service
44import (
55 "fmt"
66 "os"
7- "runtime"
87 "strconv"
98 "sync"
109
@@ -41,6 +40,7 @@ type MinikubeClient struct {
4140 isoUrls []string
4241 deleteOnFailure bool
4342 nodes int
43+ nativeSsh bool
4444
4545 // TfCreationLock is a mutex used to prevent multiple minikube clients from conflicting on Start().
4646 // Only set this if you're using MinikubeClient in a concurrent context
@@ -58,6 +58,7 @@ type MinikubeClientConfig struct {
5858 IsoUrls []string
5959 DeleteOnFailure bool
6060 Nodes int
61+ NativeSsh bool
6162}
6263
6364type MinikubeClientDeps struct {
@@ -75,6 +76,7 @@ func NewMinikubeClient(args MinikubeClientConfig, dep MinikubeClientDeps) *Minik
7576 deleteOnFailure : args .DeleteOnFailure ,
7677 TfCreationLock : nil ,
7778 nodes : args .Nodes ,
79+ nativeSsh : args .NativeSsh ,
7880
7981 nRunner : dep .Node ,
8082 dLoader : dep .Downloader ,
@@ -91,12 +93,6 @@ func init() {
9193
9294 register .Reg .SetStep (register .InitialSetup )
9395
94- if runtime .GOOS == "windows" {
95- ssh .SetDefaultClient (ssh .Native )
96- } else {
97- ssh .SetDefaultClient (ssh .External )
98- }
99-
10096}
10197
10298// SetConfig sets the clients configuration
@@ -107,6 +103,7 @@ func (e *MinikubeClient) SetConfig(args MinikubeClientConfig) {
107103 e .addons = args .Addons
108104 e .deleteOnFailure = args .DeleteOnFailure
109105 e .nodes = args .Nodes
106+ e .nativeSsh = args .NativeSsh
110107}
111108
112109// GetConfig retrieves the current clients configuration
@@ -148,6 +145,12 @@ func (e *MinikubeClient) Start() (*kubeconfig.Settings, error) {
148145
149146 e .clusterConfig .MinikubeISO = url
150147
148+ if e .nativeSsh {
149+ ssh .SetDefaultClient (ssh .Native )
150+ } else {
151+ ssh .SetDefaultClient (ssh .External )
152+ }
153+
151154 mRunner , preExists , mAPI , host , err := e .nRunner .Provision (& e .clusterConfig , & e .clusterConfig .Nodes [0 ], true , true )
152155 if err != nil {
153156 return nil , err
0 commit comments