@rallycry/conveyor-k3 0.1.13 → 0.1.15
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/cli.js +968 -256
- package/dist/index.d.ts +37 -30
- package/dist/index.js +839 -216
- package/dist/vm-qemu.js +6472 -7
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PersonalClusterEnrollmentBundle, PersonalClusterEnrollmentCompletion, PersonalClusterDesiredState, PersonalClusterHeartbeat, PersonalClusterWorkloads, PersonalClusterKubeletState } from '@project/shared';
|
|
2
|
+
export { maximumGuestMemoryGiB, maximumGuestMemoryGiBWithin } from '@project/shared';
|
|
2
3
|
|
|
3
4
|
interface ClusterConnectionConfig {
|
|
4
5
|
apiUrl: string;
|
|
@@ -144,6 +145,8 @@ declare class ClusterDaemon {
|
|
|
144
145
|
* against k3s's own settings before reporting it.
|
|
145
146
|
*/
|
|
146
147
|
private isolation;
|
|
148
|
+
/** Whether the pod slice's CPU cap is in force, from the last reconcile. */
|
|
149
|
+
private cpuQuotaApplied;
|
|
147
150
|
private timers;
|
|
148
151
|
/** When the last store walk started, so one that failed is not retried on every reconcile. */
|
|
149
152
|
private storeWalkStartedAt;
|
|
@@ -247,6 +250,12 @@ interface PruneResult {
|
|
|
247
250
|
removed: number;
|
|
248
251
|
bytesReclaimed: number;
|
|
249
252
|
failures: string[];
|
|
253
|
+
/**
|
|
254
|
+
* Removals crictl stopped waiting for. containerd carries on deleting a
|
|
255
|
+
* multi-gigabyte image after crictl's deadline, so these are not failures:
|
|
256
|
+
* the next prune finds the image gone, or tries it again.
|
|
257
|
+
*/
|
|
258
|
+
pending: string[];
|
|
250
259
|
}
|
|
251
260
|
/** Remove the stranded images. Individual failures are reported, not thrown. */
|
|
252
261
|
declare function pruneStrandedImages(exec: Executor, inventory: ImageInventory, wantedImages: string[]): Promise<PruneResult>;
|
|
@@ -286,6 +295,11 @@ declare function warmImages(exec: Executor, wantedImages: string[], unauthentica
|
|
|
286
295
|
* and should prefer one holding the latest bake. So the heartbeat lists every
|
|
287
296
|
* `localhost/` ref, with the content hash the bake stamped on the image.
|
|
288
297
|
*
|
|
298
|
+
* It also lists every wanted ref the node holds, whatever its registry. A
|
|
299
|
+
* shadow bake's image lives in the machine's own registry, and placement runs
|
|
300
|
+
* a card on the previous shadow while its rebuild is queued only when this
|
|
301
|
+
* list says the node still holds it.
|
|
302
|
+
*
|
|
289
303
|
* The hash takes one `crictl inspecti` per image, cached by image id: an id
|
|
290
304
|
* names exactly one image config, so its label never changes.
|
|
291
305
|
*/
|
|
@@ -315,6 +329,8 @@ interface TelemetryState {
|
|
|
315
329
|
isolation?: {
|
|
316
330
|
applied: boolean;
|
|
317
331
|
};
|
|
332
|
+
/** Present while a host-runtime machine's desired state reserves CPU. */
|
|
333
|
+
cpuQuotaApplied?: boolean | undefined;
|
|
318
334
|
/**
|
|
319
335
|
* The last measured size of k3s's containerd store. Null (or absent) until
|
|
320
336
|
* the first measurement, and the heartbeat says null then: a 0 would read
|
|
@@ -424,6 +440,11 @@ interface ReconcileResult {
|
|
|
424
440
|
isolation?: {
|
|
425
441
|
applied: boolean;
|
|
426
442
|
};
|
|
443
|
+
/**
|
|
444
|
+
* Whether the pod slice is hard-capped at the CPU the reserve leaves, on a
|
|
445
|
+
* host-runtime machine whose desired state reserves CPU. Undefined otherwise.
|
|
446
|
+
*/
|
|
447
|
+
cpuQuotaApplied?: boolean;
|
|
427
448
|
}
|
|
428
449
|
declare function reconcile(ctx: ReconcileContext, desired: PersonalClusterDesiredState): Promise<ReconcileResult>;
|
|
429
450
|
|
|
@@ -553,11 +574,6 @@ declare function renderK3sDropIn(kubelet: PersonalClusterKubeletState, ownerConf
|
|
|
553
574
|
options?: {
|
|
554
575
|
disableComponents?: boolean;
|
|
555
576
|
}): DropInRenderResult;
|
|
556
|
-
/**
|
|
557
|
-
* @deprecated Use {@link renderK3sDropIn}. Kept as a named alias because the
|
|
558
|
-
* package exports it and a published CLI may still import it by this name.
|
|
559
|
-
*/
|
|
560
|
-
declare const renderKubeletDropIn: typeof renderK3sDropIn;
|
|
561
577
|
|
|
562
578
|
interface UnitRenderOptions {
|
|
563
579
|
/** Absolute path to the installed `conveyor-k3` binary. */
|
|
@@ -732,27 +748,21 @@ interface UninstallResult {
|
|
|
732
748
|
declare function uninstall(ports: UninstallPorts, options?: UninstallOptions): Promise<UninstallResult>;
|
|
733
749
|
|
|
734
750
|
/**
|
|
735
|
-
*
|
|
736
|
-
*
|
|
737
|
-
*
|
|
738
|
-
*
|
|
739
|
-
*
|
|
740
|
-
*
|
|
741
|
-
*
|
|
742
|
-
*
|
|
743
|
-
*
|
|
744
|
-
*
|
|
745
|
-
*
|
|
746
|
-
* names, never `@latest` — the npm dist-tag is a root-execution channel on
|
|
747
|
-
* every enrolled machine, so a compromised publish would reach them all
|
|
748
|
-
* within a day. The daemon restarts only if the version actually moved.
|
|
749
|
-
* - **cloudflared.** `cloudflared update` exits 11 to mean "updated"; that is
|
|
750
|
-
* the only case that needs a tunnel restart.
|
|
751
|
-
* - **k3s.** Only when the owner allowed it AND nothing of Conveyor's is
|
|
752
|
-
* running. A k3s upgrade at the wrong moment interrupts someone's build, and
|
|
753
|
-
* no upgrade is worth that.
|
|
751
|
+
* Who keeps this machine's cloudflared current.
|
|
752
|
+
*
|
|
753
|
+
* `cloudflared update` only works on a binary cloudflared installed itself. A
|
|
754
|
+
* package-manager build refuses: it prints "cloudflared was installed by a
|
|
755
|
+
* package manager" and exits 0 — the same exit as "already current". Read by
|
|
756
|
+
* exit code alone, such a machine reports a current cloudflared forever while
|
|
757
|
+
* apt (or nothing) is what actually updates it.
|
|
758
|
+
*
|
|
759
|
+
* The literal path lies, too. On a server where `/usr/local/bin/cloudflared`
|
|
760
|
+
* is a symlink to apt's `/usr/bin/cloudflared` there is ONE binary, owned by
|
|
761
|
+
* dpkg, so the owner check runs against the resolved path.
|
|
754
762
|
*/
|
|
755
763
|
|
|
764
|
+
type CloudflaredUpdater = "conveyor" | "package-manager";
|
|
765
|
+
|
|
756
766
|
interface UpdatePorts {
|
|
757
767
|
exec: Executor;
|
|
758
768
|
log: (line: string) => void;
|
|
@@ -802,6 +812,8 @@ declare function decideK3sUpgrade(input: UpdateDecisionInput): K3sUpgradeDecisio
|
|
|
802
812
|
interface UpdateResult {
|
|
803
813
|
packageUpdated: boolean;
|
|
804
814
|
cloudflaredUpdated: boolean;
|
|
815
|
+
/** Who keeps cloudflared current; null when this run could not tell. */
|
|
816
|
+
cloudflaredUpdater: CloudflaredUpdater | null;
|
|
805
817
|
k3sUpgraded: boolean;
|
|
806
818
|
notes: string[];
|
|
807
819
|
}
|
|
@@ -956,11 +968,6 @@ interface QemuPolicyContext {
|
|
|
956
968
|
*/
|
|
957
969
|
declare function rewriteQemuArgs(args: string[], network: QemuNetworkPolicy, ncPath?: string, hostContext?: QemuPolicyContext): string[];
|
|
958
970
|
|
|
959
|
-
/** The largest whole-GiB guest whose host cost (see vmHostMemoryGiB) fits in the budget. */
|
|
960
|
-
declare function maximumGuestMemoryGiBWithin(budgetGiB: number, relaySlots?: number): number;
|
|
961
|
-
/** Reserve 25% of physical host RAM after accounting for VM overhead. */
|
|
962
|
-
declare function maximumGuestMemoryGiB(hostBytes: number, relaySlots?: number): number;
|
|
963
|
-
|
|
964
971
|
/** `--instance` omitted or `default`: the original VM, whose paths never move. */
|
|
965
972
|
declare const DEFAULT_INSTANCE = "default";
|
|
966
973
|
/** The `--instance` flag's value. Omitted or `default` selects the default VM. */
|
|
@@ -1010,4 +1017,4 @@ declare function pathsForRoot(root: string, instance?: string): {
|
|
|
1010
1017
|
};
|
|
1011
1018
|
type HostPaths = ReturnType<typeof pathsForRoot>;
|
|
1012
1019
|
|
|
1013
|
-
export { ClusterConnection, type ClusterConnectionConfig, ClusterDaemon, CommandError, type CrictlImage, DEFAULT_INSTANCE, type DaemonPorts, type Executor, type FileSystemPort$1 as FileSystemPort, type GuestDnsProvision, type GuestSrvRecord, HELP, type HostPaths, type ImageInventory, K3S_DISABLED_COMPONENTS, K3S_INSTALL_EXEC, type K3sUpgradeDecision, type MachineState, type NetworkEndpoint, type NetworkPolicy, type QemuNetworkPolicy, type ReconcileContext, type ReconcileResult, type RegistriesFile, type ResolvedNetwork, type ResolvedNetworkHost, type SRVLookup, type UninstallResult, type UnitRenderOptions, VERBS, type Verb, cloudflaredSrvRecords, collectHeartbeat, configuredAuthHosts, countRunningConveyorPods, createMemoryFileSystem, decideK3sUpgrade, hostPaths, isGloballyRoutableIPv4, isVerb,
|
|
1020
|
+
export { ClusterConnection, type ClusterConnectionConfig, ClusterDaemon, CommandError, type CrictlImage, DEFAULT_INSTANCE, type DaemonPorts, type Executor, type FileSystemPort$1 as FileSystemPort, type GuestDnsProvision, type GuestSrvRecord, HELP, type HostPaths, type ImageInventory, K3S_DISABLED_COMPONENTS, K3S_INSTALL_EXEC, type K3sUpgradeDecision, type MachineState, type NetworkEndpoint, type NetworkPolicy, type QemuNetworkPolicy, type ReconcileContext, type ReconcileResult, type RegistriesFile, type ResolvedNetwork, type ResolvedNetworkHost, type SRVLookup, type UninstallResult, type UnitRenderOptions, VERBS, type Verb, cloudflaredSrvRecords, collectHeartbeat, configuredAuthHosts, countRunningConveyorPods, createMemoryFileSystem, decideK3sUpgrade, hostPaths, isGloballyRoutableIPv4, isVerb, meetsK3sMinimum, missingAuthHosts, nodeFileSystem, ownerConfiguredKeys, ownerConfiguredKubeletFlags, parseArgs, parseInstanceName, parseK3sVersion, parseRegistries, pruneStrandedImages, readImageInventory, readState, reconcile, registryAdd, registryList, renderAllUnits, renderGuestDnsProvision, renderK3sDropIn, renderRegistryAuthSummary, resolveCloudflaredSrvRecords, resolveNetwork, rewriteQemuArgs, runOrThrow, runUpdate, selectStrandedImages, serializeRegistries, spawnExecutor, uninstall, upsertRegistryAuth, warmImages, writeState };
|