Skip to content

Commit 78d2d97

Browse files
committed
Enable TLS validation for Redfish emulator
Starting with 4.21, we can pass the CA certificate to the installer. Signed-off-by: Dmitry Tantsur <[email protected]>
1 parent 41cd770 commit 78d2d97

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

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
@@ -260,13 +260,15 @@ function node_map_to_install_config_hosts() {
260260
EOF
261261

262262
if [[ "$driver_prefix" == "redfish" ]]; then
263-
# Set disableCertificateVerification
264-
# Heads up, "verify ca" in ironic driver config, and "disableCertificateVerification" in BMH have opposite meaning
265-
verify_ca=$(node_val ${idx} "driver_info.redfish_verify_ca")
266-
disable_certificate_verification=$([ "$verify_ca" = "False" ] && echo "true" || echo "false")
267-
cat << EOF
263+
# Set disableCertificateVerification on older versions
264+
if is_lower_version "$(openshift_version $OCP_DIR)" "4.21"; then
265+
# Heads up, "verify ca" in ironic driver config, and "disableCertificateVerification" in BMH have opposite meaning
266+
verify_ca=$(node_val ${idx} "driver_info.redfish_verify_ca")
267+
disable_certificate_verification=$([ "$verify_ca" = "False" ] && echo "true" || echo "false")
268+
cat << EOF
268269
disableCertificateVerification: ${disable_certificate_verification}
269270
EOF
271+
fi
270272
fi
271273

272274

0 commit comments

Comments
 (0)