Skip to content

OCPEDGE-2934: feat: add macAddress as alternative identifier for fencing credentials - #1916

Open
fracappa wants to merge 1 commit into
openshift-metal3:masterfrom
fracappa:fca/fencing-credentials-macaddress-support
Open

OCPEDGE-2934: feat: add macAddress as alternative identifier for fencing credentials#1916
fracappa wants to merge 1 commit into
openshift-metal3:masterfrom
fracappa:fca/fencing-credentials-macaddress-support

Conversation

@fracappa

Copy link
Copy Markdown
Contributor

Introduce FENCING_CREDENTIALS_IDENTIFIER env var to control whether fencing credentials identify nodes by hostname (default) or macAddress.

@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 19, 2026
@openshift-ci
openshift-ci Bot requested review from bfournie and celebdor June 19, 2026 09:19
@openshift-ci openshift-ci Bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jun 19, 2026
@openshift-ci

openshift-ci Bot commented Jun 19, 2026

Copy link
Copy Markdown

Hi @fracappa. Thanks for your PR.

I'm waiting for a openshift-metal3 member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Tip

We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@fracappa
fracappa force-pushed the fca/fencing-credentials-macaddress-support branch 2 times, most recently from a0ee3a7 to b1b2692 Compare July 16, 2026 14:07
@fracappa
fracappa force-pushed the fca/fencing-credentials-macaddress-support branch from 0c17b82 to b1b2692 Compare August 4, 2026 12:28
@fracappa
fracappa force-pushed the fca/fencing-credentials-macaddress-support branch 2 times, most recently from aaa2b9a to 8eb12dc Compare August 18, 2026 12:08
@fracappa fracappa changed the title WIP: feat: add macAddress as alternative identifier for fencing credentials OCPEDGE-2934: feat: add macAddress as alternative identifier for fencing credentials Aug 18, 2026
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 18, 2026
@elfosardo

Copy link
Copy Markdown
Member

/ok-to-test

@openshift-ci openshift-ci Bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 18, 2026
@fracappa

Copy link
Copy Markdown
Contributor Author

/retest-required

@fracappa

Copy link
Copy Markdown
Contributor Author

/retest

@MahnoorAsghar

Copy link
Copy Markdown
Contributor

Looks alright to me :)

@dtantsur

Copy link
Copy Markdown
Member

/approve

@openshift-ci

openshift-ci Bot commented Aug 21, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dtantsur

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 21, 2026

@lucaconsalvi lucaconsalvi left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR, Francesco! Clean approach to supporting macAddress-based fencing credentials — the identifier_key/identifier_value pattern in utils.sh is nicely done.

A few findings below — the first one (missing AGENT_MASTER_MACS in the baremetal code path) is a deployment blocker that affects all baremetal deployments, not just macAddress mode.

Minor: The PR description references FENCING_CREDENTIALS_IDENTIFIER (plural) but the code consistently uses FENCING_CREDENTIAL_IDENTIFIER (singular). Worth fixing for searchability.

fi
AGENT_NODES_MACS+=("$node_mac")
if [[ "$node_type" == "master" ]]; then
AGENT_MASTER_MACS+=("$node_mac")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: AGENT_MASTER_MACS is populated here in configure_node() (called by get_static_ips_and_macs()), but the alternative code path — get_baremetal_ips_and_macs() — never declares or populates this array.

Since generate_cluster_manifests() unconditionally serializes it ("${AGENT_MASTER_MACS[@]}"), and the script runs with set -euxo pipefail, this will crash with unbound variable on every NODES_PLATFORM=baremetal deployment — even with the default hostname mode.

Suggested fix — mirror the AGENT_MASTER_HOSTNAMES pattern in get_baremetal_ips_and_macs():

  • Add AGENT_MASTER_MACS=() to the initialization block
  • Add AGENT_MASTER_MACS+=("$mac") inside the if (( i < NUM_MASTERS )) block

Also worth adding AGENT_MASTER_MACS=() to the init block in get_static_ips_and_macs() to match the established pattern.

Comment thread common.sh
fi

# Controls whether fencing credentials use "hostname" or "macAddress" to identify nodes
export FENCING_CREDENTIAL_IDENTIFIER=${FENCING_CREDENTIAL_IDENTIFIER:-hostname}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Any value other than the exact string macAddress silently falls through to hostname mode in both code paths. A typo like macaddress or mac would be silently ignored.

The BMC_DRIVER validation just below establishes a precedent for early validation — worth adding a similar guard:

Comment thread utils.sh

if [[ "${FENCING_CREDENTIAL_IDENTIFIER}" == "macAddress" ]]; then
identifier_key="macAddress"
identifier_value=$(node_val ${idx} "ports[0].address")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: node_val uses jq -r, which returns the literal string "null" with exit code 0 when a JSON path doesn't exist. If the node JSON lacks ports[0].address, the generated YAML would contain - macAddress: null — which YAML parsers interpret as a null value.

Consider adding a guard:

Also — the original code had a helpful comment explaining why the FQDN append is needed for IPv6/DualStack. That "why" was lost in the refactor. Worth restoring above the if [[ $IP_STACK != 'v4' ]] check.

address: {{ master_bmc_addresses[i] }}
username: {{ master_bmc_usernames[i] }}
password: {{ master_bmc_passwords[i] }}
certificateVerification: {{ 'Disabled' if bmc_verify_cas[i] == "False" else 'Enabled' }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit (pre-existing): This uses bmc_verify_cas[i] (the all-nodes array from line 6) instead of master_bmc_verify_cas[i] (the master-specific array set on line 44). Invisible in 2-master/0-worker TNF but technically wrong. Since the PR touches this line, good opportunity to fix.

@fracappa
fracappa force-pushed the fca/fencing-credentials-macaddress-support branch from 40ff347 to 7353cda Compare August 21, 2026 13:47
Introduce FENCING_CREDENTIALS_IDENTIFIER env var to control whether
fencing credentials identify nodes by hostname (default) or macAddress.
@fracappa
fracappa force-pushed the fca/fencing-credentials-macaddress-support branch from 075bfb5 to 7613ce0 Compare August 21, 2026 13:54
@lucaconsalvi

Copy link
Copy Markdown

/lgtm

@openshift-ci

openshift-ci Bot commented Aug 21, 2026

Copy link
Copy Markdown

@lucaconsalvi: changing LGTM is restricted to collaborators

Details

In response to this:

/lgtm

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@openshift-ci

openshift-ci Bot commented Aug 21, 2026

Copy link
Copy Markdown

@fracappa: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-agent-compact-ipv4 7613ce0 link true /test e2e-agent-compact-ipv4
ci/prow/e2e-agent-5control-ipv4 7613ce0 link false /test e2e-agent-5control-ipv4
ci/prow/e2e-agent-compact-ipv4-iso-no-registry 7613ce0 link false /test e2e-agent-compact-ipv4-iso-no-registry
ci/prow/e2e-metal-ipi-virtualmedia 7613ce0 link false /test e2e-metal-ipi-virtualmedia
ci/prow/e2e-metal-ovn-arbiter 7613ce0 link false /test e2e-metal-ovn-arbiter
ci/prow/e2e-metal-ipi-serial-ipv4-1of2 7613ce0 link true /test e2e-metal-ipi-serial-ipv4-1of2

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. ok-to-test Indicates a non-member PR verified by an org member that is safe to test.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants