@rallycry/conveyor-k3 0.1.12 → 0.1.13

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/dist/index.d.ts CHANGED
@@ -8,10 +8,14 @@ interface ClusterConnectionConfig {
8
8
  /** Test-only overrides; production reads the host-written control aliases. */
9
9
  readControlFile?: (path: string) => string | null;
10
10
  controlFileExists?: (path: string) => boolean;
11
+ /** Dial again after the server closes the socket. The daemon's connection only. */
12
+ reconnectWhenReplaced?: boolean;
11
13
  }
12
14
  declare class ClusterConnection {
13
15
  private socket;
14
16
  private readonly config;
17
+ private redialDelayMs;
18
+ private redialTimer;
15
19
  /** Called when Conveyor says the desired state changed. */
16
20
  onSyncRequested: (() => void) | null;
17
21
  /** Called when Conveyor asks the machine to remove itself. */
@@ -29,6 +33,8 @@ declare class ClusterConnection {
29
33
  * instead of waiting out the stale window.
30
34
  */
31
35
  sayGoodbye(timeoutMs?: number): Promise<void>;
36
+ /** Dial again after the server closed the socket, waiting longer each time. */
37
+ private redial;
32
38
  disconnect(): void;
33
39
  }
34
40
 
@@ -132,17 +138,29 @@ declare class ClusterDaemon {
132
138
  private readonly localImageHashes;
133
139
  /** How long the in-cluster registry has been not ready, across beats. */
134
140
  private readonly registryWatch;
141
+ /**
142
+ * Whether pod isolation is in force, from the last reconcile; undefined
143
+ * while desired state does not ask for it. Every heartbeat checks it again
144
+ * against k3s's own settings before reporting it.
145
+ */
146
+ private isolation;
135
147
  private timers;
136
148
  /** When the last store walk started, so one that failed is not retried on every reconcile. */
137
149
  private storeWalkStartedAt;
138
150
  /** Serializes reconcile against itself — a sync nudge during a reconcile
139
151
  * must queue, not interleave two kubectl applies of the same manifests. */
140
152
  private reconciling;
153
+ /** The run queued behind the running one, until it starts. At most one waits. */
154
+ private queuedRun;
155
+ /** The next reconcile while pod isolation is not applied; `dueAt` 0 = none. */
156
+ private isolationRetry;
141
157
  constructor(ports: DaemonPorts);
142
158
  start(): Promise<void>;
143
159
  stop(): Promise<void>;
144
160
  /** Fetch the desired state and converge to it. Queued, never concurrent. */
145
161
  syncAndReconcile(): Promise<void>;
162
+ /** Reconcile again later while pod isolation is not applied; stop once it is. */
163
+ private scheduleIsolationRetry;
146
164
  private runReconcile;
147
165
  /**
148
166
  * The hourly clock: warm, re-pin, and reclaim if the pile justifies it.
@@ -293,6 +311,10 @@ interface TelemetryState {
293
311
  localImageHashes?: LocalImageHashCache;
294
312
  /** Present while desired state turns the in-cluster registry on. */
295
313
  localRegistry?: LocalRegistryWatch;
314
+ /** Present while desired state asks for pod isolation (a host-runtime machine). */
315
+ isolation?: {
316
+ applied: boolean;
317
+ };
296
318
  /**
297
319
  * The last measured size of k3s's containerd store. Null (or absent) until
298
320
  * the first measurement, and the heartbeat says null then: a 0 would read
@@ -395,6 +417,13 @@ interface ReconcileResult {
395
417
  recreatedPriorityClass: boolean;
396
418
  /** Empty pool namespaces of projects this machine no longer serves, removed. */
397
419
  prunedNamespaces: string[];
420
+ /**
421
+ * Whether pod isolation is in force, while desired state asks for it (a
422
+ * host-runtime machine). Undefined otherwise. Reported on every heartbeat.
423
+ */
424
+ isolation?: {
425
+ applied: boolean;
426
+ };
398
427
  }
399
428
  declare function reconcile(ctx: ReconcileContext, desired: PersonalClusterDesiredState): Promise<ReconcileResult>;
400
429
 
@@ -519,7 +548,11 @@ declare function ownerConfiguredKeys(ownerConfig: string | null): Set<string>;
519
548
  * they chose, and last-writer-wins on their own file is exactly what this
520
549
  * module exists not to do.
521
550
  */
522
- declare function renderK3sDropIn(kubelet: PersonalClusterKubeletState, ownerConfig: string | null): DropInRenderResult;
551
+ declare function renderK3sDropIn(kubelet: PersonalClusterKubeletState, ownerConfig: string | null,
552
+ /** False on an adopted k3s: its components stay as its owner set them. */
553
+ options?: {
554
+ disableComponents?: boolean;
555
+ }): DropInRenderResult;
523
556
  /**
524
557
  * @deprecated Use {@link renderK3sDropIn}. Kept as a named alias because the
525
558
  * package exports it and a published CLI may still import it by this name.
@@ -585,6 +618,18 @@ interface MachineState {
585
618
  */
586
619
  k3sStoreBytes?: number;
587
620
  k3sStoreMeasuredAt?: string;
621
+ /**
622
+ * "host" once `conveyor-k3 host setup` or `host link` enrolled this machine
623
+ * as a host-runtime instance. Absent on a VM guest, including every state
624
+ * file written before the host runtime existed.
625
+ */
626
+ runtime?: "host";
627
+ /**
628
+ * True once setup installed this machine's k3s. Absent on a k3s setup found
629
+ * already installed, and in every state file written before the field
630
+ * existed. See {@link managesK3s}.
631
+ */
632
+ k3sInstalledByConveyor?: boolean;
588
633
  }
589
634
  declare function readState(fs: FileSystemPort$1): Promise<MachineState>;
590
635
  declare function writeState(fs: FileSystemPort$1, state: MachineState): Promise<void>;
@@ -597,7 +642,7 @@ declare function writeState(fs: FileSystemPort$1, state: MachineState): Promise<
597
642
  * help output below is part of the product: every verb states what it does to
598
643
  * their machine, and `uninstall` states what it does not.
599
644
  */
600
- declare const VERBS: readonly ["vm", "setup", "start", "stop", "status", "sync", "update", "registry", "runners", "uninstall", "daemon"];
645
+ declare const VERBS: readonly ["vm", "host", "setup", "start", "stop", "status", "sync", "update", "registry", "runners", "uninstall", "daemon"];
601
646
  type Verb = (typeof VERBS)[number];
602
647
  declare function isVerb(value: string): value is Verb;
603
648
  interface ParsedArgs {
@@ -613,7 +658,7 @@ interface ParsedArgs {
613
658
  * this surface is nine verbs and six flags, not a general CLI framework.
614
659
  */
615
660
  declare function parseArgs(argv: readonly string[]): ParsedArgs;
616
- declare const HELP = "conveyor-k3 \u2014 managed personal compute for Conveyor\n\nUsage: conveyor-k3 <command> [options]\n\nCommands:\n vm Manage isolated compute on macOS or Linux.\n Run conveyor-k3 vm for host lifecycle commands.\n setup Install and enrol this machine. Safe to re-run.\n start Start the tunnel and the daemon.\n stop Stop both, and tell Conveyor at once so your next\n build goes straight to project compute.\n status [--json] What is running, what Conveyor knows, and what is\n missing.\n sync Re-read your settings from Conveyor and apply them.\n update Update conveyor-k3, cloudflared, and (when you have\n allowed it and nothing is running) k3s.\n registry list Which registry credentials are configured, and which\n ones your projects still need.\n registry add <host> Add one registry credential.\n --username <user>\n --password-stdin read the password from stdin\n --no-restart skip the required k3s restart\n registry gc Delete superseded shadow-bake images from the image\n registry inside this cluster. Runs daily on its own,\n and only while no Conveyor pod or bake is running.\n --dry-run list what it would delete\n runners list Which GitHub Actions runners this machine hosts, and\n whether each may import a locally baked image.\n runners grant <user>\u2026 Let those runner users import a locally baked image\n into this node and pin it. Writes one file under\n /etc/sudoers.d, checked with visudo first. Needed only\n when a project has Bake Locally turned on.\n uninstall Remove Conveyor's units, environment, state, and image\n registry. Your k3s config, your own registries.yaml\n entries, your workloads, and the registry's data are\n left alone.\n --purge-k3s --yes also remove k3s itself and the\n registry's data\n daemon Run in the foreground (what the systemd unit calls).\n\nOptions:\n --version Print the version.\n --help Print this message.\n\nDocs: https://conveyor.rallycryapp.com/docs/guides/managed-personal-compute\n";
661
+ declare const HELP = "conveyor-k3 \u2014 Personal Compute for Conveyor\n\nUsage: conveyor-k3 <command> [options]\n\nOne product, two runtimes. Pick the one that fits the machine:\n\nOn your computer or server:\n vm Personal computer runtime: an isolated VM on macOS or\n Linux. Run conveyor-k3 vm for its commands.\n host Dedicated server runtime: k3s and the daemon on this\n Linux machine, with no VM. Root only. Run\n conveyor-k3 host for its commands.\n\nInside a linked machine (the VM guest, or the server itself):\n setup VM guest only: install and enrol this machine. Safe\n to re-run. On a server, use conveyor-k3 host setup.\n start Start the tunnel and the daemon.\n stop Stop both, and tell Conveyor at once so your next\n build goes straight to project compute.\n status [--json] What is running, what Conveyor knows, and what is\n missing.\n sync Re-read your settings from Conveyor and apply them.\n update Update conveyor-k3, cloudflared, and (when you have\n allowed it and nothing is running) k3s.\n registry list Which registry credentials are configured, and which\n ones your projects still need.\n registry add <host> Add one registry credential.\n --username <user>\n --password-stdin read the password from stdin\n --no-restart skip the required k3s restart\n registry gc Delete superseded shadow-bake images from the image\n registry inside this cluster. Runs daily on its own,\n and only while no Conveyor pod or bake is running.\n --dry-run list what it would delete\n runners list Which GitHub Actions runners this machine hosts, and\n whether each may import a locally baked image.\n runners grant <user>\u2026 Let those runner users import a locally baked image\n into this node and pin it. Writes one file under\n /etc/sudoers.d, checked with visudo first. Needed only\n when a project has Bake Locally turned on.\n uninstall VM guest only: remove Conveyor's units, environment,\n state, and image registry. Your k3s config, your own\n registries.yaml entries, your workloads, and the\n registry's data are left alone. On a server, use\n conveyor-k3 host uninstall: it also removes the\n device key.\n --purge-k3s --yes also remove k3s itself and the\n registry's data\n daemon Run in the foreground (what the systemd unit calls).\n\nOptions:\n --version Print the version.\n --help Print this message.\n\nDocs: https://conveyor.rallycryapp.com/docs/guides/managed-personal-compute\n";
617
662
 
618
663
  /**
619
664
  * `conveyor-k3 registry add|list|gc` — where an owner adds registry
@@ -729,6 +774,12 @@ interface UpdateBinaries {
729
774
  }
730
775
  interface UpdateDecisionInput {
731
776
  autoUpgradeK3s: boolean;
777
+ /**
778
+ * False on a server whose k3s setup did not install (`managesK3s`): the
779
+ * installer would turn off the owner's traefik and servicelb. Absent reads
780
+ * as true, which is every VM guest.
781
+ */
782
+ managesK3s?: boolean;
732
783
  /** Null when the count could not be read — treated exactly like "busy". */
733
784
  runningConveyorPods: number | null;
734
785
  installedK3s: [number, number] | null;