mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-10-31 10:18:13 +00:00 
			
		
		
		
	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'.
This commit is contained in:
		
							
								
								
									
										11
									
								
								Vagrantfile
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										11
									
								
								Vagrantfile
									
									
									
									
										vendored
									
									
								
							| @@ -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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Jiri Stransky
					Jiri Stransky