Skip to content

spike: reduce Monitoring Console restart churn from ConfigMap metadata updates#1731

Open
vivekr-splunk wants to merge 2 commits intodevelopfrom
spike/mc-flaky-restart-config-hash
Open

spike: reduce Monitoring Console restart churn from ConfigMap metadata updates#1731
vivekr-splunk wants to merge 2 commits intodevelopfrom
spike/mc-flaky-restart-config-hash

Conversation

@vivekr-splunk
Copy link
Collaborator

@vivekr-splunk vivekr-splunk commented Feb 26, 2026

Summary

  • switch MC pod-template annotation monitoringConsoleConfigRev to a deterministic hash of MC ConfigMap data
  • avoid rollouts when only ConfigMap metadata/resourceVersion changes
  • add unit tests for hash determinism and statefulset annotation behavior

Why

During C3-style bring-up, MC can restart multiple times. One trigger is that annotation currently follows ConfigMap resourceVersion, so metadata-only updates can force unnecessary restarts. This spike constrains restarts to effective data changes only.

Testing

  • go test ./pkg/splunk/enterprise -run "TestGetMonitoringConsoleConfigDataHash|TestGetMonitoringConsoleStatefulSetUsesConfigDataHash|TestGetMonitoringConsoleStatefulSet|TestApplyMonitoringConsoleEnvConfigMap" -count=1

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR optimizes Monitoring Console (MC) pod restart behavior during C3-style bring-up by switching from ConfigMap resourceVersion tracking to deterministic data hashing. This prevents unnecessary MC restarts when only ConfigMap metadata changes (not actual data).

Changes:

  • Replaced ConfigMap resourceVersion with SHA256 data hash for the monitoringConsoleConfigRev annotation
  • Added deterministic hash function that sorts keys to ensure consistent output regardless of map iteration order
  • Added comprehensive unit tests for hash determinism and statefulset annotation behavior

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
pkg/splunk/enterprise/monitoringconsole.go Implemented getMonitoringConsoleConfigDataHash() function and updated getMonitoringConsoleStatefulSet() to use data hash instead of resourceVersion
pkg/splunk/enterprise/monitoringconsole_test.go Added tests for hash determinism (TestGetMonitoringConsoleConfigDataHash) and integration test verifying statefulset uses data hash (TestGetMonitoringConsoleStatefulSetUsesConfigDataHash)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants