mirror of https://github.com/docker/cli.git
commit
48fbb12b7c
|
@ -81,7 +81,7 @@ func RunDeploy(dockerCli command.Cli, flags *pflag.FlagSet, config *composetypes
|
||||||
case commonOrchestrator.HasKubernetes():
|
case commonOrchestrator.HasKubernetes():
|
||||||
kli, err := kubernetes.WrapCli(dockerCli, kubernetes.NewOptions(flags, commonOrchestrator))
|
kli, err := kubernetes.WrapCli(dockerCli, kubernetes.NewOptions(flags, commonOrchestrator))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return errors.Wrap(err, "unable to deploy to Kubernetes")
|
||||||
}
|
}
|
||||||
return kubernetes.RunDeploy(kli, opts, config)
|
return kubernetes.RunDeploy(kli, opts, config)
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -4,10 +4,12 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"os"
|
||||||
|
|
||||||
"github.com/docker/cli/cli/command"
|
"github.com/docker/cli/cli/command"
|
||||||
"github.com/docker/cli/kubernetes"
|
"github.com/docker/cli/kubernetes"
|
||||||
cliv1beta1 "github.com/docker/cli/kubernetes/client/clientset/typed/compose/v1beta1"
|
cliv1beta1 "github.com/docker/cli/kubernetes/client/clientset/typed/compose/v1beta1"
|
||||||
|
"github.com/pkg/errors"
|
||||||
flag "github.com/spf13/pflag"
|
flag "github.com/spf13/pflag"
|
||||||
kubeclient "k8s.io/client-go/kubernetes"
|
kubeclient "k8s.io/client-go/kubernetes"
|
||||||
restclient "k8s.io/client-go/rest"
|
restclient "k8s.io/client-go/rest"
|
||||||
|
@ -58,7 +60,10 @@ func WrapCli(dockerCli command.Cli, opts Options) (*KubeCli, error) {
|
||||||
cli.kubeNamespace = opts.Namespace
|
cli.kubeNamespace = opts.Namespace
|
||||||
if opts.Namespace == "" {
|
if opts.Namespace == "" {
|
||||||
configNamespace, _, err := clientConfig.Namespace()
|
configNamespace, _, err := clientConfig.Namespace()
|
||||||
if err != nil {
|
switch {
|
||||||
|
case os.IsNotExist(err), os.IsPermission(err):
|
||||||
|
return nil, errors.Wrap(err, "unable to load configuration file")
|
||||||
|
case err != nil:
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
cli.kubeNamespace = configNamespace
|
cli.kubeNamespace = configNamespace
|
||||||
|
|
Loading…
Reference in New Issue