Проверять смену сертификатов без рестарта и разделить бюджет health-check

This commit is contained in:
2026-11-22 20:50:55 +03:00
parent 341b6b887d
commit b9b6ece535
9 changed files with 9209 additions and 3 deletions
+16
View File
@@ -85,6 +85,22 @@ def metadata():
)
def lb_worker_pid():
# Return only the public native worker PID, never raw admin socket output.
script = """import socket
s=socket.socket(socket.AF_UNIX);s.settimeout(5)
s.connect('/proc/1/root/tmp/admin.sock');s.sendall(b'show info\\n')
s.shutdown(socket.SHUT_WR);chunks=[]
while True:
part=s.recv(4096)
if not part:break
chunks.append(part)
s.close()
print(next(line.split(':',1)[1].strip() for line in b''.join(chunks).decode().splitlines() if line.startswith('Pid:')))
"""
return int(compose("exec", "-T", "identity-lb", "python", "-c", script))
def reload_lb():
compose(
"exec",
+8
View File
@@ -160,8 +160,13 @@ def main():
def renewal():
before = pki.metadata()
native_pid_before = pki.lb_worker_pid()
time.sleep(100)
after = pki.metadata()
native_pid_after = pki.lb_worker_pid()
assert native_pid_before == native_pid_after, (
"Ordinary leaf renewal restarted the native load balancer"
)
roles = set(before) - {"migrate"}
assert roles and all(
before[r]["serial"] != after[r]["serial"] for r in roles
@@ -179,6 +184,9 @@ def main():
"after": after,
"all_active_serials_changed": True,
"api_token_renewed": True,
"native_lb_worker_pid_before": native_pid_before,
"native_lb_worker_pid_after": native_pid_after,
"native_lb_worker_not_restarted": True,
}
phase("automatic_renewal", renewal)