Alertmanager cluster.listen-address flag does not preserve explicitly configured empty values
Summary
Setting alertmanager['flags']['cluster.listen-address'] to an empty string in /etc/gitlab/gitlab.rb does not correctly disable Alertmanager's cluster listener.
alertmanager['flags'] = { 'cluster.listen-address' => '' }
After running gitlab-ctl reconfigure, the empty string is not preserved in the generated Alertmanager configuration. Instead, the setting is effectively omitted, causing Alertmanager to fall back to its default cluster listen address of *:9094.
This makes it impossible to explicitly configure an empty cluster listen address through the GitLab Linux package configuration, despite the underlying Alertmanager supporting an empty value to disable its cluster listener.
The behaviour is particularly problematic for single-node GitLab installations where Alertmanager clustering is unnecessary and the cluster listener is intentionally disabled to reduce unnecessary listening services.
System information
- GitLab version: 19.5.3
- GitLab edition: Community Edition (CE)
- Installation method: Linux package (Omnibus)
- Operating system: Debian 13 (Trixie)
- Architecture: x86_64
Steps to reproduce
-
Configure Alertmanager in
/etc/gitlab/gitlab.rb:alertmanager['flags'] = { 'cluster.listen-address' => '' } -
Run
gitlab-ctl reconfigure. -
Inspect the generated Alertmanager configuration or running process arguments.
-
Check listening sockets:
ss -lntp | grep 9094
What is the current bug behavior?
The explicitly configured empty string is not retained during configuration generation.
Instead, Alertmanager starts with its default cluster listener enabled:
LISTEN 0 2048 *:9094 0.0.0.0:*
This behaviour was also reproducible by temporarily setting the flag to a non-empty value:
alertmanager['flags'] = { 'cluster.listen-address' => '127.0.0.1:9094' }
After reconfiguration, the generated configuration correctly reflected the non-empty value.
This suggests that empty-string values are being discarded or treated as unset somewhere in the GitLab configuration generation process.
What is the expected correct behavior?
GitLab should preserve explicitly configured empty-string values when generating Alertmanager flags.
In this case, the following configuration:
alertmanager['flags'] = { 'cluster.listen-address' => '' }
Should result in Alertmanager receiving the empty flag value, disabling its cluster listener as intended.
Possible fixes
Investigate the GitLab configuration generation logic for Alertmanager flags.
The logic may currently treat empty strings as unset values, potentially through conditional checks that evaluate the value's truthiness rather than checking whether the key is explicitly configured.
Explicitly configured empty strings should be distinguished from missing or unset configuration values.