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.
131 lines
4.9 KiB
YAML
131 lines
4.9 KiB
YAML
---
|
|
# Rotate the `registry-bot` Gitea PAT (write:package, read:repository) and sync it into the
|
|
# konairius org's Woodpecker secret `registry_bot_token`. registry-bot is in the
|
|
# konairius team `publishers` (packages write, code read); every konairius release
|
|
# pipeline publishes images to gitea.renner.uno/konairius/* with it.
|
|
#
|
|
# init `rotate-mint` — secret-rotator gitea-token: mint the PAT, verify it can
|
|
# pull a private konairius repo, store it at infrastructure/registry-bot#token,
|
|
# reap old tokens keeping the two newest.
|
|
# main `sync-woodpecker` — secret-rotator woodpecker-secret: upsert the org
|
|
# secret, events push,tag,release,manual (no pull_request).
|
|
#
|
|
# Policy/role rotator-registry-bot and the bootstraps are provisioned by hand —
|
|
# see policies/rotator-registry-bot.hcl. Netpol halves:
|
|
# gitea-allow-registry-bot-rotator, woodpecker-allow-rotators,
|
|
# rotator-registry-bot-egress.
|
|
apiVersion: v1
|
|
kind: ServiceAccount
|
|
metadata:
|
|
name: registry-bot-secret-rotator
|
|
namespace: openbao
|
|
labels:
|
|
app.kubernetes.io/name: registry-bot
|
|
app.kubernetes.io/component: secret-rotator
|
|
---
|
|
apiVersion: batch/v1
|
|
kind: CronJob
|
|
metadata:
|
|
name: registry-bot-secret-rotate
|
|
namespace: openbao
|
|
labels:
|
|
app.kubernetes.io/name: registry-bot
|
|
app.kubernetes.io/component: secret-rotator
|
|
spec:
|
|
suspend: false
|
|
schedule: "15 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: registry-bot
|
|
app.kubernetes.io/component: secret-rotator
|
|
spec:
|
|
serviceAccountName: registry-bot-secret-rotator
|
|
restartPolicy: Never
|
|
securityContext:
|
|
runAsNonRoot: true
|
|
runAsUser: 65534
|
|
runAsGroup: 65534
|
|
seccompProfile:
|
|
type: RuntimeDefault
|
|
initContainers:
|
|
- name: rotate-mint
|
|
image: gitea.renner.uno/gitea_admin/secret-rotator:2026-07-30
|
|
args: ["gitea-token"]
|
|
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-registry-bot
|
|
- name: BOOTSTRAP_PATH
|
|
value: homelab/infrastructure/secret-rotators-bootstrap/registry-bot
|
|
- name: BAO_PATH
|
|
value: homelab/infrastructure/registry-bot
|
|
- name: GITEA_URL
|
|
value: http://gitea.gitea.svc.cluster.local:3000
|
|
# Private konairius repo the publishers team can read.
|
|
- name: GITEA_VERIFY_REPO
|
|
value: konairius/vsftpd
|
|
# read:repository: the pull check needs it.
|
|
- name: GITEA_SCOPES
|
|
value: write:package,read:repository
|
|
- name: GITEA_REQUIRE_PUSH
|
|
value: "false"
|
|
- name: GITEA_TOKEN_NAME_PREFIX
|
|
value: registry-bot-rotated
|
|
resources:
|
|
requests:
|
|
cpu: 25m
|
|
memory: 16Mi
|
|
limits:
|
|
memory: 48Mi
|
|
containers:
|
|
- name: sync-woodpecker
|
|
image: gitea.renner.uno/gitea_admin/secret-rotator:2026-07-30
|
|
args: ["woodpecker-secret"]
|
|
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-registry-bot
|
|
- name: BOOTSTRAP_PATH
|
|
value: homelab/infrastructure/secret-rotators-bootstrap/woodpecker-bot
|
|
- name: BAO_PATH
|
|
value: homelab/infrastructure/registry-bot
|
|
- name: BAO_FIELD
|
|
value: token
|
|
- name: WOODPECKER_URL
|
|
value: http://woodpecker.woodpecker.svc.cluster.local:8000
|
|
- name: WOODPECKER_ORG
|
|
value: konairius
|
|
- name: WOODPECKER_SECRET_NAME
|
|
value: registry_bot_token
|
|
- name: WOODPECKER_EVENTS
|
|
value: push,tag,release,manual
|
|
resources:
|
|
requests:
|
|
cpu: 25m
|
|
memory: 16Mi
|
|
limits:
|
|
memory: 48Mi
|