Skip to content

Commit 5c33bf9

Browse files
authored
OCPEDGE-1932: feat: support abi with arbiter node (#1773)
* feat: support abi with arbiter node Signed-off-by: ehila <ehila@redhat.com> * feat: update to use num arbiters removed ENABLE_ARBITER and added NUM_ARBITERS for creating arbiter nodes Signed-off-by: ehila <ehila@redhat.com> --------- Signed-off-by: ehila <ehila@redhat.com>
1 parent 37238e7 commit 5c33bf9

File tree

11 files changed

+107
-35
lines changed

11 files changed

+107
-35
lines changed

agent/05_agent_configure.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,17 @@ function configure_node() {
5959
local cluster_name="${CLUSTER_NAME}_${node_type}_${node_num}"
6060
local hostname="$(printf "${MASTER_HOSTNAME_FORMAT}" "${node_num}")"
6161
local ip=$((base_ip + node_num))
62+
if [[ "$node_type" == "arbiter" ]]; then
63+
local hostname="$(printf "${ARBITER_HOSTNAME_FORMAT}" "${node_num}")"
64+
local ip=$((base_ip + ${NUM_MASTERS} + node_num))
65+
fi
6266
if [[ "$node_type" == "worker" ]]; then
6367
local hostname="$(printf "${WORKER_HOSTNAME_FORMAT}" "${node_num}")"
64-
local ip=$((base_ip + ${NUM_MASTERS} + node_num))
68+
local ip=$((base_ip + ${NUM_MASTERS} + ${NUM_ARBITERS} + node_num))
6569
fi
6670
if [[ "$node_type" == "extraworker" ]]; then
6771
local hostname="$(printf "${EXTRA_WORKER_HOSTNAME_FORMAT}" "${node_num}")"
68-
local ip=$((base_ip + ${NUM_MASTERS} + ${NUM_WORKERS} + node_num))
72+
local ip=$((base_ip + ${NUM_MASTERS} + ${NUM_ARBITERS} + ${NUM_WORKERS} + node_num))
6973
fi
7074

7175
if [[ "$node_type" != "extraworker" ]]; then
@@ -137,6 +141,11 @@ function get_static_ips_and_macs() {
137141
configure_node "master" "$i"
138142
done
139143

144+
for (( i=0; i<${NUM_ARBITERS}; i++ ))
145+
do
146+
configure_node "arbiter" "$i"
147+
done
148+
140149
for (( i=0; i<${NUM_WORKERS}; i++ ))
141150
do
142151
configure_node "worker" "$i"

agent/06_agent_create_cluster.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,7 @@ case "${AGENT_E2E_TEST_BOOT_MODE}" in
564564

565565
attach_agent_iso master $NUM_MASTERS
566566
attach_agent_iso worker $NUM_WORKERS
567+
attach_agent_iso arbiter $NUM_ARBITERS
567568

568569
;;
569570

@@ -573,6 +574,7 @@ case "${AGENT_E2E_TEST_BOOT_MODE}" in
573574

574575
agent_pxe_boot master $NUM_MASTERS
575576
agent_pxe_boot worker $NUM_WORKERS
577+
agent_pxe_boot arbiter $NUM_ARBITERS
576578
;;
577579

578580
"ISCSI" )
@@ -583,10 +585,12 @@ case "${AGENT_E2E_TEST_BOOT_MODE}" in
583585

584586
agent_iscsi_targets master $NUM_MASTERS
585587
agent_iscsi_targets worker $NUM_WORKERS
588+
agent_iscsi_targets arbiter $NUM_ARBITERS
586589

587590
# Update the nodes and restart
588591
agent_iscsi_update_nodes master $NUM_MASTERS
589592
agent_iscsi_update_nodes worker $NUM_WORKERS
593+
agent_iscsi_update_nodes arbiter $NUM_ARBITERS
590594
;;
591595

592596
"DISKIMAGE" )
@@ -601,6 +605,7 @@ case "${AGENT_E2E_TEST_BOOT_MODE}" in
601605
# Attach the diskimage to nodes
602606
attach_appliance_diskimage master $NUM_MASTERS
603607
attach_appliance_diskimage worker $NUM_WORKERS
608+
attach_appliance_diskimage arbiter $NUM_ARBITERS
604609

605610
# Delete the unused appliance.raw file and cache/temp directories
606611
# (to avoid storage overconsumption on the CI machine)
@@ -624,11 +629,13 @@ case "${AGENT_E2E_TEST_BOOT_MODE}" in
624629

625630
attach_agent_iso_no_registry master $NUM_MASTERS
626631
attach_agent_iso_no_registry worker $NUM_WORKERS
632+
attach_agent_iso_no_registry arbiter $NUM_ARBITERS
627633

628634
echo "Waiting for 2 mins to arrive at agent-tui screen"
629635
sleep 120
630636
automate_rendezvousIP_selection master $NUM_MASTERS
631637
automate_rendezvousIP_selection worker $NUM_WORKERS
638+
automate_rendezvousIP_selection arbiter $NUM_ARBITERS
632639

633640
check_assisted_install_UI
634641

agent/roles/manifests/templates/install-config_baremetal_yaml.j2

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ compute:
66
name: worker
77
replicas: {{ num_workers }}
88
architecture: {{ goCPUArchitecture }}
9+
{% if num_arbiters != "0" %}
10+
arbiter:
11+
architecture: {{ goCPUArchitecture }}
12+
hyperthreading: Enabled
13+
name: arbiter
14+
replicas: {{ num_arbiters }}
15+
{% endif %}
16+
{% if feature_set %}
17+
featureSet: {{ feature_set }}
18+
{% endif %}
919
controlPlane:
1020
architecture: {{ goCPUArchitecture }}
1121
hyperthreading: Enabled

agent/roles/manifests/templates/install-config_vsphere_yaml.j2

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ compute:
55
name: worker
66
replicas: {{ num_workers }}
77
architecture: {{ goCPUArchitecture }}
8+
{% if num_arbiters != "0" %}
9+
arbiter:
10+
architecture: {{ goCPUArchitecture }}
11+
hyperthreading: Enabled
12+
name: arbiter
13+
replicas: {{ num_arbiters }}
14+
{% endif %}
15+
{% if feature_set %}
16+
featureSet: {{ feature_set }}
17+
{% endif %}
818
controlPlane:
919
architecture: {{ goCPUArchitecture }}
1020
hyperthreading: Enabled

agent/roles/manifests/templates/install-config_yaml.j2

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ compute:
55
name: worker
66
replicas: {{ num_workers }}
77
architecture: {{ goCPUArchitecture }}
8+
{% if num_arbiters != "0" %}
9+
arbiter:
10+
architecture: {{ goCPUArchitecture }}
11+
hyperthreading: Enabled
12+
name: arbiter
13+
replicas: {{ num_arbiters }}
14+
{% endif %}
15+
{% if feature_set %}
16+
featureSet: {{ feature_set }}
17+
{% endif %}
818
controlPlane:
919
architecture: {{ goCPUArchitecture }}
1020
hyperthreading: Enabled

agent/roles/manifests/vars/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ networking_mode: "{{ lookup('env', 'NETWORKING_MODE') }}"
5151
network_type: "{{ lookup('env', 'NETWORK_TYPE') }}"
5252
num_masters: "{{ lookup('env', 'NUM_MASTERS') }}"
5353
num_workers: "{{ lookup('env', 'NUM_WORKERS') }}"
54+
num_arbiters: "{{ lookup('env', 'NUM_ARBITERS') }}"
55+
feature_set: "{{ lookup('env', 'FEATURE_SET') }}"
5456
num_extra_workers: "{{ lookup('env', 'NUM_EXTRA_WORKERS', default='0') }}"
5557
no_proxy: "{{ lookup('env', 'AGENT_NO_PROXY') }}"
5658
platform_type: "{{ lookup('env', 'AGENT_PLATFORM_TYPE') }}"

common.sh

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,14 +274,15 @@ export CONTAINER_RUNTIME="podman"
274274

275275
export NUM_MASTERS=${NUM_MASTERS:-"3"}
276276
export NUM_WORKERS=${NUM_WORKERS:-"2"}
277-
export ENABLE_ARBITER=${ENABLE_ARBITER:-}
277+
export NUM_ARBITERS=${NUM_ARBITERS:-"0"}
278278
export NUM_EXTRA_WORKERS=${NUM_EXTRA_WORKERS:-"0"}
279279
export EXTRA_WORKERS_ONLINE_STATUS=${EXTRA_WORKERS_ONLINE_STATUS:-"true"}
280280
export EXTRA_WORKERS_NAMESPACE=${EXTRA_WORKERS_NAMESPACE:-"openshift-machine-api"}
281281
export VM_EXTRADISKS=${VM_EXTRADISKS:-"false"}
282282
export VM_EXTRADISKS_LIST=${VM_EXTRADISKS_LIST:-"vdb"}
283283
export VM_EXTRADISKS_SIZE=${VM_EXTRADISKS_SIZE:-"8G"}
284284
export MASTER_HOSTNAME_FORMAT=${MASTER_HOSTNAME_FORMAT:-"master-%d"}
285+
export ARBITER_HOSTNAME_FORMAT=${ARBITER_HOSTNAME_FORMAT:-"arbiter-%d"}
285286
export WORKER_HOSTNAME_FORMAT=${WORKER_HOSTNAME_FORMAT:-"worker-%d"}
286287
export EXTRA_WORKER_HOSTNAME_FORMAT=${EXTRA_WORKER_HOSTNAME_FORMAT:-"extraworker-%d"}
287288

@@ -310,7 +311,7 @@ export IRONIC_IMAGES_DIR="${IRONIC_DATA_DIR}/html/images"
310311
export VBMC_IMAGE=${VBMC_IMAGE:-"quay.io/metal3-io/vbmc"}
311312
export SUSHY_TOOLS_IMAGE=${SUSHY_TOOLS_IMAGE:-"quay.io/metal3-io/sushy-tools"}
312313
export VBMC_BASE_PORT=${VBMC_BASE_PORT:-"6230"}
313-
export VBMC_MAX_PORT=$((VBMC_BASE_PORT + NUM_MASTERS + NUM_WORKERS + NUM_EXTRA_WORKERS - 1))
314+
export VBMC_MAX_PORT=$((VBMC_BASE_PORT + NUM_MASTERS + NUM_ARBITERS + NUM_WORKERS + NUM_EXTRA_WORKERS - 1))
314315
export REDFISH_EMULATOR_IGNORE_BOOT_DEVICE="${REDFISH_EMULATOR_IGNORE_BOOT_DEVICE:-False}"
315316

316317
# Which docker registry image should we use?
@@ -358,6 +359,16 @@ if [ ! -d "$IRONIC_IMAGES_DIR" ]; then
358359
sudo mkdir -p "$IRONIC_IMAGES_DIR"
359360
fi
360361

362+
if [[ ${NUM_ARBITERS} -gt 1 ]]; then
363+
error "Creating a cluster with more than 1 arbiter is currently not supported"
364+
exit 1
365+
fi
366+
367+
if [[ ${NUM_ARBITERS} -eq 1 ]] && [[ ${NUM_MASTERS} -ne 2 ]]; then
368+
error "Creating a cluster with 1 arbiter and ${NUM_MASTERS} masters is not supported, please use 2 masters"
369+
exit 1
370+
fi
371+
361372
# Previously the directory was owned by root, we need to alter
362373
# permissions to be owned by the user running dev-scripts.
363374
if [ ! -f "$IRONIC_IMAGES_DIR/.permissions" ]; then
@@ -395,7 +406,7 @@ export AGENT_WAIT_FOR_INSTALL_COMPLETE=${AGENT_WAIT_FOR_INSTALL_COMPLETE:-true}
395406
# Agent specific configuration
396407

397408
function invalidAgentValue() {
398-
printf "Found invalid value \"$AGENT_E2E_TEST_SCENARIO\" for AGENT_E2E_TEST_SCENARIO. Supported values: 'COMPACT_IPXX', 'HA_IPXX', 'SNO_IPXX', '4CONTROL_IPXX', or '5CONTROL_IPXX', where XX is 'V4', 'V6', or 'V4V6'"
409+
printf "Found invalid value \"$AGENT_E2E_TEST_SCENARIO\" for AGENT_E2E_TEST_SCENARIO. Supported values: 'COMPACT_IPXX', 'HA_IPXX', 'SNO_IPXX', 'TNA_IPXX', '4CONTROL_IPXX', or '5CONTROL_IPXX', where XX is 'V4', 'V6', or 'V4V6'"
399410
exit 1
400411
}
401412

@@ -457,6 +468,17 @@ if [[ ! -z ${AGENT_E2E_TEST_SCENARIO} ]]; then
457468
export MASTER_MEMORY=32768
458469
export NUM_WORKERS=0
459470
;;
471+
"TNA" )
472+
export NUM_MASTERS=2
473+
export MASTER_VCPU=4
474+
export MASTER_DISK=100
475+
export MASTER_MEMORY=32768
476+
export NUM_ARBITERS=1
477+
export ARBITER_VCPU=2
478+
export ARBITER_MEMORY=16384
479+
export ARBITER_DISK=100
480+
export NUM_WORKERS=0
481+
;;
460482
"HA" )
461483
export NUM_MASTERS=3
462484
export MASTER_VCPU=4

config_example.sh

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -465,16 +465,6 @@ set -x
465465
#
466466
#export NODES_PLATFORM=baremetal
467467

468-
# ENABLE_ARBITER -
469-
# Set to any non zero length string value to enable the creation of an arbiter node.
470-
# Arbiter nodes take the place of a master node but run only critical containers to maintain HA for the cluster,
471-
# it is a TechPreview feature so `export FEATURE_SET="TechPreviewNoUpgrade"` must be set.
472-
#
473-
# Furthermore, since an Arbiter node takes the place of a master node the NUM_MASTERS count
474-
# must be set to `export NUM_MASTERS=2` and not the default `3` to avoid even number etcd members.
475-
#
476-
#export ENABLE_ARBITER=1
477-
478468
# ENABLE_WORKLOAD_PARTITIONING -
479469
# Set to any non zero length string value to enable workload partitioning in the install config.
480470
#
@@ -531,6 +521,26 @@ set -x
531521
#export MASTER_DISK=40
532522
#export MASTER_VCPU=8
533523

524+
# ARBITER_HOSTNAME_FORMAT -
525+
# Set a custom hostname format for arbiters. This is a format string that should
526+
# include one %d field, which will be replaced with the number of the node.
527+
# Default: "arbiter-%d"
528+
#
529+
#export ARBITER_HOSTNAME_FORMAT=arbiter-%d
530+
531+
# NUM_ARBITERS -
532+
# Indicate number of arbiter nodes to deploy.
533+
# Arbiter nodes take the place of a master node but run only critical containers to maintain HA for the cluster,
534+
# it is a TechPreview for OCP 4.19, so `export FEATURE_SET="TechPreviewNoUpgrade"` must be set.
535+
# Default: 0
536+
#
537+
# Furthermore, since an Arbiter node takes the place of a master node the NUM_MASTERS count
538+
# must be set to `export NUM_MASTERS=2` and not the default `3` to avoid even number etcd members.
539+
#
540+
# This script will currently only support 1 arbiter node and 2 masters.
541+
#
542+
#export NUM_ARBITERS=0
543+
534544
# ARBITER_MEMORY, ARBITER_DISK, ARBITER_VCPU -
535545
# Change VM resources for arbiters
536546
## Defaults:
@@ -794,6 +804,10 @@ set -x
794804
# - COMPACT_IPV6
795805
# - COMPACT_IPV4_DHCP
796806
# - COMPACT_IPV6_DHCP
807+
# - TNA_IPV4
808+
# - TNA_IPV6
809+
# - TNA_IPV4_DHCP
810+
# - TNA_IPV6_DHCP
797811
# - HA_IPV4
798812
# - HA_IPV6
799813
# - HA_IPV4_DHCP

ocp_install_env.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,11 @@ EOF
207207
}
208208

209209
function arbiter_stanza() {
210-
if [[ -n "${ENABLE_ARBITER:-}" ]]; then
210+
if [[ ${NUM_ARBITERS} -gt 0 ]]; then
211211
cat <<EOF
212212
arbiter:
213213
name: arbiter
214-
replicas: 1
214+
replicas: ${NUM_ARBITERS}
215215
hyperthreading: Enabled
216216
architecture: $(get_arch install_config)
217217
platform:
@@ -384,9 +384,11 @@ EOF
384384
cat >> "${outdir}/install-config.yaml" << EOF
385385
$(node_map_to_install_config_hosts $NUM_MASTERS 0 master)
386386
$(node_map_to_install_config_hosts $NUM_WORKERS $NUM_MASTERS worker)
387+
$(node_map_to_install_config_hosts $NUM_ARBITERS $(( NUM_MASTERS + NUM_WORKERS )) arbiter)
387388
EOF
388389
else
389390
cat >> "${outdir}/install-config.yaml" << EOF
391+
$(node_map_to_install_config_hosts $NUM_ARBITERS $(( NUM_MASTERS + NUM_WORKERS )) arbiter)
390392
$(node_map_to_install_config_hosts $NUM_WORKERS $NUM_MASTERS worker)
391393
$(node_map_to_install_config_hosts $NUM_MASTERS 0 master)
392394
EOF

utils.sh

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

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
227+
for ((idx=$start_idx;idx<$(($1 + $start_idx));idx++)); do
237228
name=$(node_val ${idx} "name")
238229
mac=$(node_val ${idx} "ports[0].address")
239230
local node_role=$role
240-
if [[ ! -z "${ENABLE_ARBITER:-}" && $idx -eq $(($num_hosts + $start_idx - 1)) && "$role" == "master" ]]; then
241-
node_role=arbiter
242-
fi
243231

244232
driver=$(node_val ${idx} "driver")
245233
if [ $driver == "ipmi" ] ; then
@@ -262,7 +250,7 @@ function node_map_to_install_config_hosts() {
262250

263251
cat << EOF
264252
- name: ${name}
265-
role: ${node_role}
253+
role: ${role}
266254
bootMACAddress: ${mac}
267255
bootMode: ${boot_mode}
268256
bmc:
@@ -324,7 +312,7 @@ function node_map_to_install_config_fencing_credentials() {
324312
return 0
325313
fi
326314

327-
if [[ -z "${ENABLE_ARBITER:-}" ]] && [[ "${NUM_MASTERS}" -eq 2 ]]; then
315+
if [[ ${NUM_ARBITERS} -eq 0 ]] && [[ "${NUM_MASTERS}" -eq 2 ]]; then
328316
cat <<EOF
329317
fencing:
330318
credentials:

0 commit comments

Comments
 (0)