Merge pull request #12872 from runningwild/master

Fix several problems with using rkt on gce
This commit is contained in:
Saad Ali
2015-08-20 15:46:16 -07:00
8 changed files with 55 additions and 37 deletions

View File

@@ -144,6 +144,7 @@ func NewMainKubelet(
osInterface kubecontainer.OSInterface,
cgroupRoot string,
containerRuntime string,
rktPath string,
mounter mount.Interface,
dockerDaemonContainer string,
systemContainer string,
@@ -304,7 +305,10 @@ func NewMainKubelet(
oomAdjuster,
procFs)
case "rkt":
conf := &rkt.Config{InsecureSkipVerify: true}
conf := &rkt.Config{
Path: rktPath,
InsecureSkipVerify: true,
}
rktRuntime, err := rkt.New(
conf,
klet,

View File

@@ -21,6 +21,8 @@ import "fmt"
// Config stores the global configuration for the rkt runtime.
// Run 'rkt' for more details.
type Config struct {
// The absolute path to the binary, or leave empty to find it in $PATH.
Path string
// The debug flag for rkt.
Debug bool
// The rkt data directory.

View File

@@ -131,11 +131,14 @@ func New(config *Config,
return nil, fmt.Errorf("cannot connect to dbus: %v", err)
}
// Test if rkt binary is in $PATH.
// TODO(yifan): Use a kubelet flag to read the path.
rktBinAbsPath, err := exec.LookPath("rkt")
if err != nil {
return nil, fmt.Errorf("cannot find rkt binary: %v", err)
rktBinAbsPath := config.Path
if rktBinAbsPath == "" {
// No default rkt path was set, so try to find one in $PATH.
var err error
rktBinAbsPath, err = exec.LookPath("rkt")
if err != nil {
return nil, fmt.Errorf("cannot find rkt binary: %v", err)
}
}
rkt := &runtime{