Files
homelab/kubernetes/infrastructure/openbao/rotation/netbird-ingress.yaml
T
hermes-bot 6f1a7b6d96
ci/woodpecker/pr/ci-scripts-test Pipeline was successful
ci/woodpecker/pr/ci-manifests-test Pipeline was successful
fix(secret-rotator): never fail the HA run after the store; stage the image rollout
Folds the good parts of #1412 into this PR and addresses both review-bot
reviews (#1412 review 1789, #1414 review 1791):

- Everything after the OpenBao store is best-effort. Decode, reconnect,
  listing and revokes run in reap_superseded(); reap_summary() turns any
  error into "reap skipped" plus a warning, so rotate_ha_token returns Ok.
  A failed run would start a second pod (backoffLimit: 1) that keeps the
  token just stored and its successor and reaps the token consumers still
  hold until ESO syncs, i.e. the #1081 outage. Two unit tests cover it.
- Warn when the replaced token is not named "<client_name> [<6 hex>]":
  no later run reaps it, so it needs a manual revoke (from #1412).
- Staged image rollout (from #1412): only the three HA CronJobs carry the
  flux-system:secret-rotator marker; the other 17 rotators stay on
  2026-07-30 until a manual HA run validates the new binary, then a
  follow-up adds the marker to them. rotation/kustomization.yaml records
  the exception.
- Merged current main (a6f37e2b, 1691a0ac): the Reloader annotations for
  zone-configurator and speech-to-phrase are already there via #1409.
2026-10-21 07:59:52 +00:00

88 lines
3.1 KiB
YAML

---
# Class-B rotation of the netbird-ingress setup key. Mints a fresh reusable
# setup key via the secret-rotator binary (netbird-key mode):
# POST /api/setup-keys, then patches OpenBao. Create-new, not roll-in-place —
# the old key is left to expire (ephemeral, 1yr), so nothing is deleted and
# there is no window: the old key stays valid while the ingress re-enrolls.
#
# openbao-ns pattern; the NetBird management API (netbird.renner.uno, valid TLS)
# is reachable via the openbao ns `world` egress. ESO syncs the
# netbird-ingress-setup-key Secret (ns ingress, 10m); Reloader restarts the
# netbird-ingress DaemonSet, whose pods re-enroll on the new key.
#
# An auto-rotated key SHOULD expire (bounded blast radius if a rotation ever
# silently breaks). The rotator NEVER deletes keys — a past manual delete-filter
# bug wiped unrelated keys, so automated deletion is deliberately absent.
apiVersion: v1
kind: ServiceAccount
metadata:
name: netbird-secret-rotator
namespace: openbao
labels:
app.kubernetes.io/name: netbird-ingress
app.kubernetes.io/component: secret-rotator
---
apiVersion: batch/v1
kind: CronJob
metadata:
name: netbird-secret-rotate
namespace: openbao
labels:
app.kubernetes.io/name: netbird-ingress
app.kubernetes.io/component: secret-rotator
spec:
suspend: false
schedule: "0 4 1 1,4,7,10 *" # quarterly, Europe/Berlin
timeZone: Europe/Berlin
concurrencyPolicy: Forbid
successfulJobsHistoryLimit: 2
failedJobsHistoryLimit: 5
startingDeadlineSeconds: 3600
jobTemplate:
spec:
backoffLimit: 1
activeDeadlineSeconds: 300
ttlSecondsAfterFinished: 259200 # 3 d
template:
metadata:
labels:
app.kubernetes.io/name: netbird-ingress
app.kubernetes.io/component: secret-rotator
spec:
serviceAccountName: netbird-secret-rotator
restartPolicy: Never
securityContext:
runAsNonRoot: true
runAsUser: 65534
runAsGroup: 65534
seccompProfile:
type: RuntimeDefault
containers:
- name: rotate
image: gitea.renner.uno/gitea_admin/secret-rotator:2026-07-30
args: ["netbird-key"]
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop: ["ALL"]
env:
- name: BAO_ADDR
value: http://openbao.openbao.svc.cluster.local:8200
- name: BAO_ROLE
value: rotator-netbird
- name: BOOTSTRAP_PATH
value: homelab/infrastructure/secret-rotators-bootstrap/netbird
- name: BAO_PATH
value: homelab/infrastructure/netbird-ingress
- name: NB_MANAGEMENT_URL
value: https://netbird.renner.uno
- name: NB_AUTO_GROUPS
value: d8umic2oc9cs73d4e1f0
resources:
requests:
cpu: 25m
memory: 16Mi
limits:
memory: 48Mi