14
14
# vi: set ft=ruby :
15
15
16
16
# This Vagrantfile creates an Oracle Cloud Native Environment and
17
- # deploys the Kubernetes module to the master and worker nodes.
17
+ # deploys the Kubernetes module to the control plane and worker nodes.
18
18
# VMs communicate via a private network using subnet 192.168.99.* (by default):
19
- # - HA Master IP: 192.168.99.99 (Virtual IP, when in HA mode)
20
- # - Operator : 192.168.99.100 (Optional, none by default)
21
- # - Master i : 192.168.99.(100+i) (1 by default, 3 in HA mode)
22
- # - Worker i : 192.168.99.(110+i) (2 by default)
23
- # - MetalLB Pool: 192.168.99.240 - 192.168.99.250
19
+ # - HA Control plane IP: 192.168.99.99 (Virtual IP, when in HA mode)
20
+ # - Operator : 192.168.99.100 (Optional, none by default)
21
+ # - Control plane i : 192.168.99.(100+i) (1 by default, 3 in HA mode)
22
+ # - Worker i : 192.168.99.(110+i) (2 by default)
23
+ # - MetalLB Pool : 192.168.99.240 - 192.168.99.250
24
24
#
25
25
# Optional plugins:
26
26
# vagrant-hosts (maintains /etc/hosts for the VMs)
@@ -54,24 +54,24 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
54
54
# vCPUS and Memory for the VMs
55
55
OPERATOR_CPUS = default_i ( 'OPERATOR_CPUS' , 1 )
56
56
OPERATOR_MEMORY = default_i ( 'OPERATOR_MEMORY' , 1024 )
57
- MASTER_CPUS = default_i ( 'MASTER_CPUS ' , 2 )
58
- MASTER_MEMORY = default_i ( 'MASTER_MEMORY ' , 2048 )
57
+ CONTROL_PLANE_CPUS = default_i ( 'CONTROL_PLANE_CPUS ' , 2 )
58
+ CONTROL_PLANE_MEMORY = default_i ( 'CONTROL_PLANE_MEMORY ' , 2048 )
59
59
WORKER_CPUS = default_i ( 'WORKER_CPUS' , 1 )
60
60
WORKER_MEMORY = default_i ( 'WORKER_MEMORY' , 1024 )
61
61
62
62
# Group VirtualBox containers
63
63
VB_GROUP = default_s ( 'VB_GROUP' , 'OCNE' )
64
64
65
- # Multi-master setup. Deploy 3 masters in HA mode.
66
- MULTI_MASTER = default_b ( 'MULTI_MASTER ' , false )
65
+ # Multi-control-plane setup. Deploy 3 control planes in HA mode.
66
+ MULTI_CONTROL_PLANE = default_b ( 'MULTI_CONTROL_PLANE ' , false )
67
67
68
68
# Separate operator node for the Oracle Cloud Native Environment
69
69
# Platform API Server and Platform Agent (default is to install the
70
- # components on the (first) master node
70
+ # components on the (first) control plane node
71
71
#
72
- # If multi-master is enabled, the standalone operator is automatically
72
+ # If multi-control-plane is enabled, the standalone operator is automatically
73
73
# enabled for routing purposes
74
- if MULTI_MASTER
74
+ if MULTI_CONTROL_PLANE
75
75
STANDALONE_OPERATOR = true
76
76
else
77
77
STANDALONE_OPERATOR = default_b ( 'STANDALONE_OPERATOR' , false )
@@ -81,14 +81,14 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
81
81
# Gluster Storage for Kubernetes Persistent Volumes
82
82
EXTRA_DISK = default_b ( 'EXTRA_DISK' , false )
83
83
84
- # Override number of masters to deploy
84
+ # Override number of control planes to deploy
85
85
# This should not be changed -- for development purpose
86
- NB_MASTERS = default_i ( 'NB_MASTERS ' , MULTI_MASTER ? 3 : 1 )
86
+ NB_CONTROL_PLANES = default_i ( 'NB_CONTROL_PLANES ' , MULTI_CONTROL_PLANE ? 3 : 1 )
87
87
88
88
# Number of worker nodes to provision
89
89
NB_WORKERS = default_i ( 'NB_WORKERS' , 2 )
90
90
91
- # Bind the kubectl proxy from the (first) master to the vagrant host
91
+ # Bind the kubectl proxy from the (first) control plane to the vagrant host
92
92
BIND_PROXY = default_b ( 'BIND_PROXY' , false )
93
93
94
94
# Additional yum channel to consider (e.g. local repo)
@@ -112,13 +112,6 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
112
112
# Deploy Multus networking module?
113
113
DEPLOY_MULTUS = default_b ( 'DEPLOY_MULTUS' , false )
114
114
115
- # Pod networking technology: flannel, calico, none. Note: flannel is deprecated.
116
- if DEPLOY_CALICO
117
- POD_NETWORK = 'none'
118
- else
119
- POD_NETWORK = default_s ( 'POD_NETWORK' , 'calico' )
120
- end
121
-
122
115
# Deploy Istio?
123
116
DEPLOY_ISTIO = default_b ( 'DEPLOY_ISTIO' , false )
124
117
@@ -138,9 +131,6 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
138
131
METALLB_MODULE_NAME = default_s ( 'METALLB_MODULE_NAME' , 'ocne-metallb' )
139
132
GLUSTER_MODULE_NAME = default_s ( 'GLUSTER_MODULE_NAME' , 'ocne-gluster' )
140
133
141
- # Use specific component version (mainly used for development)
142
- NGINX_IMAGE = default_s ( 'NGINX_IMAGE' , 'nginx:1.17.7' )
143
-
144
134
# Update Base OS
145
135
UPDATE_OS = default_b ( 'UPDATE_OS' , false )
146
136
@@ -178,10 +168,9 @@ def provision_vm(vm, vm_args)
178
168
args = vm_args . clone
179
169
args . push ( "--ocne-environment-name" , OCNE_ENV_NAME )
180
170
args . push ( "--ocne-cluster-name" , OCNE_CLUSTER_NAME )
181
- args . push ( "--multi-master " ) if MULTI_MASTER
171
+ args . push ( "--multi-control-plane " ) if MULTI_CONTROL_PLANE
182
172
args . push ( "--repo" , YUM_REPO ) unless YUM_REPO == ""
183
173
args . push ( "--ocne-dev" ) if OCNE_DEV
184
- args . push ( "--pod-network" , POD_NETWORK ) if POD_NETWORK
185
174
args . push ( "--with-calico" ) if DEPLOY_CALICO
186
175
args . push ( "--calico-module-name" , CALICO_MODULE_NAME ) if DEPLOY_CALICO
187
176
args . push ( "--with-multus" ) if DEPLOY_MULTUS
@@ -206,6 +195,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
206
195
207
196
config . vm . box = BOX_NAME
208
197
config . vm . box_url = "#{ BOX_URL } /#{ BOX_NAME } .json"
198
+ # config.vm.box_version = "8.6.359"
209
199
210
200
# If we use the vagrant-proxyconf plugin, we should not proxy k8s/local IPs
211
201
# Unfortunately we can't use CIDR with no_proxy, so we have to enumerate and
@@ -263,6 +253,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
263
253
ip = 110 + i
264
254
ip_addr = "#{ SUBNET } .#{ ip } "
265
255
workers += "#{ ip_addr } ,"
256
+ # worker.vm.network :private_network, nic_type: "virtio", ip: ip_addr, nm_controlled: "yes"
266
257
worker . vm . network :private_network , nic_type : "virtio" , ip : ip_addr
267
258
if Vagrant . has_plugin? ( "vagrant-hosts" )
268
259
worker . vm . provision :hosts , :sync_hosts => true , :add_localhost_hostnames => false
@@ -289,42 +280,42 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
289
280
end
290
281
end
291
282
292
- # Masters provisioning
293
- masters = ""
294
- NB_MASTERS . downto ( 1 ) do |i |
295
- config . vm . define "master #{ i } " do |master |
296
- master . vm . hostname = "master #{ i } .vagrant.vm"
283
+ # Control plane provisioning
284
+ control_planes = ""
285
+ NB_CONTROL_PLANES . downto ( 1 ) do |i |
286
+ config . vm . define "controlplane #{ i } " do |control_plane |
287
+ control_plane . vm . hostname = "controlplane #{ i } .vagrant.vm"
297
288
ip = 100 + i
298
289
ip_addr = "#{ SUBNET } .#{ ip } "
299
- masters += "#{ ip_addr } ,"
300
- master . vm . network :private_network , nic_type : "virtio" , ip : ip_addr
290
+ control_planes += "#{ ip_addr } ,"
291
+ control_plane . vm . network :private_network , nic_type : "virtio" , ip : ip_addr
301
292
if Vagrant . has_plugin? ( "vagrant-hosts" )
302
- master . vm . provision :hosts , :sync_hosts => true , :add_localhost_hostnames => false
293
+ control_plane . vm . provision :hosts , :sync_hosts => true , :add_localhost_hostnames => false
303
294
end
304
- master . vm . provider :virtualbox do |vb |
305
- vb . name = "master #{ i } "
306
- vb . memory = MASTER_MEMORY
307
- vb . cpus = MASTER_CPUS
295
+ control_plane . vm . provider :virtualbox do |vb |
296
+ vb . name = "control_plane #{ i } "
297
+ vb . memory = CONTROL_PLANE_MEMORY
298
+ vb . cpus = CONTROL_PLANE_CPUS
308
299
end
309
300
config . vm . provider :libvirt do |lv |
310
- lv . memory = MASTER_MEMORY
311
- lv . cpus = MASTER_CPUS
301
+ lv . memory = CONTROL_PLANE_MEMORY
302
+ lv . cpus = CONTROL_PLANE_CPUS
312
303
end
313
304
if BIND_PROXY && i == 1
314
305
# Bind kubectl proxy port
315
- master . vm . network :forwarded_port , guest : 8001 , host : 8001
306
+ control_plane . vm . network :forwarded_port , guest : 8001 , host : 8001
316
307
end
317
308
# Update OS if UPDATE_OS=true
318
- update_os ( master . vm )
319
- # Provisioning: Master Node
320
- args = [ "--master" , "--nginx-image" , NGINX_IMAGE ]
309
+ update_os ( control_plane . vm )
310
+ # Provisioning: Control plane Node
311
+ args = [ "--control-plane" ]
321
312
if !STANDALONE_OPERATOR && i == 1
322
313
args . push ( "--operator" )
323
314
args . push ( "--subnet" , SUBNET )
324
315
args . push ( "--workers" , workers . chop )
325
- args . push ( "--masters " , masters . chop )
316
+ args . push ( "--control-planes " , control_planes . chop )
326
317
end
327
- provision_vm ( master . vm , args )
318
+ provision_vm ( control_plane . vm , args )
328
319
end
329
320
end
330
321
@@ -351,8 +342,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
351
342
args = [ "--operator" ]
352
343
args . push ( "--subnet" , SUBNET )
353
344
args . push ( "--workers" , workers . chop )
354
- args . push ( "--masters" , masters . chop )
355
- args . push ( "--nginx-image" , NGINX_IMAGE )
345
+ args . push ( "--control-planes" , control_planes . chop )
356
346
provision_vm ( operator . vm , args )
357
347
end
358
348
end
0 commit comments