Merge pull request #4687 from medyagh/move_command_runner
moving command runner to its own packagepull/4689/head
commit
4e5f173a9c
|
@ -24,8 +24,8 @@ import (
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"k8s.io/minikube/pkg/minikube/assets"
|
"k8s.io/minikube/pkg/minikube/assets"
|
||||||
"k8s.io/minikube/pkg/minikube/bootstrapper"
|
|
||||||
"k8s.io/minikube/pkg/minikube/cluster"
|
"k8s.io/minikube/pkg/minikube/cluster"
|
||||||
|
"k8s.io/minikube/pkg/minikube/command"
|
||||||
"k8s.io/minikube/pkg/minikube/config"
|
"k8s.io/minikube/pkg/minikube/config"
|
||||||
"k8s.io/minikube/pkg/minikube/console"
|
"k8s.io/minikube/pkg/minikube/console"
|
||||||
"k8s.io/minikube/pkg/minikube/constants"
|
"k8s.io/minikube/pkg/minikube/constants"
|
||||||
|
@ -154,7 +154,7 @@ func isAddonAlreadySet(addon *assets.Addon, enable bool) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func enableOrDisableAddonInternal(addon *assets.Addon, cmd bootstrapper.CommandRunner, data interface{}, enable bool) error {
|
func enableOrDisableAddonInternal(addon *assets.Addon, cmd command.Runner, data interface{}, enable bool) error {
|
||||||
var err error
|
var err error
|
||||||
// check addon status before enabling/disabling it
|
// check addon status before enabling/disabling it
|
||||||
if err := isAddonAlreadySet(addon, enable); err != nil {
|
if err := isAddonAlreadySet(addon, enable); err != nil {
|
||||||
|
|
|
@ -49,6 +49,7 @@ import (
|
||||||
"k8s.io/minikube/pkg/minikube/bootstrapper"
|
"k8s.io/minikube/pkg/minikube/bootstrapper"
|
||||||
"k8s.io/minikube/pkg/minikube/bootstrapper/kubeadm"
|
"k8s.io/minikube/pkg/minikube/bootstrapper/kubeadm"
|
||||||
"k8s.io/minikube/pkg/minikube/cluster"
|
"k8s.io/minikube/pkg/minikube/cluster"
|
||||||
|
"k8s.io/minikube/pkg/minikube/command"
|
||||||
cfg "k8s.io/minikube/pkg/minikube/config"
|
cfg "k8s.io/minikube/pkg/minikube/config"
|
||||||
"k8s.io/minikube/pkg/minikube/console"
|
"k8s.io/minikube/pkg/minikube/console"
|
||||||
"k8s.io/minikube/pkg/minikube/constants"
|
"k8s.io/minikube/pkg/minikube/constants"
|
||||||
|
@ -759,7 +760,7 @@ func configureRuntimes(runner cruntime.CommandRunner) cruntime.Manager {
|
||||||
}
|
}
|
||||||
|
|
||||||
// bootstrapCluster starts Kubernetes using the chosen bootstrapper
|
// bootstrapCluster starts Kubernetes using the chosen bootstrapper
|
||||||
func bootstrapCluster(bs bootstrapper.Bootstrapper, r cruntime.Manager, runner bootstrapper.CommandRunner, kc cfg.KubernetesConfig, preexisting bool, isUpgrade bool) {
|
func bootstrapCluster(bs bootstrapper.Bootstrapper, r cruntime.Manager, runner command.Runner, kc cfg.KubernetesConfig, preexisting bool, isUpgrade bool) {
|
||||||
// hum. bootstrapper.Bootstrapper should probably have a Name function.
|
// hum. bootstrapper.Bootstrapper should probably have a Name function.
|
||||||
bsName := viper.GetString(cmdcfg.Bootstrapper)
|
bsName := viper.GetString(cmdcfg.Bootstrapper)
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ func Test_portExtraction(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_defaultDiskSize(t *testing.T) {
|
func Test_defaultDiskSize(t *testing.T) {
|
||||||
expectedDefaultDiscSize := commonutil.CalculateDiskSizeInMB(constants.DefaultDiskSize)
|
expectedDefaultDiscSize := commonutil.CalculateSizeInMB(constants.DefaultDiskSize)
|
||||||
driver := NewDriver("", "")
|
driver := NewDriver("", "")
|
||||||
got := driver.DiskSize
|
got := driver.DiskSize
|
||||||
if got != expectedDefaultDiscSize {
|
if got != expectedDefaultDiscSize {
|
||||||
|
|
|
@ -25,8 +25,8 @@ import (
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"k8s.io/apimachinery/pkg/util/net"
|
"k8s.io/apimachinery/pkg/util/net"
|
||||||
pkgdrivers "k8s.io/minikube/pkg/drivers" // TODO(tstromberg): Extract CommandRunner into its own package
|
pkgdrivers "k8s.io/minikube/pkg/drivers"
|
||||||
"k8s.io/minikube/pkg/minikube/bootstrapper"
|
"k8s.io/minikube/pkg/minikube/command"
|
||||||
"k8s.io/minikube/pkg/minikube/constants"
|
"k8s.io/minikube/pkg/minikube/constants"
|
||||||
"k8s.io/minikube/pkg/minikube/cruntime"
|
"k8s.io/minikube/pkg/minikube/cruntime"
|
||||||
)
|
)
|
||||||
|
@ -47,7 +47,7 @@ type Driver struct {
|
||||||
*pkgdrivers.CommonDriver
|
*pkgdrivers.CommonDriver
|
||||||
URL string
|
URL string
|
||||||
runtime cruntime.Manager
|
runtime cruntime.Manager
|
||||||
exec bootstrapper.CommandRunner
|
exec command.Runner
|
||||||
}
|
}
|
||||||
|
|
||||||
// Config is configuration for the None driver
|
// Config is configuration for the None driver
|
||||||
|
@ -59,7 +59,7 @@ type Config struct {
|
||||||
|
|
||||||
// NewDriver returns a fully configured None driver
|
// NewDriver returns a fully configured None driver
|
||||||
func NewDriver(c Config) *Driver {
|
func NewDriver(c Config) *Driver {
|
||||||
runner := &bootstrapper.ExecRunner{}
|
runner := &command.ExecRunner{}
|
||||||
runtime, err := cruntime.New(cruntime.Config{Type: c.ContainerRuntime, Runner: runner})
|
runtime, err := cruntime.New(cruntime.Config{Type: c.ContainerRuntime, Runner: runner})
|
||||||
// Libraries shouldn't panic, but there is no way for drivers to return error :(
|
// Libraries shouldn't panic, but there is no way for drivers to return error :(
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -216,19 +216,19 @@ func (d *Driver) RunSSHCommandFromDriver() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// stopKubelet idempotently stops the kubelet
|
// stopKubelet idempotently stops the kubelet
|
||||||
func stopKubelet(exec bootstrapper.CommandRunner) error {
|
func stopKubelet(exec command.Runner) error {
|
||||||
glog.Infof("stopping kubelet.service ...")
|
glog.Infof("stopping kubelet.service ...")
|
||||||
return exec.Run("sudo systemctl stop kubelet.service")
|
return exec.Run("sudo systemctl stop kubelet.service")
|
||||||
}
|
}
|
||||||
|
|
||||||
// restartKubelet restarts the kubelet
|
// restartKubelet restarts the kubelet
|
||||||
func restartKubelet(exec bootstrapper.CommandRunner) error {
|
func restartKubelet(exec command.Runner) error {
|
||||||
glog.Infof("restarting kubelet.service ...")
|
glog.Infof("restarting kubelet.service ...")
|
||||||
return exec.Run("sudo systemctl restart kubelet.service")
|
return exec.Run("sudo systemctl restart kubelet.service")
|
||||||
}
|
}
|
||||||
|
|
||||||
// checkKubelet returns an error if the kubelet is not running.
|
// checkKubelet returns an error if the kubelet is not running.
|
||||||
func checkKubelet(exec bootstrapper.CommandRunner) error {
|
func checkKubelet(exec command.Runner) error {
|
||||||
glog.Infof("checking for running kubelet ...")
|
glog.Infof("checking for running kubelet ...")
|
||||||
return exec.Run("systemctl is-active --quiet service kubelet")
|
return exec.Run("systemctl is-active --quiet service kubelet")
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ import (
|
||||||
"k8s.io/client-go/tools/clientcmd/api"
|
"k8s.io/client-go/tools/clientcmd/api"
|
||||||
"k8s.io/client-go/tools/clientcmd/api/latest"
|
"k8s.io/client-go/tools/clientcmd/api/latest"
|
||||||
"k8s.io/minikube/pkg/minikube/assets"
|
"k8s.io/minikube/pkg/minikube/assets"
|
||||||
|
"k8s.io/minikube/pkg/minikube/command"
|
||||||
"k8s.io/minikube/pkg/minikube/config"
|
"k8s.io/minikube/pkg/minikube/config"
|
||||||
"k8s.io/minikube/pkg/minikube/constants"
|
"k8s.io/minikube/pkg/minikube/constants"
|
||||||
"k8s.io/minikube/pkg/util"
|
"k8s.io/minikube/pkg/util"
|
||||||
|
@ -42,7 +43,7 @@ var (
|
||||||
)
|
)
|
||||||
|
|
||||||
// SetupCerts gets the generated credentials required to talk to the APIServer.
|
// SetupCerts gets the generated credentials required to talk to the APIServer.
|
||||||
func SetupCerts(cmd CommandRunner, k8s config.KubernetesConfig) error {
|
func SetupCerts(cmd command.Runner, k8s config.KubernetesConfig) error {
|
||||||
localPath := constants.GetMinipath()
|
localPath := constants.GetMinipath()
|
||||||
glog.Infof("Setting up certificates for IP: %s\n", k8s.NodeIP)
|
glog.Infof("Setting up certificates for IP: %s\n", k8s.NodeIP)
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"k8s.io/minikube/pkg/minikube/command"
|
||||||
"k8s.io/minikube/pkg/minikube/config"
|
"k8s.io/minikube/pkg/minikube/config"
|
||||||
"k8s.io/minikube/pkg/minikube/constants"
|
"k8s.io/minikube/pkg/minikube/constants"
|
||||||
"k8s.io/minikube/pkg/minikube/tests"
|
"k8s.io/minikube/pkg/minikube/tests"
|
||||||
|
@ -31,7 +32,7 @@ func TestSetupCerts(t *testing.T) {
|
||||||
tempDir := tests.MakeTempDir()
|
tempDir := tests.MakeTempDir()
|
||||||
defer os.RemoveAll(tempDir)
|
defer os.RemoveAll(tempDir)
|
||||||
|
|
||||||
f := NewFakeCommandRunner()
|
f := command.NewFakeCommandRunner()
|
||||||
k8s := config.KubernetesConfig{
|
k8s := config.KubernetesConfig{
|
||||||
APIServerName: constants.APIServerName,
|
APIServerName: constants.APIServerName,
|
||||||
DNSDomain: constants.ClusterDNSDomain,
|
DNSDomain: constants.ClusterDNSDomain,
|
||||||
|
|
|
@ -36,6 +36,7 @@ import (
|
||||||
"k8s.io/apimachinery/pkg/util/wait"
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
"k8s.io/minikube/pkg/minikube/assets"
|
"k8s.io/minikube/pkg/minikube/assets"
|
||||||
"k8s.io/minikube/pkg/minikube/bootstrapper"
|
"k8s.io/minikube/pkg/minikube/bootstrapper"
|
||||||
|
"k8s.io/minikube/pkg/minikube/command"
|
||||||
"k8s.io/minikube/pkg/minikube/config"
|
"k8s.io/minikube/pkg/minikube/config"
|
||||||
"k8s.io/minikube/pkg/minikube/console"
|
"k8s.io/minikube/pkg/minikube/console"
|
||||||
"k8s.io/minikube/pkg/minikube/constants"
|
"k8s.io/minikube/pkg/minikube/constants"
|
||||||
|
@ -94,7 +95,7 @@ var SkipAdditionalPreflights = map[string][]string{}
|
||||||
|
|
||||||
// Bootstrapper is a bootstrapper using kubeadm
|
// Bootstrapper is a bootstrapper using kubeadm
|
||||||
type Bootstrapper struct {
|
type Bootstrapper struct {
|
||||||
c bootstrapper.CommandRunner
|
c command.Runner
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewKubeadmBootstrapper creates a new kubeadm.Bootstrapper
|
// NewKubeadmBootstrapper creates a new kubeadm.Bootstrapper
|
||||||
|
@ -640,7 +641,7 @@ func copyConfig(cfg config.KubernetesConfig, files []assets.CopyableFile, kubead
|
||||||
return files
|
return files
|
||||||
}
|
}
|
||||||
|
|
||||||
func downloadBinaries(cfg config.KubernetesConfig, c bootstrapper.CommandRunner) error {
|
func downloadBinaries(cfg config.KubernetesConfig, c command.Runner) error {
|
||||||
var g errgroup.Group
|
var g errgroup.Group
|
||||||
for _, bin := range constants.GetKubeadmCachedBinaries() {
|
for _, bin := range constants.GetKubeadmCachedBinaries() {
|
||||||
bin := bin
|
bin := bin
|
||||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package bootstrapper
|
package command
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
@ -24,8 +24,8 @@ import (
|
||||||
"k8s.io/minikube/pkg/minikube/assets"
|
"k8s.io/minikube/pkg/minikube/assets"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CommandRunner represents an interface to run commands.
|
// Runner represents an interface to run commands.
|
||||||
type CommandRunner interface {
|
type Runner interface {
|
||||||
// Run starts the specified command and waits for it to complete.
|
// Run starts the specified command and waits for it to complete.
|
||||||
Run(cmd string) error
|
Run(cmd string) error
|
||||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package bootstrapper
|
package command
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package bootstrapper
|
package command
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package bootstrapper
|
package command
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
|
@ -25,7 +25,7 @@ import (
|
||||||
"k8s.io/minikube/pkg/minikube/console"
|
"k8s.io/minikube/pkg/minikube/console"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CommandRunner is the subset of bootstrapper.CommandRunner this package consumes
|
// CommandRunner is the subset of command.Runner this package consumes
|
||||||
type CommandRunner interface {
|
type CommandRunner interface {
|
||||||
Run(string) error
|
Run(string) error
|
||||||
CombinedOutput(string) (string, error)
|
CombinedOutput(string) (string, error)
|
||||||
|
|
|
@ -28,6 +28,7 @@ import (
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
"k8s.io/minikube/pkg/minikube/bootstrapper"
|
"k8s.io/minikube/pkg/minikube/bootstrapper"
|
||||||
|
"k8s.io/minikube/pkg/minikube/command"
|
||||||
"k8s.io/minikube/pkg/minikube/console"
|
"k8s.io/minikube/pkg/minikube/console"
|
||||||
"k8s.io/minikube/pkg/minikube/cruntime"
|
"k8s.io/minikube/pkg/minikube/cruntime"
|
||||||
)
|
)
|
||||||
|
@ -54,7 +55,7 @@ var importantPods = []string{
|
||||||
const lookBackwardsCount = 200
|
const lookBackwardsCount = 200
|
||||||
|
|
||||||
// Follow follows logs from multiple files in tail(1) format
|
// Follow follows logs from multiple files in tail(1) format
|
||||||
func Follow(r cruntime.Manager, bs bootstrapper.Bootstrapper, runner bootstrapper.CommandRunner) error {
|
func Follow(r cruntime.Manager, bs bootstrapper.Bootstrapper, runner command.Runner) error {
|
||||||
cs := []string{}
|
cs := []string{}
|
||||||
for _, v := range logCommands(r, bs, 0, true) {
|
for _, v := range logCommands(r, bs, 0, true) {
|
||||||
cs = append(cs, v+" &")
|
cs = append(cs, v+" &")
|
||||||
|
@ -69,7 +70,7 @@ func IsProblem(line string) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
// FindProblems finds possible root causes among the logs
|
// FindProblems finds possible root causes among the logs
|
||||||
func FindProblems(r cruntime.Manager, bs bootstrapper.Bootstrapper, runner bootstrapper.CommandRunner) map[string][]string {
|
func FindProblems(r cruntime.Manager, bs bootstrapper.Bootstrapper, runner command.Runner) map[string][]string {
|
||||||
pMap := map[string][]string{}
|
pMap := map[string][]string{}
|
||||||
cmds := logCommands(r, bs, lookBackwardsCount, false)
|
cmds := logCommands(r, bs, lookBackwardsCount, false)
|
||||||
for name, cmd := range cmds {
|
for name, cmd := range cmds {
|
||||||
|
@ -110,7 +111,7 @@ func OutputProblems(problems map[string][]string, maxLines int) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Output displays logs from multiple sources in tail(1) format
|
// Output displays logs from multiple sources in tail(1) format
|
||||||
func Output(r cruntime.Manager, bs bootstrapper.Bootstrapper, runner bootstrapper.CommandRunner, lines int) error {
|
func Output(r cruntime.Manager, bs bootstrapper.Bootstrapper, runner command.Runner, lines int) error {
|
||||||
cmds := logCommands(r, bs, lines, false)
|
cmds := logCommands(r, bs, lines, false)
|
||||||
|
|
||||||
// These are not technically logs, but are useful to have in bug reports.
|
// These are not technically logs, but are useful to have in bug reports.
|
||||||
|
|
|
@ -28,6 +28,7 @@ import (
|
||||||
"golang.org/x/sync/errgroup"
|
"golang.org/x/sync/errgroup"
|
||||||
"k8s.io/minikube/pkg/minikube/assets"
|
"k8s.io/minikube/pkg/minikube/assets"
|
||||||
"k8s.io/minikube/pkg/minikube/bootstrapper"
|
"k8s.io/minikube/pkg/minikube/bootstrapper"
|
||||||
|
"k8s.io/minikube/pkg/minikube/command"
|
||||||
"k8s.io/minikube/pkg/minikube/console"
|
"k8s.io/minikube/pkg/minikube/console"
|
||||||
"k8s.io/minikube/pkg/minikube/constants"
|
"k8s.io/minikube/pkg/minikube/constants"
|
||||||
)
|
)
|
||||||
|
@ -90,7 +91,7 @@ func CacheBinary(binary, version, osName, archName string) (string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// CopyBinary copies previously cached binaries into the path
|
// CopyBinary copies previously cached binaries into the path
|
||||||
func CopyBinary(cr bootstrapper.CommandRunner, binary, path string) error {
|
func CopyBinary(cr command.Runner, binary, path string) error {
|
||||||
f, err := assets.NewFileAsset(path, "/usr/bin", binary, "0755")
|
f, err := assets.NewFileAsset(path, "/usr/bin", binary, "0755")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "new file asset")
|
return errors.Wrap(err, "new file asset")
|
||||||
|
|
|
@ -35,6 +35,7 @@ import (
|
||||||
"golang.org/x/sync/errgroup"
|
"golang.org/x/sync/errgroup"
|
||||||
"k8s.io/minikube/pkg/minikube/assets"
|
"k8s.io/minikube/pkg/minikube/assets"
|
||||||
"k8s.io/minikube/pkg/minikube/bootstrapper"
|
"k8s.io/minikube/pkg/minikube/bootstrapper"
|
||||||
|
"k8s.io/minikube/pkg/minikube/command"
|
||||||
"k8s.io/minikube/pkg/minikube/config"
|
"k8s.io/minikube/pkg/minikube/config"
|
||||||
"k8s.io/minikube/pkg/minikube/constants"
|
"k8s.io/minikube/pkg/minikube/constants"
|
||||||
"k8s.io/minikube/pkg/minikube/cruntime"
|
"k8s.io/minikube/pkg/minikube/cruntime"
|
||||||
|
@ -84,7 +85,7 @@ func CacheImages(images []string, cacheDir string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// LoadImages loads previously cached images into the container runtime
|
// LoadImages loads previously cached images into the container runtime
|
||||||
func LoadImages(cmd bootstrapper.CommandRunner, images []string, cacheDir string) error {
|
func LoadImages(cmd command.Runner, images []string, cacheDir string) error {
|
||||||
var g errgroup.Group
|
var g errgroup.Group
|
||||||
// Load profile cluster config from file
|
// Load profile cluster config from file
|
||||||
cc, err := config.Load()
|
cc, err := config.Load()
|
||||||
|
@ -194,7 +195,7 @@ func getWindowsVolumeNameCmd(d string) (string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// loadImageFromCache loads a single image from the cache
|
// loadImageFromCache loads a single image from the cache
|
||||||
func loadImageFromCache(cr bootstrapper.CommandRunner, k8s config.KubernetesConfig, src string) error {
|
func loadImageFromCache(cr command.Runner, k8s config.KubernetesConfig, src string) error {
|
||||||
glog.Infof("Loading image from cache: %s", src)
|
glog.Infof("Loading image from cache: %s", src)
|
||||||
filename := filepath.Base(src)
|
filename := filepath.Base(src)
|
||||||
if _, err := os.Stat(src); err != nil {
|
if _, err := os.Stat(src); err != nil {
|
||||||
|
|
|
@ -40,7 +40,7 @@ import (
|
||||||
"github.com/docker/machine/libmachine/swarm"
|
"github.com/docker/machine/libmachine/swarm"
|
||||||
"github.com/docker/machine/libmachine/version"
|
"github.com/docker/machine/libmachine/version"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"k8s.io/minikube/pkg/minikube/bootstrapper"
|
"k8s.io/minikube/pkg/minikube/command"
|
||||||
"k8s.io/minikube/pkg/minikube/constants"
|
"k8s.io/minikube/pkg/minikube/constants"
|
||||||
"k8s.io/minikube/pkg/minikube/exit"
|
"k8s.io/minikube/pkg/minikube/exit"
|
||||||
"k8s.io/minikube/pkg/minikube/registry"
|
"k8s.io/minikube/pkg/minikube/registry"
|
||||||
|
@ -145,15 +145,15 @@ func (api *LocalClient) Close() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// CommandRunner returns best available command runner for this host
|
// CommandRunner returns best available command runner for this host
|
||||||
func CommandRunner(h *host.Host) (bootstrapper.CommandRunner, error) {
|
func CommandRunner(h *host.Host) (command.Runner, error) {
|
||||||
if h.DriverName == constants.DriverNone {
|
if h.DriverName == constants.DriverNone {
|
||||||
return &bootstrapper.ExecRunner{}, nil
|
return &command.ExecRunner{}, nil
|
||||||
}
|
}
|
||||||
client, err := sshutil.NewSSHClient(h.Driver)
|
client, err := sshutil.NewSSHClient(h.Driver)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "getting ssh client for bootstrapper")
|
return nil, errors.Wrap(err, "getting ssh client for bootstrapper")
|
||||||
}
|
}
|
||||||
return bootstrapper.NewSSHRunner(client), nil
|
return command.NewSSHRunner(client), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create creates the host
|
// Create creates the host
|
||||||
|
|
|
@ -37,7 +37,7 @@ import (
|
||||||
"github.com/docker/machine/libmachine/swarm"
|
"github.com/docker/machine/libmachine/swarm"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"k8s.io/minikube/pkg/minikube/assets"
|
"k8s.io/minikube/pkg/minikube/assets"
|
||||||
"k8s.io/minikube/pkg/minikube/bootstrapper"
|
"k8s.io/minikube/pkg/minikube/command"
|
||||||
"k8s.io/minikube/pkg/minikube/config"
|
"k8s.io/minikube/pkg/minikube/config"
|
||||||
"k8s.io/minikube/pkg/minikube/sshutil"
|
"k8s.io/minikube/pkg/minikube/sshutil"
|
||||||
"k8s.io/minikube/pkg/util"
|
"k8s.io/minikube/pkg/util"
|
||||||
|
@ -314,7 +314,7 @@ func configureAuth(p *BuildrootProvisioner) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func copyHostCerts(authOptions auth.Options) error {
|
func copyHostCerts(authOptions auth.Options) error {
|
||||||
execRunner := &bootstrapper.ExecRunner{}
|
execRunner := &command.ExecRunner{}
|
||||||
hostCerts := map[string]string{
|
hostCerts := map[string]string{
|
||||||
authOptions.CaCertPath: path.Join(authOptions.StorePath, "ca.pem"),
|
authOptions.CaCertPath: path.Join(authOptions.StorePath, "ca.pem"),
|
||||||
authOptions.ClientCertPath: path.Join(authOptions.StorePath, "cert.pem"),
|
authOptions.ClientCertPath: path.Join(authOptions.StorePath, "cert.pem"),
|
||||||
|
@ -345,7 +345,7 @@ func copyRemoteCerts(authOptions auth.Options, driver drivers.Driver) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "provisioning: error getting ssh client")
|
return errors.Wrap(err, "provisioning: error getting ssh client")
|
||||||
}
|
}
|
||||||
sshRunner := bootstrapper.NewSSHRunner(sshClient)
|
sshRunner := command.NewSSHRunner(sshClient)
|
||||||
for src, dst := range remoteCerts {
|
for src, dst := range remoteCerts {
|
||||||
f, err := assets.NewFileAsset(src, path.Dir(dst), filepath.Base(dst), "0640")
|
f, err := assets.NewFileAsset(src, path.Dir(dst), filepath.Base(dst), "0640")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue