@@ -19,7 +19,8 @@ func NewConnectCommand(logger log.Logger, ioStreams genericclioptions.IOStreams)
19
19
20
20
func newConnectKubeflowCommand (logger log.Logger , ioStreams genericclioptions.IOStreams ) * cobra.Command {
21
21
var (
22
- port int // dedicated port
22
+ port int // dedicated port
23
+ enablePublic bool // enable public access
23
24
)
24
25
handle := func (machineName string ) error {
25
26
m , err := findMachineByName (machineName , logger )
@@ -35,7 +36,11 @@ func newConnectKubeflowCommand(logger log.Logger, ioStreams genericclioptions.IO
35
36
}
36
37
}
37
38
logger .V (0 ).Infof ("now you can open http://localhost:%d\n " , destPort )
38
- return m .GetKubeCli ().Portforward (m .GetKubeConfig (), "svc/istio-ingressgateway" , "istio-system" , 80 , destPort )
39
+ var listenedAddress string
40
+ if enablePublic {
41
+ listenedAddress = "0.0.0.0"
42
+ }
43
+ return m .GetKubeCli ().Portforward (m .GetKubeConfig (), "svc/istio-ingressgateway" , "istio-system" , listenedAddress , 80 , destPort )
39
44
}
40
45
cmd := & cobra.Command {
41
46
Use : "kubeflow" ,
@@ -46,5 +51,6 @@ func newConnectKubeflowCommand(logger log.Logger, ioStreams genericclioptions.IO
46
51
}
47
52
48
53
cmd .Flags ().IntVar (& port , "port" , 0 , "customized port number for connect, ranged should be 65535> >1024, default is 0 (random)" )
54
+ cmd .Flags ().BoolVar (& enablePublic , "enable_public" , false , "enable public access, default: false" )
49
55
return cmd
50
56
}
0 commit comments