Skip to content

chore(gr26): swap MQTT auth from gr26 user → mapache fleet user#73

Merged
BK1031 merged 2 commits into
mainfrom
bk1031/gr26-mqtt-mapache-user
Jun 5, 2026
Merged

chore(gr26): swap MQTT auth from gr26 user → mapache fleet user#73
BK1031 merged 2 commits into
mainfrom
bk1031/gr26-mqtt-mapache-user

Conversation

@BK1031

@BK1031 BK1031 commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Standardize the in-cluster gr26 service onto the shared `mapache` MQTT credential (PR #70) instead of the dedicated `gr26` user.

Net manifest diff is one line — `MQTT_USER: gr26 → mapache`. The secret key stays as `MQTT_PASSWORD` because the value was rotated in place to hold the mapache user's password (out-of-band patch); no manifest re-wiring needed.

What changed out-of-band

`mapache-secrets.MQTT_PASSWORD` now holds the mapache user's password (was the gr26 user's). The gr26 user's password is still recoverable from terraform output if we ever need to roll back:
```bash
terraform -chdir=infra/environments/prod output -raw mqtt_password # gr26 user pw (unchanged in TF)
```

Why this is safe to ship

Existing gr26 pods read `MQTT_PASSWORD` into env at container start; the in-place secret change doesn't affect already-running pods, which keep talking to the broker using their cached (old gr26) credentials. The swap only takes effect when ArgoCD spins up a new pod for the rolling update — and that pod has `MQTT_USER=mapache` paired with `MQTT_PASSWORD=` → clean auth on first connect.

Rollout

ArgoCD sync → rolling restart of 3 gr26 pods → each new pod connects to the broker as `mapache` cleanly. Brief paho reconnect window per pod.

Test plan

  • `kubectl kustomize . | kubectl apply --dry-run=client` validates
  • Secret patched before opening this PR; `kubectl -n mapache get secret mapache-secrets -o jsonpath='{.data.MQTT_PASSWORD}' | base64 -d` matches `terraform output -raw mqtt_password_mapache`
  • After ArgoCD sync: `kubectl -n mapache logs deploy/gr26 | grep '[MQ] Connected'` shows fresh connects on all 3 pods
  • Live ECU MQTT receive rate matches pre-PR (~33/sec/pod via the shared subscription)

Follow-up

The `gr26` MQTT user on the broker is now unused. Drop it from the mqtt-ec2 module as a future cleanup PR if we don't end up giving the on-vehicle TCM a distinct identity from `tcm26`.

BK1031 added 2 commits June 5, 2026 11:57
The dedicated `gr26` MQTT user (PR #45) and the `mapache` fleet user
(PR #70) both exist on the gr-mqtt broker. Standardizing the in-cluster
gr26 service onto the fleet credential so all mapache services share a
single broker identity that rotates together — keeps the `gr26` user
free for the on-vehicle ingest path if we ever want it there.

- MQTT_USER: gr26 → mapache
- MQTT_PASSWORD secretKeyRef.key: MQTT_PASSWORD → MQTT_MAPACHE_PASSWORD
- mapache-secrets already has both keys populated (MQTT_PASSWORD untouched,
  MQTT_MAPACHE_PASSWORD added manually via `kubectl patch` before this PR)

Rollout: ArgoCD sync → new pods come up with the new env, paho connects
fresh under the mapache identity. Old gr26-user MQTT sessions hold their
TCP socket until pod termination then drop cleanly.
Switching strategy: instead of adding a new MQTT_MAPACHE_PASSWORD key,
the mapache-secrets MQTT_PASSWORD value got updated in place to hold
the mapache user's password (out-of-band patch). All consumers stay
pointed at the same secret key, the env diff is just MQTT_USER.

The temporary MQTT_MAPACHE_PASSWORD key was removed from the secret.
@BK1031 BK1031 merged commit 2916b62 into main Jun 5, 2026
@BK1031 BK1031 deleted the bk1031/gr26-mqtt-mapache-user branch June 5, 2026 19:50
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.

1 participant