Skip to content

Commit f9d5f98

Browse files
committed
feat: add support for TNF agent based install
added ENABLE_TWO_NODE_FENCING internal variable to help identify fencing for templating. added fencing block in jinja baremetal install config Signed-off-by: ehila <[email protected]>
1 parent a699e12 commit f9d5f98

File tree

5 files changed

+36
-6
lines changed

5 files changed

+36
-6
lines changed

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

Lines changed: 15 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,16 @@ 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+
{% endfor %}
38+
{% endif %}
2439
fips: {{ fips_mode }}
2540
metadata:
2641
name: {{ cluster_name }}
@@ -60,7 +75,6 @@ networking:
6075
networkType: {{ network_type }}
6176
platform:
6277
{% set macs = agent_nodes_macs.split(',') %}
63-
{% set hostnames = agent_nodes_hostnames.split(',') %}
6478
{% set ips = agent_nodes_ips.split(',') %}
6579
{% set ipsv6 = agent_nodes_ipsv6.split(',') %}
6680
baremetal:
@@ -75,10 +89,6 @@ platform:
7589
- {{ ingress_vip }}
7690
{% endfor %}
7791
{% 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(',') %}
8292
provisioningHostIP: {{ cluster_provisioning_ip }}
8393
provisioningNetworkInterface: {{ cluster_provisioning_interface }}
8494
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: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,13 @@ fi
397397

398398
export ENABLE_LOCAL_REGISTRY=${ENABLE_LOCAL_REGISTRY:-}
399399

400+
# Helper variable, not meant to be configurable by user, will be set if two node fencing is detected
401+
# and used as reference for TNF configurations.
402+
export ENABLE_TWO_NODE_FENCING=${ENABLE_TWO_NODE_FENCING:-false}
403+
if [[ ${NUM_ARBITERS} -eq 0 ]] && [[ ${NUM_MASTERS} -eq 2 ]]; then
404+
export ENABLE_TWO_NODE_FENCING="true"
405+
fi
406+
400407
# Defaults the DISABLE_MULTICAST variable
401408
export DISABLE_MULTICAST=${DISABLE_MULTICAST:-false}
402409

@@ -479,6 +486,14 @@ if [[ ! -z ${AGENT_E2E_TEST_SCENARIO} ]]; then
479486
export ARBITER_DISK=50
480487
export NUM_WORKERS=0
481488
;;
489+
"TNF" )
490+
export NUM_MASTERS=2
491+
export MASTER_VCPU=8
492+
export MASTER_DISK=100
493+
export MASTER_MEMORY=32768
494+
export NUM_WORKERS=0
495+
export ENABLE_TWO_NODE_FENCING="true"
496+
;;
482497
"HA" )
483498
export NUM_MASTERS=3
484499
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)