Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions pkg/minikube/assets/addons.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package assets

import (
"fmt"
"os"
"path/filepath"
"strconv"
Expand Down Expand Up @@ -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)
}
}
6 changes: 4 additions & 2 deletions pkg/minikube/bootstrapper/localkube/localkube.go
Original file line number Diff line number Diff line change
Expand Up @@ -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, &copyableFiles)

// custom addons
assets.AddMinikubeAddonsDirToAssets(&copyableFiles)
assets.AddMinikubeDirToAssets("addons", constants.AddonsPath, &copyableFiles)
// bundled addons
for _, addonBundle := range assets.Addons {
if isEnabled, err := addonBundle.IsEnabled(); err == nil && isEnabled {
Expand Down
1 change: 1 addition & 0 deletions pkg/minikube/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down