@mark1russell7/kind 0.2.0 → 0.2.1

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
@@ -54,7 +54,7 @@ The unit of the main value of a run comes from the prediction of its cell:
54
54
 
55
55
  These values stay numbers in the two formats:
56
56
 
57
- - **A stamp** is a reading of CLOCK_MONOTONIC in milliseconds, a point on a clock, not an amount. The stamps are `start`, `end` and `acts` of a run, `t` of each line, and `first`, `last` and `deletion` of the facts.
57
+ - **A stamp** is a reading of CLOCK_MONOTONIC in milliseconds, a point on a clock, not an amount. The stamps are `start`, `end` and `acts` of a run, `t` of each line, and `first`, `last`, `deletion` and `deletions` of the facts.
58
58
  - **A line** stays as its source wrote it. The image writes it, and the record keeps it.
59
59
  - **A count** or **a share**: the replicas, the thresholds, the runs and the counts of a verdict. The jitter of a poll and the idle share of a load sample are shares.
60
60
 
@@ -154,6 +154,15 @@ The plan's `event:clock-jump` has no trigger. A step of CLOCK_REALTIME in the VM
154
154
 
155
155
  From 0.1.8, a run can agree with the law but be past its calibrated band (D-EXTEND). A request failed after the window, but before the rules of its node dropped the target. The check of that run tells it (`tail`), and its cell is `extend`. Such a cell does not hold. A request after the drop is still late, thus its run fails the cell.
156
156
 
157
+ From 0.2.1, a window can be one window for each deleted replica (`each`). A rolling update deletes each old replica in turn, and a client of gRPC can see each of these deletions.
158
+
159
+ - The judge makes one window for each replica of the run (`replicas`) with a deletion after the start of the run. Each window counts from the intake and the deletion of its own replica.
160
+ - A request is late only when it is outside each of these windows. A request after a window and before the rules of its node dropped the replica of that window is a `tail`.
161
+ - The facts of each run give these replicas, with the stamps of their intake and their deletion (`deletions`).
162
+ - `predictionText` adds `of each deleted replica`. A window without `each` stays the window of the target.
163
+
164
+ A preStop sleep that is longer than the grace is a command in the container (`sh -c "sleep 60"`). The API server refuses a sleep action that is longer than the grace.
165
+
157
166
  ## Tests
158
167
 
159
168
  `pnpm --filter @mark1russell7/kind test` starts the tests of the configuration, the tools, the parser of the rules and the fault mapping. It also starts the tests of the predictions, the verdict and the judge of the real records. They do not need Docker.
package/build/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as RulesLine, $t as KubeProxyMode, A as TriggerV1, At as bandOf, B as RunFacts, Bt as Prediction, C as KindCellResult, Ct as transitionOf, D as PredictionV1, Dt as PORT, E as LoadSample, Et as LOG_LABEL, F as KindDecision, Ft as Declaration, G as referenceOf, Gt as Stack, H as factsOf, Ht as Reference, I as KindVerdict, It as KindCell, J as Endpoint, Jt as TriggerKind, K as reusesReset, Kt as Template, L as LAST_SLACK, Lt as KindRun, M as upgrade, Mt as secondsOf, N as upgradeCell, Nt as showBand, O as RunCheckV1, Ot as REDIS, P as KIND_NOISE, Pt as Band, Q as Request, Qt as KindScenario, R as Propagated, Rt as KubeletProbe, S as KindCellRecordV1, St as stoppingOf, T as KindVerdictV1, Tt as HEALTH_PORT, U as judgeKind, Ut as Replica, V as checkRun, Vt as RedisDeclaration, W as propagationOf, Wt as ResetReuse, X as PodLine, Xt as KUBE_PROXY_MODES, Y as Line, Yt as Workload, Z as RecordLine, Zt as KindConfig, _ as ClusterManifest, _t as signalOf, a as STAGES, an as kindConfig, at as dropOf, b as FORMAT_V1, bt as sliceEmptyOf, c as readRecord, cn as scenario, ct as intakeOf, d as calibrationOf, dt as podsAt, en as NODE_IMAGES, et as SliceLine, f as cellsTable, ft as podsOf, g as BandV1, gt as rulesOf, h as timeSpread, ht as restartsAt, i as quantileOf, in as goDuration, it as deletionOf, j as judge, jt as seconds, k as RunFactsV1, kt as SERVER, l as Judged, ln as scenarioProblems, lt as kernelCounts, m as predictionText, mt as requestsOf, n as medianInterval, nn as cidrOverlap, nt as byClients, o as kindCellRecordSchema, on as kubeProxyPatch, ot as emptyOf, p as medianText, pt as recordsOf, q as unitOf, qt as Trigger, r as middle, rn as cidrRange, rt as byNode, s as kindCellRecordV1Schema, sn as nodeNames, st as failuresOf, t as RELATIVE, tn as NodeImage, tt as backendsAt, u as TimeSpread, ut as outcomesOf, v as EnvironmentManifest, vt as signalsOf, w as KindCellV1, wt as CLIENT, x as KindCellRecord, xt as slicesOf, y as FORMAT, yt as sliceDropOf, z as RunCheck, zt as PodSettings } from "./judge-D5SBTJ-V.js";
1
+ import { $ as RecordLine, $t as KindConfig, A as TriggerV1, At as REDIS, B as RunCheck, Bt as KubeletProbe, C as KindCellResult, Ct as slicesOf, D as PredictionV1, Dt as HEALTH_PORT, E as LoadSample, Et as CLIENT, F as KIND_NOISE, Ft as showBand, G as judgeKind, Gt as Replica, H as checkRun, Ht as Prediction, I as KindDecision, It as Band, J as reusesReset, Jt as Template, K as propagationOf, Kt as ResetReuse, L as KindVerdict, Lt as Declaration, M as upgrade, Mt as bandOf, N as upgradeCell, Nt as seconds, O as RunCheckV1, Ot as LOG_LABEL, P as Deleted, Pt as secondsOf, Q as PodLine, Qt as KUBE_PROXY_MODES, R as LAST_SLACK, Rt as KindCell, S as KindCellRecordV1, St as sliceEmptyOf, T as KindVerdictV1, Tt as transitionOf, U as deletionsOf, Ut as RedisDeclaration, V as RunFacts, Vt as PodSettings, W as factsOf, Wt as Reference, X as Endpoint, Xt as TriggerKind, Y as unitOf, Yt as Trigger, Z as Line, Zt as Workload, _ as ClusterManifest, _t as restartsAt, a as STAGES, an as cidrRange, at as byNode, b as FORMAT_V1, bt as signalsOf, c as readRecord, cn as kubeProxyPatch, ct as emptyOf, d as calibrationOf, dn as scenarioProblems, dt as kernelCounts, en as KindScenario, et as Request, f as cellsTable, ft as outcomesOf, g as BandV1, gt as requestsOf, h as timeSpread, ht as recordsOf, i as quantileOf, in as cidrOverlap, it as byClients, j as judge, jt as SERVER, k as RunFactsV1, kt as PORT, l as Judged, ln as nodeNames, lt as failuresOf, m as predictionText, mt as podsOf, n as medianInterval, nn as NODE_IMAGES, nt as SliceLine, o as kindCellRecordSchema, on as goDuration, ot as deletionOf, p as medianText, pt as podsAt, q as referenceOf, qt as Stack, r as middle, rn as NodeImage, rt as backendsAt, s as kindCellRecordV1Schema, sn as kindConfig, st as dropOf, t as RELATIVE, tn as KubeProxyMode, tt as RulesLine, u as TimeSpread, un as scenario, ut as intakeOf, v as EnvironmentManifest, vt as rulesOf, w as KindCellV1, wt as stoppingOf, x as KindCellRecord, xt as sliceDropOf, y as FORMAT, yt as signalOf, z as Propagated, zt as KindRun } from "./judge-Dwa6MqP4.js";
2
2
  import { Quantity } from "@mark1russell7/quantity";
3
3
  import { CheckFn, Finding, HealthServer, Poll, Rule, Scenario, ServiceBuilder, ServiceDescription, Stage, Timing, TransportImpl, Verdict } from "@mark1russell7/service";
4
4
  import { RedisClient } from "@mark1russell7/service/redis";
@@ -415,5 +415,5 @@ export declare const toolPath: (tool: Tool, key?: string, cache?: string) => str
415
415
  */
416
416
  export declare const ensureTool: (tool: Tool, key?: string, cache?: string) => Promise<string>;
417
417
  //#endregion
418
- export { type Band, type BandV1, CLIENT, type Cluster, type ClusterManifest, type Credentials, type Declaration, type DeletionWindow, Endpoint, type EnvironmentManifest, FORMAT, FORMAT_V1, type FaultPlan, 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, Line, type LoadSample, NODE_IMAGES, type NodeImage, PORT, type Parts, PodLine, type PodSettings, type Prediction, type PredictionV1, type Propagated, type Propagation, 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, type Stack, type Stamp, type Step, type Target, type Template, type TimeSpread, type Tool, type Trigger, type TriggerKind, type TriggerV1, type Verdicts, type Workload, backendsAt, bandOf, byClients, byNode, calibrationOf, cellsTable, checkRun, cidrOverlap, cidrRange, deletionOf, dropOf, emptyOf, factsOf, failuresOf, goDuration, intakeOf, judge, judgeKind, kernelCounts, kindCellRecordSchema, kindCellRecordV1Schema, kindConfig, kubeProxyPatch, medianInterval, medianText, middle, nodeNames, outcomesOf, podsAt, podsOf, predictionText, propagationOf, quantileOf, readRecord, recordsOf, referenceOf, requestsOf, restartsAt, reusesReset, rulesOf, scenario, scenarioProblems, seconds, secondsOf, showBand, signalOf, signalsOf, sliceDropOf, sliceEmptyOf, slicesOf, stoppingOf, timeSpread, transitionOf, unitOf, upgrade, upgradeCell };
418
+ export { type Band, type BandV1, CLIENT, type Cluster, type ClusterManifest, type Credentials, type Declaration, type Deleted, type DeletionWindow, Endpoint, type EnvironmentManifest, FORMAT, FORMAT_V1, type FaultPlan, 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, Line, type LoadSample, NODE_IMAGES, type NodeImage, PORT, type Parts, PodLine, type PodSettings, type Prediction, type PredictionV1, type Propagated, type Propagation, 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, type Stack, type Stamp, type Step, type Target, type Template, type TimeSpread, type Tool, type Trigger, type TriggerKind, type TriggerV1, type Verdicts, type Workload, backendsAt, bandOf, byClients, byNode, calibrationOf, cellsTable, checkRun, cidrOverlap, cidrRange, deletionOf, deletionsOf, dropOf, emptyOf, factsOf, failuresOf, goDuration, intakeOf, judge, judgeKind, kernelCounts, kindCellRecordSchema, kindCellRecordV1Schema, kindConfig, kubeProxyPatch, medianInterval, medianText, middle, nodeNames, outcomesOf, podsAt, podsOf, predictionText, propagationOf, quantileOf, readRecord, recordsOf, referenceOf, requestsOf, restartsAt, reusesReset, rulesOf, scenario, scenarioProblems, seconds, secondsOf, showBand, signalOf, signalsOf, sliceDropOf, sliceEmptyOf, slicesOf, stoppingOf, timeSpread, transitionOf, unitOf, upgrade, upgradeCell };
419
419
  //# sourceMappingURL=index.d.ts.map
package/build/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as LOG_LABEL, A as byNode, B as recordsOf, C as unitOf, D as quantileOf, E as middle, F as intakeOf, G as signalsOf, H as restartsAt, I as kernelCounts, J as slicesOf, K as sliceDropOf, L as outcomesOf, M as dropOf, N as emptyOf, O as backendsAt, P as failuresOf, Q as HEALTH_PORT, R as podsAt, S as reusesReset, T as medianInterval, U as rulesOf, V as requestsOf, W as signalOf, X as transitionOf, Y as stoppingOf, Z as CLIENT, _ as checkRun, a as calibrationOf, at as secondsOf, b as propagationOf, c as predictionText, d as FORMAT_V1, et as PORT, f as judge, g as LAST_SLACK, h as KIND_NOISE, i as readRecord, it as seconds, j as deletionOf, k as byClients, l as timeSpread, m as upgradeCell, n as kindCellRecordSchema, nt as SERVER, o as cellsTable, ot as showBand, p as upgrade, q as sliceEmptyOf, r as kindCellRecordV1Schema, rt as bandOf, s as medianText, t as STAGES, tt as REDIS, u as FORMAT, v as factsOf, w as RELATIVE, x as referenceOf, y as judgeKind, z as podsOf } from "./judge-DlmmZHcI.js";
1
+ import { $ as HEALTH_PORT, A as byClients, B as podsOf, C as reusesReset, D as middle, E as medianInterval, F as failuresOf, G as signalOf, H as requestsOf, I as intakeOf, J as sliceEmptyOf, K as signalsOf, L as kernelCounts, M as deletionOf, N as dropOf, O as quantileOf, P as emptyOf, Q as CLIENT, R as outcomesOf, S as referenceOf, T as RELATIVE, U as restartsAt, V as recordsOf, W as rulesOf, X as stoppingOf, Y as slicesOf, Z as transitionOf, _ as checkRun, a as calibrationOf, at as seconds, b as judgeKind, c as predictionText, d as FORMAT_V1, et as LOG_LABEL, f as judge, g as LAST_SLACK, h as KIND_NOISE, i as readRecord, it as bandOf, j as byNode, k as backendsAt, l as timeSpread, m as upgradeCell, n as kindCellRecordSchema, nt as REDIS, o as cellsTable, ot as secondsOf, p as upgrade, q as sliceDropOf, r as kindCellRecordV1Schema, rt as SERVER, s as medianText, st as showBand, t as STAGES, tt as PORT, u as FORMAT, v as deletionsOf, w as unitOf, x as propagationOf, y as factsOf, z as podsAt } from "./judge-reWPMVr4.js";
2
2
  import { valueIn } from "@mark1russell7/quantity";
3
3
  import { execFile, execFileSync } from "node:child_process";
4
4
  import { chmodSync, copyFileSync, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, writeFileSync } from "node:fs";
@@ -1374,11 +1374,28 @@ const redisObjects = (namespace, image) => [{
1374
1374
  }
1375
1375
  }];
1376
1376
  /**
1377
+ * This function gives the preStop hook of a sleep, or nothing for no sleep. The hook is the native
1378
+ * sleep action of the kubelet. The API server refuses a sleep action that is longer than the grace
1379
+ * (`validateSleepAction`, `pkg/apis/core/validation/validation.go` at v1.37.0, line 3483). Thus a
1380
+ * longer sleep is a command in the container, `sleep` from `/bin/sh`, as public manifests write it.
1381
+ * The kubelet starts that command with no timeout (`pkg/kubelet/lifecycle/handlers.go`, line 81).
1382
+ */
1383
+ const preStopOf = (preStop, grace) => {
1384
+ if (preStop === 0) return {};
1385
+ if (preStop <= grace) return { lifecycle: { preStop: { sleep: { seconds: preStop } } } };
1386
+ return { lifecycle: { preStop: { exec: { command: [
1387
+ "/bin/sh",
1388
+ "-c",
1389
+ `sleep ${preStop}`
1390
+ ] } } } };
1391
+ };
1392
+ /**
1377
1393
  * These are the objects of the server: a Service of type ClusterIP, and the Deployment with the
1378
1394
  * settings of the cell. The image is the lab image for the service, or the image of grpc-go.
1379
1395
  */
1380
1396
  const serverObjects = (cell, namespace, image, version = 1) => {
1381
1397
  const preStop = whole(cell.pod.preStop, "the preStop sleep");
1398
+ const grace = whole(cell.pod.grace, "the grace period");
1382
1399
  return [{
1383
1400
  apiVersion: "v1",
1384
1401
  kind: "Service",
@@ -1420,7 +1437,7 @@ const serverObjects = (cell, namespace, image, version = 1) => {
1420
1437
  "lab.systems/version": String(version)
1421
1438
  } },
1422
1439
  spec: {
1423
- terminationGracePeriodSeconds: whole(cell.pod.grace, "the grace period"),
1440
+ terminationGracePeriodSeconds: grace,
1424
1441
  enableServiceLinks: true,
1425
1442
  topologySpreadConstraints: [{
1426
1443
  maxSkew: 1,
@@ -1433,7 +1450,7 @@ const serverObjects = (cell, namespace, image, version = 1) => {
1433
1450
  image,
1434
1451
  imagePullPolicy: "Never",
1435
1452
  ...serverContainer(cell, version),
1436
- ...preStop === 0 ? {} : { lifecycle: { preStop: { sleep: { seconds: preStop } } } }
1453
+ ...preStopOf(preStop, grace)
1437
1454
  }]
1438
1455
  }
1439
1456
  }
@@ -2457,6 +2474,6 @@ const shardOf = (cells, index, count) => {
2457
2474
  return out;
2458
2475
  };
2459
2476
  //#endregion
2460
- export { CLIENT, CONTROLLER, DOCUMENTED, DRAIN_RULES, FLAG_CHECK, FORMAT, FORMAT_V1, HEALTH_PORT, KEPT_KERNEL, KIND, KIND_NOISE, KUBECTL, KUBE_PROXY_MODES, LAST_SLACK, LOG_LABEL, NODE_IMAGES, O04, O09, O10, O16, PORT, REDIS, REDIS_IMAGE, RELATIVE, ROUTE, RULES_EVERY, SERVER, STAGES, WATCHDOG, backendsAt, backendsOf, bandOf, byClients, byNode, cacheFolder, calibrationOf, capOf, cellsTable, checkRun, cidrOverlap, cidrRange, clientObjects, compose, createCluster, deletes, deletionOf, deletionWindow, describeCell, dropOf, emptyOf, ensureTool, estimatedTime, factsOf, failuresOf, goDuration, intakeAfter, intakeOf, judge, judgeKind, kernelCounts, kindCellRecordSchema, kindCellRecordV1Schema, kindConfig, kubeProxyPatch, kubeletBand, labImage, latchBand, lintCell, localPin, medianInterval, medianText, middle, namespaceOf, nodeNames, openKindLab, outcomesOf, pausedWindow, planOf, platformKey, podsAt, podsOf, predictionText, probeOf, propagationOf, quantileOf, readRecord, recordsOf, redisObjects, referenceOf, removalBand, requestsOf, restartBand, restartsAt, reusesReset, rulesOf, runKindCells, scenario, scenarioOf, scenarioProblems, seconds, secondsOf, serverObjects, sha256, shardOf, showBand, signalOf, signalsOf, sliceDropOf, sliceEmptyOf, slicesOf, stackOf, stageLabImage, stallRemovalBand, stoppingOf, timeSpread, toolPath, transitionOf, unitOf, upgrade, upgradeCell, verdictsOf, writeResult };
2477
+ export { CLIENT, CONTROLLER, DOCUMENTED, DRAIN_RULES, FLAG_CHECK, FORMAT, FORMAT_V1, HEALTH_PORT, KEPT_KERNEL, KIND, KIND_NOISE, KUBECTL, KUBE_PROXY_MODES, LAST_SLACK, LOG_LABEL, NODE_IMAGES, O04, O09, O10, O16, PORT, REDIS, REDIS_IMAGE, RELATIVE, ROUTE, RULES_EVERY, SERVER, STAGES, WATCHDOG, backendsAt, backendsOf, bandOf, byClients, byNode, cacheFolder, calibrationOf, capOf, cellsTable, checkRun, cidrOverlap, cidrRange, clientObjects, compose, createCluster, deletes, deletionOf, deletionWindow, deletionsOf, describeCell, dropOf, emptyOf, ensureTool, estimatedTime, factsOf, failuresOf, goDuration, intakeAfter, intakeOf, judge, judgeKind, kernelCounts, kindCellRecordSchema, kindCellRecordV1Schema, kindConfig, kubeProxyPatch, kubeletBand, labImage, latchBand, lintCell, localPin, medianInterval, medianText, middle, namespaceOf, nodeNames, openKindLab, outcomesOf, pausedWindow, planOf, platformKey, podsAt, podsOf, predictionText, probeOf, propagationOf, quantileOf, readRecord, recordsOf, redisObjects, referenceOf, removalBand, requestsOf, restartBand, restartsAt, reusesReset, rulesOf, runKindCells, scenario, scenarioOf, scenarioProblems, seconds, secondsOf, serverObjects, sha256, shardOf, showBand, signalOf, signalsOf, sliceDropOf, sliceEmptyOf, slicesOf, stackOf, stageLabImage, stallRemovalBand, stoppingOf, timeSpread, toolPath, transitionOf, unitOf, upgrade, upgradeCell, verdictsOf, writeResult };
2461
2478
 
2462
2479
  //# sourceMappingURL=index.js.map