Skip to content

Commit b996866

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 b996866

File tree

4 files changed

+47
-3
lines changed

4 files changed

+47
-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}

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: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ function custom_ntp(){
8585
if [ -n "$NTP_SERVERS" ]; then
8686
cp assets/templates/98_worker-chronyd-custom.yaml.optional assets/generated/98_worker-chronyd-custom.yaml
8787
cp assets/templates/98_master-chronyd-custom.yaml.optional assets/generated/98_master-chronyd-custom.yaml
88+
8889
NTPFILECONTENT=$(cat assets/files/etc/chrony.conf)
8990
for ntp in $(echo $NTP_SERVERS | tr ";" "\n"); do
9091
NTPFILECONTENT="${NTPFILECONTENT}"$'\n'"pool ${ntp} iburst"
@@ -224,9 +225,22 @@ function node_map_to_install_config_hosts() {
224225
start_idx="$2"
225226
role="$3"
226227

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

231245
driver=$(node_val ${idx} "driver")
232246
if [ $driver == "ipmi" ] ; then
@@ -247,7 +261,7 @@ function node_map_to_install_config_hosts() {
247261

248262
cat << EOF
249263
- name: ${name}
250-
role: ${role}
264+
role: ${node_role}
251265
bmc:
252266
address: ${address}
253267
username: ${username}
@@ -266,7 +280,7 @@ EOF
266280
# FIXME(stbenjam) Worker code in installer should accept
267281
# "default" as well -- currently the mapping doesn't work,
268282
# so we use the raw value for BMO's default which is "unknown"
269-
if [[ "$role" == "master" ]]; then
283+
if [[ "$node_role" == "master" ]] || [[ "$node_role" == "arbiter" ]] ; then
270284
if [ -z "${MASTER_HARDWARE_PROFILE:-}" ]; then
271285
cat <<EOF
272286
rootDeviceHints:

vm_setup_vars.yml

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

8+
# Helper var to alter the number of masters being deployed and create an arbiter flavor node
9+
arbiter_enabled: "{{ lookup('env', 'ENABLE_ARBITER') | default(false) }}"
10+
811
# We enable more memory and masters in dev-scripts compared to the minimal setup
912
# in metal3-dev-env
1013
num_masters: 3
1114
num_workers: 1
15+
num_arbiters: "{{ 1 if arbiter_enabled else 0 }}"
1216
num_extraworkers: 0
1317
extradisks_list: "{{ lookup('env', 'VM_EXTRADISKS_LIST').split(' ') | default(['vdb']) }}"
1418
extradisks_size: "{{ lookup('env', 'VM_EXTRADISKS_SIZE') | default(['8G']) }}"
@@ -19,6 +23,12 @@ flavors:
1923
vcpu: "{{ lookup('env', 'MASTER_VCPU') }}"
2024
extradisks: "{{ lookup('env', 'VM_EXTRADISKS') | default(false) }}"
2125

26+
arbiter:
27+
memory: "{{ lookup('env', 'ARBITER_MEMORY') }}"
28+
disk: "{{ lookup('env', 'ARBITER_DISK') }}"
29+
vcpu: "{{ lookup('env', 'ARBITER_VCPU') }}"
30+
extradisks: "{{ lookup('env', 'VM_EXTRADISKS') | default(false) }}"
31+
2232
worker:
2333
memory: "{{ lookup('env', 'WORKER_MEMORY') }}"
2434
disk: "{{ lookup('env', 'WORKER_DISK') }}"

0 commit comments

Comments
 (0)