Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ export CONTAINER_RUNTIME="podman"

export NUM_MASTERS=${NUM_MASTERS:-"3"}
export NUM_WORKERS=${NUM_WORKERS:-"2"}
export ENABLE_ARBITER=${ENABLE_ARBITER:-}
export NUM_EXTRA_WORKERS=${NUM_EXTRA_WORKERS:-"0"}
export EXTRA_WORKERS_ONLINE_STATUS=${EXTRA_WORKERS_ONLINE_STATUS:-"true"}
export EXTRA_WORKERS_NAMESPACE=${EXTRA_WORKERS_NAMESPACE:-"openshift-machine-api"}
Expand All @@ -285,6 +286,10 @@ export MASTER_MEMORY=${MASTER_MEMORY:-16384}
export MASTER_DISK=${MASTER_DISK:-50}
export MASTER_VCPU=${MASTER_VCPU:-8}

export ARBITER_MEMORY=${ARBITER_MEMORY:-8192}
export ARBITER_DISK=${ARBITER_DISK:-50}
export ARBITER_VCPU=${ARBITER_VCPU:-4}

export WORKER_MEMORY=${WORKER_MEMORY:-8192}
export WORKER_DISK=${WORKER_DISK:-50}
export WORKER_VCPU=${WORKER_VCPU:-4}
Expand Down
21 changes: 21 additions & 0 deletions config_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,16 @@ set -x
#
#export NODES_PLATFORM=baremetal

# ENABLE_ARBITER -
# Set to any non zero length string value to enable the creation of an arbiter node.
# Arbiter nodes take the place of a master node but run only critical containers to maintain HA for the cluster,
# it is a TechPreview feature so `export FEATURE_SET="TechPreviewNoUpgrade"` must be set.
#
# Furthermore, since an Arbiter node takes the place of a master node the NUM_MASTERS count
# must be set to `export NUM_MASTERS=2` and not the default `3` to avoid even number etcd members.
#
#export ENABLE_ARBITER=1

# MASTER_HOSTNAME_FORMAT -
# Set a custom hostname format for masters. This is a format string that should
# include one %d field, which will be replaced with the number of the node.
Expand All @@ -476,6 +486,17 @@ set -x
#export MASTER_DISK=40
#export MASTER_VCPU=8

# ARBITER_MEMORY, ARBITER_DISK, ARBITER_VCPU -
# Change VM resources for arbiters
## Defaults:
## ARBITER_DISK=50
## ARBITER_MEMORY=8192
## ARBITER_VCPU=4
#
#export ARBITER_MEMORY=8192
#export ARBITER_DISK=50
#export ARBITER_VCPU=2

# WORKER_HOSTNAME_FORMAT -
# Set a custom hostname format for workers. This is a format string that should
# include one %d field, which will be replaced with the number of the node.
Expand Down
15 changes: 15 additions & 0 deletions ocp_install_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,20 @@ EOF
fi
}

function arbiterStanza() {
if [[ ! -z "${ENABLE_ARBITER:-}" ]]; then
cat <<EOF
arbiter:
name: arbiter
replicas: 1
hyperthreading: Enabled
architecture: $(get_arch install_config)
platform:
baremetal: {}
EOF
fi
}

function libvirturi() {
if [[ "$REMOTE_LIBVIRT" -ne 0 ]]; then
cat <<EOF
Expand Down Expand Up @@ -314,6 +328,7 @@ controlPlane:
architecture: $(get_arch install_config)
platform:
baremetal: {}
$(arbiterStanza)
$(featureSet)
platform:
baremetal:
Expand Down
19 changes: 16 additions & 3 deletions utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,22 @@ function node_map_to_install_config_hosts() {
start_idx="$2"
role="$3"

for ((idx=$start_idx;idx<$(($1 + $start_idx));idx++)); do
# If arbiter is enabled, an arbiter node will be created so we increase the number of hosts by 1
# when the role is for master to capture the arbiter position.
# If the role is for a worker, we increment the index since the worker position has moved by 1.
if [[ ! -z "${ENABLE_ARBITER:-}" && "$role" == "master" ]]; then
num_hosts=$((num_hosts + 1))
elif [[ ! -z "${ENABLE_ARBITER:-}" && "$role" == "worker" ]]; then
start_idx=$((start_idx + 1))
fi

for ((idx=$start_idx;idx<$(($num_hosts + $start_idx));idx++)); do
name=$(node_val ${idx} "name")
mac=$(node_val ${idx} "ports[0].address")
local node_role=$role
if [[ ! -z "${ENABLE_ARBITER:-}" && $name =~ "arbiter" && "$role" == "master" ]]; then
node_role=arbiter
fi

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

cat << EOF
- name: ${name}
role: ${role}
role: ${node_role}
bmc:
address: ${address}
username: ${username}
Expand All @@ -266,7 +279,7 @@ EOF
# FIXME(stbenjam) Worker code in installer should accept
# "default" as well -- currently the mapping doesn't work,
# so we use the raw value for BMO's default which is "unknown"
if [[ "$role" == "master" ]]; then
if [[ "$node_role" == "master" ]] || [[ "$node_role" == "arbiter" ]] ; then
if [ -z "${MASTER_HARDWARE_PROFILE:-}" ]; then
cat <<EOF
rootDeviceHints:
Expand Down
9 changes: 9 additions & 0 deletions vm_setup_vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
# openshift-installer terraform templates
ironic_prefix: "{{ ironic_prefix }}"

arbiter_enabled: "{{ lookup('env', 'ENABLE_ARBITER') | default(false) }}"

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

arbiter:
memory: "{{ lookup('env', 'ARBITER_MEMORY') }}"
disk: "{{ lookup('env', 'ARBITER_DISK') }}"
vcpu: "{{ lookup('env', 'ARBITER_VCPU') }}"
extradisks: "{{ lookup('env', 'VM_EXTRADISKS') | default(false) }}"

worker:
memory: "{{ lookup('env', 'WORKER_MEMORY') }}"
disk: "{{ lookup('env', 'WORKER_DISK') }}"
Expand Down