@mark1russell7/kind 0.11.6 → 0.11.8
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 +1 -1
- package/build/index.d.ts +3 -20
- package/build/index.js +2 -125
- package/build/index.js.map +1 -1
- package/image/agent.mjs +35 -30
- package/image/client.mjs +29 -2
- package/image/watch.mjs +11 -11
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -211,7 +211,7 @@ The plan's `event:clock-jump` has no trigger. A step of CLOCK_REALTIME in the VM
|
|
|
211
211
|
|
|
212
212
|
`predict.ts` gives each band from the declaration, the pod settings and the calibration of the propagation:
|
|
213
213
|
|
|
214
|
-
- **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.
|
|
214
|
+
- **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. The entry `@mark1russell7/service/rules` gives O04 with the hold as data, and `lint()` decides it. Kind gives the drain rules of that entry again (`DRAIN_RULES`, `O04`, `O09`, `O10`, `O16`).
|
|
215
215
|
- **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.
|
|
216
216
|
- **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`.
|
|
217
217
|
- **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.
|
package/build/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { $ as updatesOf, $t as Declaration, A as TriggerV1, An as nodeNames, At as rulesOf, B as RunCheck, Bt as ztunnelPodsOf, C as KindCellResult, Cn as NODE_IMAGES, Ct as outcomesOf, D as PredictionV1, Dn as goDuration, Dt as requestsOf, E as LoadSample, En as cidrRange, 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, Mn as scenarioProblems, Mt as signalsOf, N as upgradeCell, Nt as sliceDropOf, O as RunCheckV1, On as kindConfig, 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 KubeProxyMode, St as kernelCounts, T as KindVerdictV1, Tn as cidrOverlap, 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 WindowPrediction, _t as dropOf, a as STAGES, an as MeshFlavor, at as RecordLine, b as FORMAT_V1, bn as KindConfig, bt as intakeOf, c as readRecord, cn as Prediction, ct as SliceLine, d as calibrationOf, dn as Replica, dt as TunnelLine, en as EdgeProtocol, et as Endpoint, f as cellsTable, fn as ResetReuse, ft as ZtunnelPodLine, g as BandV1, gn as TriggerKind, gt as deletionOf, h as timeSpread, hn as Trigger, ht as byNode, i as quantileOf, in as Mesh, it as PropagationSource, j as judge, jn as scenario, jt as signalOf, k as RunFactsV1, kn as kubeProxyPatch, kt as restartsAt, l as Judged, ln as RedisDeclaration, lt as SocketLine, m as predictionText, mn as Template, mt as byClients, n as medianInterval, nn as KindRun, nt as Line, o as kindCellRecordSchema, on as MeshMode, ot as Request, p as medianText, pn as Stack, pt as backendsAt, q as observationEnd, qt as SERVER, r as middle, rn as KubeletProbe, rt as PodLine, s as kindCellRecordV1Schema, sn as PodSettings, st as RulesLine, t as RELATIVE, tn as KindCell, tt as HBONE_PORT, u as TimeSpread, un as Reference, ut as TCP_STATE, v as EnvironmentManifest, vn as Workload, vt as emptyOf, w as KindCellV1, wn as NodeImage, wt as podsAt, x as KindCellRecord, xn as KindScenario, xt as isTunnelState, y as FORMAT, yn as KUBE_PROXY_MODES, yt as failuresOf, z as Propagated, zt as tunnelsOf } from "./judge-DnB9wEwC.js";
|
|
2
2
|
import { Quantity } from "@mark1russell7/quantity";
|
|
3
|
-
import { CheckFn, Finding, HealthServer, Poll,
|
|
3
|
+
import { CheckFn, Finding, HealthServer, Poll, Scenario, ServiceBuilder, ServiceDescription, Stage, StopWay, Timing, TransportImpl, Verdict } from "@mark1russell7/service";
|
|
4
4
|
import { BuildImage } from "@mark1russell7/harness";
|
|
5
5
|
import { RedisClient } from "@mark1russell7/service/redis";
|
|
6
|
+
import { DRAIN_RULES, O04, O09, O10, O16 } from "@mark1russell7/service/rules";
|
|
6
7
|
//#region src/backends.d.ts
|
|
7
8
|
/** A service rule names the Service whose backends the agent reads: its namespace, its name, and its ClusterIP and port for IPVS. */
|
|
8
9
|
interface ServiceRule {
|
|
@@ -680,24 +681,6 @@ interface LearnWindow {
|
|
|
680
681
|
export declare const learnWindow: (declaration: Declaration, readiness: KubeletProbe, propagation: Propagation, workload: Workload) => LearnWindow;
|
|
681
682
|
//#endregion
|
|
682
683
|
//#region src/rules.d.ts
|
|
683
|
-
/**
|
|
684
|
-
* These are the rules of the ordering law that a drain in Kubernetes meets, as data. The caller of
|
|
685
|
-
* `lint()` gives the rules, thus they are here and not in the service.
|
|
686
|
-
*/
|
|
687
|
-
/**
|
|
688
|
-
* O04 with the hold of the service. The listener of a pod stays open through the preStop sleep and
|
|
689
|
-
* then through the hold of `fail readiness`. Thus the sum of the two must cover the propagation of
|
|
690
|
-
* the endpoints. The rule of the research is the case without a hold.
|
|
691
|
-
*/
|
|
692
|
-
export declare const O04: Rule;
|
|
693
|
-
/** O09 is W8: readiness detection plus propagation is no longer than liveness detection plus the preStop sleep. */
|
|
694
|
-
export declare const O09: Rule;
|
|
695
|
-
/** O10: the preStop sleep plus the drain of the process fits in the grace period. */
|
|
696
|
-
export declare const O10: Rule;
|
|
697
|
-
/** O16: the cooperative window is shorter than the drain, which is shorter than the grace less the preStop sleep. */
|
|
698
|
-
export declare const O16: Rule;
|
|
699
|
-
/** These are the rules of the drain. A kind cell gets the rules that guard the way that its plan stops a pod. */
|
|
700
|
-
export declare const DRAIN_RULES: readonly Rule[];
|
|
701
684
|
/**
|
|
702
685
|
* This function gives the scenario of a cell for `lint()`: the preStop sleep, the grace, the probe
|
|
703
686
|
* period and the propagation. The probe windows are the period times the threshold of each probe.
|
|
@@ -817,5 +800,5 @@ export declare const toolPath: (tool: Tool, key?: string, cache?: string) => str
|
|
|
817
800
|
*/
|
|
818
801
|
export declare const ensureTool: (tool: Tool, key?: string, cache?: string) => Promise<string>;
|
|
819
802
|
//#endregion
|
|
820
|
-
export { type Band, type BandV1, CLIENT, type Cluster, type ClusterHosts, type ClusterManifest, type Credentials, type Declaration, type Deleted, type DeletionWindow, type EdgeProtocol, type EdsSpec, Endpoint, type EnvironmentManifest, FORMAT, FORMAT_V1, type FaultPlan, HBONE_PORT, HEALTH_PORT, type Judged, KIND_NOISE, KUBE_PROXY_MODES, type KindCell, type KindCellRecord, type KindCellRecordV1, type KindCellResult, type KindCellV1, type KindConfig, type KindDecision, type KindLab, type KindRun, type KindScenario, type KindVerdict, type KindVerdictV1, type KubeProxyMode, type KubeletProbe, LAST_SLACK, LOG_LABEL, type LdsSpec, type LeafCertificate, type LearnWindow, Line, type ListenerCounts, type LoadSample, type Mesh, type MeshFlavor, type MeshImages, type MeshMode, NODE_IMAGES, type NodeImage, PORT, type Parts, PodLine, type PodSettings, type Prediction, type PredictionV1, type Propagated, type Propagation, PropagationSource, REDIS, RELATIVE, RecordLine, type RedisDeclaration, type Reference, type Replica, Request, type ResetReuse, RulesLine, type RunCheck, type RunCheckV1, type RunFacts, type RunFactsV1, type RunOptions, SERVER, STAGES, type ServiceRule, SliceLine, SocketLine, type Stack, type Stamp, type Step, TCP_STATE, type Target, type Template, type TimeSpread, type Tool, type Trigger, type TriggerKind, type TriggerV1, TunnelLine, type Verdicts, type WindowPrediction, type Workload, ZtunnelPodLine, backendsAt, bandOf, byClients, byNode, calibrationOf, cellsTable, checkRun, cidrOverlap, cidrRange, deletionOf, deletionsOf, dropOf, emptyOf, factsOf, failuresOf, goDuration, intakeOf, isTunnelState, judge, judgeKind, kernelCounts, kindCellRecordSchema, kindCellRecordV1Schema, kindConfig, kubeProxyPatch, medianInterval, medianText, middle, nodeNames, observationAfter, observationEnd, outcomesOf, podsAt, podsOf, predictionText, propagationOf, propagationSource, quantileOf, readRecord, recordsOf, referenceOf, requestsOf, restartOf, restartsAt, reusesReset, rulesOf, scenario, scenarioProblems, seconds, secondsOf, showBand, signalOf, signalsOf, sliceDropOf, sliceEmptyOf, slicesOf, socketsOf, stoppingOf, timeSpread, transitionOf, tunnelsOf, unitOf, updatesOf, upgrade, upgradeCell, ztunnelPodsOf, ztunnelReplaced };
|
|
803
|
+
export { type Band, type BandV1, CLIENT, type Cluster, type ClusterHosts, type ClusterManifest, type Credentials, DRAIN_RULES, type Declaration, type Deleted, type DeletionWindow, type EdgeProtocol, type EdsSpec, Endpoint, type EnvironmentManifest, FORMAT, FORMAT_V1, type FaultPlan, HBONE_PORT, HEALTH_PORT, type Judged, KIND_NOISE, KUBE_PROXY_MODES, type KindCell, type KindCellRecord, type KindCellRecordV1, type KindCellResult, type KindCellV1, type KindConfig, type KindDecision, type KindLab, type KindRun, type KindScenario, type KindVerdict, type KindVerdictV1, type KubeProxyMode, type KubeletProbe, LAST_SLACK, LOG_LABEL, type LdsSpec, type LeafCertificate, type LearnWindow, Line, type ListenerCounts, type LoadSample, type Mesh, type MeshFlavor, type MeshImages, type MeshMode, NODE_IMAGES, type NodeImage, O04, O09, O10, O16, PORT, type Parts, PodLine, type PodSettings, type Prediction, type PredictionV1, type Propagated, type Propagation, PropagationSource, REDIS, RELATIVE, RecordLine, type RedisDeclaration, type Reference, type Replica, Request, type ResetReuse, RulesLine, type RunCheck, type RunCheckV1, type RunFacts, type RunFactsV1, type RunOptions, SERVER, STAGES, type ServiceRule, SliceLine, SocketLine, type Stack, type Stamp, type Step, TCP_STATE, type Target, type Template, type TimeSpread, type Tool, type Trigger, type TriggerKind, type TriggerV1, TunnelLine, type Verdicts, type WindowPrediction, type Workload, ZtunnelPodLine, backendsAt, bandOf, byClients, byNode, calibrationOf, cellsTable, checkRun, cidrOverlap, cidrRange, deletionOf, deletionsOf, dropOf, emptyOf, factsOf, failuresOf, goDuration, intakeOf, isTunnelState, judge, judgeKind, kernelCounts, kindCellRecordSchema, kindCellRecordV1Schema, kindConfig, kubeProxyPatch, medianInterval, medianText, middle, nodeNames, observationAfter, observationEnd, outcomesOf, podsAt, podsOf, predictionText, propagationOf, propagationSource, quantileOf, readRecord, recordsOf, referenceOf, requestsOf, restartOf, restartsAt, reusesReset, rulesOf, scenario, scenarioProblems, seconds, secondsOf, showBand, signalOf, signalsOf, sliceDropOf, sliceEmptyOf, slicesOf, socketsOf, stoppingOf, timeSpread, transitionOf, tunnelsOf, unitOf, updatesOf, upgrade, upgradeCell, ztunnelPodsOf, ztunnelReplaced };
|
|
821
804
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.js
CHANGED
|
@@ -12,6 +12,7 @@ import { createRequire } from "node:module";
|
|
|
12
12
|
import { tmpdir } from "node:os";
|
|
13
13
|
import { harnessImage, imageOf } from "@mark1russell7/harness";
|
|
14
14
|
import { redisClient } from "@mark1russell7/service/redis";
|
|
15
|
+
import { DRAIN_RULES, DRAIN_RULES as DRAIN_RULES$1, O04, O09, O10, O16 } from "@mark1russell7/service/rules";
|
|
15
16
|
//#region src/backends.ts
|
|
16
17
|
const hexIp = (hex) => [
|
|
17
18
|
0,
|
|
@@ -2653,130 +2654,6 @@ const learnWindow = (declaration, readiness, propagation, workload) => {
|
|
|
2653
2654
|
};
|
|
2654
2655
|
//#endregion
|
|
2655
2656
|
//#region src/rules.ts
|
|
2656
|
-
/**
|
|
2657
|
-
* These are the rules of the ordering law that a drain in Kubernetes meets, as data. The caller of
|
|
2658
|
-
* `lint()` gives the rules, thus they are here and not in the service.
|
|
2659
|
-
*/
|
|
2660
|
-
/**
|
|
2661
|
-
* O04 with the hold of the service. The listener of a pod stays open through the preStop sleep and
|
|
2662
|
-
* then through the hold of `fail readiness`. Thus the sum of the two must cover the propagation of
|
|
2663
|
-
* the endpoints. The rule of the research is the case without a hold.
|
|
2664
|
-
*/
|
|
2665
|
-
const O04 = {
|
|
2666
|
-
id: "O04",
|
|
2667
|
-
rule: "the preStop sleep plus the hold of fail readiness is at least the endpoint propagation",
|
|
2668
|
-
window: "new connections reach a pod whose listener is closed",
|
|
2669
|
-
expr: {
|
|
2670
|
-
lhs: { terms: [{
|
|
2671
|
-
knob: "prestop_sleep",
|
|
2672
|
-
coef: 1,
|
|
2673
|
-
at: "pod"
|
|
2674
|
-
}, {
|
|
2675
|
-
knob: "readiness_hold",
|
|
2676
|
-
coef: 1,
|
|
2677
|
-
at: "process"
|
|
2678
|
-
}] },
|
|
2679
|
-
op: ">=",
|
|
2680
|
-
rhs: { terms: [{
|
|
2681
|
-
knob: "propagation_bound",
|
|
2682
|
-
coef: 1,
|
|
2683
|
-
at: "cluster"
|
|
2684
|
-
}] }
|
|
2685
|
-
}
|
|
2686
|
-
};
|
|
2687
|
-
/** O09 is W8: readiness detection plus propagation is no longer than liveness detection plus the preStop sleep. */
|
|
2688
|
-
const O09 = {
|
|
2689
|
-
id: "O09",
|
|
2690
|
-
rule: "readiness detection plus endpoint propagation is no longer than liveness detection plus the preStop sleep",
|
|
2691
|
-
window: "traffic reaches a container that its liveness probe kills",
|
|
2692
|
-
expr: {
|
|
2693
|
-
lhs: { terms: [{
|
|
2694
|
-
knob: "readiness_detection_window",
|
|
2695
|
-
coef: 1,
|
|
2696
|
-
at: "pod"
|
|
2697
|
-
}, {
|
|
2698
|
-
knob: "propagation_bound",
|
|
2699
|
-
coef: 1,
|
|
2700
|
-
at: "cluster"
|
|
2701
|
-
}] },
|
|
2702
|
-
op: "<=",
|
|
2703
|
-
rhs: { terms: [{
|
|
2704
|
-
knob: "liveness_detection_window",
|
|
2705
|
-
coef: 1,
|
|
2706
|
-
at: "pod"
|
|
2707
|
-
}, {
|
|
2708
|
-
knob: "prestop_sleep",
|
|
2709
|
-
coef: 1,
|
|
2710
|
-
at: "pod"
|
|
2711
|
-
}] }
|
|
2712
|
-
}
|
|
2713
|
-
};
|
|
2714
|
-
/** O10: the preStop sleep plus the drain of the process fits in the grace period. */
|
|
2715
|
-
const O10 = {
|
|
2716
|
-
id: "O10",
|
|
2717
|
-
rule: "the preStop sleep plus the shutdown of the process fits in the grace period",
|
|
2718
|
-
window: "work in flight at SIGKILL is cut, and each connection closes at once",
|
|
2719
|
-
expr: {
|
|
2720
|
-
lhs: { terms: [{
|
|
2721
|
-
knob: "prestop_sleep",
|
|
2722
|
-
coef: 1,
|
|
2723
|
-
at: "pod"
|
|
2724
|
-
}, {
|
|
2725
|
-
knob: "process_drain_time",
|
|
2726
|
-
coef: 1,
|
|
2727
|
-
at: "process"
|
|
2728
|
-
}] },
|
|
2729
|
-
op: "<=",
|
|
2730
|
-
rhs: { terms: [{
|
|
2731
|
-
knob: "termination_grace",
|
|
2732
|
-
coef: 1,
|
|
2733
|
-
at: "pod"
|
|
2734
|
-
}] }
|
|
2735
|
-
}
|
|
2736
|
-
};
|
|
2737
|
-
/** O16: the cooperative window is shorter than the drain, which is shorter than the grace less the preStop sleep. */
|
|
2738
|
-
const O16 = {
|
|
2739
|
-
id: "O16",
|
|
2740
|
-
rule: "the cooperative window is shorter than the drain, which is shorter than the grace less the preStop sleep",
|
|
2741
|
-
window: "handlers are cut before they answer, or the drain itself gets SIGKILL",
|
|
2742
|
-
expr: {
|
|
2743
|
-
lhs: { terms: [{
|
|
2744
|
-
knob: "cooperative_window",
|
|
2745
|
-
coef: 1,
|
|
2746
|
-
at: "process"
|
|
2747
|
-
}] },
|
|
2748
|
-
op: "<",
|
|
2749
|
-
rhs: { terms: [{
|
|
2750
|
-
knob: "process_drain_time",
|
|
2751
|
-
coef: 1,
|
|
2752
|
-
at: "process"
|
|
2753
|
-
}] }
|
|
2754
|
-
},
|
|
2755
|
-
expr_more: [{
|
|
2756
|
-
lhs: { terms: [{
|
|
2757
|
-
knob: "process_drain_time",
|
|
2758
|
-
coef: 1,
|
|
2759
|
-
at: "process"
|
|
2760
|
-
}] },
|
|
2761
|
-
op: "<",
|
|
2762
|
-
rhs: { terms: [{
|
|
2763
|
-
knob: "termination_grace",
|
|
2764
|
-
coef: 1,
|
|
2765
|
-
at: "pod"
|
|
2766
|
-
}, {
|
|
2767
|
-
knob: "prestop_sleep",
|
|
2768
|
-
coef: -1,
|
|
2769
|
-
at: "pod"
|
|
2770
|
-
}] }
|
|
2771
|
-
}]
|
|
2772
|
-
};
|
|
2773
|
-
/** These are the rules of the drain. A kind cell gets the rules that guard the way that its plan stops a pod. */
|
|
2774
|
-
const DRAIN_RULES = [
|
|
2775
|
-
O04,
|
|
2776
|
-
O09,
|
|
2777
|
-
O10,
|
|
2778
|
-
O16
|
|
2779
|
-
];
|
|
2780
2657
|
const seconds$1 = (amount) => valueIn(amount, "s");
|
|
2781
2658
|
const s = (value) => ({
|
|
2782
2659
|
value,
|
|
@@ -2835,7 +2712,7 @@ const stopOf = (cell) => {
|
|
|
2835
2712
|
const lintCell = (description, cell, propagation) => {
|
|
2836
2713
|
const way = stopOf(cell);
|
|
2837
2714
|
const scenario = scenarioOf(cell, propagation);
|
|
2838
|
-
return way === null ? lint(description, scenario, DRAIN_RULES) : lintStop(description, scenario, DRAIN_RULES, way);
|
|
2715
|
+
return way === null ? lint(description, scenario, DRAIN_RULES$1) : lintStop(description, scenario, DRAIN_RULES$1, way);
|
|
2839
2716
|
};
|
|
2840
2717
|
/** This function gives the verdict of each drain rule, by its identifier. */
|
|
2841
2718
|
const verdictsOf = (findings) => Object.fromEntries(findings.map((finding) => [finding.rule, finding.verdict]));
|