Skip to content

Commit ed70919

Browse files
authored
feat: add support for TNF agent based install (#1798)
added ENABLE_TWO_NODE_FENCING internal variable to help identify fencing for templating. added fencing block in jinja baremetal install config added BMC driver validation for two node fencing to make sure only redfish is used Signed-off-by: ehila <ehila@redhat.com>
1 parent e56d0a5 commit ed70919

File tree

5 files changed

+46
-6
lines changed

5 files changed

+46
-6
lines changed

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

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
{% import 'net_macros.yaml' as net %}
2+
{% set hostnames = agent_nodes_hostnames.split(',') %}
3+
{% set bmc_addresses = agent_nodes_bmc_addresses.split(',') %}
4+
{% set bmc_passwords = agent_nodes_bmc_passwords.split(',') %}
5+
{% set bmc_usernames = agent_nodes_bmc_usernames.split(',') %}
6+
{% set bmc_verify_cas = agent_nodes_bmc_verify_cas.split(',') %}
27
apiVersion: v1
38
baseDomain: {{ base_domain }}
49
compute:
@@ -21,6 +26,17 @@ controlPlane:
2126
hyperthreading: Enabled
2227
name: master
2328
replicas: {{ num_masters }}
29+
{% if enable_two_node_fencing %}
30+
fencing:
31+
credentials:
32+
{% for hostname in hostnames %}
33+
- hostname: {{hostname}}
34+
address: {{ bmc_addresses[loop.index0] }}
35+
username: {{ bmc_usernames[loop.index0] }}
36+
password: {{ bmc_passwords[loop.index0] }}
37+
certificateVerification: {{ 'Enabled' if bmc_verify_cas[loop.index0] else 'Disabled' }}
38+
{% endfor %}
39+
{% endif %}
2440
fips: {{ fips_mode }}
2541
metadata:
2642
name: {{ cluster_name }}
@@ -60,7 +76,6 @@ networking:
6076
networkType: {{ network_type }}
6177
platform:
6278
{% set macs = agent_nodes_macs.split(',') %}
63-
{% set hostnames = agent_nodes_hostnames.split(',') %}
6479
{% set ips = agent_nodes_ips.split(',') %}
6580
{% set ipsv6 = agent_nodes_ipsv6.split(',') %}
6681
baremetal:
@@ -75,10 +90,6 @@ platform:
7590
- {{ ingress_vip }}
7691
{% endfor %}
7792
{% if agent_install_config_bm_hosts == "true" %}
78-
{% set bmc_addresses = agent_nodes_bmc_addresses.split(',') %}
79-
{% set bmc_passwords = agent_nodes_bmc_passwords.split(',') %}
80-
{% set bmc_usernames = agent_nodes_bmc_usernames.split(',') %}
81-
{% set bmc_verify_cas = agent_nodes_bmc_verify_cas.split(',') %}
8293
provisioningHostIP: {{ cluster_provisioning_ip }}
8394
provisioningNetworkInterface: {{ cluster_provisioning_interface }}
8495
provisioningNetworkCIDR: {{ provisioning_network }}

agent/roles/manifests/vars/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ cluster_provisioning_interface: "{{ lookup('env', 'CLUSTER_PRO_IF') }}"
3030
cluster_subnet_v4: "{{ lookup('env', 'CLUSTER_SUBNET_V4') }}"
3131
cluster_subnet_v6: "{{ lookup('env', 'CLUSTER_SUBNET_V6') }}"
3232
enable_local_registry: "{{ lookup('env', 'ENABLE_LOCAL_REGISTRY') != '' }}"
33+
enable_two_node_fencing: "{{ lookup('env', 'ENABLE_TWO_NODE_FENCING', default='') == 'true' }}"
3334
external_subnet_v4: "{{ lookup('env', 'EXTERNAL_SUBNET_V4') }}"
3435
external_subnet_v6: "{{ lookup('env', 'EXTERNAL_SUBNET_V6') }}"
3536
external_subnet_v4_prefixlen: "{{ lookup('env', 'EXTERNAL_SUBNET_V4') | ansible.utils.ipaddr('prefix') }}"

common.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,22 @@ fi
397397

398398
export ENABLE_LOCAL_REGISTRY=${ENABLE_LOCAL_REGISTRY:-}
399399

400+
# Helper variable for TNF, normally not meant to be configurable by user.
401+
# When two node fencing is detected we set this variable because the installer
402+
# validation will fail if fencing credentials are not present when two masters
403+
# and no arbiter are set.
404+
# Skip on agent scenarios to avoid accidental overrides.
405+
export ENABLE_TWO_NODE_FENCING=${ENABLE_TWO_NODE_FENCING:-false}
406+
if [[ -z ${AGENT_E2E_TEST_SCENARIO:-} ]] && [[ ${NUM_ARBITERS} -eq 0 ]] && [[ ${NUM_MASTERS} -eq 2 ]]; then
407+
export ENABLE_TWO_NODE_FENCING="true"
408+
fi
409+
410+
# Only redfish BMC driver is supported for two node fencing
411+
if [[ "${BMC_DRIVER}" != "redfish" ]] && [[ "${ENABLE_TWO_NODE_FENCING:-}" == "true" ]]; then
412+
printf "Only redfish BMC driver is supported for Two Node Fencing deployments: BMC_DRIVER=${BMC_DRIVER}, ENABLE_TWO_NODE_FENCING=${ENABLE_TWO_NODE_FENCING}"
413+
exit 1
414+
fi
415+
400416
# Defaults the DISABLE_MULTICAST variable
401417
export DISABLE_MULTICAST=${DISABLE_MULTICAST:-false}
402418

@@ -479,6 +495,14 @@ if [[ ! -z ${AGENT_E2E_TEST_SCENARIO} ]]; then
479495
export ARBITER_DISK=50
480496
export NUM_WORKERS=0
481497
;;
498+
"TNF" )
499+
export NUM_MASTERS=2
500+
export MASTER_VCPU=8
501+
export MASTER_DISK=100
502+
export MASTER_MEMORY=32768
503+
export NUM_WORKERS=0
504+
export ENABLE_TWO_NODE_FENCING="true"
505+
;;
482506
"HA" )
483507
export NUM_MASTERS=3
484508
export MASTER_VCPU=4

config_example.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,10 @@ set -x
812812
# - TNA_IPV6
813813
# - TNA_IPV4_DHCP
814814
# - TNA_IPV6_DHCP
815+
# - TNF_IPV4
816+
# - TNF_IPV6
817+
# - TNF_IPV4_DHCP
818+
# - TNA_IPV6_DHCP
815819
# - HA_IPV4
816820
# - HA_IPV6
817821
# - HA_IPV4_DHCP

utils.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ function node_map_to_install_config_fencing_credentials() {
312312
return 0
313313
fi
314314

315-
if [[ ${NUM_ARBITERS} -eq 0 ]] && [[ "${NUM_MASTERS}" -eq 2 ]]; then
315+
if [ "${ENABLE_TWO_NODE_FENCING:-}" == "true" ]; then
316316
cat <<EOF
317317
fencing:
318318
credentials:

0 commit comments

Comments
 (0)