Skip to content

Configure PostHog without repeated thunderd restarts - #59

Merged
brianmodel merged 3 commits into
nextfrom
wato/thu-4916-v2
Sep 25, 2026
Merged

brianmodel merged 3 commits into
nextfrom
wato/thu-4916-v2

Conversation

@joshuawatkins04

@joshuawatkins04 joshuawatkins04 commented Sep 11, 2026 •

Copy link
Copy Markdown

Behavior:

  1. Daemon reads its env vars named THUNDERD_ENV_<key>. It places the variables in /etc/thunder/thunderd.env.
  2. It will not write to the file when the variables are not provided in its own environment. It will leave comments unchanged.
  3. It only writes to the file when there is a missing or outdated variable in the file.
  4. It will not trigger a thunder restart - it waits for the next restart.

Note

Medium Risk
The privileged daemon writes to host /etc/thunder/thunderd.env from operator-supplied env (often secrets); misconfiguration or partial writes could affect thunderd behavior, though errors are non-fatal to the reconcile loop.

Overview
Adds Helm daemon.extraEnv so operators can inject extra daemon container environment variables (including secrets via valueFrom), with chart schema, DaemonSet rendering, and README guidance.

The daemon now reads THUNDERD_ENV_<key> variables at startup into Config.ThunderdEnv, then once per pod start (before enrollment/repair) merges those keys into the host /etc/thunder/thunderd.env via an atomic shell write using new RunShellInput (stdin keeps values off the command line). Unrelated file content is preserved; unchanged effective values skip writes; failures are logged and do not block DRA startup or retry on reconcile. thunderd is not restarted—settings apply on its next start.

Reconcile tests were adjusted so dangling systemd symlink fixtures use host-style absolute targets, matching how the sweep reports paths.

Reviewed by Cursor Bugbot for commit 6980d8a. Bugbot is set up for automated code reviews on this repo. Configure here.

@joshuawatkins04
joshuawatkins04 changed the base branch from main to next September 11, 2026 05:03

@brianmodel brianmodel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We shouldn't have any logic for posthog specifically, it should just be extra env so that we can add arbitrary env variables to this

@brianmodel brianmodel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good, do we need to rebuild tags?

@brianmodel
brianmodel merged commit e7c8981 into next Sep 25, 2026
3 checks passed
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.

3 participants