Skip to content

Commit 129a23f

Browse files
authored
Merge pull request #1018 from vhosakot/cpu_mem_k8s_vagrant
Adding CPU and memory settings for k8s Vagrantfile
2 parents 37ffb5c + 9281037 commit 129a23f

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

README.md

+10
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ $ cd netplugin; make demo
3838
$ vagrant ssh netplugin-node1
3939
```
4040

41+
Optionally, variables can be passed to Makefile if needed. For example, to
42+
use 4 GB memory and 2 CPUs for the vagrant VMs, run:
43+
44+
```
45+
CONTIV_MEMORY=4096 CONTIV_CPUS=2 make demo
46+
```
47+
48+
CONTIV_MEMORY and CONTIV_CPUS are set to 2048 and 4 as the default values
49+
respectively.
50+
4151
#### Step 2: Create a network
4252

4353
```

vagrant/k8s/Vagrantfile

+4-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ master_ip = "192.168.2.10"
1212

1313
http_proxy = ENV['HTTP_PROXY'] || ENV['http_proxy'] || ''
1414
https_proxy = ENV['HTTPS_PROXY'] || ENV['https_proxy'] || ''
15+
num_vm_cpus = (ENV['CONTIV_CPUS'] || 4).to_i
16+
vm_memory = (ENV['CONTIV_MEMORY'] || 2048).to_i
1517

1618
# python -c 'import random; print "%0x.%0x" % (random.SystemRandom().getrandbits(3*8), random.SystemRandom().getrandbits(8*8))
1719
token = "d900e1.8a392798f13b33a4"
@@ -211,7 +213,8 @@ Vagrant.configure(2) do |config|
211213
c.vm.network :private_network, ip: member_info["contiv_network_ip"], virtualbox__intnet: network_name, auto_config: false
212214
c.vm.provider "virtualbox" do |v|
213215
customize(v)
214-
v.memory = 2048
216+
v.memory = vm_memory
217+
v.cpus = num_vm_cpus
215218
v.customize ['modifyvm', :id, '--nicpromisc2', 'allow-all']
216219
v.customize ['modifyvm', :id, '--nicpromisc3', 'allow-all']
217220
end # v

0 commit comments

Comments
 (0)