Skip to content

Draft: SPL-Noah-spike: eliminate SHC captain bootstrap restart (zero restarts in Noah mode) - #923

Draft
vivekr-splunk wants to merge 4 commits into
developfrom
readonly-rootfs-fix8
Draft

vivekr-splunk wants to merge 4 commits into
developfrom
readonly-rootfs-fix8

Conversation

@vivekr-splunk

Copy link
Copy Markdown
Contributor

Summary

Eliminates the last remaining Splunk restart during SHC pod rolls when Noah pre-configures all [shcclustering] fields before splunkd starts. Produces the noah-splunk-v12 image.

Context: configure_noah.yml already writes 7 [shcclustering] fields to server.conf before Splunk starts. This makes bootstrap shcluster-captain a no-op API call — no restart needed. The restart was still firing because changed_when: task_result.rc == 0 was left on the Bootstrap task.

Changes

  • roles/splunk_common/tasks/configure_noah.yml: Added set_fact: noah_shc_prestart_configured: true after the last [shcclustering] pre-start write. Only set when splunk.role == splunk_search_head and splunk.shc is defined (Noah SHC mode only).

  • roles/splunk_search_head/tasks/search_head_clustering.yml: Changed Bootstrap SHC captain changed_when from task_result.rc == 0 to a two-condition block:

    changed_when:
      - task_result.rc == 0
      - not (noah_shc_prestart_configured | default(false) | bool)

    In Noah mode this is always false → Restart the splunkd service handler never fires.

Non-Noah SHC flows are unaffected: when configure_noah.yml does not run, the fact is unset, default(false) applies, and the restart fires as before.

Restart History

Image Change Result
v11 init shcluster-configchanged_when: false -537s restart on every non-captain pod roll
v12 (this PR) bootstrap shcluster-captain → suppressed via noah_shc_prestart_configured -537s restart on captain pod
Combined Zero Ansible-triggered restarts in Noah mode All SHC pod rolls ~8–9 min

Validation

  • Image noah-splunk-v12 built and pushed to ECR
  • EKS validation on vivek-noah-c3-dev in progress
  • Analogous to feature/shc-kubernetes-reliability POC (their prestart_config flag), adapted for our Noah configure_noah.yml flow

AI Assistance

Claude Code assisted with analysis and implementation.

vivekr-splunk and others added 4 commits January 13, 2026 09:00
…password compat

The declarative admin password path runs `splunk cmd splunkd rest --noauth` to
apply the admin password on non-first-run starts. This brief splunkd invocation
initializes the Noah C++ client (NoahConfiguration::loadNoahServiceFromConfFilesReloadable)
which crashes in two ways when [noahService] is present:

1. pass4SymmKey error: [general] pass4SymmKey is written as plaintext by
   set_general_symmkey_password.yml; if [noahService] has an encrypted
   pass4SymmKey from the previous run, encrypt_fields processing aborts.

2. heartbeatPeriod assertion: when disabled=false, the Noah client crashes
   asserting parsedCorrectly==true because heartbeatPeriod is absent or
   fails as an unsigned integer.

Fix: add set_noah_symmkey_password.yml which runs between
set_general_symmkey_password.yml and enable_admin_auth.yml to write the
full [noahService] stanza with disabled=true (so Noah client stays dormant
during the brief splunkd start), heartbeatPeriod=30 (persists for the full
start), and pass4SymmKey=plaintext. set_config_file.yml overwrites disabled
with the real value after enable_admin_auth.yml completes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ng] writes

splunk init shcluster-config always returns rc=0, and search_head_clustering.yml
used changed_when: task_result.rc == 0 — so every pod restart unconditionally
fired the Restart the splunkd service handler, adding ~537s.

Fix: write all [shcclustering] fields (pass4SymmKey, label, replication_port,
replication_factor, conf_deploy_fetch_url, mgmt_uri, disabled=false) to
server.conf in configure_noah.yml before splunk start. This makes
splunk init shcluster-config a no-op; changed_when: false prevents the restart.

Works with Noah: configure_noah.yml already runs before enable_admin_auth.yml
(before splunk start), preserving the disabled=true / pass4SymmKey sequencing
for [noahService]. The init-etc init container (operator side) will be extended
to also strip [shcclustering].pass4SymmKey so ini_file can overwrite the
splunkd-encrypted value on each restart.

Expected improvement: SHC pod roll time ~18 min → ~8 min.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…r SHC pods)

configure_noah.yml already writes all [shcclustering] fields to server.conf
before splunkd starts, making bootstrap shcluster-captain a no-op API call.
Add a set_fact (noah_shc_prestart_configured) after those writes, then gate
the captain bootstrap task's changed_when on that fact so the restart handler
never fires in Noah mode. Non-Noah SHC flows are unaffected (fact unset →
default(false) → restart fires as before).

This completes zero-restart SHC pod rolls: v11 removed the init shcluster-config
restart (537s); v12 removes the captain bootstrap restart (~537s additional).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant