Skip to content

Commit f5d754b

Browse files
committed
feat: initial arbiter node addition
added support for creating install for clusters with arbiter nodes added arbiter flavor to allow using smaller compute sizes for testing
1 parent 4155b90 commit f5d754b

File tree

5 files changed

+55
-3
lines changed

5 files changed

+55
-3
lines changed

common.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ export CONTAINER_RUNTIME="podman"
271271

272272
export NUM_MASTERS=${NUM_MASTERS:-"3"}
273273
export NUM_WORKERS=${NUM_WORKERS:-"2"}
274+
export ENABLE_ARBITER=${ENABLE_ARBITER:-}
274275
export NUM_EXTRA_WORKERS=${NUM_EXTRA_WORKERS:-"0"}
275276
export EXTRA_WORKERS_ONLINE_STATUS=${EXTRA_WORKERS_ONLINE_STATUS:-"true"}
276277
export EXTRA_WORKERS_NAMESPACE=${EXTRA_WORKERS_NAMESPACE:-"openshift-machine-api"}
@@ -285,6 +286,10 @@ export MASTER_MEMORY=${MASTER_MEMORY:-16384}
285286
export MASTER_DISK=${MASTER_DISK:-50}
286287
export MASTER_VCPU=${MASTER_VCPU:-8}
287288

289+
export ARBITER_MEMORY=${ARBITER_MEMORY:-8384}
290+
export ARBITER_DISK=${ARBITER_DISK:-50}
291+
export ARBITER_VCPU=${ARBITER_VCPU:-4}
292+
288293
export WORKER_MEMORY=${WORKER_MEMORY:-8192}
289294
export WORKER_DISK=${WORKER_DISK:-50}
290295
export WORKER_VCPU=${WORKER_VCPU:-4}

config_example.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,16 @@ set -x
452452
#
453453
#export NODES_PLATFORM=baremetal
454454

455+
# ENABLE_ARBITER -
456+
# Set to true to enable the creation of an arbiter node. Arbiter nodes take the place
457+
# of a master node but run only critical containers to maintain HA for the cluster, it is a
458+
# TechPreview feature so `export FEATURE_SET="TechPreviewNoUpgrade"` must be set.
459+
#
460+
# Furthermore, since an Arbiter node takes the place of a master node the NUM_MASTERS count
461+
# must be set to `export NUM_MASTERS=2` and not the default `3` to avoid even number etcd members.
462+
#
463+
#export ENABLE_ARBITER=true
464+
455465
# MASTER_HOSTNAME_FORMAT -
456466
# Set a custom hostname format for masters. This is a format string that should
457467
# include one %d field, which will be replaced with the number of the node.

ocp_install_env.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,20 @@ EOF
181181
fi
182182
}
183183

184+
function arbiterStanza() {
185+
if [[ ! -z "${ENABLE_ARBITER:-}" ]]; then
186+
cat <<EOF
187+
arbiter:
188+
name: arbiter
189+
replicas: 1
190+
hyperthreading: Enabled
191+
architecture: $(get_arch install_config)
192+
platform:
193+
baremetal: {}
194+
EOF
195+
fi
196+
}
197+
184198
function libvirturi() {
185199
if [[ "$REMOTE_LIBVIRT" -ne 0 ]]; then
186200
cat <<EOF
@@ -314,6 +328,7 @@ controlPlane:
314328
architecture: $(get_arch install_config)
315329
platform:
316330
baremetal: {}
331+
$(arbiterStanza)
317332
$(featureSet)
318333
platform:
319334
baremetal:

utils.sh

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,22 @@ function node_map_to_install_config_hosts() {
224224
start_idx="$2"
225225
role="$3"
226226

227-
for ((idx=$start_idx;idx<$(($1 + $start_idx));idx++)); do
227+
# If arbiter is enabled, an arbiter node will be created so we increase the number of hosts by 1
228+
# when the role is for master to capture the arbiter position.
229+
# If the role is for a worker, we increment the index since the worker position has moved by 1.
230+
if [[ ! -z "${ENABLE_ARBITER:-}" && "$role" == "master" ]]; then
231+
num_hosts=$((num_hosts + 1))
232+
elif [[ ! -z "${ENABLE_ARBITER:-}" && "$role" == "worker" ]]; then
233+
start_idx=$((start_idx + 1))
234+
fi
235+
236+
for ((idx=$start_idx;idx<$(($num_hosts + $start_idx));idx++)); do
228237
name=$(node_val ${idx} "name")
229238
mac=$(node_val ${idx} "ports[0].address")
239+
local node_role=$role
240+
if [[ ! -z "${ENABLE_ARBITER:-}" && $name =~ "arbiter" && "$role" == "master" ]]; then
241+
node_role=arbiter
242+
fi
230243

231244
driver=$(node_val ${idx} "driver")
232245
if [ $driver == "ipmi" ] ; then
@@ -247,7 +260,7 @@ function node_map_to_install_config_hosts() {
247260

248261
cat << EOF
249262
- name: ${name}
250-
role: ${role}
263+
role: ${node_role}
251264
bmc:
252265
address: ${address}
253266
username: ${username}
@@ -266,7 +279,7 @@ EOF
266279
# FIXME(stbenjam) Worker code in installer should accept
267280
# "default" as well -- currently the mapping doesn't work,
268281
# so we use the raw value for BMO's default which is "unknown"
269-
if [[ "$role" == "master" ]]; then
282+
if [[ "$node_role" == "master" ]] || [[ "$node_role" == "arbiter" ]] ; then
270283
if [ -z "${MASTER_HARDWARE_PROFILE:-}" ]; then
271284
cat <<EOF
272285
rootDeviceHints:

vm_setup_vars.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@
55
# openshift-installer terraform templates
66
ironic_prefix: "{{ ironic_prefix }}"
77

8+
arbiter_enabled: "{{ lookup('env', 'ENABLE_ARBITER') | default(false) }}"
9+
810
# We enable more memory and masters in dev-scripts compared to the minimal setup
911
# in metal3-dev-env
1012
num_masters: 3
1113
num_workers: 1
14+
num_arbiters: "{{ 1 if arbiter_enabled else 0 }}"
1215
num_extraworkers: 0
1316
extradisks_list: "{{ lookup('env', 'VM_EXTRADISKS_LIST').split(' ') | default(['vdb']) }}"
1417
extradisks_size: "{{ lookup('env', 'VM_EXTRADISKS_SIZE') | default(['8G']) }}"
@@ -19,6 +22,12 @@ flavors:
1922
vcpu: "{{ lookup('env', 'MASTER_VCPU') }}"
2023
extradisks: "{{ lookup('env', 'VM_EXTRADISKS') | default(false) }}"
2124

25+
arbiter:
26+
memory: "{{ lookup('env', 'ARBITER_MEMORY') }}"
27+
disk: "{{ lookup('env', 'ARBITER_DISK') }}"
28+
vcpu: "{{ lookup('env', 'ARBITER_VCPU') }}"
29+
extradisks: "{{ lookup('env', 'VM_EXTRADISKS') | default(false) }}"
30+
2231
worker:
2332
memory: "{{ lookup('env', 'WORKER_MEMORY') }}"
2433
disk: "{{ lookup('env', 'WORKER_DISK') }}"

0 commit comments

Comments
 (0)