Merge pull request #527 from pgray/pg/add-https-flag-minikube-cmd
add https flag to minikube command for services that run over ssl/tlspull/537/head
commit
60c1205909
|
@ -19,6 +19,7 @@ package cmd
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/docker/machine/libmachine"
|
"github.com/docker/machine/libmachine"
|
||||||
|
@ -33,6 +34,7 @@ import (
|
||||||
|
|
||||||
var (
|
var (
|
||||||
namespace string
|
namespace string
|
||||||
|
https bool
|
||||||
serviceURLMode bool
|
serviceURLMode bool
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -63,6 +65,9 @@ var serviceCmd = &cobra.Command{
|
||||||
fmt.Fprintln(os.Stderr, "Check that minikube is running and that you have specified the correct namespace (-n flag).")
|
fmt.Fprintln(os.Stderr, "Check that minikube is running and that you have specified the correct namespace (-n flag).")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
if https {
|
||||||
|
url = strings.Replace(url, "http", "https", 1)
|
||||||
|
}
|
||||||
if serviceURLMode {
|
if serviceURLMode {
|
||||||
fmt.Fprintln(os.Stdout, url)
|
fmt.Fprintln(os.Stdout, url)
|
||||||
} else {
|
} else {
|
||||||
|
@ -75,6 +80,7 @@ var serviceCmd = &cobra.Command{
|
||||||
func init() {
|
func init() {
|
||||||
serviceCmd.Flags().StringVarP(&namespace, "namespace", "n", "default", "The service namespace")
|
serviceCmd.Flags().StringVarP(&namespace, "namespace", "n", "default", "The service namespace")
|
||||||
serviceCmd.Flags().BoolVar(&serviceURLMode, "url", false, "Display the kubernetes service URL in the CLI instead of opening it in the default browser")
|
serviceCmd.Flags().BoolVar(&serviceURLMode, "url", false, "Display the kubernetes service URL in the CLI instead of opening it in the default browser")
|
||||||
|
serviceCmd.Flags().BoolVar(&https, "https", false, "Open the service URL with https instead of http")
|
||||||
RootCmd.AddCommand(serviceCmd)
|
RootCmd.AddCommand(serviceCmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ minikube service [flags] SERVICE
|
||||||
### Options
|
### Options
|
||||||
|
|
||||||
```
|
```
|
||||||
|
--https[=false]: Open the service URL with https instead of http
|
||||||
-n, --namespace="default": The service namespace
|
-n, --namespace="default": The service namespace
|
||||||
--url[=false]: Display the kubernetes service URL in the CLI instead of opening it in the default browser
|
--url[=false]: Display the kubernetes service URL in the CLI instead of opening it in the default browser
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in New Issue