Skip to content

Commit a3a2413

Browse files
committed
Add lite mode for less RAM/CPUs
I am on a device with 16GB RAM and unable to run as configured. Thats difficult to work with since I'm constantly stashing/popping changes to the vagrantfile if I'm also trying to stay up to date with the latest version. This allows me to just set an env var and dev as anyone else would. Signed-off-by: John Schnake <[email protected]>
1 parent 455859e commit a3a2413

File tree

4 files changed

+49
-7
lines changed

4 files changed

+49
-7
lines changed

Vagrantfile

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
require 'yaml'
44

55
# Modify these in the variables.yaml file... they are described there in gory detail...
6-
settings = YAML.load_file 'sync/shared/variables.yaml'
6+
settingsFile = ENV["VAGRANT_VARIABLES"] || 'sync/shared/variables.yaml'
7+
settings = YAML.load_file settingsFile
78
k8s_linux_registry=settings['k8s_linux_registry']
89
k8s_linux_kubelet_deb=settings['k8s_linux_kubelet_deb']
910
k8s_linux_apiserver=settings['k8s_linux_apiserver']
@@ -12,6 +13,12 @@ kubernetes_version_windows=settings['kubernetes_version_windows']
1213
overwrite_linux_bins = settings['overwrite_linux_bins']
1314
overwrite_windows_bins = settings['overwrite_windows_bins'] ? "-OverwriteBins" : ""
1415

16+
linux_ram = settings['linux_ram']
17+
linux_cpus = settings['linux_cpus']
18+
windows_ram = settings['windows_ram']
19+
windows_cpus = settings['windows_cpus']
20+
21+
1522
Vagrant.configure(2) do |config|
1623

1724
# LINUX Control Plane
@@ -24,8 +31,8 @@ Vagrant.configure(2) do |config|
2431
controlplane.vm.provider :virtualbox do |vb|
2532
controlplane.vm.synced_folder "./sync/shared", "/var/sync/shared"
2633
controlplane.vm.synced_folder "./sync/linux", "/var/sync/linux"
27-
vb.memory = 8192
28-
vb.cpus = 4
34+
vb.memory = linux_ram
35+
vb.cpus = linux_cpus
2936
end
3037
controlplane.vm.provision :shell, privileged: false, path: "sync/linux/controlplane.sh", args: "#{overwrite_linux_bins} #{k8s_linux_registry} #{k8s_linux_kubelet_deb} #{k8s_linux_apiserver} "
3138
end
@@ -39,8 +46,8 @@ Vagrant.configure(2) do |config|
3946
winw1.vm.synced_folder "./sync/shared", "C:\\sync\\shared"
4047
winw1.vm.synced_folder "./sync/windows", "C:\\sync\\windows"
4148
winw1.vm.provider :virtualbox do |vb|
42-
vb.memory = 8192
43-
vb.cpus = 4
49+
vb.memory = windows_ram
50+
vb.cpus = windows_cpus
4451
vb.gui = false
4552
end
4653

sync/shared/kubejoin.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
$env:path += ";C:\Program Files\containerd"
22
[Environment]::SetEnvironmentVariable("Path", $env:Path, [System.EnvironmentVariableTarget]::Machine)
3-
kubeadm join 10.20.30.10:6443 --cri-socket "npipe:////./pipe/containerd-containerd" --token v3seop.mso4p1ibifs87ucp --discovery-token-ca-cert-hash sha256:2dea5736a807dc50b09c67c4c0da2f66f30111cd379af31b172b7aa2482a479a
3+
kubeadm join 10.20.30.10:6443 --cri-socket "npipe:////./pipe/containerd-containerd" --token 9ehroj.ymupqnfk6lmsi9mc --discovery-token-ca-cert-hash sha256:6c339766d490a41c79977e77c60e9a022b9b8aceacfa4c817cc8dd6c0fbd3c1d

sync/shared/variables-lite.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
kubernetes_sha: "cb303e613a121a29364f75cc67d3d580833a7479"
2+
3+
kubelet_path: "./sync/windows/bin/kubelet.exe"
4+
kubeproxy_path: "./sync/windows/bin/kube-proxy.exe"
5+
6+
# LINUX KUBELET VERSION
7+
# LINUX KUBEADM VERSION
8+
# The RPM versions of the kubelet pulled down remotely
9+
# from https://apt.kubernetes.io/
10+
k8s_linux_registry: "gcr.io/k8s-staging-ci-images"
11+
k8s_linux_kubelet_deb: "1.21.0"
12+
k8s_linux_apiserver: "ci/v1.22.0-alpha.3.31+a3abd06ad53b2f"
13+
14+
# WINDOWS KUBELET VERSION
15+
# This is the -KubernetesVersion sent to
16+
# The PrepareNode.ps1 script, which is maintained
17+
# by sig-windows. It determines what
18+
# WINDOWS KUBELET, KUBEADM we download.
19+
kubernetes_version_windows: "1.21.0"
20+
21+
### THIS WILL OVERWRITE THE KUBEADM and KUBELET with LOCAL SOURCE
22+
# TODO make these explicit about what they are overwriting
23+
# Seperate kubelet from kubeadm
24+
overwrite_linux_bins: false
25+
overwrite_windows_bins: false
26+
27+
linux_ram: 2048
28+
linux_cpus: 2
29+
windows_ram: 4096
30+
windows_cpus: 2

sync/shared/variables.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,9 @@ kubernetes_version_windows: "1.21.0"
2222
# TODO make these explicit about what they are overwriting
2323
# Seperate kubelet from kubeadm
2424
overwrite_linux_bins: false
25-
overwrite_windows_bins: false
25+
overwrite_windows_bins: false
26+
27+
linux_ram: 4096
28+
linux_cpus: 4
29+
windows_ram: 8162
30+
windows_cpus: 4

0 commit comments

Comments
 (0)