From 020acf57c65d55c743106fa18db16efca3986afa Mon Sep 17 00:00:00 2001 From: Aaron Prindle Date: Wed, 6 Sep 2017 14:33:59 -0700 Subject: [PATCH] added .minikube/files dir which gets ssh'd into VM on start --- pkg/minikube/assets/addons.go | 17 +++++++++-------- .../bootstrapper/localkube/localkube.go | 6 ++++-- pkg/minikube/constants/constants.go | 1 + 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/pkg/minikube/assets/addons.go b/pkg/minikube/assets/addons.go index e71d65d52ca4..496d19838900 100644 --- a/pkg/minikube/assets/addons.go +++ b/pkg/minikube/assets/addons.go @@ -17,6 +17,7 @@ limitations under the License. package assets import ( + "fmt" "os" "path/filepath" "strconv" @@ -163,22 +164,22 @@ var Addons = map[string]*Addon{ }, false, "registry-creds"), } -func AddMinikubeAddonsDirToAssets(assetList *[]CopyableFile) { - // loop over .minikube/addons and add them to assets - searchDir := constants.MakeMiniPath("addons") - err := filepath.Walk(searchDir, func(addonFile string, f os.FileInfo, err error) error { - isDir, err := util.IsDirectory(addonFile) +func AddMinikubeDirToAssets(minipath string, vmpath string, assetList *[]CopyableFile) { + // loop over $MINIKUBE_HOME/minipath and add them to assets + searchDir := constants.MakeMiniPath(minipath) + err := filepath.Walk(searchDir, func(miniFile string, f os.FileInfo, err error) error { + isDir, err := util.IsDirectory(miniFile) 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 { *assetList = append(*assetList, f) } } 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 }) if err != nil { - glog.Infoln("Error encountered while walking .minikube/addons: ", err) + glog.Infoln(fmt.Sprintf("Error encountered while walking %s: ", searchDir), err) } } diff --git a/pkg/minikube/bootstrapper/localkube/localkube.go b/pkg/minikube/bootstrapper/localkube/localkube.go index c7032a28421f..ff2eeff7f7a7 100644 --- a/pkg/minikube/bootstrapper/localkube/localkube.go +++ b/pkg/minikube/bootstrapper/localkube/localkube.go @@ -121,9 +121,11 @@ func (lk *LocalkubeBootstrapper) UpdateCluster(config bootstrapper.KubernetesCon } copyableFiles = append(copyableFiles, localkubeFile) - // add addons to file list + // user added files + assets.AddMinikubeDirToAssets("files", constants.FilesPath, ©ableFiles) + // custom addons - assets.AddMinikubeAddonsDirToAssets(©ableFiles) + assets.AddMinikubeDirToAssets("addons", constants.AddonsPath, ©ableFiles) // bundled addons for _, addonBundle := range assets.Addons { if isEnabled, err := addonBundle.IsEnabled(); err == nil && isEnabled { diff --git a/pkg/minikube/constants/constants.go b/pkg/minikube/constants/constants.go index 0238fbd3838a..026bfe312f33 100644 --- a/pkg/minikube/constants/constants.go +++ b/pkg/minikube/constants/constants.go @@ -122,6 +122,7 @@ const DockerAPIVersion = "1.23" const ReportingURL = "https://clouderrorreporting.googleapis.com/v1beta1/projects/k8s-minikube/events:report?key=AIzaSyACUwzG0dEPcl-eOgpDKnyKoUFgHdfoFuA" const AddonsPath = "/etc/kubernetes/addons" +const FilesPath = "/files" const ( RemoteLocalKubeErrPath = "/var/lib/localkube/localkube.err"