Bound /readyz so kubelet probes cannot hang the Service
/readyz walked the hash chain and opened pooled connections with no libpq connect_timeout, so a 2s kubelet probe never saw a response and the pod stayed unready. Informed Decision accept is blocked on that. Probe health() only, under a 1.5s budget, publish last-known tamper_evidence, and fail TCP handshake in 1s. Integrity stays on /v1/integrity. Assistant: grok Assistant-Session: 01a0a182-bab7-7f11-b32b-d06f3af52082
This commit is contained in:
parent
e7e054d8d6
commit
b0e6792cf0
9 changed files with 276 additions and 18 deletions
|
|
@ -303,6 +303,32 @@ def test_postgres_policy_treats_an_unreadable_attestation_as_absent(tmp_path):
|
|||
assert backend.tamper_evidence_state().reason == "no_attestation"
|
||||
|
||||
|
||||
def test_postgres_readiness_policy_does_not_walk_the_chain(tmp_path):
|
||||
backend = _bare_postgres_backend(tmp_path)
|
||||
|
||||
def _boom(attestation=None):
|
||||
raise AssertionError("/readyz must not walk the chain")
|
||||
|
||||
backend.verify_chain = _boom
|
||||
policy = backend.readiness_policy()
|
||||
assert policy.tamper_evidence is False
|
||||
assert policy.durable is True
|
||||
assert policy.custody_class == "operational"
|
||||
|
||||
|
||||
def test_postgres_readiness_policy_reports_a_cached_claim(tmp_path):
|
||||
from audit_core.integrity import TamperEvidenceState, utc_now
|
||||
|
||||
backend = _bare_postgres_backend(tmp_path)
|
||||
backend.verify_chain = lambda attestation=None: (_ for _ in ()).throw(
|
||||
AssertionError("cached claim must not walk")
|
||||
)
|
||||
backend._tamper_state = TamperEvidenceState(
|
||||
claimed=True, reason="attested", observed_at=utc_now(),
|
||||
)
|
||||
assert backend.readiness_policy().tamper_evidence is True
|
||||
|
||||
|
||||
def test_postgres_policy_drops_the_claim_when_the_chain_cannot_be_walked(tmp_path):
|
||||
from audit_core.integrity import utc_now
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue