Skip to content

fix(metal3): reconcile BMCSecret for existing BareMetalHosts#161

Merged
defo89 merged 1 commit into
mainfrom
feature/metal3-reconcile-bmcsecret-existing-bmh
Jun 11, 2026
Merged

fix(metal3): reconcile BMCSecret for existing BareMetalHosts#161
defo89 merged 1 commit into
mainfrom
feature/metal3-reconcile-bmcsecret-existing-bmh

Conversation

@defo89

@defo89 defo89 commented Jun 11, 2026

Copy link
Copy Markdown
Member

Problem

The metal3 controller's reconcileDevice returned early when a BareMetalHost already existed, skipping reconcileBmcSecret entirely. This meant:

  • Credential rotation from credentials.json was never applied to existing devices
  • Manual edits to BMC secrets were never corrected

Fix

  1. Move reconcileBmcSecret before BMH existence check — secrets are now always reconciled regardless of whether the BMH already exists (matching the ironcore controller pattern)
  2. Use Data instead of StringData — StringData is write-only (never returned by the API), causing CreateOrUpdate to issue spurious updates every reconcile cycle. Using Data directly allows proper equality comparison, updating only when credentials actually change.

@github-actions

Copy link
Copy Markdown

Merging this branch will not change overall coverage

Impacted Packages Coverage Δ 🤖
github.com/sapcc/argora/internal/controller 86.02% (ø)

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/sapcc/argora/internal/controller/metal3_controller.go 76.27% (ø) 177 135 42

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

@goerangudat goerangudat left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm

@defo89 defo89 merged commit b0e45a1 into main Jun 11, 2026
7 checks passed
@defo89 defo89 deleted the feature/metal3-reconcile-bmcsecret-existing-bmh branch June 11, 2026 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants