Skip to content

Commit 09fe9ba

Browse files
authored
Enable TLS validation for Redfish emulator (#1812)
Starting with 4.21, we can pass the CA certificate to the installer. Signed-off-by: Dmitry Tantsur <[email protected]>
1 parent 3afa0cb commit 09fe9ba

File tree

3 files changed

+23
-8
lines changed

3 files changed

+23
-8
lines changed

01_install_requirements.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if [ -z "${METAL3_DEV_ENV}" ]; then
1919
# TODO -- come up with a plan for continuously updating this
2020
# Note we only do this in the case where METAL3_DEV_ENV is
2121
# unset, to enable developer testing of local checkouts
22-
git reset 01530d036cce1ff0b4675768777af7a6c6de7487 --hard
22+
git reset cb83ca7ae9cfabe827d7a784b28e537e098070ae --hard
2323

2424
popd
2525
fi

ocp_install_env.sh

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,8 @@ function generate_ocp_install_config() {
361361
NETWORK_TYPE=OVNKubernetes
362362
fi
363363

364+
OCP_VERSION=$(openshift_version $OCP_DIR)
365+
364366
cat > "${outdir}/install-config.yaml" << EOF
365367
apiVersion: v1
366368
baseDomain: ${BASE_DOMAIN}
@@ -409,6 +411,13 @@ EOF
409411
$(node_map_to_install_config_hosts $NUM_WORKERS $(( NUM_MASTERS + NUM_ARBITERS )) worker)
410412
$(node_map_to_install_config_hosts $NUM_ARBITERS $NUM_MASTERS arbiter)
411413
$(node_map_to_install_config_hosts $NUM_MASTERS 0 master)
414+
EOF
415+
fi
416+
417+
if ! is_lower_version "$(openshift_version $OCP_DIR)" "4.21"; then
418+
cat >> "${outdir}/install-config.yaml" << EOF
419+
bmcVerifyCA: |
420+
$(sudo sed 's/^/ /' "${WORKING_DIR}/virtualbmc/sushy-tools/cert.pem")
412421
EOF
413422
fi
414423

@@ -455,8 +464,12 @@ function generate_ocp_host_manifest() {
455464

456465
encoded_username=$(echo -n "$username" | base64)
457466
encoded_password=$(echo -n "$password" | base64)
458-
# Heads up, "verify_ca" in ironic driver config, and "disableCertificateVerification" in BMH have opposite meaning
459-
disableCertificateVerification=$([ "$verify_ca" = "False" ] && echo "true" || echo "false")
467+
if is_lower_version "$(openshift_version $OCP_DIR)" "4.21"; then
468+
# Heads up, "verify_ca" in ironic driver config, and "disableCertificateVerification" in BMH have opposite meaning
469+
disableCertificateVerification=$([ "$verify_ca" = "False" ] && echo "true" || echo "false")
470+
else
471+
disableCertificateVerification=false
472+
fi
460473

461474
secret="---
462475
apiVersion: v1

utils.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -268,13 +268,15 @@ function node_map_to_install_config_hosts() {
268268
EOF
269269

270270
if [[ "$driver_prefix" == "redfish" ]]; then
271-
# Set disableCertificateVerification
272-
# Heads up, "verify ca" in ironic driver config, and "disableCertificateVerification" in BMH have opposite meaning
273-
verify_ca=$(node_val ${idx} "driver_info.redfish_verify_ca")
274-
disable_certificate_verification=$([ "$verify_ca" = "False" ] && echo "true" || echo "false")
275-
cat << EOF
271+
# Set disableCertificateVerification on older versions
272+
if is_lower_version "$(openshift_version $OCP_DIR)" "4.21"; then
273+
# Heads up, "verify ca" in ironic driver config, and "disableCertificateVerification" in BMH have opposite meaning
274+
verify_ca=$(node_val ${idx} "driver_info.redfish_verify_ca")
275+
disable_certificate_verification=$([ "$verify_ca" = "False" ] && echo "true" || echo "false")
276+
cat << EOF
276277
disableCertificateVerification: ${disable_certificate_verification}
277278
EOF
279+
fi
278280
fi
279281

280282

0 commit comments

Comments
 (0)