Commit 8c90478
committed
[k8s] add 'certs list/rotate/revoke' subcommands
Customer-facing cert lifecycle for the in-cluster kube-controller's
service-account cert (Secret apoxy/apiz-cert).
- list: parses tls.crt from the Secret, prints fingerprint + expiry,
looks up server-side status via GET /v1/terra/serviceaccount/
certificate/<fp>. --all also lists every cert cosmos has for the
project (active + revoked).
- rotate: issues a new cert, atomically swaps Secret data with a
ResourceVersion-gated Update, patches the Deployment pod template
(cert-rotated-at + cert-fingerprint annotations) to trigger a
RollingUpdate. Single-replica controller + maxSurge=1,
maxUnavailable=0 keeps the aggregated APIService routable through
the swap because the old pod's in-memory cert stays valid in cosmos
until explicit revoke. --revoke combines the two; --wait-timeout=0
skips the rollout poll for dev where /healthz aggregates tunnel
readiness.
- revoke: DELETE /v1/terra/serviceaccount/certificate/<fp> with a user
JWT (PropelAuth access token). cosmos refuses API-key auth here so a
leaked API key can't kill the cert it lives next to. JWT precedence:
--user-jwt > APOXY_USER_JWT > ~/.config/apoxy/user-jwt.
Includes pkg/cert/fingerprint.go (SHA1 hex of DER, NormalizeFingerprint)
mirroring apoxy-cloud/core/cert without taking a cosmos module dep.
Unit tests cover the fingerprint helper, the safe-strategy guard
(refuses Recreate or multi-replica without --allow-disruption), and the
JWT precedence chain.
Design + customer guide in apoxy-cloud:
- docs/kube-controller-auth.md
- run/docs/content/docs/guides/rotating-kube-controller-cert.mdx
Integration coverage: //tests/integration/kube-controller (drives the
full install -> list -> rotate flow against dev Tilt cluster in <10s).1 parent b721dfb commit 8c90478
3 files changed
Lines changed: 847 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
0 commit comments