forked from mtusi2026/mtusi2026lab7
fix(pki): repair active identities without container startup overhead
This commit is contained in:
+16
-1
@@ -36,6 +36,21 @@ print('Operator installed a scoped short-lived leaf')
|
|||||||
def install(role, data):
|
def install(role, data):
|
||||||
payload = {**data, "reload_lb": role == "lb"}
|
payload = {**data, "reload_lb": role == "lb"}
|
||||||
args = ["--profile", "maintenance"] if role == "migrate" else []
|
args = ["--profile", "maintenance"] if role == "migrate" else []
|
||||||
|
service = "identity-" + role
|
||||||
|
if compose(*args, "ps", "--status", "running", "-q", service):
|
||||||
|
# The agent already owns this identity volume. Install with its own UID
|
||||||
|
# and atomic generation switch, without starting a second container.
|
||||||
|
compose(
|
||||||
|
*args,
|
||||||
|
"exec",
|
||||||
|
"-T",
|
||||||
|
service,
|
||||||
|
"python",
|
||||||
|
"-c",
|
||||||
|
INSTALL,
|
||||||
|
input=json.dumps(payload),
|
||||||
|
)
|
||||||
|
return
|
||||||
compose(
|
compose(
|
||||||
*args,
|
*args,
|
||||||
"run",
|
"run",
|
||||||
@@ -44,7 +59,7 @@ def install(role, data):
|
|||||||
"-T",
|
"-T",
|
||||||
"--entrypoint",
|
"--entrypoint",
|
||||||
"python",
|
"python",
|
||||||
"identity-" + role,
|
service,
|
||||||
"-c",
|
"-c",
|
||||||
INSTALL,
|
INSTALL,
|
||||||
input=json.dumps(payload),
|
input=json.dumps(payload),
|
||||||
|
|||||||
@@ -121,6 +121,7 @@ def main():
|
|||||||
def sample_resources():
|
def sample_resources():
|
||||||
while not resource_stop.is_set():
|
while not resource_stop.is_set():
|
||||||
began = time.time()
|
began = time.time()
|
||||||
|
phase = load.phase
|
||||||
try:
|
try:
|
||||||
raw = command(
|
raw = command(
|
||||||
[
|
[
|
||||||
@@ -139,7 +140,7 @@ def main():
|
|||||||
{
|
{
|
||||||
"started_at": began,
|
"started_at": began,
|
||||||
"ended_at": time.time(),
|
"ended_at": time.time(),
|
||||||
"phase": load.phase,
|
"phase": phase,
|
||||||
"containers": observations,
|
"containers": observations,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -366,6 +367,7 @@ def main():
|
|||||||
assert report["images_before"] == report["images_after"], (
|
assert report["images_before"] == report["images_after"], (
|
||||||
"Lifecycle must not rebuild/replace images"
|
"Lifecycle must not rebuild/replace images"
|
||||||
)
|
)
|
||||||
|
assert report["resource_samples"], "No measured CPU/RAM samples"
|
||||||
report["complete"] = True
|
report["complete"] = True
|
||||||
except BaseException as error:
|
except BaseException as error:
|
||||||
report["failure_type"] = type(error).__name__
|
report["failure_type"] = type(error).__name__
|
||||||
|
|||||||
Reference in New Issue
Block a user