24 Commits
Author SHA1 Message Date
Thibault VINCENTandThibault VINCENT 7ae955e6a0 feat(cabundle): record reflector watch errors via x509_kube_transport_errors_total 2026-06-15 18:12:17 +02:00
Thibault VINCENTandThibault VINCENT a068fc5308 test(k8s): assert bad_passphrase bundle emission, two-source accumulation, JksTryEmpty switch 2026-06-15 18:12:17 +02:00
Thibault VINCENTandThibault VINCENT 52e9c2e66c feat: emit x509_kube_transport_errors_total for LIST/WATCH/informer failures
The Kubernetes source's transport layer had 9 distinct failure sites
that surfaced only as logs: LIST failure (with retry/backoff), WATCH
start failure, WATCH stream Error event, watch flap (close within 5s
of open), and namespace informer sync timeout — once for secrets, once
for configmaps. None had a corresponding metric, so an exporter that
was functionally up but operationally degraded (token rotation drift,
apiserver throttling, intermittent network) was invisible to ops.

Introduce x509_kube_transport_errors_total{source_name,resource,reason}
incremented at each of the 9 sites via a new Recorder interface on
k8s.Options. The interface keeps the source decoupled from
*registry.Registry; nil is valid (the unmetered path keeps the old
log-only behaviour) and tests plug a fake. main.go wires the actual
registry through.

Ship a paired KubeTransportErrors PrometheusRule alert (opt-in via
alertOnKubeTransportErrors, default true). docs/metrics.md documents
the new metric, the five reason codes, and cross-links the alert.
2026-05-25 19:18:58 +02:00
Thibault VINCENTandThibault VINCENT efe153a148 fix(k8s,jks): preserve passphrase resolution cause, sort JKS aliases 2026-05-25 13:06:24 +02:00
Thibault VINCENTandThibault VINCENT cdf7ce8e46 fix(k8s): skip parse on passphraseSecretRef failure when tryEmptyPassphrase false
Same root cause as the passphraseKey fix: when resolveRef fails and
tryEmptyPassphrase is false, the parser was being called with an empty
passphrase, producing a misleading digest error.

resolveRef now returns bool; call sites propagate failure into
passphraseUnavailable using the relevant TryEmpty flag. Tests updated
to assert the new (correct) skip behavior and cover the tryEmpty:true
path that must still fall through.
2026-05-25 13:06:24 +02:00
Thibault VINCENTandThibault VINCENT 17fb83c174 fix(k8s): skip parse when passphraseKey absent and tryEmptyPassphrase false
When passphraseKey is configured but the key is absent from the Secret
and tryEmptyPassphrase is false, the parser was called with an empty
passphrase anyway, producing a misleading 'invalid digest' error. Now
the source emits a bad_passphrase bundle error directly, and the
preceding debug log already names the missing key.
2026-05-25 13:06:24 +02:00
Thibault VINCENTandThibault VINCENT e24b0e7354 fix(log): debug log when passphraseKey is absent from secret data 2026-05-25 13:06:24 +02:00
Thibault VINCENTandThibault VINCENT e95dfcb0bf fix(log): drop source_kind from k8s base logger to avoid collision with SourceRef.Kind 2026-05-25 13:06:24 +02:00
Thibault VINCENTandThibault VINCENT 999e76c4a9 refactor(k8s): log bundle errors and missing secret refs 2026-05-25 13:06:24 +02:00
Thibault VINCENTandThibault VINCENT a8c305ed82 fix(lint): pass ctx in onSecret test call sites 2026-05-15 16:54:25 +02:00
Thibault VINCENTandThibault VINCENT e69b3d0172 fix(lint): contextcheck + gosec nosec + ineffassign + unconvert
Thread ctx through onSecret→fetchPassphrase (contextcheck); suppress
SHA-1 gosec warnings in jceksHMAC with nosec (protocol-mandated by
JKS/JCEKS wire format); drop dead skip initialiser in decodeJCEKS
(ineffassign); remove redundant int64 cast on UnixMilli (unconvert).
2026-05-15 16:54:25 +02:00
Thibault VINCENTandThibault VINCENT 0f013463a6 feat(k8s, config): add jks.passphraseSecretRef for parity with pkcs12 2026-05-15 16:54:25 +02:00
Thibault VINCENTandThibault VINCENT 0f8672e9aa feat(k8s, cmd): wire pkcs12 passphraseSecretRef end-to-end with API lookup 2026-05-15 16:54:25 +02:00
Thibault VINCENTandThibault VINCENT 074db8806a fix(k8s): trim only CR/LF from secret-sourced passphrases, not all whitespace 2026-05-13 17:55:30 +02:00
Thibault VINCENTandThibault VINCENT 19305f0774 feat(config, cmd): wire format: jks + jks: passphrase block 2026-05-13 17:55:30 +02:00
Thibault VINCENTandThibault VINCENT 80b44e80f3 test(cabundle): close audit gaps (rotation, cross-kind, validation, fixtures) 2026-05-13 14:24:36 +02:00
Thibault VINCENTandThibault VINCENT 7610ca68fe feat(cabundle): extend source to APIService and CRD conversion webhooks 2026-05-13 14:24:36 +02:00
Thibault VINCENTandThibault VINCENT 6f8d78396a feat(source/cabundle): watch MWC + VWC caBundles cluster-wide 2026-05-13 14:24:36 +02:00
Thibault VINCENTandThibault VINCENT 4431be6714 test(file): cover SkipUnchanged invalidation on edit 2026-05-13 14:06:52 +02:00
Thibault VINCENTandThibault VINCENT 13222ed141 test(kubeconfig): cover embedded cert rotation in place 2026-05-13 14:06:52 +02:00
Thibault VINCENTandThibault VINCENT f2189b43ca test(k8s): cover Secret rotation and Secret/ConfigMap same-name disambiguation 2026-05-13 14:06:52 +02:00
Thibault VINCENTandThibault VINCENT ab1ce3ad77 feat(k8s): support shell-glob patterns in include/exclude names 2026-05-11 18:16:38 +02:00
Thibault VINCENT 5614977544 refactor: drop pre-v4 leftover debug constant and timing placeholder 2026-05-06 04:56:29 +02:00
Thibault VINCENT aabe4eaa9b refactor(pkg): promote fileglob and source/* from internal 2026-05-06 04:52:48 +02:00