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.
83 lines
2.9 KiB
YAML
83 lines
2.9 KiB
YAML
---
|
|
# Class-B rotation of the external-dns Cloudflare api-token. Rolls the
|
|
# `Kubernetes External-DNS` token value in place via the secret-rotator binary
|
|
# (cloudflare-roll mode): PUT /user/tokens/{id}/value, then patches OpenBao.
|
|
# Reads `external-dns-token-id` from the shared bootstrap (a DIFFERENT field
|
|
# from cert-manager, same admin token) so the two roll independently.
|
|
#
|
|
# UNLIKE cert-manager, this needs Reloader: external-dns reads CF_API_TOKEN as a
|
|
# startup env var, so the external-dns Deployment carries a reload annotation
|
|
# (kubernetes/apps/external-dns/helmrelease.yaml). Schedule is offset 30 min
|
|
# from the cert-manager roll. openbao-ns pattern; ESO syncs the
|
|
# cloudflare-api-token Secret (ns apps, 10m).
|
|
apiVersion: v1
|
|
kind: ServiceAccount
|
|
metadata:
|
|
name: external-dns-secret-rotator
|
|
namespace: openbao
|
|
labels:
|
|
app.kubernetes.io/name: external-dns
|
|
app.kubernetes.io/component: secret-rotator
|
|
---
|
|
apiVersion: batch/v1
|
|
kind: CronJob
|
|
metadata:
|
|
name: external-dns-secret-rotate
|
|
namespace: openbao
|
|
labels:
|
|
app.kubernetes.io/name: external-dns
|
|
app.kubernetes.io/component: secret-rotator
|
|
spec:
|
|
suspend: false
|
|
schedule: "30 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: external-dns
|
|
app.kubernetes.io/component: secret-rotator
|
|
spec:
|
|
serviceAccountName: external-dns-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: ["cloudflare-roll"]
|
|
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-external-dns
|
|
- name: BOOTSTRAP_PATH
|
|
value: homelab/infrastructure/secret-rotators-bootstrap/cloudflare
|
|
- name: BOOTSTRAP_TOKENID_FIELD
|
|
value: external-dns-token-id
|
|
- name: BAO_PATH
|
|
value: homelab/apps/external-dns
|
|
resources:
|
|
requests:
|
|
cpu: 25m
|
|
memory: 16Mi
|
|
limits:
|
|
memory: 48Mi
|