@mark1russell7/kind 0.11.1 → 0.11.3

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/index.d.ts CHANGED
@@ -1,4 +1,4 @@
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-C3mbgYxY.js";
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-yWlioigZ.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
4
  import { BuildImage } from "@mark1russell7/harness";
@@ -109,7 +109,8 @@ export declare const hostsOf: (text: string, cluster: string) => ClusterHosts;
109
109
  */
110
110
  /**
111
111
  * A target is a process or a pod of the cell:
112
- * - `server` is the first replica of the service, in the sequence of its name.
112
+ * - `server` is the first replica of the service, in the sequence of its name. The injector acts in
113
+ * its network namespace only, with each client pod as a peer: the partition of one replica.
113
114
  * - `redis` is the Redis pod.
114
115
  * - `kube-proxy` is kube-proxy on the first worker.
115
116
  * - `servers` is each replica of the service. Only the injector, a middlebox and a sysctl take it.
@@ -570,7 +571,8 @@ export declare const serverObjects: (cell: KindCell, namespace: string, image: s
570
571
  * These are the objects of the clients: a DaemonSet with one client on each node, the control plane
571
572
  * too. The client of the service is `client.mjs`, and the client of grpc-go is `client-grpc.mjs`.
572
573
  * Each one is in the lab image, and each one writes the same lines. A service with the protocol
573
- * `h2c` gives its clients `PROTOCOL`, thus they speak HTTP/2 to it.
574
+ * `h2c` gives its clients `PROTOCOL`, thus they speak HTTP/2 to it. A workload with a session check
575
+ * gives its clients `SESSION_CHECK`: the knobs of the check, as JSON.
574
576
  */
575
577
  export declare const clientObjects: (cell: KindCell, namespace: string, image: string, target: string) => unknown[];
576
578
  //#endregion
package/build/index.js CHANGED
@@ -1,4 +1,4 @@
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-Bb4ebE9V.js";
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-BHygFh4Z.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, realpathSync, renameSync, rmSync, writeFileSync } from "node:fs";
@@ -849,9 +849,10 @@ const middleboxCommands = (peers, idle, port) => {
849
849
  /**
850
850
  * This function gives the target of a reset or a black hole of a cell. In T07 and T18 it is Redis,
851
851
  * with the replicas as peers. In T15 the fault is on the mesh leg between the client pods and the
852
- * replicas. It is a rule in each replica, with the client pods as peers.
852
+ * replicas. It is a rule in each replica, with the client pods as peers. A partition (`partition`)
853
+ * is a rule in the target replica only, with the client pods as peers.
853
854
  */
854
- const linkOf = (cell) => cell.template === "T15" ? "servers" : "redis";
855
+ const linkOf = (cell) => cell.trigger.partition === true ? "server" : cell.template === "T15" ? "servers" : "redis";
855
856
  /** This function gives the fault plan of a cell. */
856
857
  const planOf = (cell) => {
857
858
  const ns = ["-n", "{namespace}"];
@@ -1024,19 +1025,30 @@ const planOf = (cell) => {
1024
1025
  target: "clients",
1025
1026
  signal: "SIGUSR2"
1026
1027
  }] : [];
1027
- const prepare = [...retries === void 0 ? [] : [{
1028
- do: "sysctl",
1029
- target: "clients",
1030
- key: SYSCTL.retries,
1031
- value: String(retries)
1032
- }], ...quiet ? [{
1033
- do: "signal",
1034
- target: "clients",
1035
- signal: "SIGUSR1"
1036
- }, {
1037
- do: "wait",
1038
- time: QUIET_LEAD
1039
- }] : []];
1028
+ const prepare = [
1029
+ ...trigger.partition === true ? [{
1030
+ do: "signal",
1031
+ target: "clients",
1032
+ signal: "SIGHUP"
1033
+ }, {
1034
+ do: "wait",
1035
+ time: SPREAD_LEAD
1036
+ }] : [],
1037
+ ...retries === void 0 ? [] : [{
1038
+ do: "sysctl",
1039
+ target: "clients",
1040
+ key: SYSCTL.retries,
1041
+ value: String(retries)
1042
+ }],
1043
+ ...quiet ? [{
1044
+ do: "signal",
1045
+ target: "clients",
1046
+ signal: "SIGUSR1"
1047
+ }, {
1048
+ do: "wait",
1049
+ time: QUIET_LEAD
1050
+ }] : []
1051
+ ];
1040
1052
  return {
1041
1053
  ...prepare.length === 0 ? {} : { prepare },
1042
1054
  inject: [{
@@ -2415,7 +2427,8 @@ const serverObjects = (cell, namespace, image, version = 1) => {
2415
2427
  * These are the objects of the clients: a DaemonSet with one client on each node, the control plane
2416
2428
  * too. The client of the service is `client.mjs`, and the client of grpc-go is `client-grpc.mjs`.
2417
2429
  * Each one is in the lab image, and each one writes the same lines. A service with the protocol
2418
- * `h2c` gives its clients `PROTOCOL`, thus they speak HTTP/2 to it.
2430
+ * `h2c` gives its clients `PROTOCOL`, thus they speak HTTP/2 to it. A workload with a session check
2431
+ * gives its clients `SESSION_CHECK`: the knobs of the check, as JSON.
2419
2432
  */
2420
2433
  const clientObjects = (cell, namespace, image, target) => [{
2421
2434
  apiVersion: "apps/v1",
@@ -2465,6 +2478,10 @@ const clientObjects = (cell, namespace, image, target) => [{
2465
2478
  name: "PROTOCOL",
2466
2479
  value: "h2c"
2467
2480
  }] : [],
2481
+ ...cell.workload.sessionCheck === void 0 ? [] : [{
2482
+ name: "SESSION_CHECK",
2483
+ value: JSON.stringify(cell.workload.sessionCheck)
2484
+ }],
2468
2485
  {
2469
2486
  name: "POD_NAME",
2470
2487
  valueFrom: { fieldRef: { fieldPath: "metadata.name" } }
@@ -3104,7 +3121,8 @@ const replicasOf = (ctx) => {
3104
3121
  const INJECT_LEAD_MS = 700;
3105
3122
  /**
3106
3123
  * This function puts the rules of an action in the network namespace of each replica, with each
3107
- * client pod as a peer: the target `servers`. The rules of all replicas commit at one instant on
3124
+ * client pod as a peer. The target `servers` gives all replicas, and `server` the target replica alone.
3125
+ * The rules of all replicas commit at one instant on
3108
3126
  * CLOCK_MONOTONIC (`--at`). Thus no client meets one replica with the rule and one without it. The
3109
3127
  * replicas of one node go one after the other, and the nodes at the same time.
3110
3128
  *
@@ -3301,6 +3319,7 @@ const doStep = async (ctx, step, replicas, background) => {
3301
3319
  }
3302
3320
  case "inject": {
3303
3321
  if (step.target === "servers") return injectServers(ctx, step.action, replicas);
3322
+ if (step.target === "server") return injectServers(ctx, step.action, [target]);
3304
3323
  const at = await where(step.target);
3305
3324
  let first = null;
3306
3325
  for (const replica of replicas) {