Graylog2 / Graylog2/graylog-helm

Do not set automatic leaderElectionMode as the default

Open Beginner friendly
#186 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go Template
Stars
12
Forks
3
Avg merge
2d 4h
Merged PRs (30d)
13

Description

**Is your feature request related to a problem? Please describe.**

The chart sets `leaderElectionMode: "automatic"` as the default. While automatic mode can work well most of the time, it does not come for free. It adds more possible scenarios to understand, and it needs to be properly managed in the the case of Graylog version upgrades, where migrations have to run. That is usually done by a statically configured leader, but in the automatic case, it needs extra handling.

Our docker entrypoint already makes the first Graylog pod in a StatefulSet (`-0`) the leader: https://github.com/Graylog2/graylog-docker/blob/788fa7f2e7a749dd98718a5be2688ed866f175d2/docker-entrypoint.sh#L42-L57

I would generally argue that automatic leader election in a Kubernetes StatefulSet is of limited value. If the leader dies, Kubernetes will try to start it again. Potentially on a different node, but still keeping its number `-0` and thus its leader role. Having no leader in Graylog for a limited time is usually not a problem.

So the only problem automatic leader election would solve is when the leader pod does not automatically come up again in a timely manner. Which is a case that needs troubleshooting anyway.

**Describe the solution you'd like**

Set `leaderElectionMode: "static"` as the default. Document that the first Graylog pod in the StatefulSet will be the leader.

**Describe alternatives you've considered**

If we would want to keep `leaderElectionMode: "automatic"`, we would have to add more documentation about the consequenes, and a migration handling on upgrades that would fit the automatic mode.

Contributor guide

Open the contributing guide

Research direction

No specific chart files or tests are named. Inspect the Helm chart's leaderElectionMode default and its documentation, then compare the behavior with the referenced Docker entrypoint. Done means static mode is the default and the chart documents that StatefulSet pod -0 is the leader.

Written by the indexing model from the issue text.

Assessment

Tech stack
helm, kubernetes
Domain
devops, infrastructure
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.