@mark1russell7/kind 0.9.0 → 0.10.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 CHANGED
@@ -202,6 +202,7 @@ The plan's `event:clock-jump` has no trigger. A step of CLOCK_REALTIME in the VM
202
202
  `predict.ts` gives each band from the declaration, the pod settings and the calibration of the propagation:
203
203
 
204
204
  - **A deletion.** The listener of a leaving pod stays open for its preStop sleep and the hold of `fail readiness`. A connection fails when the rules of its node select the pod after that. `rules.ts` gives O04 with the hold as data, and `lint()` decides it.
205
+ - **The way that a plan stops a pod.** `stopOf(cell)` reads it from the trigger: a deletion, a liveness restart, a crash, or null when the plan stops no pod. `lintCell()` gives each cell only the drain rules that guard its way (`lintStop()` of the service). A plan that stops no pod gets each drain rule. A crash gets no drain rule, and its finding of `stop` depends.
205
206
  - **A pause of kube-proxy** keeps the rules of one node for its hold. The window on that node ends one propagation after the pause. A SYN_SENT entry of an earlier run lives up to 122 s, thus the window also opens up to 122 s before the intake. `predictionText` writes each end of a window with its band, for example `the intake + [-122, 4.605] s`.
206
207
  - **A reset from a leaving pod** leaves the conntrack entry of its flow in CLOSE for 10 s, with the NAT to that pod. From 0.1.6, a window can give that life (`afterReset`). Then a request outside the window can fail with the outcome of the rule (`reusesReset`). The condition is a reset of the same client on the same port, up to that life before the request. The catalog gives it to a deletion without a hold, in the modes with the NAT in conntrack.
207
208
  - **A fault of a shared dependency** trips the readiness latch of each replica (`failSpan`). Then the kubelet needs its threshold of probes, and the rules need one propagation.
package/build/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { $ as updatesOf, $t as Declaration, A as TriggerV1, An as scenario, At as rulesOf, B as RunCheck, Bt as ztunnelPodsOf, C as KindCellResult, Cn as NodeImage, Ct as outcomesOf, D as PredictionV1, Dn as kindConfig, Dt as requestsOf, E as LoadSample, En as goDuration, 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, On as kubeProxyPatch, 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, Sn as NODE_IMAGES, St as kernelCounts, T as KindVerdictV1, Tn as cidrRange, 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, bn as KindScenario, 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, jn as scenarioProblems, jt as signalOf, k as RunFactsV1, kn as nodeNames, 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, vn as KUBE_PROXY_MODES, vt as emptyOf, w as KindCellV1, wn as cidrOverlap, wt as podsAt, x as KindCellRecord, xn as KubeProxyMode, xt as isTunnelState, y as FORMAT, yn as KindConfig, yt as failuresOf, z as Propagated, zt as tunnelsOf } from "./judge-BD4UVQfy.js";
2
2
  import { Quantity } from "@mark1russell7/quantity";
3
- import { CheckFn, Finding, HealthServer, Poll, Rule, Scenario, ServiceBuilder, ServiceDescription, Stage, Timing, TransportImpl, Verdict } from "@mark1russell7/service";
3
+ import { CheckFn, Finding, HealthServer, Poll, Rule, Scenario, ServiceBuilder, ServiceDescription, Stage, StopWay, Timing, TransportImpl, Verdict } from "@mark1russell7/service";
4
4
  import { RedisClient } from "@mark1russell7/service/redis";
5
5
  //#region src/backends.d.ts
6
6
  /** A service rule names the Service whose backends the agent reads: its namespace, its name, and its ClusterIP and port for IPVS. */
@@ -649,7 +649,7 @@ export declare const O09: Rule;
649
649
  export declare const O10: Rule;
650
650
  /** O16: the cooperative window is shorter than the drain, which is shorter than the grace less the preStop sleep. */
651
651
  export declare const O16: Rule;
652
- /** These are the rules of the drain that each kind cell gets. */
652
+ /** These are the rules of the drain. A kind cell gets the rules that guard the way that its plan stops a pod. */
653
653
  export declare const DRAIN_RULES: readonly Rule[];
654
654
  /**
655
655
  * This function gives the scenario of a cell for `lint()`: the preStop sleep, the grace, the probe
@@ -658,7 +658,19 @@ export declare const DRAIN_RULES: readonly Rule[];
658
658
  export declare const scenarioOf: (cell: KindCell, propagation: Propagation) => Scenario;
659
659
  /** A verdict set is the verdict of each drain rule for one declaration, by the identifier of the rule. */
660
660
  type Verdicts = Readonly<Record<string, Verdict>>;
661
- /** This function applies the drain rules to the description of a cell, and gives each finding. */
661
+ /**
662
+ * This function gives the way that the fault plan of a cell stops a pod, or null when the plan stops no pod.
663
+ * - A deletion, a rolling update, a node drain, a scale-in and a rollout delete a pod with its grace.
664
+ * - In T07 a pause of kube-proxy comes before a deletion. In T18 the pause is on Redis.
665
+ * - The crash of the lab is SIGKILL from the node. Like a crash, it has no preStop hook and no drain.
666
+ * - The other faults are on a link, on Redis or on the process. The kubelet can restart a pod after them.
667
+ */
668
+ export declare const stopOf: (cell: KindCell) => StopWay | null;
669
+ /**
670
+ * This function applies the drain rules to the description of a cell, and gives each finding. A cell
671
+ * whose plan stops a pod gets the rules of that way (`lintStop()`). A plan that stops no pod gets each
672
+ * drain rule, because a restart by the kubelet or a later deletion can follow its fault.
673
+ */
662
674
  export declare const lintCell: (description: ServiceDescription, cell: KindCell, propagation: Propagation) => Finding[];
663
675
  /** This function gives the verdict of each drain rule, by its identifier. */
664
676
  export declare const verdictsOf: (findings: readonly Finding[]) => Verdicts;
package/build/index.js CHANGED
@@ -7,7 +7,7 @@ import { promisify } from "node:util";
7
7
  import { createHash } from "node:crypto";
8
8
  import { fileURLToPath } from "node:url";
9
9
  import { gunzipSync } from "node:zlib";
10
- import { failSpan, lint, service } from "@mark1russell7/service";
10
+ import { failSpan, lint, lintStop, service } from "@mark1russell7/service";
11
11
  import { createRequire } from "node:module";
12
12
  import { tmpdir } from "node:os";
13
13
  import { harnessImage, imageOf } from "@mark1russell7/harness";
@@ -2657,7 +2657,7 @@ const O16 = {
2657
2657
  }] }
2658
2658
  }]
2659
2659
  };
2660
- /** These are the rules of the drain that each kind cell gets. */
2660
+ /** These are the rules of the drain. A kind cell gets the rules that guard the way that its plan stops a pod. */
2661
2661
  const DRAIN_RULES = [
2662
2662
  O04,
2663
2663
  O09,
@@ -2685,8 +2685,44 @@ const scenarioOf = (cell, propagation) => ({
2685
2685
  liveness: s(seconds$1(cell.pod.liveness.period) * cell.pod.liveness.threshold)
2686
2686
  }
2687
2687
  });
2688
- /** This function applies the drain rules to the description of a cell, and gives each finding. */
2689
- const lintCell = (description, cell, propagation) => lint(description, scenarioOf(cell, propagation), DRAIN_RULES);
2688
+ /**
2689
+ * This function gives the way that the fault plan of a cell stops a pod, or null when the plan stops no pod.
2690
+ * - A deletion, a rolling update, a node drain, a scale-in and a rollout delete a pod with its grace.
2691
+ * - In T07 a pause of kube-proxy comes before a deletion. In T18 the pause is on Redis.
2692
+ * - The crash of the lab is SIGKILL from the node. Like a crash, it has no preStop hook and no drain.
2693
+ * - The other faults are on a link, on Redis or on the process. The kubelet can restart a pod after them.
2694
+ */
2695
+ const stopOf = (cell) => {
2696
+ switch (cell.trigger.kind) {
2697
+ case "pod-deletion":
2698
+ case "rolling-update":
2699
+ case "node-drain":
2700
+ case "scale-in":
2701
+ case "rollout": return "deletion";
2702
+ case "freeze-process": return cell.template === "T07" ? "deletion" : null;
2703
+ case "crash": return "crash";
2704
+ case "liveness-restart": return "liveness-restart";
2705
+ case "rst":
2706
+ case "blackhole":
2707
+ case "peer-gone-without-close":
2708
+ case "app-stall":
2709
+ case "cpu-throttle":
2710
+ case "authorization-policy":
2711
+ case "idle":
2712
+ case "ztunnel-restart":
2713
+ case "certificate-expiry": return null;
2714
+ }
2715
+ };
2716
+ /**
2717
+ * This function applies the drain rules to the description of a cell, and gives each finding. A cell
2718
+ * whose plan stops a pod gets the rules of that way (`lintStop()`). A plan that stops no pod gets each
2719
+ * drain rule, because a restart by the kubelet or a later deletion can follow its fault.
2720
+ */
2721
+ const lintCell = (description, cell, propagation) => {
2722
+ const way = stopOf(cell);
2723
+ const scenario = scenarioOf(cell, propagation);
2724
+ return way === null ? lint(description, scenario, DRAIN_RULES) : lintStop(description, scenario, DRAIN_RULES, way);
2725
+ };
2690
2726
  /** This function gives the verdict of each drain rule, by its identifier. */
2691
2727
  const verdictsOf = (findings) => Object.fromEntries(findings.map((finding) => [finding.rule, finding.verdict]));
2692
2728
  /** This function gives the description of the service of a cell, as the app of the image composes it. Nothing connects. */
@@ -3687,6 +3723,6 @@ const shardOf = (cells, index, count) => {
3687
3723
  return out;
3688
3724
  };
3689
3725
  //#endregion
3690
- export { ACCESS_LOG_FORMAT, CHANNEL_USE, CLIENT, CLIENT_ACCOUNT, CLOSE_LEAD, CONTROLLER, DOCUMENTED, DRAIN_RULES, EDS_EVERY, FLAG_CHECK, FORMAT, FORMAT_V1, HBONE_PORT, HEALTH_PORT, ISTIOCTL, ISTIO_IMAGES, ISTIO_VERSION, KEPT_KERNEL, KIND, KIND_NOISE, KUBECTL, KUBE_PROXY_MODES, LAST_SLACK, LDS_EVERY, LDS_FILTER, LOG_LABEL, MESH_IMAGES, MESH_WORKLOADS, MIDDLEBOX, NETNS_DEFAULTS, NODE_IMAGES, O04, O09, O10, O16, POLICY, PORT, QUIET_LEAD, REDIS, REDIS_IMAGE, RELATIVE, ROUTE, RULES_EVERY, SERVER, STAGES, SYSCTL, TCP_STATE, WATCHDOG, ZTUNNEL_PODS, backendsAt, backendsOf, bandOf, byClients, byNode, cacheFolder, calibrationOf, capOf, cellsTable, certificateArgs, checkRun, cidrOverlap, cidrRange, clientObjects, clusterFilter, compose, createCluster, deletes, deletionOf, deletionWindow, deletionsOf, describeCell, dropOf, emptyOf, ensureTool, estimatedTime, factsOf, failuresOf, followsZtunnel, goDuration, hostsOf, installMesh, intakeAfter, intakeOf, isTunnelState, istioOperator, judge, judgeKind, keptKernel, kernelCounts, kindCellRecordSchema, kindCellRecordV1Schema, kindConfig, kubeProxyPatch, kubeletBand, labImage, latchBand, leafCertificates, lintCell, listenerCountsOf, localPin, medianInterval, medianText, meshKey, middle, middleboxCommands, namespaceObject, namespaceOf, nodeNames, observationAfter, observationEnd, openKindLab, outboundCluster, outcomesOf, pausedWindow, planOf, platformKey, podsAt, podsOf, policyObject, pollsListeners, predictionText, probeOf, propagationOf, propagationSource, quantileOf, readRecord, recordsOf, redisObjects, referenceOf, removalBand, requestsOf, restartBand, restartOf, restartsAt, reusesReset, rulesOf, runKindCells, scenario, scenarioOf, scenarioProblems, seconds, secondsOf, serverCluster, serverObjects, setZtunnelEnv, sha256, shardOf, showBand, signalOf, signalsOf, sliceDropOf, sliceEmptyOf, slicesOf, socketsOf, stackOf, stageLabImage, stallRemovalBand, stoppingOf, sysctlCommand, tarEntry, timeSpread, toolPath, transitionOf, tunnelsOf, unitOf, updatesOf, upgrade, upgradeCell, verdictsOf, writeResult, ztunnelCertificates, ztunnelEnvArgs, ztunnelPodsOf, ztunnelReplaced };
3726
+ export { ACCESS_LOG_FORMAT, CHANNEL_USE, CLIENT, CLIENT_ACCOUNT, CLOSE_LEAD, CONTROLLER, DOCUMENTED, DRAIN_RULES, EDS_EVERY, FLAG_CHECK, FORMAT, FORMAT_V1, HBONE_PORT, HEALTH_PORT, ISTIOCTL, ISTIO_IMAGES, ISTIO_VERSION, KEPT_KERNEL, KIND, KIND_NOISE, KUBECTL, KUBE_PROXY_MODES, LAST_SLACK, LDS_EVERY, LDS_FILTER, LOG_LABEL, MESH_IMAGES, MESH_WORKLOADS, MIDDLEBOX, NETNS_DEFAULTS, NODE_IMAGES, O04, O09, O10, O16, POLICY, PORT, QUIET_LEAD, REDIS, REDIS_IMAGE, RELATIVE, ROUTE, RULES_EVERY, SERVER, STAGES, SYSCTL, TCP_STATE, WATCHDOG, ZTUNNEL_PODS, backendsAt, backendsOf, bandOf, byClients, byNode, cacheFolder, calibrationOf, capOf, cellsTable, certificateArgs, checkRun, cidrOverlap, cidrRange, clientObjects, clusterFilter, compose, createCluster, deletes, deletionOf, deletionWindow, deletionsOf, describeCell, dropOf, emptyOf, ensureTool, estimatedTime, factsOf, failuresOf, followsZtunnel, goDuration, hostsOf, installMesh, intakeAfter, intakeOf, isTunnelState, istioOperator, judge, judgeKind, keptKernel, kernelCounts, kindCellRecordSchema, kindCellRecordV1Schema, kindConfig, kubeProxyPatch, kubeletBand, labImage, latchBand, leafCertificates, lintCell, listenerCountsOf, localPin, medianInterval, medianText, meshKey, middle, middleboxCommands, namespaceObject, namespaceOf, nodeNames, observationAfter, observationEnd, openKindLab, outboundCluster, outcomesOf, pausedWindow, planOf, platformKey, podsAt, podsOf, policyObject, pollsListeners, predictionText, probeOf, propagationOf, propagationSource, quantileOf, readRecord, recordsOf, redisObjects, referenceOf, removalBand, requestsOf, restartBand, restartOf, restartsAt, reusesReset, rulesOf, runKindCells, scenario, scenarioOf, scenarioProblems, seconds, secondsOf, serverCluster, serverObjects, setZtunnelEnv, sha256, shardOf, showBand, signalOf, signalsOf, sliceDropOf, sliceEmptyOf, slicesOf, socketsOf, stackOf, stageLabImage, stallRemovalBand, stopOf, stoppingOf, sysctlCommand, tarEntry, timeSpread, toolPath, transitionOf, tunnelsOf, unitOf, updatesOf, upgrade, upgradeCell, verdictsOf, writeResult, ztunnelCertificates, ztunnelEnvArgs, ztunnelPodsOf, ztunnelReplaced };
3691
3727
 
3692
3728
  //# sourceMappingURL=index.js.map