Allow configuring the rkt binary in a kubelet with a flag.

This is necessary because coreos comes with rkt installed, and if we want to use a different version
we need some way to avoid the default one.
This commit is contained in:
Jonathan Wills
2015-08-17 13:03:45 -04:00
parent a68e819e60
commit 80e799fc0c
7 changed files with 25 additions and 7 deletions

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

@@ -128,11 +128,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{