Set a fixed cluster_name in the OpenBao server config
What does this MR do?
Sets cluster_name in the rendered OpenBao server config. It defaults to the chart's full name (gitlab-openbao for a release named gitlab) and can be overridden with config.clusterName.
The metric problem
OpenBao adds a cluster label to its gauges. When cluster_name isn't set in the config:
- A node that starts as a standby doesn't know the cluster name yet, so it emits gauges with
cluster="". - When it becomes active, it reads the name from storage and switches the label to that name.
- The Prometheus sink keeps the old
cluster=""series untiltelemetry.prometheusRetentionTimeexpires (24 hours by default).
After a failover, the new active node exposes both vault_core_active{cluster=""} 0 and vault_core_active{cluster="<stored name>"} 1 for up to a day. Any other gauge with the cluster label is duplicated the same way. Dashboards show a stale 0, and a sum or count over these gauges is wrong. Alerts that take the max per pod, like the ones added in gitlab-com/runbooks!12006 (merged), mostly aren't affected.
When the metrics pipeline overwrites the cluster label, the two series collide, and the active node can read as 0 for a day after each failover. This happened on the GitLab.com deployment, where a fixed cluster_name fixed it. This MR ports that fix to the chart.
With cluster_name in the config, the label is set at startup and never changes.
Effect on existing installs
The name only changes what OpenBao reports. It doesn't rewrite storage. In OpenBao v2.6.2:
setupClusterwrites a name to storage only when none is stored (vault/cluster.go), so existing clusters keep their stored name.Cluster()returns the config value instead of the stored one whenever it's set (vault/cluster.go). So after upgrading, theclustermetric label and thecluster_namefield ofsys/healthandsys/seal-statuschange from the stored name (for examplevault-cluster-1a2b3c4d) to the configured one. Queries that filter on the oldclustervalue need updating.
The chart version is bumped to 1.1.0 because this adds a value and changes the reported cluster name.
Test plan
helm lint .passes.helm template gitlab .renders"cluster_name": "gitlab-openbao". With--set config.clusterName=my-cluster, it renders"cluster_name": "my-cluster". A number is rejected by the schema.- Unit tests added in
tests/configmap_test.yaml(to be run by CI).
Author's Checklist
For anything in this list which will not be completed, please provide a reason in the MR discussion.
Required
- Ensure a release milestone is set.
- MR title and description are up to date, accurate, and descriptive.
- MR targeting the appropriate branch.
- MR has a green pipeline on GitLab.com.
- If the MR changes the packaged chart (
templates/,values.yaml,values.schema.json),versioninChart.yamlis bumped per the release process. - When ready for review, MR is labeled workflowready for review per the MR workflow.
Expected
- Test plan indicating conditions for success has been posted and passes.
- Documentation is created or updated.
- Tests are added.