@mark1russell7/kind 0.10.0 → 0.10.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
@@ -148,7 +148,9 @@ A new member of the union `Template` breaks a reader that switches on it. That i
148
148
 
149
149
  ## The image
150
150
 
151
- The lab image (`image/`) holds the service of a cell on `@mark1russell7/service`, its clients, the agent and the watcher, on Node 24.21.0. Its base is pinned by digest, and `npm-lock.json` pins the packages from npm. `stageLabImage()` stages its context, and `labImage()` tags the image by its content.
151
+ The lab image (`image/`) holds the service of a cell on `@mark1russell7/service`, its clients, the agent and the watcher, on Node 24.21.0. Its base is pinned by digest, and `npm-lock.json` pins the packages from npm. `stageLabImage()` stages its context, and `labImage()` gives the tag of the image.
152
+
153
+ - **The resolver.** From 0.10.1, the lab image is a `build` source of the harness (`labSource()`). The resolver of the harness plans it and builds it, as it does each other image (`planOf`, `imageOf`). Thus its tag comes from its content, and each `FROM` has a digest. Each manifest of packages has a lockfile, and a failed build tries again after each wait. The build goes through the CLI of Docker, not through Testcontainers.
152
154
 
153
155
  - **In the workspace** of this repository, the stage builds `@mark1russell7/quantity`, `@mark1russell7/algebra` and `@mark1russell7/service`, and packs each one as npm gets it.
154
156
  - **From npm**, the stage packs the installed versions of the same packages. The package holds the files of the image, and `src/compose.ts` and `src/backends.ts`, for that.
package/build/index.d.ts CHANGED
@@ -1,6 +1,7 @@
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
3
  import { CheckFn, Finding, HealthServer, Poll, Rule, Scenario, ServiceBuilder, ServiceDescription, Stage, StopWay, Timing, TransportImpl, Verdict } from "@mark1russell7/service";
4
+ import { BuildImage } from "@mark1russell7/harness";
4
5
  import { RedisClient } from "@mark1russell7/service/redis";
5
6
  //#region src/backends.d.ts
6
7
  /** A service rule names the Service whose backends the agent reads: its namespace, its name, and its ClusterIP and port for IPVS. */
@@ -266,9 +267,16 @@ export declare const deletes: (cell: KindCell) => boolean;
266
267
  */
267
268
  export declare const stageLabImage: () => string;
268
269
  /**
269
- * This function builds the lab image one time for each process, and gives its tag. Docker keeps its
270
- * layers between builds. A build that fails leaves the cache. Thus a later call builds again after a
271
- * fault of Docker or of the network.
270
+ * This function gives the source of the lab image from a staged context, as a `build` source of
271
+ * the harness. The resolver of the harness plans it and builds it, as it does each other image.
272
+ * Thus each `FROM` has a digest, and each manifest of packages has a lockfile.
273
+ */
274
+ export declare const labSource: (context: string) => BuildImage;
275
+ /**
276
+ * This function gives the tag of the lab image, one time for each process. It stages the context,
277
+ * and the resolver of the harness builds it with a tag from its content (`imageOf`). The stage
278
+ * builds and packs packages, thus a tag that passed stays. A stage or a build that fails leaves
279
+ * the cache. Thus a later call stages and builds again after a fault of Docker or of the network.
272
280
  */
273
281
  export declare const labImage: () => Promise<string>;
274
282
  //#endregion
package/build/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { $ as signalOf, A as medianInterval, B as emptyOf, C as propagationOf, D as unitOf, E as reusesReset, F as backendsAt, G as outcomesOf, H as intakeOf, I as byClients, J as recordsOf, K as podsAt, L as byNode, M as quantileOf, N as HBONE_PORT, O as updatesOf, P as TCP_STATE, Q as rulesOf, R as deletionOf, S as observationEnd, T as referenceOf, U as isTunnelState, V as failuresOf, W as kernelCounts, X as restartOf, Y as requestsOf, Z as restartsAt, _ as checkRun, _t as seconds, a as calibrationOf, at as stoppingOf, b as judgeKind, c as predictionText, ct as ztunnelPodsOf, d as FORMAT_V1, dt as HEALTH_PORT, et as signalsOf, f as judge, ft as LOG_LABEL, g as LAST_SLACK, gt as bandOf, h as KIND_NOISE, ht as SERVER, i as readRecord, it as socketsOf, j as middle, k as RELATIVE, l as timeSpread, lt as ztunnelReplaced, m as upgradeCell, mt as REDIS, n as kindCellRecordSchema, nt as sliceEmptyOf, o as cellsTable, ot as transitionOf, p as upgrade, pt as PORT, q as podsOf, r as kindCellRecordV1Schema, rt as slicesOf, s as medianText, st as tunnelsOf, t as STAGES, tt as sliceDropOf, u as FORMAT, ut as CLIENT, v as deletionsOf, vt as secondsOf, w as propagationSource, x as observationAfter, y as factsOf, yt as showBand, z as dropOf } from "./judge-BbLWVTYj.js";
2
2
  import { valueIn } from "@mark1russell7/quantity";
3
3
  import { execFile, execFileSync } from "node:child_process";
4
- import { chmodSync, copyFileSync, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, writeFileSync } from "node:fs";
4
+ import { chmodSync, copyFileSync, existsSync, mkdirSync, mkdtempSync, readFileSync, realpathSync, renameSync, rmSync, writeFileSync } from "node:fs";
5
5
  import { dirname, join } from "node:path";
6
6
  import { promisify } from "node:util";
7
7
  import { createHash } from "node:crypto";
@@ -1269,6 +1269,8 @@ const WORKSPACE_PACKAGES = [
1269
1269
  "algebra",
1270
1270
  "service"
1271
1271
  ];
1272
+ /** This folder of a staged context holds the tarball of each package of the workspace. */
1273
+ const PACKED = "workspace";
1272
1274
  /** These are the files of the image, by their name in the context and their source in the package. */
1273
1275
  const FILES = [
1274
1276
  ["Dockerfile", "image/Dockerfile"],
@@ -1288,17 +1290,6 @@ const FILES = [
1288
1290
  ["client-lines.ts", "src/client-lines.ts"]
1289
1291
  ];
1290
1292
  const shell = process.platform === "win32";
1291
- /** This function gives each file of a staged context, with its path in the context, in a stable sequence. */
1292
- const filesOf = (root, at = "") => readdirSync(join(root, at), { withFileTypes: true }).flatMap((entry) => entry.isDirectory() ? filesOf(root, join(at, entry.name)) : [join(at, entry.name)]).sort();
1293
- /** This function gives the tag of a staged context from its content: the name, then 12 digits of a sha256. */
1294
- const contentTag = (name, root) => {
1295
- const hash = createHash("sha256");
1296
- for (const file of filesOf(root)) {
1297
- hash.update(file.replaceAll("\\", "/"));
1298
- hash.update(readFileSync(join(root, file)));
1299
- }
1300
- return `${name}:${hash.digest("hex").slice(0, 12)}`;
1301
- };
1302
1293
  /** This function tells if the package is in the workspace of its repository. From npm, it is not. */
1303
1294
  const inWorkspace = () => existsSync(join(REPO, "pnpm-workspace.yaml")) && WORKSPACE_PACKAGES.every((name) => existsSync(join(REPO, "packages", name, "package.json")));
1304
1295
  /**
@@ -1328,7 +1319,7 @@ const installedFolders = () => {
1328
1319
  */
1329
1320
  const stageLabImage = () => {
1330
1321
  const context = mkdtempSync(join(tmpdir(), "systems-kind-lab-"));
1331
- const packed = join(context, "workspace");
1322
+ const packed = join(context, PACKED);
1332
1323
  mkdirSync(packed);
1333
1324
  if (inWorkspace()) {
1334
1325
  const filters = WORKSPACE_PACKAGES.flatMap((name) => ["--filter", `@mark1russell7/${name}`]);
@@ -1359,21 +1350,30 @@ const stageLabImage = () => {
1359
1350
  for (const [at, from] of FILES) copyFileSync(join(PACKAGE, from), join(context, at));
1360
1351
  return context;
1361
1352
  };
1353
+ /**
1354
+ * This function gives the source of the lab image from a staged context, as a `build` source of
1355
+ * the harness. The resolver of the harness plans it and builds it, as it does each other image.
1356
+ * Thus each `FROM` has a digest, and each manifest of packages has a lockfile.
1357
+ */
1358
+ const labSource = (context) => ({
1359
+ kind: "build",
1360
+ name: "systems-kind-lab",
1361
+ context,
1362
+ files: [...FILES.map(([at]) => at), PACKED]
1363
+ });
1362
1364
  let built = null;
1363
1365
  /**
1364
- * This function builds the lab image one time for each process, and gives its tag. Docker keeps its
1365
- * layers between builds. A build that fails leaves the cache. Thus a later call builds again after a
1366
- * fault of Docker or of the network.
1366
+ * This function gives the tag of the lab image, one time for each process. It stages the context,
1367
+ * and the resolver of the harness builds it with a tag from its content (`imageOf`). The stage
1368
+ * builds and packs packages, thus a tag that passed stays. A stage or a build that fails leaves
1369
+ * the cache. Thus a later call stages and builds again after a fault of Docker or of the network.
1367
1370
  */
1368
1371
  const labImage = () => {
1369
1372
  if (built !== null) return built;
1370
1373
  const building = (async () => {
1371
1374
  const context = stageLabImage();
1372
1375
  try {
1373
- const tag = contentTag("systems-kind-lab", context);
1374
- const { GenericContainer } = await import("testcontainers");
1375
- await GenericContainer.fromDockerfile(context).build(tag, { deleteOnExit: false });
1376
- return tag;
1376
+ return await imageOf(labSource(context));
1377
1377
  } finally {
1378
1378
  rmSync(context, {
1379
1379
  recursive: true,
@@ -3723,6 +3723,6 @@ const shardOf = (cells, index, count) => {
3723
3723
  return out;
3724
3724
  };
3725
3725
  //#endregion
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 };
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, labSource, 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 };
3727
3727
 
3728
3728
  //# sourceMappingURL=index.js.map