Skip to content

Enhance overcloud openbao deployment - #2477

Open
seunghun1ee wants to merge 5 commits into
stackhpc/2026.1from
enhance-overcloud-openbao-deployment
Open

Enhance overcloud openbao deployment#2477
seunghun1ee wants to merge 5 commits into
stackhpc/2026.1from
enhance-overcloud-openbao-deployment

Conversation

@seunghun1ee

@seunghun1ee seunghun1ee commented Aug 3, 2026

Copy link
Copy Markdown
Member

Currently fixing split brain OpenBao cluster is not a smooth operation.
Added following to improve the cluster restoration process

  • A playbook for finding current OpenBao Raft leader
  • A variable in deployment playbook for setting leader node
  • Documentation for this procedure

Also added 10 seconds timeout on unsealing first OpenBao node to prevent the deployment playbook from failing caused by slightly longer unsealing time when fixing the cluster..

Summary by CodeRabbit

  • New Features

    • Added a tool to identify the current OpenBao Raft leader.
    • Added a recovery workflow that detects the current leader before redeployment.
    • Deployment now supports selecting a configurable Raft leader controller.
    • Added a 10-second timeout for the initial secret-store unseal operation.
  • Documentation

    • Added guidance for restoring an OpenBao cluster after leader failure, including leader verification and redeployment steps.

Added variable ``raft_leader_index`` to the
``secret-store-deploy-overcloud.yml`` playbook. This variable controls
which controller becomes the leader when deploying OpenBao.
The default is 0 (Frist controller).

This variable needs to track the index of current leader controller when
fixing/restarting the cluster to prevent split brain.
@seunghun1ee seunghun1ee self-assigned this Aug 3, 2026
@seunghun1ee
seunghun1ee requested a review from a team as a code owner August 3, 2026 12:27
@github-actions github-actions Bot added the waiting-review PR is waiting for a review label Aug 3, 2026
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@seunghun1ee, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 11 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: eea86e3c-90a1-4d93-8a05-1fa493cbc915

📥 Commits

Reviewing files that changed from the base of the PR and between 4b56791 and 6cd456c.

📒 Files selected for processing (4)
  • doc/source/configuration/openbao.rst
  • etc/kayobe/ansible/secret-store/fix-openbao-overcloud.yml
  • etc/kayobe/ansible/secret-store/get-current-raft-leader.yml
  • etc/kayobe/ansible/secret-store/secret-store-deploy-overcloud.yml
📝 Walkthrough

Walkthrough

Adds a playbook to identify the current OpenBao Raft leader. Wires that playbook into recovery deployment. Updates deployment to use a configurable leader index and adds a first-unseal timeout. Documents the cluster restoration procedure.

Changes

OpenBao recovery

Layer / File(s) Summary
Raft leader discovery
etc/kayobe/ansible/secret-store/get-current-raft-leader.yml
The playbook prepares the controller environment, queries Secret Store HA status, computes the leader controller index, and displays it.
Recovery deployment wiring and leader selection
etc/kayobe/ansible/secret-store/fix-openbao-overcloud.yml, etc/kayobe/ansible/secret-store/secret-store-deploy-overcloud.yml
The recovery playbook runs leader discovery before deployment. Deployment uses raft_leader_index to select the OpenBao Raft leader and sets a 10-second timeout for the first unseal operation.
Recovery procedure documentation
doc/source/configuration/openbao.rst
The documentation describes how to identify the current leader and redeploy with raft_leader_index.

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

Sequence Diagram(s)

sequenceDiagram
  participant Operator
  participant LeaderPlaybook as get-current-raft-leader.yml
  participant SecretStoreAPI
  participant RecoveryPlaybook as fix-openbao-overcloud.yml
  participant OvercloudDeploy as secret-store-deploy-overcloud.yml
  Operator->>LeaderPlaybook: Run leader discovery
  LeaderPlaybook->>SecretStoreAPI: Query HA and leader status
  SecretStoreAPI-->>LeaderPlaybook: Return current leader
  LeaderPlaybook-->>RecoveryPlaybook: Set raft_leader_index
  RecoveryPlaybook->>OvercloudDeploy: Import deployment
  OvercloudDeploy->>SecretStoreAPI: Use selected Raft leader IP
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change to enhance overcloud OpenBao deployment, although it does not mention cluster restoration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch enhance-overcloud-openbao-deployment

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

@seunghun1ee

Copy link
Copy Markdown
Member Author

This needs to be backported at least to stackhpc/2025.1

@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: 5

🧹 Nitpick comments (1)
etc/kayobe/ansible/secret-store/get-current-raft-leader.yml (1)

17-23: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Remove the unused hvac installation.

This playbook uses no hvac-dependent module. Remove Lines 17–23 to avoid an unnecessary package and network dependency before leader discovery.

🤖 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 `@etc/kayobe/ansible/secret-store/get-current-raft-leader.yml` around lines 17
- 23, Remove the Ensure Python hvac module is installed task from the playbook,
including its pip installation, virtualenv, and become configuration; leave the
raft leader discovery tasks unchanged.
🤖 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 `@etc/kayobe/ansible/secret-store/get-current-raft-leader.yml`:
- Around line 30-42: Update both ansible.builtin.uri tasks, “Query the HA
status” and “Query the leader,” to set use_proxy: false and clear https_proxy in
their task environments, matching the established secret-store request
configuration while preserving their existing URLs, headers, and registrations.
- Around line 47-48: Update the HA condition in get-current-raft-leader to
reference the documented case-sensitive Nodes field from ha_status_query.json
instead of nodes, preserving the existing length-greater-than-one check so
raft_leader is created when multiple nodes are returned.
- Around line 51-53: Update the Raft leader index assignment using a core
Ansible expression, or declare ansible.utils in the Ansible collection
requirements consumed by the supported installation commands. Ensure the lookup
in the raft_leader_index set_fact remains functional when ansible.utils is not
otherwise installed.
- Around line 44-53: Update the “Determine Raft leader” condition to read the HA
node count from ha_status_query.json.Nodes, then validate that
groups['raft_leader'] contains exactly one host before calculating
raft_leader_index. Reject zero or multiple detected leaders rather than applying
first and selecting an ambiguous controller.

In `@etc/kayobe/ansible/secret-store/secret-store-deploy-overcloud.yml`:
- Around line 26-35: Set stackhpc.hashicorp’s openbao_init_addr to the
controller selected by raft_leader_index, alongside openbao_raft_leaders, so
initialization checks and hashivault_init target the same leader used for
retry-join. Preserve the existing selected-controller address construction and
avoid leaving initialization bound to the default openbao_api_addr.

---

Nitpick comments:
In `@etc/kayobe/ansible/secret-store/get-current-raft-leader.yml`:
- Around line 17-23: Remove the Ensure Python hvac module is installed task from
the playbook, including its pip installation, virtualenv, and become
configuration; leave the raft leader discovery tasks unchanged.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c54e153f-49d7-4412-bf70-31e4d9eda846

📥 Commits

Reviewing files that changed from the base of the PR and between 625c066 and 5386a35.

📒 Files selected for processing (3)
  • doc/source/configuration/openbao.rst
  • etc/kayobe/ansible/secret-store/get-current-raft-leader.yml
  • etc/kayobe/ansible/secret-store/secret-store-deploy-overcloud.yml

Comment thread etc/kayobe/ansible/secret-store/get-current-raft-leader.yml
Comment thread etc/kayobe/ansible/secret-store/get-current-raft-leader.yml
Comment thread etc/kayobe/ansible/secret-store/get-current-raft-leader.yml
Comment thread etc/kayobe/ansible/secret-store/get-current-raft-leader.yml
Comment thread etc/kayobe/ansible/secret-store/secret-store-deploy-overcloud.yml
@mnasiadka

Copy link
Copy Markdown
Member

Why are we doing it here, instead of fixing it in the hashicorp collection?

@seunghun1ee

Copy link
Copy Markdown
Member Author

@mnasiadka Currently The OpenBao role in hashicorp collection supports setting the leader node other than the first controller. It's the SKC playbook that fixed the leader to be the first controller.
But perhaps something can be automated from the collection. I'll come back to you once I know what's needed to achieve that.

@seunghun1ee

Copy link
Copy Markdown
Member Author

@mnasiadka
I had some look around our openbao role in hashicorp collection and I don't think we can automate the fix from it unless we do some overhaul on openbao role. This is because

  1. The openbao role expects 'users' to provide the address of the leader node. There's no default value.
  2. For any reason, the existing cluster can have different node as the leader. Then, which does the role follow as a truth? The user input? or the actual current leader?
    A. If the role takes the user input, we have a risk of getting split brain
    B. If the role sticks with the current leader, we're somehow overriding the user input, which usualy takes the highest precedence. I think this is anti-pattern

We can still automate this in SKC by having a wrapper playbook for get-current-raft-leader.yml and secret-store-deploy-overcloud.yml

@seunghun1ee
seunghun1ee force-pushed the enhance-overcloud-openbao-deployment branch from 5386a35 to c89988c Compare August 4, 2026 11:53

@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 `@etc/kayobe/ansible/secret-store/get-current-raft-leader.yml`:
- Around line 47-56: Insert an ansible.builtin.assert immediately before the
“Set Raft leader index fact” task, requiring (groups['raft_leader'] |
default([])) | length == 1. Keep the existing raft_leader_index calculation
unchanged, and make the assertion fail when no leader or multiple leaders are
detected.
- Around line 30-44: Update both the “Query the HA status” and “Query the
leader” ansible.builtin.uri tasks to prevent redirects from forwarding the
X-Vault-Token header, preferably by setting follow_redirects to none while
preserving the existing requests and error handling.
- Around line 36-52: Update the “Determine Raft leader” task to require
successful completion of both URI tasks before accessing ha_status_query.json or
leader_query.json, using their registered success indicators. Also add an
explicit no-leader fallback for when no host joins raft_leader so the play does
not fail when leader discovery returns no match.
🪄 Autofix

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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: cf175bfb-814c-44d1-a0ab-baa5dbeeedc7

📥 Commits

Reviewing files that changed from the base of the PR and between 5386a35 and c89988c.

📒 Files selected for processing (4)
  • doc/source/configuration/openbao.rst
  • etc/kayobe/ansible/secret-store/fix-openbao-overcloud.yml
  • etc/kayobe/ansible/secret-store/get-current-raft-leader.yml
  • etc/kayobe/ansible/secret-store/secret-store-deploy-overcloud.yml
🚧 Files skipped from review as they are similar to previous changes (2)
  • etc/kayobe/ansible/secret-store/secret-store-deploy-overcloud.yml
  • doc/source/configuration/openbao.rst

Comment thread etc/kayobe/ansible/secret-store/get-current-raft-leader.yml
Comment thread etc/kayobe/ansible/secret-store/get-current-raft-leader.yml Outdated
Comment thread etc/kayobe/ansible/secret-store/get-current-raft-leader.yml
@seunghun1ee
seunghun1ee force-pushed the enhance-overcloud-openbao-deployment branch 4 times, most recently from 45ee6c6 to de8078a Compare August 4, 2026 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting-review PR is waiting for a review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants