Skip to content
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

~/.minikube/files as rootfs "layer" #2110

Merged
merged 4 commits into from
Nov 29, 2017
Merged

Conversation

r2d4
Copy link
Contributor

@r2d4 r2d4 commented Oct 23, 2017

This PR applies the ~/.minikube/files directory as a rootfs rather than just scp-ing the files into /files. The VM path will be calculated relatively to the ~/.minikube/files folder.

Some examples when MINIKUBE_HOME=~/.minikube

A file at ~/.minikube/files/var/log/testing will show up in the VM at /var/log/testing.

On the surface this doesn't seem to useful, but you can use it to symlink binaries and utilities:

ln -s ~/go/src/k8s.io/kubernetes/_output/bin/kubelet ~/.minikube/files/usr/bin/kubelet will let you use a custom kubelet in your minikube cluster.

I don't think this will work on windows, since that would equate to translating a windows path to a linux path, which should probably not work. If the test fails, I'll figure out how best to handle that.

Instead of scping these files to just /files, we mimic the directory
structure relative to the ~/.minikube/files directory and place the
binaries there.  This can be useful for development.
To allow users to overwrite some of the files that we download
(kubelet, kubeadm, etc.)
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 23, 2017
@codecov-io
Copy link

codecov-io commented Oct 23, 2017

Codecov Report

Merging #2110 into master will not change coverage.
The diff coverage is 0%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2110   +/-   ##
=======================================
  Coverage   28.86%   28.86%           
=======================================
  Files          81       81           
  Lines        5307     5307           
=======================================
  Hits         1532     1532           
  Misses       3582     3582           
  Partials      193      193
Impacted Files Coverage Δ
pkg/minikube/bootstrapper/ssh_runner.go 0% <0%> (ø) ⬆️
pkg/minikube/bootstrapper/localkube/localkube.go 31.46% <0%> (+0.69%) ⬆️
pkg/minikube/bootstrapper/kubeadm/kubeadm.go 10.6% <0%> (-0.05%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ea31492...633fc4a. Read the comment docs.

if err != nil {
return errors.Wrap(err, "generating relative path")
}
rPath = filepath.Dir(rPath)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure this will work with Windows as you stated. Should be able to massage the paths though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the tests will cover this, I don't think any integration tests use the .minikube/files dir.

return errors.Wrap(err, "generating relative path")
}
rPath = filepath.Dir(rPath)
vmpath = filepath.Join("/", rPath)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think this one needs to be a path.Join

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well the tricky thing is that I'm using the host path to determine the remote path.

so rPath is always the relative path to your MINIKUBE_HOME.

Essentially it boils down to - how to do you translate a unix path from a partial windows path? I don't think we can just reverse the slashes and call it day.

@r2d4 r2d4 merged commit fc916f7 into kubernetes:master Nov 29, 2017
@r2d4 r2d4 deleted the files-rootfs branch November 29, 2017 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants