@namzu/sandbox 13.0.0 → 15.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/CHANGELOG.md +1147 -0
- package/README.md +447 -0
- package/dist/backends/aci-standby-pool/index.d.ts.map +1 -1
- package/dist/backends/aci-standby-pool/index.js +13 -1
- package/dist/backends/aci-standby-pool/index.js.map +1 -1
- package/dist/backends/docker/index.d.ts.map +1 -1
- package/dist/backends/docker/index.js +19 -1
- package/dist/backends/docker/index.js.map +1 -1
- package/dist/backends/firecracker/index.d.ts.map +1 -1
- package/dist/backends/firecracker/index.js +12 -2
- package/dist/backends/firecracker/index.js.map +1 -1
- package/dist/backends/firecracker/protocol.d.ts +481 -8
- package/dist/backends/firecracker/protocol.d.ts.map +1 -1
- package/dist/backends/firecracker/protocol.js +136 -0
- package/dist/backends/firecracker/protocol.js.map +1 -1
- package/dist/backends/firecracker/transport.d.ts +642 -14
- package/dist/backends/firecracker/transport.d.ts.map +1 -1
- package/dist/backends/firecracker/transport.js +1307 -34
- package/dist/backends/firecracker/transport.js.map +1 -1
- package/dist/backends/kubernetes/egress-policy.d.ts +1296 -0
- package/dist/backends/kubernetes/egress-policy.d.ts.map +1 -0
- package/dist/backends/kubernetes/egress-policy.js +2458 -0
- package/dist/backends/kubernetes/egress-policy.js.map +1 -0
- package/dist/backends/kubernetes/identity.d.ts +193 -0
- package/dist/backends/kubernetes/identity.d.ts.map +1 -0
- package/dist/backends/kubernetes/identity.js +147 -0
- package/dist/backends/kubernetes/identity.js.map +1 -0
- package/dist/backends/kubernetes/index.d.ts +1019 -0
- package/dist/backends/kubernetes/index.d.ts.map +1 -0
- package/dist/backends/kubernetes/index.js +1756 -0
- package/dist/backends/kubernetes/index.js.map +1 -0
- package/dist/backends/kubernetes/ingress-policy.d.ts +375 -0
- package/dist/backends/kubernetes/ingress-policy.d.ts.map +1 -0
- package/dist/backends/kubernetes/ingress-policy.js +1050 -0
- package/dist/backends/kubernetes/ingress-policy.js.map +1 -0
- package/dist/backends/kubernetes/k8s-client.d.ts +334 -0
- package/dist/backends/kubernetes/k8s-client.d.ts.map +1 -0
- package/dist/backends/kubernetes/k8s-client.js +553 -0
- package/dist/backends/kubernetes/k8s-client.js.map +1 -0
- package/dist/backends/kubernetes/lease.d.ts +145 -0
- package/dist/backends/kubernetes/lease.d.ts.map +1 -0
- package/dist/backends/kubernetes/lease.js +201 -0
- package/dist/backends/kubernetes/lease.js.map +1 -0
- package/dist/backends/kubernetes/objects.d.ts +702 -0
- package/dist/backends/kubernetes/objects.d.ts.map +1 -0
- package/dist/backends/kubernetes/objects.js +518 -0
- package/dist/backends/kubernetes/objects.js.map +1 -0
- package/dist/backends/kubernetes/per-sandbox-policy.d.ts +219 -0
- package/dist/backends/kubernetes/per-sandbox-policy.d.ts.map +1 -0
- package/dist/backends/kubernetes/per-sandbox-policy.js +407 -0
- package/dist/backends/kubernetes/per-sandbox-policy.js.map +1 -0
- package/dist/backends/kubernetes/privilege-probe.d.ts +136 -0
- package/dist/backends/kubernetes/privilege-probe.d.ts.map +1 -0
- package/dist/backends/kubernetes/privilege-probe.js +185 -0
- package/dist/backends/kubernetes/privilege-probe.js.map +1 -0
- package/dist/backends/kubernetes/rbac.d.ts +153 -0
- package/dist/backends/kubernetes/rbac.d.ts.map +1 -0
- package/dist/backends/kubernetes/rbac.js +177 -0
- package/dist/backends/kubernetes/rbac.js.map +1 -0
- package/dist/backends/kubernetes/sandbox.d.ts +190 -0
- package/dist/backends/kubernetes/sandbox.d.ts.map +1 -0
- package/dist/backends/kubernetes/sandbox.js +433 -0
- package/dist/backends/kubernetes/sandbox.js.map +1 -0
- package/dist/backends/kubernetes/transport.d.ts +1048 -0
- package/dist/backends/kubernetes/transport.d.ts.map +1 -0
- package/dist/backends/kubernetes/transport.js +2093 -0
- package/dist/backends/kubernetes/transport.js.map +1 -0
- package/dist/backends/kubernetes/workspace.d.ts +1512 -0
- package/dist/backends/kubernetes/workspace.d.ts.map +1 -0
- package/dist/backends/kubernetes/workspace.js +3703 -0
- package/dist/backends/kubernetes/workspace.js.map +1 -0
- package/dist/backends/remote-execution-controller.d.ts +14 -0
- package/dist/backends/remote-execution-controller.d.ts.map +1 -1
- package/dist/backends/remote-execution-controller.js.map +1 -1
- package/dist/index.d.ts +350 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +344 -34
- package/dist/index.js.map +1 -1
- package/dist/testing/sandbox-conformance.d.ts +227 -0
- package/dist/testing/sandbox-conformance.d.ts.map +1 -0
- package/dist/testing/sandbox-conformance.js +896 -0
- package/dist/testing/sandbox-conformance.js.map +1 -0
- package/package.json +5 -4
- package/src/backends/aci-standby-pool/index.ts +16 -1
- package/src/backends/docker/index.ts +22 -1
- package/src/backends/firecracker/index.ts +14 -2
- package/src/backends/firecracker/protocol.ts +541 -6
- package/src/backends/firecracker/transport.ts +1687 -64
- package/src/backends/kubernetes/egress-policy.ts +3448 -0
- package/src/backends/kubernetes/identity.ts +261 -0
- package/src/backends/kubernetes/index.ts +2670 -0
- package/src/backends/kubernetes/ingress-policy.ts +1344 -0
- package/src/backends/kubernetes/k8s-client.ts +742 -0
- package/src/backends/kubernetes/lease.ts +254 -0
- package/src/backends/kubernetes/objects.ts +983 -0
- package/src/backends/kubernetes/per-sandbox-policy.ts +542 -0
- package/src/backends/kubernetes/privilege-probe.ts +261 -0
- package/src/backends/kubernetes/rbac.ts +192 -0
- package/src/backends/kubernetes/sandbox.ts +593 -0
- package/src/backends/kubernetes/transport.ts +2895 -0
- package/src/backends/kubernetes/workspace.ts +5640 -0
- package/src/backends/remote-execution-controller.ts +14 -0
- package/src/index.ts +838 -35
- package/src/testing/sandbox-conformance.ts +1202 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"objects.d.ts","sourceRoot":"","sources":["../../../src/backends/kubernetes/objects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAIH,wCAAwC;AACxC,eAAO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E,eAAO,MAAM,kCAAkC,OAAO,CAAA;AAEtD,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAElE;AAED,wBAAgB,oCAAoC,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEzE;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,wBAAwB;IACxC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CACpB"}
|
|
@@ -0,0 +1,518 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire shapes and paths for the agent-sandbox CRDs this backend touches.
|
|
3
|
+
*
|
|
4
|
+
* Every field name here was read off the CRDs a real cluster serves —
|
|
5
|
+
* `kubectl get crd -o json` against agent-sandbox v1.0.2 on a kind cluster —
|
|
6
|
+
* and cross-checked against the upstream `sandbox_types.go` /
|
|
7
|
+
* `sandboxclaim_types.go` doc comments. Where the two disagree the served CRD
|
|
8
|
+
* wins, because it is what the API server validates against: the Go source on
|
|
9
|
+
* upstream main has already moved `Sandbox`'s `shutdownTime` /
|
|
10
|
+
* `shutdownPolicy` under a `lifecycle` block, and v1beta1 as served still
|
|
11
|
+
* carries them at the top of `spec`.
|
|
12
|
+
*
|
|
13
|
+
* The shapes are deliberately partial. This backend reads four fields out of a
|
|
14
|
+
* Sandbox status and writes three into a claim spec; typing the rest of a
|
|
15
|
+
* PodSpec would be a vendored copy of the core API that goes stale on its own
|
|
16
|
+
* schedule. A pod template read from a SandboxTemplate is carried through as
|
|
17
|
+
* an opaque record for exactly that reason — it is copied, never interpreted.
|
|
18
|
+
*
|
|
19
|
+
* Two groups, both `v1beta1` and both singular-versioned today:
|
|
20
|
+
* - `agents.x-k8s.io` → sandboxes
|
|
21
|
+
* - `extensions.agents.x-k8s.io` → sandboxtemplates, sandboxwarmpools,
|
|
22
|
+
* sandboxclaims
|
|
23
|
+
*/
|
|
24
|
+
import { createHash } from 'node:crypto';
|
|
25
|
+
/** Group serving the `Sandbox` kind. */
|
|
26
|
+
export const SANDBOX_API_GROUP = 'agents.x-k8s.io';
|
|
27
|
+
/** Group serving `SandboxTemplate`, `SandboxWarmPool` and `SandboxClaim`. */
|
|
28
|
+
export const SANDBOX_EXTENSIONS_API_GROUP = 'extensions.agents.x-k8s.io';
|
|
29
|
+
/** The only version either group serves in agent-sandbox v1.0.2. */
|
|
30
|
+
export const SANDBOX_API_VERSION = 'v1beta1';
|
|
31
|
+
/** `status.conditions[].type` both kinds report readiness under. */
|
|
32
|
+
export const READY_CONDITION = 'Ready';
|
|
33
|
+
/**
|
|
34
|
+
* True only for an explicit `status: 'True'`. An absent condition, an
|
|
35
|
+
* `Unknown` and a `False` are all "not yet", never "assume so" — the
|
|
36
|
+
* controller writes `Unknown` while it is still deciding.
|
|
37
|
+
*/
|
|
38
|
+
export function isConditionTrue(conditions, type) {
|
|
39
|
+
return conditions?.some((c) => c.type === type && c.status === 'True') === true;
|
|
40
|
+
}
|
|
41
|
+
/** The pod's own address, whichever of the two fields this cluster fills. */
|
|
42
|
+
export function readPodIP(pod) {
|
|
43
|
+
const status = pod?.status;
|
|
44
|
+
if (typeof status?.podIP === 'string' && status.podIP !== '')
|
|
45
|
+
return status.podIP;
|
|
46
|
+
for (const entry of status?.podIPs ?? []) {
|
|
47
|
+
if (typeof entry?.ip === 'string' && entry.ip !== '')
|
|
48
|
+
return entry.ip;
|
|
49
|
+
}
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* A pod whose uid is still worth binding to: not being deleted, and not in a
|
|
54
|
+
* phase it cannot leave.
|
|
55
|
+
*
|
|
56
|
+
* The case this exists for is resume. A resumed sandbox's pod keeps the
|
|
57
|
+
* SAME NAME and gets a new uid and a new IP, so while the outgoing pod is
|
|
58
|
+
* terminating a `GET` by that name answers with the pod on its way out, and a
|
|
59
|
+
* list by the sandbox's selector returns every pod still carrying its labels,
|
|
60
|
+
* that one included. Binding to the terminating pod's uid produces a token the
|
|
61
|
+
* new agent refuses, and the failure arrives as a flat `unauthorized` with
|
|
62
|
+
* nothing pointing at the race that caused it.
|
|
63
|
+
*/
|
|
64
|
+
export function isPodLive(pod) {
|
|
65
|
+
if (!pod?.metadata)
|
|
66
|
+
return false;
|
|
67
|
+
// `!= null`, not `!== undefined`: an explicit JSON null would otherwise
|
|
68
|
+
// read as "terminating" and make a perfectly healthy pod unbindable. The
|
|
69
|
+
// API server omits the field rather than nulling it, so this never fires
|
|
70
|
+
// against a real cluster — it costs nothing not to depend on that.
|
|
71
|
+
if (pod.metadata.deletionTimestamp != null)
|
|
72
|
+
return false;
|
|
73
|
+
const phase = pod.status?.phase;
|
|
74
|
+
return phase !== 'Succeeded' && phase !== 'Failed';
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* A pod whose containers have stopped: it is still an object, and nothing in
|
|
78
|
+
* it is executing any more.
|
|
79
|
+
*
|
|
80
|
+
* NOT the negation of {@link isPodLive}, and the gap between the two is the
|
|
81
|
+
* whole point. A terminating pod — `deletionTimestamp` set, phase still
|
|
82
|
+
* `Running` — is not live (never bind to it: its uid is about to stop being
|
|
83
|
+
* a valid token) and not stopped either (its process is still running, and on
|
|
84
|
+
* a workspace it is still writing to the caller's block device until it exits
|
|
85
|
+
* or `terminationGracePeriodSeconds` runs out). A suspend that treated the
|
|
86
|
+
* timestamp as "gone" would resolve mid-drain and promise a quiesced disk it
|
|
87
|
+
* had not waited for.
|
|
88
|
+
*/
|
|
89
|
+
export function isPodStopped(pod) {
|
|
90
|
+
const phase = pod?.status?.phase;
|
|
91
|
+
return phase === 'Succeeded' || phase === 'Failed';
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Backend-owned pod label naming which `SandboxTemplate` a Sandbox's pod was
|
|
95
|
+
* built from.
|
|
96
|
+
*
|
|
97
|
+
* agent-sandbox's OWN template-adoption controller selects pods by a
|
|
98
|
+
* controller-owned label, `agents.x-k8s.io/sandbox-template-ref-hash` — but
|
|
99
|
+
* that label is written only onto a Sandbox ADOPTED out of a
|
|
100
|
+
* `SandboxWarmPool` (the controller re-parents ownership and re-labels on
|
|
101
|
+
* bind). A Sandbox this backend POSTs directly (the pool-less path in
|
|
102
|
+
* `index.ts`'s `buildSandboxBody`) is never adopted, so it never gets that
|
|
103
|
+
* label — a direct Sandbox's pod would carry nothing a `NetworkPolicy`
|
|
104
|
+
* could reliably select it by. This backend writes its own label instead, on
|
|
105
|
+
* every Sandbox it creates, pooled or direct, so `egress-policy.ts`'s
|
|
106
|
+
* translated `NetworkPolicy` has one selector that always matches.
|
|
107
|
+
*
|
|
108
|
+
* `namzu.ai` matches the published domain (`packages/cli/package.json`'s
|
|
109
|
+
* `homepage`); there is no pre-existing Kubernetes label or annotation
|
|
110
|
+
* prefix anywhere in this repo to follow instead — the closest existing
|
|
111
|
+
* convention, `NAMZU_AGENT_*` / `NAMZU_SANDBOX_*` env vars, is not a
|
|
112
|
+
* label-safe shape.
|
|
113
|
+
*
|
|
114
|
+
* W8's `SandboxTemplate` manifests MUST set this same label (value = the
|
|
115
|
+
* template's own name) on their `podTemplate.metadata.labels`, so a POOLED
|
|
116
|
+
* sandbox's pod carries it too — the pool's pods are built from that
|
|
117
|
+
* template's `podTemplate` directly, not through `buildSandboxBody`, so
|
|
118
|
+
* nothing here can put it there for them. Skipping that step means a
|
|
119
|
+
* translated `NetworkPolicy`'s `podSelector` matches only sandboxes this
|
|
120
|
+
* backend created directly and none of the pooled ones — see
|
|
121
|
+
* `docs/sdk/kubernetes-sandbox.md`'s egress section.
|
|
122
|
+
*/
|
|
123
|
+
export const SANDBOX_TEMPLATE_LABEL_KEY = 'sandbox.namzu.ai/template';
|
|
124
|
+
/**
|
|
125
|
+
* Backend-owned annotation naming when a Sandbox's `spec.operatingMode` was
|
|
126
|
+
* last changed BY THIS BACKEND, RFC 3339.
|
|
127
|
+
*
|
|
128
|
+
* It exists because nothing already on the object answers the question, and
|
|
129
|
+
* an inventory that never wakes a workspace is the reason to ask it: a
|
|
130
|
+
* retention pass deleting the workspaces nobody has resumed for a month reads
|
|
131
|
+
* this and `metadata.creationTimestamp` and nothing else.
|
|
132
|
+
*
|
|
133
|
+
* The obvious candidate is the controller's own `Suspended` condition and its
|
|
134
|
+
* `lastTransitionTime`, and upstream's `sandbox_types.go` rules it out in the
|
|
135
|
+
* same breath it documents it: "the controller does not currently remove this
|
|
136
|
+
* condition when the Sandbox is resumed", so after a resume the condition is
|
|
137
|
+
* still True and its timestamp still names the suspend that preceded it. The
|
|
138
|
+
* `Ready` condition's timestamp is no better — it moves for every pod that
|
|
139
|
+
* comes and goes, a crash-restart included, and a workspace whose pod
|
|
140
|
+
* restarted has not changed operating mode at all.
|
|
141
|
+
*
|
|
142
|
+
* So the two patches that DO change the mode stamp the moment they were sent,
|
|
143
|
+
* and the value is exactly that: the host's clock at the moment it asked, not
|
|
144
|
+
* the cluster's at the moment it applied. It is an inventory column, never a
|
|
145
|
+
* lock or an ordering, and nothing in this backend reads it back to make a
|
|
146
|
+
* decision. A Sandbox whose mode has never been changed since it was created
|
|
147
|
+
* carries no annotation at all, and is reported without one rather than with
|
|
148
|
+
* a guess.
|
|
149
|
+
*
|
|
150
|
+
* Same prefix as {@link SANDBOX_TEMPLATE_LABEL_KEY}, for the same reason.
|
|
151
|
+
*/
|
|
152
|
+
export const OPERATING_MODE_CHANGED_AT_ANNOTATION_KEY = 'sandbox.namzu.ai/operating-mode-changed-at';
|
|
153
|
+
/**
|
|
154
|
+
* Backend-owned annotation carrying the HOLDER EPOCH: a decimal integer the
|
|
155
|
+
* host raises whenever authority over this workspace moves to another
|
|
156
|
+
* process.
|
|
157
|
+
*
|
|
158
|
+
* A workspace id is a name, not a lock, and a host that drives one workspace
|
|
159
|
+
* from more than one process has to decide which of them may suspend, resume
|
|
160
|
+
* or delete it. Checking its own epoch and then calling `suspend()` does not
|
|
161
|
+
* close the race, because the write that follows is a separate request and
|
|
162
|
+
* the API server accepts it. So the epoch is stored HERE, on the object every
|
|
163
|
+
* lifecycle write targets, and every such write carries it as a condition in
|
|
164
|
+
* the same request — see {@link buildHolderEpochPatch}.
|
|
165
|
+
*
|
|
166
|
+
* The rule: a write carrying epoch `e` applies when the stored epoch is `<=
|
|
167
|
+
* e`, and sets the stored epoch to `e` in the same request. A stored epoch
|
|
168
|
+
* greater than `e` refuses it. An object with NO annotation reads as 0, so
|
|
169
|
+
* every workspace created before this existed accepts its first
|
|
170
|
+
* epoch-carrying write.
|
|
171
|
+
*
|
|
172
|
+
* It is the caller's number, never this backend's: nothing here invents,
|
|
173
|
+
* increments or persists an epoch of its own, and a call that passes none
|
|
174
|
+
* sends exactly the requests it always sent.
|
|
175
|
+
*
|
|
176
|
+
* Same prefix as {@link SANDBOX_TEMPLATE_LABEL_KEY} and
|
|
177
|
+
* {@link OPERATING_MODE_CHANGED_AT_ANNOTATION_KEY}, for the same reason.
|
|
178
|
+
*/
|
|
179
|
+
export const HOLDER_EPOCH_ANNOTATION_KEY = 'sandbox.namzu.ai/holder-epoch';
|
|
180
|
+
/**
|
|
181
|
+
* Backend-owned annotation carrying a hash of the pod template a Sandbox was
|
|
182
|
+
* last built with.
|
|
183
|
+
*
|
|
184
|
+
* A Sandbox's `spec.podTemplate` is a COPY of the SandboxTemplate's, taken
|
|
185
|
+
* once, and the controller rebuilds every replacement pod from that copy
|
|
186
|
+
* rather than from the template — so a workspace kept for weeks runs the pod
|
|
187
|
+
* spec it was created with, and an edit to the template (a new image tag, a
|
|
188
|
+
* memory limit, a grace period, an env entry) reaches only workspaces created
|
|
189
|
+
* after it. Nothing on the object answers "is this copy still the template's
|
|
190
|
+
* current one": the two are separate objects with separate
|
|
191
|
+
* `resourceVersion`s, and comparing the templates field by field on every
|
|
192
|
+
* open would be a second, weaker copy of the overlay rules.
|
|
193
|
+
*
|
|
194
|
+
* So the value is a hash of exactly what was written: the template's
|
|
195
|
+
* `podTemplate` AFTER this backend's own overlays (the template label and the
|
|
196
|
+
* configured `runtimeClassName`), which is the object the Sandbox carries.
|
|
197
|
+
* Hashing before the overlays would report drift on every workspace whose
|
|
198
|
+
* RuntimeClass this backend chose.
|
|
199
|
+
*
|
|
200
|
+
* Written by the workspace paths only — the create POST and the refresh patch
|
|
201
|
+
* — and read back as `templateRevision` on a handle. A task sandbox is
|
|
202
|
+
* ephemeral and has nothing to drift from, so its create body is unchanged.
|
|
203
|
+
* A workspace created before this existed carries no annotation and reports
|
|
204
|
+
* `templateRevision: undefined`, which reads honestly as "unknown", never as
|
|
205
|
+
* "current".
|
|
206
|
+
*
|
|
207
|
+
* Same prefix as {@link SANDBOX_TEMPLATE_LABEL_KEY}, for the same reason.
|
|
208
|
+
*/
|
|
209
|
+
export const POD_TEMPLATE_HASH_ANNOTATION_KEY = 'sandbox.namzu.ai/pod-template-hash';
|
|
210
|
+
/** Object keys in code-unit order, so the hash does not depend on a locale. */
|
|
211
|
+
function compareKeys(left, right) {
|
|
212
|
+
if (left < right)
|
|
213
|
+
return -1;
|
|
214
|
+
return left > right ? 1 : 0;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* The same JSON with its object keys sorted, recursively.
|
|
218
|
+
*
|
|
219
|
+
* `JSON.stringify` preserves insertion order, and the two pod templates this
|
|
220
|
+
* hash has to compare never have the same one: one comes back from the API
|
|
221
|
+
* server's own serialisation of a stored object and the other is built here
|
|
222
|
+
* by spreading a template's members into a fresh object. Without this, every
|
|
223
|
+
* comparison would report drift that does not exist.
|
|
224
|
+
*/
|
|
225
|
+
function canonicalJson(value) {
|
|
226
|
+
if (Array.isArray(value))
|
|
227
|
+
return value.map(canonicalJson);
|
|
228
|
+
if (typeof value !== 'object' || value === null)
|
|
229
|
+
return value;
|
|
230
|
+
const canonical = {};
|
|
231
|
+
for (const key of Object.keys(value).sort(compareKeys)) {
|
|
232
|
+
const member = value[key];
|
|
233
|
+
if (member === undefined)
|
|
234
|
+
continue;
|
|
235
|
+
canonical[key] = canonicalJson(member);
|
|
236
|
+
}
|
|
237
|
+
return canonical;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* `sha256:<hex>` over the pod template, for
|
|
241
|
+
* {@link POD_TEMPLATE_HASH_ANNOTATION_KEY}.
|
|
242
|
+
*
|
|
243
|
+
* It is an identity, not a checksum of anything security-relevant: two hosts
|
|
244
|
+
* running the same release against the same template must compute the same
|
|
245
|
+
* string, and a template edit must change it. Nothing here compares it
|
|
246
|
+
* against a value an untrusted party chose.
|
|
247
|
+
*/
|
|
248
|
+
export function podTemplateHash(podTemplate) {
|
|
249
|
+
const digest = createHash('sha256')
|
|
250
|
+
.update(JSON.stringify(canonicalJson(podTemplate)))
|
|
251
|
+
.digest('hex');
|
|
252
|
+
return `sha256:${digest}`;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* One JSON Pointer reference token (RFC 6901 §3): `~` becomes `~0` and `/`
|
|
256
|
+
* becomes `~1`, in that order — the reverse order would turn a literal `~1`
|
|
257
|
+
* into a slash.
|
|
258
|
+
*
|
|
259
|
+
* An annotation key always contains a `/` (`sandbox.namzu.ai/holder-epoch`),
|
|
260
|
+
* so the pointer to one is unusable without this.
|
|
261
|
+
*/
|
|
262
|
+
export function escapeJsonPointerSegment(token) {
|
|
263
|
+
return token.replace(/~/g, '~0').replace(/\//g, '~1');
|
|
264
|
+
}
|
|
265
|
+
/** Pointer to one annotation on an object's own metadata. */
|
|
266
|
+
export function annotationPointer(key) {
|
|
267
|
+
return `/metadata/annotations/${escapeJsonPointerSegment(key)}`;
|
|
268
|
+
}
|
|
269
|
+
/** Decimal, no sign, no padding, no exponent — what this backend writes. */
|
|
270
|
+
const HOLDER_EPOCH_PATTERN = /^(?:0|[1-9][0-9]*)$/;
|
|
271
|
+
/** Read {@link HOLDER_EPOCH_ANNOTATION_KEY} off an object's metadata. */
|
|
272
|
+
export function readHolderEpoch(meta) {
|
|
273
|
+
const annotations = meta?.annotations;
|
|
274
|
+
const resourceVersion = typeof meta?.resourceVersion === 'string' && meta.resourceVersion !== ''
|
|
275
|
+
? meta.resourceVersion
|
|
276
|
+
: undefined;
|
|
277
|
+
const stored = annotations?.[HOLDER_EPOCH_ANNOTATION_KEY];
|
|
278
|
+
const base = {
|
|
279
|
+
hasAnnotations: annotations !== undefined,
|
|
280
|
+
...(resourceVersion !== undefined ? { resourceVersion } : {}),
|
|
281
|
+
};
|
|
282
|
+
if (typeof stored !== 'string')
|
|
283
|
+
return { ...base, epoch: 0 };
|
|
284
|
+
if (!HOLDER_EPOCH_PATTERN.test(stored))
|
|
285
|
+
return { ...base, annotation: stored };
|
|
286
|
+
const parsed = Number(stored);
|
|
287
|
+
if (!Number.isSafeInteger(parsed))
|
|
288
|
+
return { ...base, annotation: stored };
|
|
289
|
+
return { ...base, epoch: parsed, annotation: stored };
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Read {@link POD_TEMPLATE_HASH_ANNOTATION_KEY} off an object's metadata.
|
|
293
|
+
*
|
|
294
|
+
* Absent — an object created before this existed, or one an older release
|
|
295
|
+
* refreshed — is `undefined`, which reads as "unknown" everywhere it is
|
|
296
|
+
* consumed. It is deliberately never compared as an empty string: a
|
|
297
|
+
* revision nobody recorded is not a revision that differs.
|
|
298
|
+
*/
|
|
299
|
+
export function readPodTemplateHash(meta) {
|
|
300
|
+
const stored = meta?.annotations?.[POD_TEMPLATE_HASH_ANNOTATION_KEY];
|
|
301
|
+
return typeof stored === 'string' && stored !== '' ? stored : undefined;
|
|
302
|
+
}
|
|
303
|
+
/** A stored epoch of `epoch` or lower lets a write carrying `epoch` through. */
|
|
304
|
+
export function holderEpochAllows(reading, epoch) {
|
|
305
|
+
return reading.epoch !== undefined && reading.epoch <= epoch;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* The one conditional-write builder this backend has, and the only place a
|
|
309
|
+
* JSON Patch body is composed.
|
|
310
|
+
*
|
|
311
|
+
* Every clause is decided from ONE read, and the whole thing goes up as one
|
|
312
|
+
* request: the condition and the mutation are in the same body, so there is
|
|
313
|
+
* no window between checking and writing for another holder to fit into.
|
|
314
|
+
*
|
|
315
|
+
* Three shapes, decided by what that read saw:
|
|
316
|
+
*
|
|
317
|
+
* - the object carries the epoch annotation ⇒ `test` it by its exact stored
|
|
318
|
+
* string, then `add` the new value over it;
|
|
319
|
+
* - the object carries annotations but not this one ⇒ `test`
|
|
320
|
+
* `/metadata/resourceVersion` instead, then `add` the member;
|
|
321
|
+
* - the object carries no `metadata.annotations` at all ⇒ the same
|
|
322
|
+
* `resourceVersion` test, then `add` the map whole, because there is no
|
|
323
|
+
* member to add one to.
|
|
324
|
+
*
|
|
325
|
+
* The `resourceVersion` fallback is the migration case and nothing more: it
|
|
326
|
+
* fires once, on a workspace created before this release, and from the first
|
|
327
|
+
* epoch write onwards the annotation is what is tested. That matters because
|
|
328
|
+
* a controller status write moves `resourceVersion` without touching the
|
|
329
|
+
* annotation, and under the annotation test those are simply not conditions
|
|
330
|
+
* this write is interested in.
|
|
331
|
+
*
|
|
332
|
+
* A call carrying NO epoch skips all three: it tests only what
|
|
333
|
+
* {@link HolderEpochPatchInput.tests} carries and writes no epoch annotation,
|
|
334
|
+
* which is how a workspace refresh conditions itself on `spec.operatingMode`
|
|
335
|
+
* without fencing a host that never asked for a fence.
|
|
336
|
+
*
|
|
337
|
+
* Every `test` precedes every mutation, which RFC 6902 requires of a
|
|
338
|
+
* condition: operations apply in order, so a `test` written after an `add`
|
|
339
|
+
* would be testing this patch's own work. Mutations go up in a fixed order —
|
|
340
|
+
* annotations, then `spec.podTemplate`, then `spec.operatingMode` — so the
|
|
341
|
+
* body a given input produces is one body and a test can assert it.
|
|
342
|
+
*/
|
|
343
|
+
export function buildHolderEpochPatch(input) {
|
|
344
|
+
const { reading, epoch } = input;
|
|
345
|
+
const epochPointer = annotationPointer(HOLDER_EPOCH_ANNOTATION_KEY);
|
|
346
|
+
const tests = [];
|
|
347
|
+
if (epoch === undefined) {
|
|
348
|
+
// Unfenced: the caller's own clauses are the whole condition, and an
|
|
349
|
+
// unconditional JSON patch is refused rather than sent. Every caller
|
|
350
|
+
// on this branch is conditioning on something — a refresh on
|
|
351
|
+
// `spec.operatingMode` — and one that passed nothing would be asking
|
|
352
|
+
// for a blind write in the one builder that exists to prevent them.
|
|
353
|
+
if ((input.tests ?? []).length === 0) {
|
|
354
|
+
throw new Error('kubernetes: cannot build a conditional patch that carries neither a holder epoch nor a test clause — there is nothing to condition the write on.');
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
else if (reading.annotation !== undefined) {
|
|
358
|
+
tests.push({ op: 'test', path: epochPointer, value: reading.annotation });
|
|
359
|
+
}
|
|
360
|
+
else if (reading.resourceVersion !== undefined) {
|
|
361
|
+
tests.push({ op: 'test', path: '/metadata/resourceVersion', value: reading.resourceVersion });
|
|
362
|
+
}
|
|
363
|
+
else {
|
|
364
|
+
// Unreachable from every call site here — each one builds from an
|
|
365
|
+
// object it just read, and the API server sets `resourceVersion` on
|
|
366
|
+
// every object it serves. It throws rather than sending an
|
|
367
|
+
// UNCONDITIONAL patch, because a fenced write that quietly stopped
|
|
368
|
+
// being fenced is the defect this whole path exists to prevent.
|
|
369
|
+
throw new Error('kubernetes: cannot build a holder-epoch patch from an object that carries neither the holder-epoch annotation nor a metadata.resourceVersion — there is nothing to condition the write on.');
|
|
370
|
+
}
|
|
371
|
+
tests.push(...(input.tests ?? []));
|
|
372
|
+
const mutations = [];
|
|
373
|
+
// Every annotation this body writes, in one place: the epoch when the
|
|
374
|
+
// write is fenced, the mode stamp when the mode moves, and whatever else
|
|
375
|
+
// the caller is landing atomically with them.
|
|
376
|
+
const annotations = {
|
|
377
|
+
...(epoch !== undefined ? { [HOLDER_EPOCH_ANNOTATION_KEY]: String(epoch) } : {}),
|
|
378
|
+
...(input.operatingModeChangedAt !== undefined
|
|
379
|
+
? { [OPERATING_MODE_CHANGED_AT_ANNOTATION_KEY]: input.operatingModeChangedAt }
|
|
380
|
+
: {}),
|
|
381
|
+
...input.annotations,
|
|
382
|
+
};
|
|
383
|
+
const keys = Object.keys(annotations);
|
|
384
|
+
if (keys.length > 0) {
|
|
385
|
+
if (!reading.hasAnnotations) {
|
|
386
|
+
// No member to add one to, so the map goes up whole — and a whole
|
|
387
|
+
// map REPLACES whatever is there, so this one operation is the only
|
|
388
|
+
// mutation in this builder that can erase another writer's work.
|
|
389
|
+
// The window is real: between the GET that saw no annotations and
|
|
390
|
+
// this patch, another process can stamp one without moving
|
|
391
|
+
// `spec.operatingMode` — a suspend carrying a holder epoch onto an
|
|
392
|
+
// already-Suspended object does exactly that — and an unconditional
|
|
393
|
+
// whole-map `add` would silently unfence the workspace it took.
|
|
394
|
+
// `resourceVersion` is what closes it. The fenced path already
|
|
395
|
+
// tests it on this branch (an object with no annotations has no
|
|
396
|
+
// epoch annotation to test); this adds the same clause for an
|
|
397
|
+
// UNFENCED caller, whose own clauses are about `spec` and say
|
|
398
|
+
// nothing about `metadata`.
|
|
399
|
+
if (!tests.some((test) => test.path === '/metadata/resourceVersion')) {
|
|
400
|
+
if (reading.resourceVersion === undefined) {
|
|
401
|
+
throw new Error('kubernetes: cannot add a metadata.annotations map to an object that carries no metadata.resourceVersion — a whole-map write with nothing to condition it on would overwrite annotations written since the read.');
|
|
402
|
+
}
|
|
403
|
+
tests.push({
|
|
404
|
+
op: 'test',
|
|
405
|
+
path: '/metadata/resourceVersion',
|
|
406
|
+
value: reading.resourceVersion,
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
mutations.push({ op: 'add', path: '/metadata/annotations', value: annotations });
|
|
410
|
+
}
|
|
411
|
+
else {
|
|
412
|
+
for (const key of keys) {
|
|
413
|
+
mutations.push({ op: 'add', path: annotationPointer(key), value: annotations[key] });
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
if (input.podTemplate !== undefined) {
|
|
418
|
+
mutations.push({ op: 'add', path: '/spec/podTemplate', value: input.podTemplate });
|
|
419
|
+
}
|
|
420
|
+
if (input.operatingMode !== undefined) {
|
|
421
|
+
mutations.push({ op: 'add', path: '/spec/operatingMode', value: input.operatingMode });
|
|
422
|
+
}
|
|
423
|
+
return [...tests, ...mutations];
|
|
424
|
+
}
|
|
425
|
+
/** `{ [SANDBOX_TEMPLATE_LABEL_KEY]: sandboxTemplateName }`, as a matchLabels-ready object. */
|
|
426
|
+
export function sandboxTemplateLabel(sandboxTemplateName) {
|
|
427
|
+
return { [SANDBOX_TEMPLATE_LABEL_KEY]: sandboxTemplateName };
|
|
428
|
+
}
|
|
429
|
+
/** Core `NetworkPolicy` — a stock resource, no CRD. */
|
|
430
|
+
export const CORE_NETWORK_POLICY_API_GROUP = 'networking.k8s.io';
|
|
431
|
+
export const CORE_NETWORK_POLICY_API_VERSION = 'v1';
|
|
432
|
+
/**
|
|
433
|
+
* Cilium's FQDN-capable policy CRD. Only reached when
|
|
434
|
+
* `KubernetesEgressConfig.engine` is explicitly `'cilium'` — see
|
|
435
|
+
* `egress-policy.ts`.
|
|
436
|
+
*/
|
|
437
|
+
export const CILIUM_NETWORK_POLICY_API_GROUP = 'cilium.io';
|
|
438
|
+
export const CILIUM_NETWORK_POLICY_API_VERSION = 'v2';
|
|
439
|
+
function segment(value) {
|
|
440
|
+
return encodeURIComponent(value);
|
|
441
|
+
}
|
|
442
|
+
export function claimCollectionPath(namespace) {
|
|
443
|
+
return `/apis/${SANDBOX_EXTENSIONS_API_GROUP}/${SANDBOX_API_VERSION}/namespaces/${segment(namespace)}/sandboxclaims`;
|
|
444
|
+
}
|
|
445
|
+
export function claimPath(namespace, name) {
|
|
446
|
+
return `${claimCollectionPath(namespace)}/${segment(name)}`;
|
|
447
|
+
}
|
|
448
|
+
/** The claims collection, narrowed to a `labelSelector` — same shape as {@link podListPath}. */
|
|
449
|
+
export function claimListPath(namespace, labelSelector) {
|
|
450
|
+
return `${claimCollectionPath(namespace)}?labelSelector=${encodeURIComponent(labelSelector)}`;
|
|
451
|
+
}
|
|
452
|
+
export function warmPoolPath(namespace, name) {
|
|
453
|
+
return `/apis/${SANDBOX_EXTENSIONS_API_GROUP}/${SANDBOX_API_VERSION}/namespaces/${segment(namespace)}/sandboxwarmpools/${segment(name)}`;
|
|
454
|
+
}
|
|
455
|
+
export function sandboxCollectionPath(namespace) {
|
|
456
|
+
return `/apis/${SANDBOX_API_GROUP}/${SANDBOX_API_VERSION}/namespaces/${segment(namespace)}/sandboxes`;
|
|
457
|
+
}
|
|
458
|
+
export function sandboxPath(namespace, name) {
|
|
459
|
+
return `${sandboxCollectionPath(namespace)}/${segment(name)}`;
|
|
460
|
+
}
|
|
461
|
+
export function sandboxTemplatePath(namespace, name) {
|
|
462
|
+
return `/apis/${SANDBOX_EXTENSIONS_API_GROUP}/${SANDBOX_API_VERSION}/namespaces/${segment(namespace)}/sandboxtemplates/${segment(name)}`;
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* The PVC the controller creates for one `volumeClaimTemplates` entry:
|
|
466
|
+
* `<entry name>-<sandbox name>`, in the Sandbox's own namespace.
|
|
467
|
+
*
|
|
468
|
+
* Written out here rather than derived at each call site because it is a
|
|
469
|
+
* NAME the controller owns, not one this backend chooses — a release that
|
|
470
|
+
* changes it breaks every read of it at once, and the one place to notice
|
|
471
|
+
* that is a function whose whole body is the convention.
|
|
472
|
+
*/
|
|
473
|
+
export function persistentVolumeClaimPath(namespace, sandboxName, claimTemplateName) {
|
|
474
|
+
return `/api/v1/namespaces/${segment(namespace)}/persistentvolumeclaims/${segment(`${claimTemplateName}-${sandboxName}`)}`;
|
|
475
|
+
}
|
|
476
|
+
export function podPath(namespace, name) {
|
|
477
|
+
return `/api/v1/namespaces/${segment(namespace)}/pods/${segment(name)}`;
|
|
478
|
+
}
|
|
479
|
+
/** The whole pods collection, unfiltered. Read by `readKubernetesTaskCapacity` alone. */
|
|
480
|
+
export function podCollectionPath(namespace) {
|
|
481
|
+
return `/api/v1/namespaces/${segment(namespace)}/pods`;
|
|
482
|
+
}
|
|
483
|
+
export function podListPath(namespace, labelSelector) {
|
|
484
|
+
return `/api/v1/namespaces/${segment(namespace)}/pods?labelSelector=${encodeURIComponent(labelSelector)}`;
|
|
485
|
+
}
|
|
486
|
+
export function networkPolicyCollectionPath(namespace) {
|
|
487
|
+
return `/apis/${CORE_NETWORK_POLICY_API_GROUP}/${CORE_NETWORK_POLICY_API_VERSION}/namespaces/${segment(namespace)}/networkpolicies`;
|
|
488
|
+
}
|
|
489
|
+
export function networkPolicyPath(namespace, name) {
|
|
490
|
+
return `${networkPolicyCollectionPath(namespace)}/${segment(name)}`;
|
|
491
|
+
}
|
|
492
|
+
export function ciliumNetworkPolicyCollectionPath(namespace) {
|
|
493
|
+
return `/apis/${CILIUM_NETWORK_POLICY_API_GROUP}/${CILIUM_NETWORK_POLICY_API_VERSION}/namespaces/${segment(namespace)}/ciliumnetworkpolicies`;
|
|
494
|
+
}
|
|
495
|
+
export function ciliumNetworkPolicyPath(namespace, name) {
|
|
496
|
+
return `${ciliumNetworkPolicyCollectionPath(namespace)}/${segment(name)}`;
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Core Kubernetes' own admission-policy resources — `ValidatingAdmissionPolicy`
|
|
500
|
+
* and its binding, both CLUSTER-scoped and both stock since v1.30, so a
|
|
501
|
+
* cluster that serves this group needs nothing installed.
|
|
502
|
+
*
|
|
503
|
+
* Read by exactly one caller: the per-sandbox policy fence
|
|
504
|
+
* (`per-sandbox-policy.ts`), which refuses to write a `CiliumNetworkPolicy`
|
|
505
|
+
* at all unless an operator has applied the policy that bounds what this
|
|
506
|
+
* host may write. Never written by this backend — the fence is the operator's
|
|
507
|
+
* object, reviewed by whoever has cluster-admin, and a host that could create
|
|
508
|
+
* its own fence would not have one.
|
|
509
|
+
*/
|
|
510
|
+
export const ADMISSION_REGISTRATION_API_GROUP = 'admissionregistration.k8s.io';
|
|
511
|
+
export const ADMISSION_REGISTRATION_API_VERSION = 'v1';
|
|
512
|
+
export function validatingAdmissionPolicyPath(name) {
|
|
513
|
+
return `/apis/${ADMISSION_REGISTRATION_API_GROUP}/${ADMISSION_REGISTRATION_API_VERSION}/validatingadmissionpolicies/${segment(name)}`;
|
|
514
|
+
}
|
|
515
|
+
export function validatingAdmissionPolicyBindingPath(name) {
|
|
516
|
+
return `/apis/${ADMISSION_REGISTRATION_API_GROUP}/${ADMISSION_REGISTRATION_API_VERSION}/validatingadmissionpolicybindings/${segment(name)}`;
|
|
517
|
+
}
|
|
518
|
+
//# sourceMappingURL=objects.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"objects.js","sourceRoot":"","sources":["../../../src/backends/kubernetes/objects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAExC,wCAAwC;AACxC,MAAM,CAAC,MAAM,iBAAiB,GAAG,iBAAiB,CAAA;AAClD,6EAA6E;AAC7E,MAAM,CAAC,MAAM,4BAA4B,GAAG,4BAA4B,CAAA;AACxE,oEAAoE;AACpE,MAAM,CAAC,MAAM,mBAAmB,GAAG,SAAS,CAAA;AAE5C,oEAAoE;AACpE,MAAM,CAAC,MAAM,eAAe,GAAG,OAAO,CAAA;AAuDtC;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAC9B,UAAsD,EACtD,IAAY;IAEZ,OAAO,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,IAAI,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,KAAK,IAAI,CAAA;AAChF,CAAC;AAqPD,6EAA6E;AAC7E,MAAM,UAAU,SAAS,CAAC,GAA4B;IACrD,MAAM,MAAM,GAAG,GAAG,EAAE,MAAM,CAAA;IAC1B,IAAI,OAAO,MAAM,EAAE,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,KAAK,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