add not implemented messages for docker on mac service
parent
41b4f35302
commit
2e261d3d00
|
@ -20,6 +20,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
|
"runtime"
|
||||||
"text/template"
|
"text/template"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
|
@ -27,6 +28,8 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
|
|
||||||
|
"k8s.io/minikube/pkg/drivers/kic/oci"
|
||||||
|
"k8s.io/minikube/pkg/minikube/config"
|
||||||
pkg_config "k8s.io/minikube/pkg/minikube/config"
|
pkg_config "k8s.io/minikube/pkg/minikube/config"
|
||||||
"k8s.io/minikube/pkg/minikube/exit"
|
"k8s.io/minikube/pkg/minikube/exit"
|
||||||
"k8s.io/minikube/pkg/minikube/machine"
|
"k8s.io/minikube/pkg/minikube/machine"
|
||||||
|
@ -77,11 +80,21 @@ var serviceCmd = &cobra.Command{
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cfg, err := config.Load(profileName)
|
||||||
|
if err != nil {
|
||||||
|
exit.WithError("Error getting config", err)
|
||||||
|
}
|
||||||
|
|
||||||
urls, err := service.WaitForService(api, namespace, svc, serviceURLTemplate, serviceURLMode, https, wait, interval)
|
urls, err := service.WaitForService(api, namespace, svc, serviceURLTemplate, serviceURLMode, https, wait, interval)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
exit.WithError("Error opening service", err)
|
exit.WithError("Error opening service", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if runtime.GOOS == "darwin" && cfg.Driver == oci.Docker {
|
||||||
|
out.T(out.Sad, "openning service in browser is not yet implemented in docker driver on mac.\nPlease track the URL bellow to see updates for in progress work.\nhttps://github.com/kubernetes/minikube/issues/6778")
|
||||||
|
exit.WithCodeT(exit.Unavailable, "not implemented for docker driver on MacOs yet")
|
||||||
|
}
|
||||||
|
|
||||||
for _, u := range urls {
|
for _, u := range urls {
|
||||||
_, err := url.Parse(u)
|
_, err := url.Parse(u)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -94,6 +107,7 @@ var serviceCmd = &cobra.Command{
|
||||||
out.String(fmt.Sprintf("%s\n", u))
|
out.String(fmt.Sprintf("%s\n", u))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
out.T(out.Celebrate, "Opening service {{.namespace_name}}/{{.service_name}} in default browser...", out.V{"namespace_name": namespace, "service_name": svc})
|
out.T(out.Celebrate, "Opening service {{.namespace_name}}/{{.service_name}} in default browser...", out.V{"namespace_name": namespace, "service_name": svc})
|
||||||
if err := browser.OpenURL(u); err != nil {
|
if err := browser.OpenURL(u); err != nil {
|
||||||
exit.WithError(fmt.Sprintf("open url failed: %s", u), err)
|
exit.WithError(fmt.Sprintf("open url failed: %s", u), err)
|
||||||
|
|
|
@ -18,10 +18,15 @@ package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
"github.com/spf13/viper"
|
||||||
core "k8s.io/api/core/v1"
|
core "k8s.io/api/core/v1"
|
||||||
|
"k8s.io/minikube/pkg/drivers/kic/oci"
|
||||||
|
"k8s.io/minikube/pkg/minikube/config"
|
||||||
|
pkg_config "k8s.io/minikube/pkg/minikube/config"
|
||||||
"k8s.io/minikube/pkg/minikube/exit"
|
"k8s.io/minikube/pkg/minikube/exit"
|
||||||
"k8s.io/minikube/pkg/minikube/machine"
|
"k8s.io/minikube/pkg/minikube/machine"
|
||||||
"k8s.io/minikube/pkg/minikube/out"
|
"k8s.io/minikube/pkg/minikube/out"
|
||||||
|
@ -41,24 +46,37 @@ var serviceListCmd = &cobra.Command{
|
||||||
exit.WithError("Error getting client", err)
|
exit.WithError("Error getting client", err)
|
||||||
}
|
}
|
||||||
defer api.Close()
|
defer api.Close()
|
||||||
|
profileName := viper.GetString(pkg_config.MachineProfile)
|
||||||
|
if !machine.IsHostRunning(api, profileName) {
|
||||||
|
exit.WithCodeT(exit.Unavailable, "profile {{.name}} is not running. ", out.V{"name": profileName})
|
||||||
|
}
|
||||||
serviceURLs, err := service.GetServiceURLs(api, serviceListNamespace, serviceURLTemplate)
|
serviceURLs, err := service.GetServiceURLs(api, serviceListNamespace, serviceURLTemplate)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
out.FatalT("Failed to get service URL: {{.error}}", out.V{"error": err})
|
out.FatalT("Failed to get service URL: {{.error}}", out.V{"error": err})
|
||||||
out.ErrT(out.Notice, "Check that minikube is running and that you have specified the correct namespace (-n flag) if required.")
|
out.ErrT(out.Notice, "Check that minikube is running and that you have specified the correct namespace (-n flag) if required.")
|
||||||
os.Exit(exit.Unavailable)
|
os.Exit(exit.Unavailable)
|
||||||
}
|
}
|
||||||
|
cfg, err := config.Load(viper.GetString(config.MachineProfile))
|
||||||
|
if err != nil {
|
||||||
|
exit.WithError("Error getting config", err)
|
||||||
|
}
|
||||||
|
|
||||||
var data [][]string
|
var data [][]string
|
||||||
for _, serviceURL := range serviceURLs {
|
for _, serviceURL := range serviceURLs {
|
||||||
if len(serviceURL.URLs) == 0 {
|
if len(serviceURL.URLs) == 0 {
|
||||||
data = append(data, []string{serviceURL.Namespace, serviceURL.Name, "No node port"})
|
data = append(data, []string{serviceURL.Namespace, serviceURL.Name, "No node port"})
|
||||||
} else {
|
} else {
|
||||||
data = append(data, []string{serviceURL.Namespace, serviceURL.Name, strings.Join(serviceURL.URLs, "\n")})
|
data = append(data, []string{serviceURL.Namespace, serviceURL.Name, "", strings.Join(serviceURL.URLs, "\n")})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
service.PrintServiceList(os.Stdout, data)
|
service.PrintServiceList(os.Stdout, data)
|
||||||
|
if runtime.GOOS == "darwin" && cfg.Driver == oci.Docker {
|
||||||
|
out.FailureT("Accessing service on docker driver for mac is not implemented yet.Please follow the work in progress and the workarround to solve this issue:\n\thttps://github.com/kubernetes/minikube/issues/6778")
|
||||||
|
exit.WithCodeT(exit.Failure, "not implemented for docker on mac driver yet.")
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue