@mark1russell7/kind 0.11.11 → 0.11.12

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/build/judge.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { $ as unitOf, $t as secondsOf, A as TriggerV1, At as restartsAt, B as RunCheck, Bt as stoppingOf, C as KindCellResult, Cn as WindowPrediction, Ct as kernelCounts, D as PredictionV1, Dt as recordsOf, E as LoadSample, Et as podsOf, F as KIND_NOISE, Ft as sliceEmptyOf, G as factsOf, Gt as CLIENT, H as checkRun, Ht as tunnelsOf, I as KindDecision, It as sliceReadyAt, J as observationEnd, Jt as PORT, K as judgeKind, Kt as HEALTH_PORT, L as KindVerdict, Lt as sliceReadyOf, M as upgrade, Mt as signalOf, N as upgradeCell, Nt as signalsOf, O as RunCheckV1, On as KubeProxyMode, Ot as requestsOf, P as Deleted, Pt as sliceDropOf, Q as reusesReset, Qt as seconds, R as LAST_SLACK, Rt as slicesOf, S as KindCellRecordV1, Sn as TriggerKind, St as isTunnelState, T as KindVerdictV1, Tt as podsAt, U as cyclesOf, Ut as ztunnelPodsOf, V as RunFacts, Vt as transitionOf, W as deletionsOf, Wt as ztunnelReplaced, X as propagationSource, Xt as SERVER, Y as propagationOf, Yt as REDIS, Z as referenceOf, Zt as bandOf, _ as ClusterManifest, _n as Replica, _t as deletionOf, a as STAGES, an as Flap, at as PropagationSource, b as FORMAT_V1, bn as Template, bt as failuresOf, c as readRecord, cn as KubeletProbe, ct as RulesLine, d as calibrationOf, dn as MeshMode, dt as TCP_STATE, en as showBand, et as updatesOf, f as cellsTable, fn as NonePrediction, ft as TunnelLine, g as BandV1, gn as Reference, gt as byNode, h as timeSpread, hn as RedisDeclaration, ht as byClients, i as quantileOf, in as EdgeProtocol, it as PodLine, j as judge, jt as rulesOf, k as RunFactsV1, kt as restartOf, l as Judged, ln as Mesh, lt as SliceLine, m as predictionText, mn as Prediction, mt as backendsAt, n as medianInterval, nn as Cycle, nt as HBONE_PORT, o as kindCellRecordSchema, on as KindCell, ot as RecordLine, p as medianText, pn as PodSettings, pt as ZtunnelPodLine, q as observationAfter, qt as LOG_LABEL, r as middle, rn as Declaration, rt as Line, s as kindCellRecordV1Schema, sn as KindRun, st as Request, t as RELATIVE, tn as Band, tt as Endpoint, u as TimeSpread, un as MeshFlavor, ut as SocketLine, v as EnvironmentManifest, vn as ResetReuse, vt as dropOf, w as KindCellV1, wn as Workload, wt as outcomesOf, x as KindCellRecord, xn as Trigger, xt as intakeOf, y as FORMAT, yn as Stack, yt as emptyOf, z as Propagated, zt as socketsOf } from "./judge-0ku_4dsJ.js";
1
+ import { $ as unitOf, $t as secondsOf, A as TriggerV1, At as restartsAt, B as RunCheck, Bt as stoppingOf, C as KindCellResult, Cn as WindowPrediction, Ct as kernelCounts, D as PredictionV1, Dt as recordsOf, E as LoadSample, Et as podsOf, F as KIND_NOISE, Ft as sliceEmptyOf, G as factsOf, Gt as CLIENT, H as checkRun, Ht as tunnelsOf, I as KindDecision, It as sliceReadyAt, J as observationEnd, Jt as PORT, K as judgeKind, Kt as HEALTH_PORT, L as KindVerdict, Lt as sliceReadyOf, M as upgrade, Mt as signalOf, N as upgradeCell, Nt as signalsOf, O as RunCheckV1, On as KubeProxyMode, Ot as requestsOf, P as Deleted, Pt as sliceDropOf, Q as reusesReset, Qt as seconds, R as LAST_SLACK, Rt as slicesOf, S as KindCellRecordV1, Sn as TriggerKind, St as isTunnelState, T as KindVerdictV1, Tt as podsAt, U as cyclesOf, Ut as ztunnelPodsOf, V as RunFacts, Vt as transitionOf, W as deletionsOf, Wt as ztunnelReplaced, X as propagationSource, Xt as SERVER, Y as propagationOf, Yt as REDIS, Z as referenceOf, Zt as bandOf, _ as ClusterManifest, _n as Replica, _t as deletionOf, a as STAGES, an as Flap, at as PropagationSource, b as FORMAT_V1, bn as Template, bt as failuresOf, c as readRecord, cn as KubeletProbe, ct as RulesLine, d as calibrationOf, dn as MeshMode, dt as TCP_STATE, en as showBand, et as updatesOf, f as cellsTable, fn as NonePrediction, ft as TunnelLine, g as BandV1, gn as Reference, gt as byNode, h as timeSpread, hn as RedisDeclaration, ht as byClients, i as quantileOf, in as EdgeProtocol, it as PodLine, j as judge, jt as rulesOf, k as RunFactsV1, kt as restartOf, l as Judged, ln as Mesh, lt as SliceLine, m as predictionText, mn as Prediction, mt as backendsAt, n as medianInterval, nn as Cycle, nt as HBONE_PORT, o as kindCellRecordSchema, on as KindCell, ot as RecordLine, p as medianText, pn as PodSettings, pt as ZtunnelPodLine, q as observationAfter, qt as LOG_LABEL, r as middle, rn as Declaration, rt as Line, s as kindCellRecordV1Schema, sn as KindRun, st as Request, t as RELATIVE, tn as Band, tt as Endpoint, u as TimeSpread, un as MeshFlavor, ut as SocketLine, v as EnvironmentManifest, vn as ResetReuse, vt as dropOf, w as KindCellV1, wn as Workload, wt as outcomesOf, x as KindCellRecord, xn as Trigger, xt as intakeOf, y as FORMAT, yn as Stack, yt as emptyOf, z as Propagated, zt as socketsOf } from "./judge-BKe6dJ3O.js";
2
2
  export { type Band, type BandV1, CLIENT, type ClusterManifest, type Cycle, type Declaration, type Deleted, type EdgeProtocol, Endpoint, type EnvironmentManifest, FORMAT, FORMAT_V1, type Flap, 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, type NonePrediction, 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, cyclesOf, 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, sliceReadyAt, sliceReadyOf, slicesOf, socketsOf, stoppingOf, timeSpread, transitionOf, tunnelsOf, unitOf, updatesOf, upgrade, upgradeCell, ztunnelPodsOf, ztunnelReplaced };
package/build/judge.js CHANGED
@@ -1 +1 @@
1
- export { pt as CLIENT, u as FORMAT, d as FORMAT_V1, P as HBONE_PORT, mt as HEALTH_PORT, h as KIND_NOISE, g as LAST_SLACK, ht as LOG_LABEL, gt as PORT, _t as REDIS, A as RELATIVE, vt as SERVER, t as STAGES, F as TCP_STATE, I as backendsAt, yt as bandOf, L as byClients, R as byNode, a as calibrationOf, o as cellsTable, _ as checkRun, v as cyclesOf, z as deletionOf, y as deletionsOf, B as dropOf, V as emptyOf, b as factsOf, H as failuresOf, U as intakeOf, W as isTunnelState, f as judge, x as judgeKind, G as kernelCounts, n as kindCellRecordSchema, r as kindCellRecordV1Schema, j as medianInterval, s as medianText, M as middle, S as observationAfter, C as observationEnd, K as outcomesOf, q as podsAt, J as podsOf, c as predictionText, w as propagationOf, T as propagationSource, N as quantileOf, i as readRecord, Y as recordsOf, E as referenceOf, X as requestsOf, Z as restartOf, Q as restartsAt, D as reusesReset, $ as rulesOf, bt as seconds, xt as secondsOf, St as showBand, et as signalOf, tt as signalsOf, nt as sliceDropOf, rt as sliceEmptyOf, it as sliceReadyAt, at as sliceReadyOf, ot as slicesOf, st as socketsOf, ct as stoppingOf, l as timeSpread, lt as transitionOf, ut as tunnelsOf, O as unitOf, k as updatesOf, p as upgrade, m as upgradeCell, dt as ztunnelPodsOf, ft as ztunnelReplaced } from "./judge-CLBiWALR.js";
1
+ export { pt as CLIENT, u as FORMAT, d as FORMAT_V1, P as HBONE_PORT, mt as HEALTH_PORT, h as KIND_NOISE, g as LAST_SLACK, ht as LOG_LABEL, gt as PORT, _t as REDIS, A as RELATIVE, vt as SERVER, t as STAGES, F as TCP_STATE, I as backendsAt, yt as bandOf, L as byClients, R as byNode, a as calibrationOf, o as cellsTable, _ as checkRun, v as cyclesOf, z as deletionOf, y as deletionsOf, B as dropOf, V as emptyOf, b as factsOf, H as failuresOf, U as intakeOf, W as isTunnelState, f as judge, x as judgeKind, G as kernelCounts, n as kindCellRecordSchema, r as kindCellRecordV1Schema, j as medianInterval, s as medianText, M as middle, S as observationAfter, C as observationEnd, K as outcomesOf, q as podsAt, J as podsOf, c as predictionText, w as propagationOf, T as propagationSource, N as quantileOf, i as readRecord, Y as recordsOf, E as referenceOf, X as requestsOf, Z as restartOf, Q as restartsAt, D as reusesReset, $ as rulesOf, bt as seconds, xt as secondsOf, St as showBand, et as signalOf, tt as signalsOf, nt as sliceDropOf, rt as sliceEmptyOf, it as sliceReadyAt, at as sliceReadyOf, ot as slicesOf, st as socketsOf, ct as stoppingOf, l as timeSpread, lt as transitionOf, ut as tunnelsOf, O as unitOf, k as updatesOf, p as upgrade, m as upgradeCell, dt as ztunnelPodsOf, ft as ztunnelReplaced } from "./judge-n0rL_RR0.js";
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.11.11",
4
+ "version": "0.11.12",
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",
package/src/compose.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  // The composition of the service of a kind cell. The app of the image and `lint()` compose the same
2
2
  // service from the same declaration: the image copies this file, and Node strips its types. Thus
3
3
  // this file imports only packages and types.
4
- import type { CheckFn, HealthServer, ServiceBuilder, TransportImpl } from "@mark1russell7/service";
4
+ import type { CheckFn, Coupling, Health, HealthServer, ProbeAnswer, ServiceBuilder, TransportImpl } from "@mark1russell7/service";
5
5
  import { service } from "@mark1russell7/service";
6
6
  import type { RedisClient } from "@mark1russell7/service/redis";
7
7
  import type { Declaration } from "./cell.ts";
@@ -22,6 +22,38 @@ export const FLAG_CHECK = "self.flag";
22
22
  /** This name is the watchdog of the event loop. */
23
23
  export const WATCHDOG = "self.event-loop";
24
24
 
25
+ /**
26
+ * This function gives the health server of the shared gate (S6, candidate E). Its readiness probe
27
+ * leaves out each check of `dependency`, a dependency that each replica shares. The controller still
28
+ * reads each check, thus the service still refuses each request at once with a 503. The other
29
+ * probes, and the readiness of a controller, answer as before.
30
+ *
31
+ * The probe passes when the service is started and not in the drain, and liveness does not fail
32
+ * readiness through a coupling. Each readiness check of another dependency, or of no dependency,
33
+ * must also be released.
34
+ */
35
+ export const sharedGate = (server: HealthServer, dependency: string, couplings: readonly Coupling[]): HealthServer => {
36
+ const gated = (health: Health): Health => ({
37
+ verdict: () => health.verdict(),
38
+ metrics: () => health.metrics(),
39
+ subscribe: (listener) => health.subscribe(listener),
40
+ forceFail: (name, on) => health.forceFail(name, on),
41
+ drain: () => health.drain(),
42
+ stop: () => health.stop(),
43
+ probe(kind, controller): ProbeAnswer {
44
+ const answer = health.probe(kind, controller);
45
+ if (kind !== "readiness" || controller !== undefined) return answer;
46
+ const verdict = health.verdict();
47
+ const coupled = couplings.some((coupling) => coupling.from === "liveness" && coupling.to === "readiness") && !verdict.alive;
48
+ const checks = Object.values(verdict.checks).every((check) => check.gates !== "readiness" || check.dependency === dependency || check.tripped !== true);
49
+ const dependencies = Object.entries(verdict.dependencies).every(([name, up]) => name === dependency || up);
50
+ const pass = verdict.started && !verdict.draining && !coupled && checks && dependencies;
51
+ return { ...answer, status: pass ? 200 : 503, body: { ...answer.body, status: pass ? "pass" : "fail" } };
52
+ },
53
+ });
54
+ return { listen: (health) => server.listen(gated(health)), close: () => server.close() };
55
+ };
56
+
25
57
  /**
26
58
  * This function composes the service of a declaration: its policies, its couplings, its checks,
27
59
  * one server, one controller and each stage of the shutdown. A declaration with Redis needs the
@@ -64,7 +96,10 @@ export const compose = (name: string, declaration: Declaration, parts: Parts = {
64
96
  const controller = svc.controller(CONTROLLER);
65
97
  if (declaration.redis !== null) controller.requires(parts.redis!.name);
66
98
  controller.route(ROUTE, { idempotent: true });
67
- if (parts.health !== undefined) svc.healthServer(parts.health);
99
+ // the shared gate keeps the checks of Redis out of the readiness that the kubelet reads
100
+ if (declaration.sharedGate === true && declaration.redis === null) throw new Error(`${name} has the shared gate, but it declares no Redis`);
101
+ if (parts.health !== undefined)
102
+ svc.healthServer(declaration.sharedGate === true ? sharedGate(parts.health, parts.redis!.name, declaration.couplings) : parts.health);
68
103
  for (const [stage, cap] of declaration.phases) svc.phase(stage, cap);
69
104
  return svc;
70
105
  };