@mark1russell7/kind 0.8.1 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/build/index.d.ts +28 -2
- package/build/index.js +84 -3
- package/build/index.js.map +1 -1
- package/build/{judge-gpC49mVw.d.ts → judge-BD4UVQfy.d.ts} +4 -2
- package/build/{judge-Cgvkh4JX.js → judge-BbLWVTYj.js} +4 -3
- package/build/{judge-Cgvkh4JX.js.map → judge-BbLWVTYj.js.map} +1 -1
- package/build/judge.d.ts +1 -1
- package/build/judge.js +1 -1
- package/image/watch.mjs +27 -11
- package/package.json +3 -3
package/build/judge.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as updatesOf, $t as Declaration, A as TriggerV1, At as rulesOf, B as RunCheck, Bt as ztunnelPodsOf, C as KindCellResult, Ct as outcomesOf, D as PredictionV1, Dt as requestsOf, E as LoadSample, Et as recordsOf, F as KIND_NOISE, Ft as slicesOf, G as judgeKind, Gt as PORT, H as checkRun, Ht as CLIENT, I as KindDecision, It as socketsOf, J as propagationOf, Jt as bandOf, K as observationAfter, Kt as REDIS, L as KindVerdict, Lt as stoppingOf, M as upgrade, Mt as signalsOf, N as upgradeCell, Nt as sliceDropOf, O as RunCheckV1, Ot as restartOf, P as Deleted, Pt as sliceEmptyOf, Q as unitOf, Qt as Band, R as LAST_SLACK, Rt as transitionOf, S as KindCellRecordV1, St as kernelCounts, T as KindVerdictV1, Tt as podsOf, U as deletionsOf, Ut as HEALTH_PORT, V as RunFacts, Vt as ztunnelReplaced, W as factsOf, Wt as LOG_LABEL, X as referenceOf, Xt as secondsOf, Y as propagationSource, Yt as seconds, Z as reusesReset, Zt as showBand, _ as ClusterManifest, _n as Workload, _t as dropOf, a as STAGES, an as MeshMode, at as RecordLine, b as FORMAT_V1, bt as intakeOf, c as readRecord, cn as RedisDeclaration, ct as SliceLine, d as calibrationOf, dn as ResetReuse, dt as TunnelLine, en as KindCell, et as Endpoint, f as cellsTable, fn as Stack, ft as ZtunnelPodLine, g as BandV1, gn as WindowPrediction, gt as deletionOf, h as timeSpread, hn as TriggerKind, ht as byNode, i as quantileOf, in as MeshFlavor, it as PropagationSource, j as judge, jt as signalOf, k as RunFactsV1, kt as restartsAt, l as Judged, ln as Reference, lt as SocketLine, m as predictionText, mn as Trigger, mt as byClients, n as medianInterval, nn as KubeletProbe, nt as Line, o as kindCellRecordSchema, on as PodSettings, ot as Request, p as medianText, pn as Template, pt as backendsAt, q as observationEnd, qt as SERVER, r as middle, rn as Mesh, rt as PodLine, s as kindCellRecordV1Schema, sn as Prediction, st as RulesLine, t as RELATIVE, tn as KindRun, tt as HBONE_PORT, u as TimeSpread, un as Replica, ut as TCP_STATE, v as EnvironmentManifest, vt as emptyOf, w as KindCellV1, wt as podsAt, x as KindCellRecord, xn as KubeProxyMode, xt as isTunnelState, y as FORMAT, yt as failuresOf, z as Propagated, zt as tunnelsOf } from "./judge-
|
|
1
|
+
import { $ as updatesOf, $t as Declaration, A as TriggerV1, At as rulesOf, B as RunCheck, Bt as ztunnelPodsOf, C as KindCellResult, Ct as outcomesOf, D as PredictionV1, Dt as requestsOf, E as LoadSample, Et as recordsOf, F as KIND_NOISE, Ft as slicesOf, G as judgeKind, Gt as PORT, H as checkRun, Ht as CLIENT, I as KindDecision, It as socketsOf, J as propagationOf, Jt as bandOf, K as observationAfter, Kt as REDIS, L as KindVerdict, Lt as stoppingOf, M as upgrade, Mt as signalsOf, N as upgradeCell, Nt as sliceDropOf, O as RunCheckV1, Ot as restartOf, P as Deleted, Pt as sliceEmptyOf, Q as unitOf, Qt as Band, R as LAST_SLACK, Rt as transitionOf, S as KindCellRecordV1, St as kernelCounts, T as KindVerdictV1, Tt as podsOf, U as deletionsOf, Ut as HEALTH_PORT, V as RunFacts, Vt as ztunnelReplaced, W as factsOf, Wt as LOG_LABEL, X as referenceOf, Xt as secondsOf, Y as propagationSource, Yt as seconds, Z as reusesReset, Zt as showBand, _ as ClusterManifest, _n as Workload, _t as dropOf, a as STAGES, an as MeshMode, at as RecordLine, b as FORMAT_V1, bt as intakeOf, c as readRecord, cn as RedisDeclaration, ct as SliceLine, d as calibrationOf, dn as ResetReuse, dt as TunnelLine, en as KindCell, et as Endpoint, f as cellsTable, fn as Stack, ft as ZtunnelPodLine, g as BandV1, gn as WindowPrediction, gt as deletionOf, h as timeSpread, hn as TriggerKind, ht as byNode, i as quantileOf, in as MeshFlavor, it as PropagationSource, j as judge, jt as signalOf, k as RunFactsV1, kt as restartsAt, l as Judged, ln as Reference, lt as SocketLine, m as predictionText, mn as Trigger, mt as byClients, n as medianInterval, nn as KubeletProbe, nt as Line, o as kindCellRecordSchema, on as PodSettings, ot as Request, p as medianText, pn as Template, pt as backendsAt, q as observationEnd, qt as SERVER, r as middle, rn as Mesh, rt as PodLine, s as kindCellRecordV1Schema, sn as Prediction, st as RulesLine, t as RELATIVE, tn as KindRun, tt as HBONE_PORT, u as TimeSpread, un as Replica, ut as TCP_STATE, v as EnvironmentManifest, vt as emptyOf, w as KindCellV1, wt as podsAt, x as KindCellRecord, xn as KubeProxyMode, xt as isTunnelState, y as FORMAT, yt as failuresOf, z as Propagated, zt as tunnelsOf } from "./judge-BD4UVQfy.js";
|
|
2
2
|
export { type Band, type BandV1, CLIENT, type ClusterManifest, type Declaration, type Deleted, Endpoint, type EnvironmentManifest, FORMAT, FORMAT_V1, HBONE_PORT, HEALTH_PORT, type Judged, KIND_NOISE, type KindCell, type KindCellRecord, type KindCellRecordV1, type KindCellResult, type KindCellV1, type KindDecision, type KindRun, type KindVerdict, type KindVerdictV1, type KubeProxyMode, type KubeletProbe, LAST_SLACK, LOG_LABEL, Line, type LoadSample, type Mesh, type MeshFlavor, type MeshMode, PORT, PodLine, type PodSettings, type Prediction, type PredictionV1, type Propagated, PropagationSource, REDIS, RELATIVE, RecordLine, type RedisDeclaration, type Reference, type Replica, Request, type ResetReuse, RulesLine, type RunCheck, type RunCheckV1, type RunFacts, type RunFactsV1, SERVER, STAGES, SliceLine, SocketLine, type Stack, TCP_STATE, type Template, type TimeSpread, type Trigger, type TriggerKind, type TriggerV1, TunnelLine, type WindowPrediction, type Workload, ZtunnelPodLine, backendsAt, bandOf, byClients, byNode, calibrationOf, cellsTable, checkRun, deletionOf, deletionsOf, dropOf, emptyOf, factsOf, failuresOf, intakeOf, isTunnelState, judge, judgeKind, kernelCounts, kindCellRecordSchema, kindCellRecordV1Schema, medianInterval, medianText, middle, observationAfter, observationEnd, outcomesOf, podsAt, podsOf, predictionText, propagationOf, propagationSource, quantileOf, readRecord, recordsOf, referenceOf, requestsOf, restartOf, restartsAt, reusesReset, rulesOf, seconds, secondsOf, showBand, signalOf, signalsOf, sliceDropOf, sliceEmptyOf, slicesOf, socketsOf, stoppingOf, timeSpread, transitionOf, tunnelsOf, unitOf, updatesOf, upgrade, upgradeCell, ztunnelPodsOf, ztunnelReplaced };
|
package/build/judge.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { ut as CLIENT, u as FORMAT, d as FORMAT_V1, N as HBONE_PORT, dt as HEALTH_PORT, h as KIND_NOISE, g as LAST_SLACK, ft as LOG_LABEL, pt as PORT, mt as REDIS, k as RELATIVE, ht as SERVER, t as STAGES, P as TCP_STATE, F as backendsAt, gt as bandOf, I as byClients, L as byNode, a as calibrationOf, o as cellsTable, _ as checkRun, R as deletionOf, v as deletionsOf, z as dropOf, B as emptyOf, y as factsOf, V as failuresOf, H as intakeOf, U as isTunnelState, f as judge, b as judgeKind, W as kernelCounts, n as kindCellRecordSchema, r as kindCellRecordV1Schema, A as medianInterval, s as medianText, j as middle, x as observationAfter, S as observationEnd, G as outcomesOf, K as podsAt, q as podsOf, c as predictionText, C as propagationOf, w as propagationSource, M as quantileOf, i as readRecord, J as recordsOf, T as referenceOf, Y as requestsOf, X as restartOf, Z as restartsAt, E as reusesReset, Q as rulesOf, _t as seconds, vt as secondsOf, yt as showBand, $ as signalOf, et as signalsOf, tt as sliceDropOf, nt as sliceEmptyOf, rt as slicesOf, it as socketsOf, at as stoppingOf, l as timeSpread, ot as transitionOf, st as tunnelsOf, D as unitOf, O as updatesOf, p as upgrade, m as upgradeCell, ct as ztunnelPodsOf, lt as ztunnelReplaced } from "./judge-
|
|
1
|
+
export { ut as CLIENT, u as FORMAT, d as FORMAT_V1, N as HBONE_PORT, dt as HEALTH_PORT, h as KIND_NOISE, g as LAST_SLACK, ft as LOG_LABEL, pt as PORT, mt as REDIS, k as RELATIVE, ht as SERVER, t as STAGES, P as TCP_STATE, F as backendsAt, gt as bandOf, I as byClients, L as byNode, a as calibrationOf, o as cellsTable, _ as checkRun, R as deletionOf, v as deletionsOf, z as dropOf, B as emptyOf, y as factsOf, V as failuresOf, H as intakeOf, U as isTunnelState, f as judge, b as judgeKind, W as kernelCounts, n as kindCellRecordSchema, r as kindCellRecordV1Schema, A as medianInterval, s as medianText, j as middle, x as observationAfter, S as observationEnd, G as outcomesOf, K as podsAt, q as podsOf, c as predictionText, C as propagationOf, w as propagationSource, M as quantileOf, i as readRecord, J as recordsOf, T as referenceOf, Y as requestsOf, X as restartOf, Z as restartsAt, E as reusesReset, Q as rulesOf, _t as seconds, vt as secondsOf, yt as showBand, $ as signalOf, et as signalsOf, tt as sliceDropOf, nt as sliceEmptyOf, rt as slicesOf, it as socketsOf, at as stoppingOf, l as timeSpread, ot as transitionOf, st as tunnelsOf, D as unitOf, O as updatesOf, p as upgrade, m as upgradeCell, ct as ztunnelPodsOf, lt as ztunnelReplaced } from "./judge-BbLWVTYj.js";
|
package/image/watch.mjs
CHANGED
|
@@ -37,10 +37,26 @@ const flush = () => {
|
|
|
37
37
|
setInterval(flush, 50);
|
|
38
38
|
const say = (line) => pending.push(`${JSON.stringify(line)}\n`);
|
|
39
39
|
|
|
40
|
+
/**
|
|
41
|
+
* A handler gives this value for an ERROR event of 410 Gone: the API has no history from the last
|
|
42
|
+
* resource version. The status of the response is 200, thus only the event tells. The watch then
|
|
43
|
+
* opens again with no resource version, and the API gives each object again as ADDED.
|
|
44
|
+
*/
|
|
45
|
+
const GONE = Symbol("gone");
|
|
46
|
+
/** the result of a handler for an ERROR event: GONE for an expired resource version, else null */
|
|
47
|
+
const errorOf = (status) => (status?.code === 410 ? GONE : null);
|
|
48
|
+
|
|
40
49
|
/** a stream of lines from the API, again after each end, from the last resource version it saw */
|
|
41
50
|
const stream = (path, query, onLine, again = true) => {
|
|
42
51
|
let version = null;
|
|
43
52
|
const open = () => {
|
|
53
|
+
// An error and a close can both end one request: only the first opens the next one.
|
|
54
|
+
let ended = false;
|
|
55
|
+
const reopen = (delay) => {
|
|
56
|
+
if (!again || ended) return;
|
|
57
|
+
ended = true;
|
|
58
|
+
setTimeout(open, delay);
|
|
59
|
+
};
|
|
44
60
|
const search = new URLSearchParams(query);
|
|
45
61
|
if (version !== null) search.set("resourceVersion", version);
|
|
46
62
|
const req = https.request(
|
|
@@ -50,7 +66,7 @@ const stream = (path, query, onLine, again = true) => {
|
|
|
50
66
|
say({ ev: "watch-fail", t: now(), path, status: res.statusCode });
|
|
51
67
|
res.resume();
|
|
52
68
|
if (res.statusCode === 410) version = null;
|
|
53
|
-
|
|
69
|
+
reopen(500);
|
|
54
70
|
return;
|
|
55
71
|
}
|
|
56
72
|
let partial = "";
|
|
@@ -63,18 +79,18 @@ const stream = (path, query, onLine, again = true) => {
|
|
|
63
79
|
for (const text of split) {
|
|
64
80
|
if (text.trim() === "") continue;
|
|
65
81
|
const next = onLine(text, t);
|
|
66
|
-
if (
|
|
82
|
+
if (next === GONE) version = null;
|
|
83
|
+
else if (typeof next === "string") version = next;
|
|
67
84
|
}
|
|
68
85
|
});
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
res.on("error", () => undefined);
|
|
86
|
+
// A response that the connection cuts has no end, only its error and its close.
|
|
87
|
+
res.on("error", (error) => say({ ev: "watch-fail", t: now(), path, why: String(error.message) }));
|
|
88
|
+
res.on("close", () => reopen(100));
|
|
73
89
|
},
|
|
74
90
|
);
|
|
75
91
|
req.on("error", (error) => {
|
|
76
92
|
say({ ev: "watch-fail", t: now(), path, why: String(error.message) });
|
|
77
|
-
|
|
93
|
+
reopen(500);
|
|
78
94
|
});
|
|
79
95
|
req.end();
|
|
80
96
|
};
|
|
@@ -149,7 +165,7 @@ for (const ns of namespaces) {
|
|
|
149
165
|
if (event.type === "BOOKMARK") return pod?.metadata?.resourceVersion;
|
|
150
166
|
if (event.type === "ERROR") {
|
|
151
167
|
say({ ev: "watch-fail", t, path: "pods", status: pod?.code });
|
|
152
|
-
return
|
|
168
|
+
return errorOf(pod);
|
|
153
169
|
}
|
|
154
170
|
const ready = (pod.status?.conditions ?? []).find((condition) => condition.type === "Ready")?.status === "True";
|
|
155
171
|
const containers = (pod.status?.containerStatuses ?? []).map((status) => ({
|
|
@@ -189,7 +205,7 @@ for (const ns of namespaces) {
|
|
|
189
205
|
const event = JSON.parse(text);
|
|
190
206
|
const slice = event.object;
|
|
191
207
|
if (event.type === "BOOKMARK") return slice?.metadata?.resourceVersion;
|
|
192
|
-
if (event.type === "ERROR") return
|
|
208
|
+
if (event.type === "ERROR") return errorOf(slice);
|
|
193
209
|
say({
|
|
194
210
|
ev: "slice",
|
|
195
211
|
t,
|
|
@@ -212,7 +228,7 @@ for (const ns of namespaces) {
|
|
|
212
228
|
const event = JSON.parse(text);
|
|
213
229
|
const object = event.object;
|
|
214
230
|
if (event.type === "BOOKMARK") return object?.metadata?.resourceVersion;
|
|
215
|
-
if (event.type === "ERROR") return
|
|
231
|
+
if (event.type === "ERROR") return errorOf(object);
|
|
216
232
|
say({
|
|
217
233
|
ev: "event",
|
|
218
234
|
t,
|
|
@@ -236,7 +252,7 @@ if (ztunnel) {
|
|
|
236
252
|
if (event.type === "BOOKMARK") return pod?.metadata?.resourceVersion;
|
|
237
253
|
if (event.type === "ERROR") {
|
|
238
254
|
say({ ev: "watch-fail", t, path: "ztunnel pods", status: pod?.code });
|
|
239
|
-
return
|
|
255
|
+
return errorOf(pod);
|
|
240
256
|
}
|
|
241
257
|
const containers = (pod.status?.containerStatuses ?? []).map((status) => ({ n: status.name, r: status.ready, rc: status.restartCount, st: stateOf(status.state), id: status.containerID ?? null }));
|
|
242
258
|
say({ ev: "ztunnel-pod", t, type: event.type, name: pod.metadata.name, node: pod.spec?.nodeName ?? null, ip: pod.status?.podIP ?? null, del: pod.metadata.deletionTimestamp !== undefined, cs: containers });
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "@mark1russell7/kind",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.9.0",
|
|
5
5
|
"description": "Kubernetes in Docker as a lab for connection timers: a kind cluster from a scenario, faults in the namespaces of its pods, observations on the one monotonic clock of the VM, and predictions from the ordering law. Its judge entry reads and judges a raw record without Docker.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"kubernetes",
|
|
@@ -65,9 +65,9 @@
|
|
|
65
65
|
"node": ">=22.19"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@mark1russell7/harness": "^0.12.
|
|
68
|
+
"@mark1russell7/harness": "^0.12.4",
|
|
69
69
|
"@mark1russell7/quantity": "^0.2.0",
|
|
70
|
-
"@mark1russell7/service": "^0.5.
|
|
70
|
+
"@mark1russell7/service": "^0.5.11",
|
|
71
71
|
"testcontainers": "12.2.0"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|