Реализовать лабораторную 7: mTLS, OpenBao и защита worker
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
"""Wait for distinct ready replicas through verified HTTPS ingress."""
|
||||
import argparse,ssl,time,urllib.request
|
||||
p=argparse.ArgumentParser();p.add_argument('--replicas',type=int,default=2);args=p.parse_args()
|
||||
ctx=ssl.create_default_context(cafile='.secrets/ca.crt');seen=set()
|
||||
for attempt in range(120):
|
||||
try:
|
||||
with urllib.request.urlopen('https://localhost:8443/health/ready',context=ctx,timeout=4) as r:
|
||||
if r.status==200:
|
||||
seen.add(r.headers['X-Instance-Id'])
|
||||
if len(seen)>=args.replicas:
|
||||
print(f'HTTPS ready: {len(seen)} distinct replicas; CA and hostname verified');break
|
||||
except Exception:pass
|
||||
time.sleep(.5)
|
||||
else:raise SystemExit('HTTPS replica readiness timeout')
|
||||
Reference in New Issue
Block a user