fix: pause personal wechat collector
This commit is contained in:
@@ -1293,7 +1293,9 @@ def event_summary(event):
|
||||
"involvedObject": {"kind": involved.get("kind"), "name": involved.get("name")},
|
||||
}
|
||||
related_events = [item for item in (event_summary(e) for e in events.get("items", [])[-30:]) if item]
|
||||
ready = status.get("readyReplicas", 0) >= spec.get("replicas", 1) and rc("deploy") == 0
|
||||
desired_replicas = spec.get("replicas", 1)
|
||||
paused = rc("deploy") == 0 and desired_replicas == 0
|
||||
ready = rc("deploy") == 0 and (paused or status.get("readyReplicas", 0) >= desired_replicas)
|
||||
payload = {
|
||||
"ok": rc("namespace") == 0 and rc("deploy") == 0,
|
||||
"namespace": "${collector.namespace}",
|
||||
@@ -1304,12 +1306,18 @@ payload = {
|
||||
"updatedReplicas": status.get("updatedReplicas", 0),
|
||||
"availableReplicas": status.get("availableReplicas", 0),
|
||||
"ready": ready,
|
||||
"paused": paused,
|
||||
},
|
||||
"pvc": {"present": rc("pvc") == 0, "name": "${collector.storage.name}"},
|
||||
"secret": {"present": rc("secret") == 0, "name": "${collector.secretName}", "valuesPrinted": False},
|
||||
"configMap": {"present": rc("configmap") == 0, "name": "personal-wechat-collector-config"},
|
||||
"pods": [pod_summary(item) for item in pod_items],
|
||||
"logs": {"pod": pod, "exitCode": logs_rc, "tail": text(os.path.join(tmp, "logs.txt")), "stderrTail": text(os.path.join(tmp, "logs.err"), 2000)},
|
||||
"logs": {
|
||||
"pod": pod,
|
||||
"exitCode": 0 if paused else logs_rc,
|
||||
"tail": text(os.path.join(tmp, "logs.txt")),
|
||||
"stderrTail": "collector paused by YAML replicas=0\\n" if paused and not pod else text(os.path.join(tmp, "logs.err"), 2000),
|
||||
},
|
||||
"events": related_events[-12:],
|
||||
"valuesPrinted": False,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user