Skip to content

OCPEDGE-2788: agent: split fencing credentials placement by identification key - #10684

Merged
openshift-merge-bot[bot] merged 3 commits into
openshift:mainfrom
fracappa:fca/split-fencing-credentials-by-key
Jul 30, 2026
Merged

OCPEDGE-2788: agent: split fencing credentials placement by identification key#10684
openshift-merge-bot[bot] merged 3 commits into
openshift:mainfrom
fracappa:fca/split-fencing-credentials-by-key

Conversation

@fracappa

@fracappa fracappa commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Hostname-keyed credentials stay at the top-level
/etc/assisted/hostconfig/fencing-credentials.yaml, while MAC-keyed credentials (no hostname) are placed in per-host directories matched by MAC address, e.g. host-0/fencing-credentials.yaml.

This allows assisted-service to discover MAC-keyed fencing credentials alongside other host-scoped config files.

Summary by CodeRabbit

  • Bug Fixes

    • Improved fencing-credentials generation to return errors on YAML marshaling failures instead of continuing silently.
    • Hostname-keyed fencing credentials are generated into the main fencing-credentials.yaml.
    • MAC-keyed fencing credentials are now grouped by the matching host directory (case-insensitive MAC matching) and written as per-host fencing-credentials.yaml, creating new host-<n> directories when needed.
    • Hostconfig generation now stops on fencing-credentials YAML generation errors.
  • Tests

    • Added unit tests covering hostname/MAC precedence, nil and mixed inputs, and per-host file output.
    • Clarified YAML-format expectations in the fencing credentials test.

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@openshift-ci-robot

openshift-ci-robot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

@fracappa: This pull request references OCPEDGE-2788 which is a valid jira issue.

Details

In response to this:

Hostname-keyed credentials stay at the top-level
/etc/assisted/hostconfig/fencing-credentials.yaml, while MAC-keyed credentials (no hostname) are placed in per-host directories matched by MAC address, e.g. host-0/fencing-credentials.yaml.

This allows assisted-service to discover MAC-keyed fencing credentials alongside other host-scoped config files.

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jul 14, 2026
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Changes

Fencing credential placement

Layer / File(s) Summary
MAC credential host mapping and per-host files
pkg/asset/agent/agentconfig/agenthosts.go, pkg/asset/agent/agentconfig/agenthosts_test.go
MAC-keyed credentials are collected from install configuration, matched to host directories case-insensitively, allocated to new directories when needed, and emitted as per-host YAML files.
Hostname credential generation
pkg/asset/agent/image/ignition.go, pkg/asset/agent/image/ignition_test.go, pkg/asset/agent/agentconfig/fencingcredentials_test.go
Ignition filters hostname-keyed credentials into the global fencing YAML file, propagates marshaling errors, and tests hostname precedence, MAC exclusion, mixed input, and empty input.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Suggested labels: jira/valid-reference

🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.09% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (14 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: splitting fencing credential placement by identification key.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed PASS: The added test titles are static string literals in table-driven cases; no fmt.Sprintf, generated IDs, dates, or other dynamic values appear.
Test Structure And Quality ✅ Passed Touched tests use plain testing.T/assert, not Ginkgo; no It/BeforeEach/Eventually or cluster resources/timeouts apply.
Microshift Test Compatibility ✅ Passed No new Ginkgo e2e tests were added; the touched files are standard Go unit tests and only exercise local asset generation.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The PR only adds Go unit tests (Test... with testing.T) and helper code; no new Ginkgo e2e tests or multi-node/SNO-sensitive cluster assumptions were added.
Topology-Aware Scheduling Compatibility ✅ Passed Diff only changes agent host fencing-credential placement/tests; no deployment manifests, controllers, or scheduling constraints were added.
Ote Binary Stdout Contract ✅ Passed No stdout writes or suite-level setup were added in the touched files; the new code only marshals/appends files, and tests lack TestMain/init/RunSpecs prints.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed No new Ginkgo e2e tests were added; the touched files are unit tests only, with no new IPv4-only or external connectivity assumptions.
No-Weak-Crypto ✅ Passed No weak crypto, custom crypto, or secret/token comparisons were added; the change only moves and tests YAML/file placement logic.
Container-Privileges ✅ Passed Touched files are Go source/tests only; no privileged/hostPID/hostNetwork/allowPrivilegeEscalation settings were found.
No-Sensitive-Data-In-Logs ✅ Passed No new logging was added in the touched code; the new fencing-credential helpers only filter/marshal/write files, not emit sensitive data.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@openshift-ci
openshift-ci Bot requested review from rwsu and zaneb July 14, 2026 07:28

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/asset/agent/image/ignition.go`:
- Around line 655-661: Update the credential classification loop in the fencing
credentials processing flow to explicitly handle entries where both HostName and
MACAddress are empty. Surface these malformed credentials through the existing
error or logging mechanism instead of silently dropping them, while preserving
the current hostname and MAC-address collection behavior.
- Around line 675-689: Update the MAC-credential handling in the surrounding
ignition configuration builder to group credentials by the hostDir returned from
findHostDirForMAC before creating Storage.Files entries. Marshal one
FencingCredentialsConfig containing all credentials for each host directory,
then emit exactly one fencing-credentials.yaml path per hostDir while preserving
the existing lookup and error handling.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 65afbc3e-f790-4bc4-9791-9af12b736083

📥 Commits

Reviewing files that changed from the base of the PR and between 0490a21 and 28ca34e.

📒 Files selected for processing (3)
  • pkg/asset/agent/agentconfig/fencingcredentials_test.go
  • pkg/asset/agent/image/ignition.go
  • pkg/asset/agent/image/ignition_test.go

Comment on lines +655 to +661
for _, cred := range fencingCredentials.Config.Credentials {
if cred.HostName != "" {
hostnameCredentials = append(hostnameCredentials, cred)
} else if cred.MACAddress != "" {
macCredentials = append(macCredentials, cred)
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Credentials with neither HostName nor MACAddress vanish silently.

If cred.HostName == "" and cred.MACAddress == "", the credential is dropped without error or log — no file is written and nothing signals the misconfiguration to the operator.

🛡️ Proposed fix to surface malformed entries
 	for _, cred := range fencingCredentials.Config.Credentials {
-		if cred.HostName != "" {
+		switch {
+		case cred.HostName != "":
 			hostnameCredentials = append(hostnameCredentials, cred)
-		} else if cred.MACAddress != "" {
+		case cred.MACAddress != "":
 			macCredentials = append(macCredentials, cred)
+		default:
+			return errors.New("fencing credential must specify either a hostname or a MAC address")
 		}
 	}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
for _, cred := range fencingCredentials.Config.Credentials {
if cred.HostName != "" {
hostnameCredentials = append(hostnameCredentials, cred)
} else if cred.MACAddress != "" {
macCredentials = append(macCredentials, cred)
}
}
for _, cred := range fencingCredentials.Config.Credentials {
switch {
case cred.HostName != "":
hostnameCredentials = append(hostnameCredentials, cred)
case cred.MACAddress != "":
macCredentials = append(macCredentials, cred)
default:
return errors.New("fencing credential must specify either a hostname or a MAC address")
}
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/asset/agent/image/ignition.go` around lines 655 - 661, Update the
credential classification loop in the fencing credentials processing flow to
explicitly handle entries where both HostName and MACAddress are empty. Surface
these malformed credentials through the existing error or logging mechanism
instead of silently dropping them, while preserving the current hostname and
MAC-address collection behavior.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@fracappa the comment seems to be relevant, do you maybe already have somewhere else a validation for that (I assume so)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@andfasano, yes. We already validate it at installation time, before even reaching asset generation.

We don't need to duplicate it in ignition.go, by the time addFencingCredentials runs, the install-config has already been validated.

Comment thread pkg/asset/agent/image/ignition.go Outdated

@fonta-rh fonta-rh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good work on the credential split — the per-host directory placement is working correctly (verified on a live ABI TNF deployment).

One maintainability issue to address before merge:

findHostDirForMAC duplicates the host directory naming convention from HostConfigFiles() (pkg/asset/agent/image/ignition.go:694)

Both functions independently compute the same logic — host.Hostname if set, else fmt.Sprintf("host-%d", i) (ignition.go:702-705 vs agenthosts.go:343-347). If the naming convention changes in one place, fencing credentials land in a different directory than mac_addresses/role files, silently breaking fencing.

Suggested fix: extract a shared helper like hostDirName(index int, host Host) string and call it from both locations.

Comment thread pkg/asset/agent/image/ignition.go Outdated
}

addFencingCredentials(&config, fencingCredentials)
if err = addFencingCredentials(&config, fencingCredentials, agentHostsAsset); err != nil {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just as a reminder, not specifically for this PR: currently this feature is not supported in the twin asset UnconfiguredIgnition{} - the one that is currently used for the OVE ISO, so probably we'll need to have it in the unconfigured ignition as well (cc @zaneb)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks a lot like configuration, so for the appliance it needs to be handled in the config-iso (not the unconfigured-ignition) and for the OVE ISO it needs to be configured through the Assisted GUI.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ok makes sense.

Comment on lines +655 to +661
for _, cred := range fencingCredentials.Config.Credentials {
if cred.HostName != "" {
hostnameCredentials = append(hostnameCredentials, cred)
} else if cred.MACAddress != "" {
macCredentials = append(macCredentials, cred)
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@fracappa the comment seems to be relevant, do you maybe already have somewhere else a validation for that (I assume so)

Comment thread pkg/asset/agent/image/ignition.go Outdated
// Hostname-keyed credentials go to /etc/assisted/hostconfig/fencing-credentials.yaml.
// MAC-keyed credentials (no hostname) go to /etc/assisted/hostconfig/<host-dir>/fencing-credentials.yaml,
// matched to a host by MAC address.
func addFencingCredentials(config *igntypes.Config, fencingCredentials *agentconfig.FencingCredentials, agentHosts *agentconfig.AgentHosts) error {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this part is mixing two different things.

  1. I would leave the old addFencingCredentials as it is, and simply rename it as addFencingCredentialsByHostname - leaving unchanged the previous responsibility to create the single top-level /etc/assisted/hostconfig/fencing-credentials.yaml. That part worked fine.

  2. In the ignition asset, the addHostConfig() method is currently the location taking care of generating specific configuration files per hosts. Currently it simply inherits and processes all the config files from agentHosts.HostConfigFiles(). The AgentHosts was defined as an intermediate asset to abstract the current list of hosts processed (it could be either from agent-config.yaml or nodes-config.yaml).
    I think it could be worth adding a FencingCredentialsHosts field to the AgentHosts struct and manage it in the HostConfigFiles method, separately after the main loop, ie:

...
for i, host := range a.Hosts {
...
}

for i, host := range a.FencingCredentialsHosts {
...
}

Clearly the Generate method should take care of populating the FencingCredentialsHosts when it makes sense. I would not touch/extend the Hosts since that field was meant to handle configs from agent-config.yaml

With this approach, I think that the FC config per host will become totally transparent for the Ignition asset, and more smoothly integrated with the current design: it will become part of the AgentHost, with the notable exception that instead of being populated by from agent-config.yaml in such case the source will be the install-config.yaml FC field.

@fracappa
fracappa force-pushed the fca/split-fencing-credentials-by-key branch from 24585b4 to 4c37224 Compare July 23, 2026 09:48

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (1)
pkg/asset/agent/agentconfig/agenthosts.go (1)

356-360: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Duplicate host-directory-naming logic.

The "hostname, else host-%d" fallback is computed twice — once in the main HostConfigFiles loop and again in findHostDirForMAC. Consider extracting a small helper (e.g. hostDirName(i int, host agent.Host) string) to avoid future divergence between the two.

Also applies to: 428-441

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/asset/agent/agentconfig/agenthosts.go` around lines 356 - 360, The host
directory naming rule is duplicated between HostConfigFiles and
findHostDirForMAC. Extract a shared helper such as hostDirName that returns
host.Hostname when set or the host-%d fallback otherwise, then use it in both
loops to keep naming behavior consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@pkg/asset/agent/agentconfig/agenthosts.go`:
- Around line 356-360: The host directory naming rule is duplicated between
HostConfigFiles and findHostDirForMAC. Extract a shared helper such as
hostDirName that returns host.Hostname when set or the host-%d fallback
otherwise, then use it in both loops to keep naming behavior consistent.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 0b69ede8-e195-42bc-b349-6c256187b24d

📥 Commits

Reviewing files that changed from the base of the PR and between 28ca34e and 24585b4.

📒 Files selected for processing (4)
  • pkg/asset/agent/agentconfig/agenthosts.go
  • pkg/asset/agent/agentconfig/agenthosts_test.go
  • pkg/asset/agent/image/ignition.go
  • pkg/asset/agent/image/ignition_test.go

@fracappa
fracappa force-pushed the fca/split-fencing-credentials-by-key branch from 7fc0397 to 6599dfa Compare July 23, 2026 11:30

// FencingCredentialHost holds MAC-keyed fencing credentials matched to a host directory.
type FencingCredentialHost struct {
DirName string

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is not required, see below

Hosts []agent.Host
rendezvousIP string
Hosts []agent.Host
FencingCredentialsByHost []FencingCredentialHost

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
FencingCredentialsByHost []FencingCredentialHost
FencingCredentialsHosts []FencingCredentialHost

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As per the above comments, it looks like this field could be simply a FencingCredentialsHosts []*types.Credential

return files, nil
}

func (a *AgentHosts) populateFencingCredentialHosts(installConfig *agentAsset.OptionalInstallConfig) error {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: a comment remembering that this method takes care only to store per host FC data only in case the mac-address is configured won't hurt

// FencingCredentialHost holds MAC-keyed fencing credentials matched to a host directory.
type FencingCredentialHost struct {
DirName string
Credentials []*types.Credential

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

IIUC an host could get just a single credential, so a list here sounds unnecessary, isn't it?

if cred.HostName != "" || cred.MACAddress == "" {
continue
}
dirName, err := a.findHostDirForMAC(cred.MACAddress)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

At this level the only code that matters is to append an entry to a.FencingCredentialsHosts only if it was configured by mac, ie:

for _, cred := range installConfig.Config.ControlPlane.Fencing.Credentials {
        // filter out hosts without a mac-address configured
		if cred.HostName != "" || cred.MACAddress == "" {
			continue
		}
        a.FencingCredentialsHosts = append(a.FencingCredentialsHost, installConfig.Config.ControlPlane.Fencing.Credentials)
}

All the rest is not required.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Note that in general, for this asset, the concept of "dir" is not known. It only takes care of carrying around hosts list, and provide a file definition for them

}
}

for _, fch := range a.FencingCredentialsByHost {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The goal here is to serialize the FC file in one of the eligible hosts-<N> folder. In particular the one whose mac-address(es) matches the current FC one. So it looks like a good spot to reuse findHostDirForMAC.
Anyhow, since the FencingCredentials are defined in the install-config.yaml, and the hosts in the agent-config.yaml, things can become a little bit tricky, since there's no guarantee that an abi host would exist for a given FC entry. So, I would recommend a slightly different logic for the matching:

  • Iterate over files, looking for keys matching <host folder name>/mac_addresses
    • Check if one the macs matches your current FC mac. If so, get <host folder name> as your current location to store the fencing-credentials.yaml for the FC
  • In case of no match, a new host folder will have to be generated - just ensure to not reuse a previously defined host folder name

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/asset/agent/agentconfig/agenthosts_test.go`:
- Around line 1042-1129: Add a table case to
TestHostConfigFiles_FencingCredentials where an existing host has no Interfaces,
roles, or root-device hints and an unmatched fencing credential requires a
generated directory. Assert that the credential is assigned to the next
non-colliding host-<i> directory, covering reservation of implicit host names by
nextAvailableHostDir.

In `@pkg/asset/agent/agentconfig/agenthosts.go`:
- Around line 377-403: Reserve every host-index directory name generated by the
host-processing loop, including hosts that produce no files, before allocating
directories for unmatched fencing credentials. Update the interaction between
the host loop and nextAvailableHostDir so names derived as host-<i> cannot be
reused, while preserving existing file generation and credential allocation
behavior.
- Around line 377-448: Update nextAvailableHostDir and its call in the host
configuration generation flow to accept len(a.Hosts), reserve every implicit
host-<i> name for indices below that count before scanning files, and then
select the next unused directory. In
pkg/asset/agent/agentconfig/agenthosts_test.go lines 1042-1129, add a
TestHostConfigFiles_FencingCredentials case with a host lacking Interfaces,
Role, and RootDeviceHints plus an unmatched fencing credential, asserting the
generated directory does not reuse that host’s implicit host-<i> name.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: d07aed07-aba5-498d-9420-aa7dea27c5d4

📥 Commits

Reviewing files that changed from the base of the PR and between 6599dfa and c0adae6.

📒 Files selected for processing (2)
  • pkg/asset/agent/agentconfig/agenthosts.go
  • pkg/asset/agent/agentconfig/agenthosts_test.go

Comment thread pkg/asset/agent/agentconfig/agenthosts_test.go
Comment thread pkg/asset/agent/agentconfig/agenthosts.go Outdated
Comment thread pkg/asset/agent/agentconfig/agenthosts.go Outdated
@fracappa
fracappa force-pushed the fca/split-fencing-credentials-by-key branch 2 times, most recently from 525ff92 to 7f46cd5 Compare July 27, 2026 08:00
fracappa added 2 commits July 27, 2026 11:26
Hostname-keyed credentials stay at the top-level
/etc/assisted/hostconfig/fencing-credentials.yaml, while MAC-keyed
credentials (no hostname) are placed in per-host directories
matched by MAC address, e.g. host-0/fencing-credentials.yaml.

This allows assisted-service to discover MAC-keyed fencing
credentials alongside other host-scoped config files.
@fracappa
fracappa force-pushed the fca/split-fencing-credentials-by-key branch from 7f46cd5 to efd2285 Compare July 27, 2026 09:27

@andfasano andfasano left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@fracappa looks like there was a nice progress, and functionally speaking the code now looks aligned to our latest discussion.
I have just two non-blocking points:

  • It looks like the new code in HostConfigFiles() may be simplified
  • It looks like this patch could be a very nice fit for a new integration test

/approve

cred := &a.FencingCredentialsHost[i]
dirName := findHostDirForMAC(files, cred.MACAddress)
if dirName == "" {
dirName = nextAvailableHostDir(files, len(a.Hosts))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

non-blocking comment: I think there could be some space for further simplification here - unless I missed something (even though the current code seems to work), by applying the following approach:

  • Initalize a a counter maxNewDirs equals to len(Hosts)
  • if dirName is empty, simply set the new dirName to host-<maxNewDirs+1> and increment maxNewDirs, and use it for adding the mac_addresses
  • Marshal the FC struct and add it to files directly in this loop

That approach may allow to user a simpler logic

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 27, 2026
@fracappa
fracappa force-pushed the fca/split-fencing-credentials-by-key branch from 3e79ce6 to f00c23a Compare July 28, 2026 14:26
@fracappa
fracappa force-pushed the fca/split-fencing-credentials-by-key branch from d8eecd2 to 5302df4 Compare July 28, 2026 16:57

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nice addition!

@fracappa

Copy link
Copy Markdown
Contributor Author

/verified by @fracappa

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Jul 30, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@fracappa: This PR has been marked as verified by @fracappa.

Details

In response to this:

/verified by @fracappa

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 openshift-eng/jira-lifecycle-plugin repository.

@fonta-rh fonta-rh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

My concern was addressed in a better way, so nothing more to say from my side, good work!

@fonta-rh

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci

openshift-ci Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andfasano, fonta-rh

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 lgtm Indicates that a PR is ready to be merged. label Jul 30, 2026
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test e2e-azure-nat-gateway-single-zone

Scheduling tests matching the pipeline_run_if_changed or not excluded by pipeline_skip_if_only_changed parameters:
/test e2e-agent-4control-ipv4
/test e2e-agent-5control-ipv4
/test e2e-agent-compact-ipv4
/test e2e-agent-compact-ipv4-appliance-diskimage
/test e2e-agent-compact-ipv4-iso-no-registry
/test e2e-agent-compact-ipv4-none-platform
/test e2e-agent-compact-ipv6-minimaliso
/test e2e-agent-ha-dualstack
/test e2e-agent-sno-ipv4-pxe
/test e2e-agent-sno-ipv6
/test e2e-agent-two-node-fencing-ipv4

@fracappa

Copy link
Copy Markdown
Contributor Author

/test e2e-agent-5control-ipv4

@openshift-merge-bot
openshift-merge-bot Bot merged commit dc5aa9c into openshift:main Jul 30, 2026
27 of 28 checks passed
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. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants