alasio 5.1.0 → 6.0.0
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/src/branches.js +6 -14
- package/dist/cli/src/branches.js.map +1 -1
- package/dist/cli/src/capacity.js +46 -0
- package/dist/cli/src/capacity.js.map +1 -0
- package/dist/cli/src/cluster/k3s.js +12 -4
- package/dist/cli/src/cluster/k3s.js.map +1 -1
- package/dist/cli/src/commands/branch.js +2 -1
- package/dist/cli/src/commands/branch.js.map +1 -1
- package/dist/cli/src/commands/restore-filer-store.js +236 -0
- package/dist/cli/src/commands/restore-filer-store.js.map +1 -0
- package/dist/cli/src/commands/status.js +110 -9
- package/dist/cli/src/commands/status.js.map +1 -1
- package/dist/cli/src/commands/uninstall.js +1 -1
- package/dist/cli/src/commands/uninstall.js.map +1 -1
- package/dist/cli/src/commands/up.js +2 -1
- package/dist/cli/src/commands/up.js.map +1 -1
- package/dist/cli/src/commands.js +2 -1
- package/dist/cli/src/commands.js.map +1 -1
- package/dist/cli/src/config.js +13 -4
- package/dist/cli/src/config.js.map +1 -1
- package/dist/cli/src/install.js +9 -3
- package/dist/cli/src/install.js.map +1 -1
- package/dist/cli/src/kube/api.js +11 -3
- package/dist/cli/src/kube/api.js.map +1 -1
- package/dist/cli/src/kube/apply.js +116 -13
- package/dist/cli/src/kube/apply.js.map +1 -1
- package/dist/cli/src/kube/autoscalers.js +48 -0
- package/dist/cli/src/kube/autoscalers.js.map +1 -0
- package/dist/cli/src/kube/object-store-scale.js +116 -0
- package/dist/cli/src/kube/object-store-scale.js.map +1 -0
- package/dist/cli/src/kube/rollout.js +2 -0
- package/dist/cli/src/kube/rollout.js.map +1 -1
- package/dist/cli/src/manifests/admission.js +296 -0
- package/dist/cli/src/manifests/admission.js.map +1 -0
- package/dist/cli/src/manifests/agent-sandbox.js +6 -3
- package/dist/cli/src/manifests/agent-sandbox.js.map +1 -1
- package/dist/cli/src/manifests/alasio.js +34 -12
- package/dist/cli/src/manifests/alasio.js.map +1 -1
- package/dist/cli/src/manifests/cloudeventsources.eventing.keda.sh.json +219 -0
- package/dist/cli/src/manifests/clustercloudeventsources.eventing.keda.sh.json +218 -0
- package/dist/cli/src/manifests/clustertriggerauthentications.keda.sh.json +997 -0
- package/dist/cli/src/manifests/collector.js +77 -38
- package/dist/cli/src/manifests/collector.js.map +1 -1
- package/dist/cli/src/manifests/common.js +11 -0
- package/dist/cli/src/manifests/common.js.map +1 -1
- package/dist/cli/src/manifests/config.js +217 -31
- package/dist/cli/src/manifests/config.js.map +1 -1
- package/dist/cli/src/manifests/controllers.js +39 -0
- package/dist/cli/src/manifests/controllers.js.map +1 -0
- package/dist/cli/src/manifests/disruption.js +47 -0
- package/dist/cli/src/manifests/disruption.js.map +1 -0
- package/dist/cli/src/manifests/grafana.js +49 -5
- package/dist/cli/src/manifests/grafana.js.map +1 -1
- package/dist/cli/src/manifests/headroom.js +40 -0
- package/dist/cli/src/manifests/headroom.js.map +1 -0
- package/dist/cli/src/manifests/index.js +12 -3
- package/dist/cli/src/manifests/index.js.map +1 -1
- package/dist/cli/src/manifests/juicefs-csi.js +9 -6
- package/dist/cli/src/manifests/juicefs-csi.js.map +1 -1
- package/dist/cli/src/manifests/keda.js +271 -0
- package/dist/cli/src/manifests/keda.js.map +1 -0
- package/dist/cli/src/manifests/lake.js +7 -3
- package/dist/cli/src/manifests/lake.js.map +1 -1
- package/dist/cli/src/manifests/neon.js +33 -25
- package/dist/cli/src/manifests/neon.js.map +1 -1
- package/dist/cli/src/manifests/network-policies.js +90 -10
- package/dist/cli/src/manifests/network-policies.js.map +1 -1
- package/dist/cli/src/manifests/object-store.js +506 -77
- package/dist/cli/src/manifests/object-store.js.map +1 -1
- package/dist/cli/src/manifests/priorities.js +30 -0
- package/dist/cli/src/manifests/priorities.js.map +1 -0
- package/dist/cli/src/manifests/scaledjobs.keda.sh.json +7507 -0
- package/dist/cli/src/manifests/scaledobjects.keda.sh.json +564 -0
- package/dist/cli/src/manifests/scalers.js +24 -0
- package/dist/cli/src/manifests/scalers.js.map +1 -0
- package/dist/cli/src/manifests/sizing.js +40 -0
- package/dist/cli/src/manifests/sizing.js.map +1 -0
- package/dist/cli/src/manifests/triggerauthentications.keda.sh.json +992 -0
- package/dist/cli/src/manifests/valkey.js +63 -35
- package/dist/cli/src/manifests/valkey.js.map +1 -1
- package/dist/cli/src/manifests/verticalpodautoscalercheckpoints.autoscaling.k8s.io.json +250 -0
- package/dist/cli/src/manifests/verticalpodautoscalers.autoscaling.k8s.io.json +837 -0
- package/dist/cli/src/manifests/vpa.js +220 -0
- package/dist/cli/src/manifests/vpa.js.map +1 -0
- package/dist/cli/src/manifests/workspace-storage.js +12 -2
- package/dist/cli/src/manifests/workspace-storage.js.map +1 -1
- package/dist/cli/src/object-store.js +57 -0
- package/dist/cli/src/object-store.js.map +1 -0
- package/dist/cli/src/release.js +6 -6
- package/dist/cli/src/target.js +1 -1
- package/dist/cli/src/target.js.map +1 -1
- package/dist/neon/control/secrets.js +3 -0
- package/dist/neon/control/secrets.js.map +1 -1
- package/dist/src/kube/busy-label.js +13 -0
- package/dist/src/kube/busy-label.js.map +1 -0
- package/dist/src/kube/config.js +5 -1
- package/dist/src/kube/config.js.map +1 -1
- package/dist/src/kube/sandbox-shape.js +62 -0
- package/dist/src/kube/sandbox-shape.js.map +1 -0
- package/dist/src/sandbox/names.js +44 -0
- package/dist/src/sandbox/names.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What alasio adds to a workspace's Sandbox over the template its installation gives it
|
|
3
|
+
* (../kube/config.ts): bayma's token, mounted from a Secret of the Sandbox's, and passed
|
|
4
|
+
* as a file; the labels that name the Sandbox and say what it is; and, of a session's,
|
|
5
|
+
* its internet's gate and DNS (../sandbox/index.ts), and of a folder's bayma, its state
|
|
6
|
+
* directory (../mcp/bayma.ts). In one place, with no dependency, so the admission policy
|
|
7
|
+
* that holds alasio to its templates (cli/src/manifests/admission.ts) knows it as they do.
|
|
8
|
+
*/
|
|
9
|
+
/** The container in every Sandbox's pod that runs bayma. */
|
|
10
|
+
export const BAYMA_CONTAINER = "bayma";
|
|
11
|
+
/** Where a Sandbox's token Secret is mounted in its bayma container, its key, and its volume. */
|
|
12
|
+
export const TOKEN_DIR = "/run/alasio/bayma";
|
|
13
|
+
export const TOKEN_KEY = "token";
|
|
14
|
+
export const TOKEN_VOLUME = "alasio-bayma-token";
|
|
15
|
+
/** The token volume's files' mode: readable by the pod's group, which is how a non-root bayma reads it. */
|
|
16
|
+
export const TOKEN_MODE = 0o440;
|
|
17
|
+
/** The arguments bayma is given after its template's: where its token is. */
|
|
18
|
+
export const TOKEN_FILE_ARGS = ["--token-file", `${TOKEN_DIR}/${TOKEN_KEY}`];
|
|
19
|
+
/** The name of a Sandbox's token Secret. */
|
|
20
|
+
export function tokenSecretName(name) {
|
|
21
|
+
return `${name}-bayma-token`;
|
|
22
|
+
}
|
|
23
|
+
/** The label every object alasio makes carries, and the one that names its Sandbox. */
|
|
24
|
+
export const MANAGED_BY = { "app.kubernetes.io/managed-by": "alasio" };
|
|
25
|
+
export const SANDBOX_LABEL = "alasio.dev/sandbox";
|
|
26
|
+
/** What a Sandbox's pod is to alasio: a session's, or a folder's bayma's. */
|
|
27
|
+
export const WORKLOAD_LABEL = "alasio.dev/workload";
|
|
28
|
+
/** A session's internet, `none` or `full`, which its NetworkPolicies follow. */
|
|
29
|
+
export const NET_MODE_LABEL = "alasio.dev/net-mode";
|
|
30
|
+
/** The harness a folder's bayma serves, as a path segment. */
|
|
31
|
+
export const HARNESS_LABEL = "alasio.dev/harness";
|
|
32
|
+
/** The token's environment variable in a session's bayma container, which its OTLP headers expand. */
|
|
33
|
+
export const TOKEN_ENV = "ALASIO_SANDBOX_TOKEN";
|
|
34
|
+
/** The resolvers a session with internet uses unless its template names others. */
|
|
35
|
+
export const DEFAULT_FULL_MODE_NAMESERVERS = ["1.1.1.1", "8.8.8.8"];
|
|
36
|
+
/** The argument a folder's bayma is given its state directory by, under its template's state root. */
|
|
37
|
+
export const STATE_DIR_ARG = "--state-dir";
|
|
38
|
+
/** A path segment from `value`: never empty, nor starting with a dot. */
|
|
39
|
+
export function sanitizePathToken(value) {
|
|
40
|
+
return String(value).replace(/[^A-Za-z0-9_.-]+/g, "-").replace(/^[-.]+|-+$/g, "") || "default";
|
|
41
|
+
}
|
|
42
|
+
/** The init container that holds a session's pod until its egress is confined: its name, and its resources. */
|
|
43
|
+
export const EGRESS_GATE = { name: "egress-gate", resources: { requests: { cpu: "10m", memory: "32Mi" }, limits: { memory: "64Mi" } } };
|
|
44
|
+
/**
|
|
45
|
+
* The egress gate's program: exits once three connections in a row to the API server
|
|
46
|
+
* fail, and fails the pod if they still succeed after two minutes. Runs on the agent
|
|
47
|
+
* image's Node.
|
|
48
|
+
*/
|
|
49
|
+
export const EGRESS_GATE_SCRIPT = [
|
|
50
|
+
"const net = require('node:net');",
|
|
51
|
+
"const host = process.env.KUBERNETES_SERVICE_HOST, port = Number(process.env.KUBERNETES_SERVICE_PORT);",
|
|
52
|
+
"const deadline = Date.now() + 120000; let refused = 0;",
|
|
53
|
+
"(function probe() {",
|
|
54
|
+
" const socket = net.connect({ host, port, timeout: 1000 });",
|
|
55
|
+
" const next = (blocked) => { socket.destroy(); refused = blocked ? refused + 1 : 0;",
|
|
56
|
+
" if (refused >= 3) process.exit(0);",
|
|
57
|
+
" if (Date.now() > deadline) { console.error('egress is not confined: is NetworkPolicy enforced in this cluster?'); process.exit(1); }",
|
|
58
|
+
" setTimeout(probe, 250); };",
|
|
59
|
+
" socket.once('connect', () => next(false)); socket.once('timeout', () => next(true)); socket.once('error', () => next(true));",
|
|
60
|
+
"})();",
|
|
61
|
+
].join("\n");
|
|
62
|
+
//# sourceMappingURL=sandbox-shape.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox-shape.js","sourceRoot":"","sources":["../../../../src/kube/sandbox-shape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AAG,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,IAAI,SAAS,CAAC;AACjG,CAAC;AAED,+GAA+G;AAC/G,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,IAAI,EAAE,aAAa,EAAE,SAAS,EAAE,EAAE,QAAQ,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAW,CAAC;AAEjJ;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,kCAAkC;IAClC,uGAAuG;IACvG,wDAAwD;IACxD,qBAAqB;IACrB,8DAA8D;IAC9D,sFAAsF;IACtF,wCAAwC;IACxC,0IAA0I;IAC1I,gCAAgC;IAChC,gIAAgI;IAChI,OAAO;CACR,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Naming for session filesystems. A workspace is one of two kinds (see
|
|
3
|
+
* ../workspace/kind.ts): a folder, or a session filesystem identified by a volume id.
|
|
4
|
+
* A volume id is what alasio generates and stores, and its session's Sandbox, Service and
|
|
5
|
+
* volume claim are named for it.
|
|
6
|
+
*/
|
|
7
|
+
import { Schema } from "effect";
|
|
8
|
+
/**
|
|
9
|
+
* The longest a volume id is: a DNS label's 63 characters, less a claim template's name
|
|
10
|
+
* of up to CLAIM_TEMPLATE_MAX and the hyphen after it, so its volume claims' names,
|
|
11
|
+
* `<template>-<id>` (../kube/sandboxes.ts claimName), are DNS labels too, as alasio's
|
|
12
|
+
* admission policy of its clones holds them to (cli/src/manifests/admission.ts).
|
|
13
|
+
*/
|
|
14
|
+
export const VOLUME_ID_MAX = 58;
|
|
15
|
+
/** The longest a claim template's name is, of which a volume id's claims are named. */
|
|
16
|
+
export const CLAIM_TEMPLATE_MAX = 63 - 1 - VOLUME_ID_MAX;
|
|
17
|
+
/**
|
|
18
|
+
* A volume id is a DNS label of 3–58 characters from `[a-z0-9-]` that starts and ends
|
|
19
|
+
* with a letter or digit, as the names of the Sandbox, its Service and its pod must be,
|
|
20
|
+
* and short enough for its claims' (VOLUME_ID_MAX). alasio generates ids that already
|
|
21
|
+
* satisfy this, and this guards against any that would not.
|
|
22
|
+
*/
|
|
23
|
+
const VOLUME_ID_PATTERN = new RegExp(`^[a-z0-9][a-z0-9-]{1,${VOLUME_ID_MAX - 2}}[a-z0-9]$`, "u");
|
|
24
|
+
/** A volume id, as what comes from outside alasio is decoded. */
|
|
25
|
+
const VolumeId = Schema.String.check(Schema.isPattern(VOLUME_ID_PATTERN));
|
|
26
|
+
/**
|
|
27
|
+
* A session's token, `<volumeId>.<random>` (../kube/sandboxes.ts newToken), decoded into
|
|
28
|
+
* the session it names and the rest.
|
|
29
|
+
*/
|
|
30
|
+
export const SessionToken = Schema.TemplateLiteralParser([VolumeId, ".", Schema.NonEmptyString]);
|
|
31
|
+
export function isValidVolumeId(volumeId) {
|
|
32
|
+
return typeof volumeId === "string" && VOLUME_ID_PATTERN.test(volumeId);
|
|
33
|
+
}
|
|
34
|
+
export function assertValidVolumeId(volumeId) {
|
|
35
|
+
if (!isValidVolumeId(volumeId)) {
|
|
36
|
+
throw new Error(`invalid session volume id: ${JSON.stringify(volumeId)} (need 3–${VOLUME_ID_MAX} chars of [a-z0-9-], starting and ending with a letter or digit)`);
|
|
37
|
+
}
|
|
38
|
+
return volumeId;
|
|
39
|
+
}
|
|
40
|
+
/** A fresh volume id, e.g. `fs-1a2b3c4d5e`, valid by construction. */
|
|
41
|
+
export function newVolumeId(random = () => crypto.randomUUID()) {
|
|
42
|
+
return `fs-${random().replace(/-/g, "").slice(0, 12)}`;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=names.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"names.js","sourceRoot":"","sources":["../../../../src/sandbox/names.ts"],"names":[],"mappings":"AAAA;;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