added .minikube/files dir which gets ssh'd into VM on start

pull/1917/head
Aaron Prindle 2017-09-06 14:33:59 -07:00
parent 64f8674612
commit 020acf57c6
3 changed files with 14 additions and 10 deletions

View File

@ -17,6 +17,7 @@ limitations under the License.
package assets package assets
import ( import (
"fmt"
"os" "os"
"path/filepath" "path/filepath"
"strconv" "strconv"
@ -163,22 +164,22 @@ var Addons = map[string]*Addon{
}, false, "registry-creds"), }, false, "registry-creds"),
} }
func AddMinikubeAddonsDirToAssets(assetList *[]CopyableFile) { func AddMinikubeDirToAssets(minipath string, vmpath string, assetList *[]CopyableFile) {
// loop over .minikube/addons and add them to assets // loop over $MINIKUBE_HOME/minipath and add them to assets
searchDir := constants.MakeMiniPath("addons") searchDir := constants.MakeMiniPath(minipath)
err := filepath.Walk(searchDir, func(addonFile string, f os.FileInfo, err error) error { err := filepath.Walk(searchDir, func(miniFile string, f os.FileInfo, err error) error {
isDir, err := util.IsDirectory(addonFile) isDir, err := util.IsDirectory(miniFile)
if err == nil && !isDir { if err == nil && !isDir {
f, err := NewFileAsset(addonFile, constants.AddonsPath, filepath.Base(addonFile), "0640") f, err := NewFileAsset(miniFile, vmpath, filepath.Base(miniFile), "0640")
if err == nil { if err == nil {
*assetList = append(*assetList, f) *assetList = append(*assetList, f)
} }
} else if err != nil { } else if err != nil {
glog.Infoln("Error encountered while walking .minikube/addons: ", err) glog.Infoln(fmt.Sprintf("Error encountered while walking %s: ", searchDir), err)
} }
return nil return nil
}) })
if err != nil { if err != nil {
glog.Infoln("Error encountered while walking .minikube/addons: ", err) glog.Infoln(fmt.Sprintf("Error encountered while walking %s: ", searchDir), err)
} }
} }

View File

@ -121,9 +121,11 @@ func (lk *LocalkubeBootstrapper) UpdateCluster(config bootstrapper.KubernetesCon
} }
copyableFiles = append(copyableFiles, localkubeFile) copyableFiles = append(copyableFiles, localkubeFile)
// add addons to file list // user added files
assets.AddMinikubeDirToAssets("files", constants.FilesPath, &copyableFiles)
// custom addons // custom addons
assets.AddMinikubeAddonsDirToAssets(&copyableFiles) assets.AddMinikubeDirToAssets("addons", constants.AddonsPath, &copyableFiles)
// bundled addons // bundled addons
for _, addonBundle := range assets.Addons { for _, addonBundle := range assets.Addons {
if isEnabled, err := addonBundle.IsEnabled(); err == nil && isEnabled { if isEnabled, err := addonBundle.IsEnabled(); err == nil && isEnabled {

View File

@ -122,6 +122,7 @@ const DockerAPIVersion = "1.23"
const ReportingURL = "https://clouderrorreporting.googleapis.com/v1beta1/projects/k8s-minikube/events:report?key=AIzaSyACUwzG0dEPcl-eOgpDKnyKoUFgHdfoFuA" const ReportingURL = "https://clouderrorreporting.googleapis.com/v1beta1/projects/k8s-minikube/events:report?key=AIzaSyACUwzG0dEPcl-eOgpDKnyKoUFgHdfoFuA"
const AddonsPath = "/etc/kubernetes/addons" const AddonsPath = "/etc/kubernetes/addons"
const FilesPath = "/files"
const ( const (
RemoteLocalKubeErrPath = "/var/lib/localkube/localkube.err" RemoteLocalKubeErrPath = "/var/lib/localkube/localkube.err"