Commit d61e5698 authored by Jiri Stransky's avatar Jiri Stransky

Customizable vagrant rsync args and excludes

When using rsync file synchronization with Vagrant, the whole kubernetes repo directory is copied over into the virtual machine. This includes the _output directory, which tends to be gigabytes in size, while often just _output/release-tars (a few hundred MB) would be enough. Furthermore, if the some of the directories contains a recursive symlink, rsync with the default args will keep descending and copying files endlessly until filling up the VM disk. Making the rsync args and excluded dirs/files customizable via KUBERNETES_VAGRANT_RSYNC_ARGS and KUBERNETES_VAGRANT_RSYNC_EXLUDE, respectively, allows the developer to prevent the issues mentioned above. A new KUBERNETES_VAGRANT_USE_RSYNC variable is also added to control whether Vagrant should force usage of rsync as the file synchronization backend. The args/exclude customizations only take effect when KUBERNETES_VAGRANT_USE_RSYNC is 'true'.
parent 98130487
......@@ -30,6 +30,8 @@ $kube_os = ENV['KUBERNETES_OS'] || "fedora"
# Determine whether vagrant should use nfs to sync folders
$use_nfs = ENV['KUBERNETES_VAGRANT_USE_NFS'] == 'true'
# Determine whether vagrant should use rsync to sync folders
$use_rsync = ENV['KUBERNETES_VAGRANT_USE_RSYNC'] == 'true'
# To override the vagrant provider, use (e.g.):
# KUBERNETES_PROVIDER=vagrant VAGRANT_DEFAULT_PROVIDER=... .../cluster/kube-up.sh
......@@ -156,6 +158,15 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
if $use_nfs then
config.vm.synced_folder ".", "/vagrant", nfs: true
elsif $use_rsync then
opts = {}
if ENV['KUBERNETES_VAGRANT_RSYNC_ARGS'] then
opts[:rsync__args] = ENV['KUBERNETES_VAGRANT_RSYNC_ARGS'].split(" ")
end
if ENV['KUBERNETES_VAGRANT_RSYNC_EXCLUDE'] then
opts[:rsync__exclude] = ENV['KUBERNETES_VAGRANT_RSYNC_EXCLUDE'].split(" ")
end
config.vm.synced_folder ".", "/vagrant", opts
end
# Try VMWare Fusion first (see
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment