@di-framework/cli-plugin-platform 6.0.2 → 6.0.5
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/README.md +196 -21
- package/dist/args.d.ts +2 -1
- package/dist/args.js +9 -5
- package/dist/assets/http-adapter.js +63 -0
- package/dist/assets/platform/README.md +22 -6
- package/dist/assets/sqlite/BUILD-INFO.txt +1 -1
- package/dist/assets/wit/deps/wasi-clocks-0.2.12/package.wit +43 -0
- package/dist/assets/wit/deps/wasi-filesystem-0.2.12/package.wit +196 -0
- package/dist/assets/wit/deps/wasi-io-0.2.12/package.wit +66 -0
- package/dist/assets/wit/deps/wasi-logging/package.wit +36 -0
- package/dist/build.d.ts +3 -1
- package/dist/build.js +4 -2
- package/dist/command.js +31 -13
- package/dist/console/auth.d.ts +20 -0
- package/dist/console/auth.js +82 -0
- package/dist/console/catalog.d.ts +196 -0
- package/dist/console/catalog.js +821 -0
- package/dist/console/cluster.d.ts +30 -0
- package/dist/console/cluster.js +299 -0
- package/dist/console/errors.d.ts +10 -0
- package/dist/console/errors.js +32 -0
- package/dist/console/run.d.ts +18 -0
- package/dist/console/run.js +102 -0
- package/dist/console/server.d.ts +25 -0
- package/dist/console/server.js +668 -0
- package/dist/console/services.d.ts +47 -0
- package/dist/console/services.js +111 -0
- package/dist/console-ui/app.css +1 -0
- package/dist/console-ui/app.js +260 -0
- package/dist/console-ui/di-framework-mark.png +0 -0
- package/dist/console-ui/index.html +13 -0
- package/dist/deps.d.ts +2 -0
- package/dist/deps.js +5 -3
- package/dist/dev.js +10 -5
- package/dist/egress.d.ts +40 -0
- package/dist/egress.js +214 -0
- package/dist/host-interface.js +2 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/manifest.d.ts +7 -0
- package/dist/manifest.js +35 -8
- package/dist/node-compat/console.d.ts +18 -0
- package/dist/node-compat/console.js +42 -0
- package/dist/node-compat/env.js +6 -0
- package/dist/node-compat/events.d.ts +20 -0
- package/dist/node-compat/events.js +55 -0
- package/dist/node-compat/fetch-runtime.d.ts +31 -0
- package/dist/node-compat/fetch-runtime.js +62 -0
- package/dist/node-compat/fs-promises.d.ts +30 -0
- package/dist/node-compat/fs-promises.js +3 -0
- package/dist/node-compat/fs.d.ts +79 -0
- package/dist/node-compat/fs.js +112 -5
- package/dist/node-compat/net.d.ts +2 -1
- package/dist/node-compat/net.js +3 -1
- package/dist/node-compat/storage.d.ts +87 -0
- package/dist/node-compat/storage.js +244 -0
- package/dist/node-compat/stream.d.ts +24 -0
- package/dist/node-compat/stream.js +70 -0
- package/dist/platform.js +2 -4
- package/dist/project.d.ts +5 -0
- package/dist/project.js +4 -0
- package/dist/service.d.ts +21 -2
- package/dist/service.js +71 -5
- package/dist/target.js +6 -1
- package/dist/wit.d.ts +8 -0
- package/dist/wit.js +28 -0
- package/dist/workload.d.ts +45 -0
- package/dist/workload.js +98 -26
- package/package.json +14 -4
package/README.md
CHANGED
|
@@ -11,11 +11,11 @@ di-framework platform build # bundle + jco compone
|
|
|
11
11
|
di-framework platform dev # build, then serve locally (wasmtime by default)
|
|
12
12
|
di-framework platform deploy # nearest project, default target
|
|
13
13
|
di-framework platform deploy greeter # named project anywhere in the workspace
|
|
14
|
-
di-framework platform deploy greeter --target development
|
|
14
|
+
di-framework platform deploy greeter --target development # a target other than default-target
|
|
15
15
|
di-framework platform destroy greeter
|
|
16
16
|
di-framework platform cluster init # generate deploy/platform + local target
|
|
17
|
-
di-framework platform cluster up
|
|
18
|
-
di-framework platform cluster destroy
|
|
17
|
+
di-framework platform cluster up --yes # start the generated platform (default-target)
|
|
18
|
+
di-framework platform cluster destroy --yes
|
|
19
19
|
di-framework platform doctor # project + toolchain readiness checks
|
|
20
20
|
```
|
|
21
21
|
|
|
@@ -82,13 +82,16 @@ to the project configuration, for example:
|
|
|
82
82
|
}
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
On a target without a `hostgroup`, the deployer writes these names under the component's
|
|
86
86
|
`localResources.allowedIpNameLookups`. Omission keeps the host's default denial;
|
|
87
|
-
it does not implicitly grant unrestricted DNS access.
|
|
87
|
+
it does not implicitly grant unrestricted DNS access. Tenant targets request egress from
|
|
88
|
+
the platform instead; see [Egress on tenant targets](#egress-on-tenant-targets).
|
|
88
89
|
|
|
89
90
|
Guest JS keeps the framework's Node contract. The bundler runs [unenv](https://github.com/unjs/unenv)
|
|
90
91
|
`nodeCompat` plus a wasmCloud preset: `node:path`, `Buffer`, and the rest of
|
|
91
|
-
the Node builtin map come from unenv; `node:fs`
|
|
92
|
+
the Node builtin map come from unenv; `node:fs` and `node:fs/promises` are an in-memory
|
|
93
|
+
filesystem (with `ENOENT`), except under the storage mount (`/data`, or `DI_STORAGE_DIR`), which
|
|
94
|
+
reads and writes the host's preopened directory through `wasi:filesystem@0.2.12`,
|
|
92
95
|
`process.env` / `process.cwd()` are guest-shaped (not the host process), and `createRequire` throws
|
|
93
96
|
`MODULE_NOT_FOUND`. `node:net` and `node:dgram` overlay WASI 0.3 `wasi:sockets` (`tcp-socket` /
|
|
94
97
|
`udp-socket` / `ip-name-lookup`) so `@di-framework/socket`'s Node TCP/UDP adapters run unchanged.
|
|
@@ -159,6 +162,30 @@ even when wasmtime is present. Set `DI_FRAMEWORK_WASMCLOUD_DEV_RUNNER` to
|
|
|
159
162
|
`wasi:config` locally (`-S config-var=key=value` to seed values). wasmCloud-only imports
|
|
160
163
|
such as `wasmcloud:postgres` still need `wash` or a wasmCloud host.
|
|
161
164
|
|
|
165
|
+
Guest `console.log`, `info`, `debug`, `warn`, and `error` write through
|
|
166
|
+
`wasi:logging/logging@0.1.0-draft`, one `log(level, "console", line)` call per line.
|
|
167
|
+
QuickJS has no console of its own, and wash 2.8 writes raw guest stdio to the host log
|
|
168
|
+
without saying which workload produced it; `wasi:logging` lines carry `workload.name`
|
|
169
|
+
and `workload.namespace`. Builds therefore link that import and every WorkloadDeployment
|
|
170
|
+
declares an unnamed `wasi:logging` host interface (`interfaces: [logging]`). `platform dev`
|
|
171
|
+
links it only for `wash`; wasmtime and jco cannot provide it, so those builds keep a
|
|
172
|
+
console that discards output.
|
|
173
|
+
|
|
174
|
+
Logs are on by default. Set `"logs": false` in `di-framework.config.json` to opt a project out:
|
|
175
|
+
|
|
176
|
+
```json
|
|
177
|
+
{ "name": "quiet-app", "entry": "src/app.ts", "logs": false }
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
The build then links no `wasi:logging` import and keeps the console that discards output, in
|
|
181
|
+
`platform deploy` and `platform dev` alike. The WorkloadDeployment declares no `wasi:logging`
|
|
182
|
+
host interface and carries the annotation `di-framework.dev/logs: "false"`, so the platform
|
|
183
|
+
publishes none of the application's console lines. It still publishes the host's WARN and
|
|
184
|
+
ERROR lines for the application's workloads (for example a workload that failed to start)
|
|
185
|
+
with the application's logs, and the console still uses them to mark a failed workload.
|
|
186
|
+
Each workload member reads its own config, so the setting applies per member. `logs` must
|
|
187
|
+
be a boolean; omitting it or setting `true` keeps logs on and adds no annotation.
|
|
188
|
+
|
|
162
189
|
`wash` 2.5.x has no `--address` flag. The extension writes
|
|
163
190
|
`.di-framework/wash-dev.yaml` (`dev.address`, `host_interfaces`,
|
|
164
191
|
`wasm_proposals: [component-model-async]`) and runs `wash dev --user-config` against it.
|
|
@@ -186,8 +213,16 @@ namespace = "wasmcloud"
|
|
|
186
213
|
push = "https://registry.example.com/team"
|
|
187
214
|
pull = "registry.internal.example.com/team"
|
|
188
215
|
insecure = false
|
|
216
|
+
|
|
217
|
+
[targets.warehouse]
|
|
218
|
+
kubeconfig = "${WAREHOUSE_KUBECONFIG}"
|
|
219
|
+
tenant = "warehouse" # namespace di-tenant-warehouse, hostgroup tenant-warehouse
|
|
220
|
+
registry = "registry.example.com/warehouse"
|
|
189
221
|
```
|
|
190
222
|
|
|
223
|
+
- Every command that takes `--target` (`deploy`, `destroy`, `console`, `service …`, and
|
|
224
|
+
`cluster up` / `cluster destroy`) uses `default-target` when `--target` is left out. Pass
|
|
225
|
+
`--target <name>` only to pick a different target.
|
|
191
226
|
- `di-framework platform deploy` with no name uses the nearest `di-framework.config.json`.
|
|
192
227
|
- `di-framework platform deploy greeter` recursively discovers projects (skipping `.git`,
|
|
193
228
|
`node_modules`, `.di-framework`, and generated output by default) and matches the configured
|
|
@@ -195,6 +230,25 @@ insecure = false
|
|
|
195
230
|
- `${VAR}` interpolation fails if the variable is unset or empty. Do not put credentials in the
|
|
196
231
|
manifest.
|
|
197
232
|
|
|
233
|
+
### Targets and tenants
|
|
234
|
+
|
|
235
|
+
A **target** and a **tenant** are different things:
|
|
236
|
+
|
|
237
|
+
- A **target** is a local deploy destination: one `[targets.<name>]` table in
|
|
238
|
+
`di-framework.deploy.toml`. It bundles a credential (kubeconfig and optional context), a
|
|
239
|
+
namespace, a host group, and a registry. Only your workspace knows about it.
|
|
240
|
+
- A **tenant** is the platform's isolation unit, declared by the platform administrator. The
|
|
241
|
+
platform gives tenant `<t>` the workload namespace `di-tenant-<t>`, the runtime namespace
|
|
242
|
+
`di-runtime-<t>`, the host group `tenant-<t>`, and RBAC for its users.
|
|
243
|
+
|
|
244
|
+
One tenant can have several targets, for example one per user, credential, or registry. A target
|
|
245
|
+
points at no tenant (an admin or plain-cluster target such as `local` or `development` above) or
|
|
246
|
+
exactly one. Set `tenant = "<t>"` on an external target to point it at a tenant: it fills in
|
|
247
|
+
`namespace = "di-tenant-<t>"` and `hostgroup = "tenant-<t>"`. An explicit `namespace` or
|
|
248
|
+
`hostgroup` still wins. Tenant names follow the platform's rule: 1–40 characters, lowercase
|
|
249
|
+
letters, digits, and single hyphens, starting with a letter. An external target needs
|
|
250
|
+
`kubeconfig`, `registry`, and either `tenant` or `namespace`.
|
|
251
|
+
|
|
198
252
|
### Managed Pulumi target
|
|
199
253
|
|
|
200
254
|
From the workspace root, generate a self-contained local platform (k0s, a local OCI registry, and
|
|
@@ -202,12 +256,13 @@ the wasmCloud operator) from templates shipped with this extension:
|
|
|
202
256
|
|
|
203
257
|
```bash
|
|
204
258
|
di-framework platform cluster init
|
|
205
|
-
di-framework platform cluster up
|
|
259
|
+
di-framework platform cluster up --yes
|
|
206
260
|
```
|
|
207
261
|
|
|
208
262
|
`platform init` writes `deploy/platform` and creates or updates `di-framework.deploy.toml` so
|
|
209
263
|
`local` is a managed target (`platform = "deploy/platform"`, `stack = "dev"`). Existing files are
|
|
210
|
-
left alone unless you pass `--force`.
|
|
264
|
+
left alone unless you pass `--force`. When the manifest has no `default-target` yet, `local`
|
|
265
|
+
becomes the default, so the commands below need no target name. The command prints the exact start command when it finishes.
|
|
211
266
|
Platform deploy runs the package-manager-neutral `pulumi install` command automatically, so the
|
|
212
267
|
generated project works immediately in a blank consumer workspace without a root workspace entry
|
|
213
268
|
or a manual install inside `deploy/platform`.
|
|
@@ -229,11 +284,12 @@ The CLI reads a small output contract from `pulumi stack output --json`:
|
|
|
229
284
|
| `context` | no | kubectl context |
|
|
230
285
|
| `endpoints.http` / `endpoints.kubernetes` / `endpoints.registry` | no | optional URLs |
|
|
231
286
|
|
|
232
|
-
Provision and tear down that stack explicitly
|
|
287
|
+
Provision and tear down that stack explicitly (add the target name, positionally or with
|
|
288
|
+
`--target`, when it is not the `default-target`):
|
|
233
289
|
|
|
234
290
|
```bash
|
|
235
|
-
di-framework platform cluster up
|
|
236
|
-
di-framework platform cluster destroy
|
|
291
|
+
di-framework platform cluster up --yes
|
|
292
|
+
di-framework platform cluster destroy --yes
|
|
237
293
|
```
|
|
238
294
|
|
|
239
295
|
Application `destroy` never runs `pulumi destroy`.
|
|
@@ -266,6 +322,38 @@ For the selected project the extension:
|
|
|
266
322
|
4. Configures `wasi:http/handler@0.3.0` with the project name as its host, applies the resources,
|
|
267
323
|
and waits for current `Ready=True` or compatible older readiness schemas.
|
|
268
324
|
|
|
325
|
+
## Console
|
|
326
|
+
|
|
327
|
+
`di-framework platform console` serves a local control panel for one tenant. The tenant credential
|
|
328
|
+
is the only authentication: there is no login. The process binds to loopback and keeps that
|
|
329
|
+
credential in memory.
|
|
330
|
+
|
|
331
|
+
The console shows each deployed application as a workload of services and components. A developer
|
|
332
|
+
can read its routes, environment, secret names, backing-service bindings, private bindings, and
|
|
333
|
+
logs. Secret values are write-only. Routes can be turned on or off without a rebuild. Logs and
|
|
334
|
+
success or compute signals appear only when the platform publishes them for that application.
|
|
335
|
+
|
|
336
|
+
```toml
|
|
337
|
+
default-target = "warehouse"
|
|
338
|
+
|
|
339
|
+
[targets.warehouse]
|
|
340
|
+
kubeconfig = "${WAREHOUSE_KUBECONFIG}"
|
|
341
|
+
tenant = "warehouse"
|
|
342
|
+
registry = "registry.example.com/warehouse"
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
```bash
|
|
346
|
+
di-framework platform console
|
|
347
|
+
di-framework platform console --port 8790
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
Without `--port` the system picks a free port. The console prints `Console listening on <url>` with
|
|
351
|
+
the real address as soon as it is serving, also when stdout is redirected to a file.
|
|
352
|
+
|
|
353
|
+
`--target` defaults to `default-target`. The target must be a tenant credential (a tenant user's
|
|
354
|
+
`kubeconfig` with `tenant`, or with `namespace` and `hostgroup`), not the platform admin
|
|
355
|
+
credential. A viewer credential sees the same screens and cannot change them.
|
|
356
|
+
|
|
269
357
|
For the generated local platform the result reports the HTTP URL and required Host header. It is
|
|
270
358
|
directly reachable without `kubectl port-forward`, for example:
|
|
271
359
|
|
|
@@ -346,8 +434,10 @@ or `WorkloadService({ path: '/sync', subscriptions: ['warehouse.stock'] })`, imp
|
|
|
346
434
|
`@di-framework/bindings`. The workload name lives in config; source describes behavior.
|
|
347
435
|
The CLI statically reads literal options, rejects conflicting member paths, and selects
|
|
348
436
|
the exported handler without requiring a default export. A service with subscriptions
|
|
349
|
-
exports `wasmcloud:messaging/handler@0.3.0
|
|
350
|
-
`wasi:cli/run@0.3.0
|
|
437
|
+
exports `wasmcloud:messaging/handler@0.3.0` and deploys as a component; a service without
|
|
438
|
+
subscriptions exports `wasi:cli/run@0.3.0` and deploys as the workload's
|
|
439
|
+
`spec.template.spec.service`, the only place wash runs a long-lived program. Both initialize
|
|
440
|
+
declared host bindings before loading the entrypoint.
|
|
351
441
|
|
|
352
442
|
The inferred manifest records routes but does not install a shared HTTP router. On the
|
|
353
443
|
current Kubernetes runtime, HTTP members retain their individual Host headers. See the
|
|
@@ -355,28 +445,44 @@ current Kubernetes runtime, HTTP members retain their individual Host headers. S
|
|
|
355
445
|
|
|
356
446
|
## Tenant deployment targets
|
|
357
447
|
|
|
358
|
-
Each external target selects a user's credentials, namespace, registry, and host groups
|
|
448
|
+
Each external target selects a user's credentials, namespace, registry, and host groups. Two
|
|
449
|
+
users of the `warehouse` tenant each get their own target:
|
|
359
450
|
|
|
360
451
|
```toml
|
|
452
|
+
default-target = "alice"
|
|
453
|
+
|
|
361
454
|
[targets.alice]
|
|
362
455
|
kubeconfig = "${ALICE_KUBECONFIG}"
|
|
363
456
|
context = "alice"
|
|
364
|
-
|
|
365
|
-
hostgroup = "alice"
|
|
366
|
-
storage-hostgroup = "alice-storage"
|
|
457
|
+
tenant = "warehouse"
|
|
367
458
|
|
|
368
459
|
[targets.alice.registry]
|
|
369
460
|
push = "https://registry.example.com/alice"
|
|
370
461
|
pull = "registry.example.com/alice"
|
|
462
|
+
|
|
463
|
+
[targets.bob]
|
|
464
|
+
kubeconfig = "${BOB_KUBECONFIG}"
|
|
465
|
+
tenant = "warehouse"
|
|
466
|
+
registry = "registry.example.com/bob"
|
|
371
467
|
```
|
|
372
468
|
|
|
373
|
-
Run `di-framework platform deploy warehouse-take
|
|
469
|
+
Run `di-framework platform deploy warehouse-take` as alice, or add `--target bob`. All Kubernetes calls,
|
|
374
470
|
including deletion and diagnostics, use that target's kubeconfig, context, and namespace.
|
|
375
471
|
The generated WorkloadDeployment also sets `spec.template.spec.environment` to the target
|
|
376
472
|
namespace, so host selection cannot silently fall back to another environment when the
|
|
377
|
-
matching pool is unavailable. `hostgroup` defaults to `default
|
|
378
|
-
|
|
379
|
-
|
|
473
|
+
matching pool is unavailable. `hostgroup` defaults to `default`. These selectors refer to
|
|
474
|
+
existing host pools; application deployment does not provision them.
|
|
475
|
+
|
|
476
|
+
A target with a `hostgroup` is a tenant target, and its storage belongs to the platform.
|
|
477
|
+
Actors, queues, workers, and `persistentStorage: true` deploy with the annotation
|
|
478
|
+
`di-framework.dev/persistent-storage: "true"` (plus `di-framework.dev/storage-mount:
|
|
479
|
+
"/data/actors"` for actors) and no volume, volume mount, or host path. The platform
|
|
480
|
+
controller creates `<storageRoot>/di-tenants/<tenant uid>/workloads/<workload>`, shared by
|
|
481
|
+
the members of one `di-framework.dev/workload` and private to the tenant, and injects the
|
|
482
|
+
volume and the `/data` preopen. The guest still reads `DI_STORAGE_DIR`; `node:fs` paths under
|
|
483
|
+
it reach that directory, so members see each other's files. `storage-hostgroup`
|
|
484
|
+
applies only to targets without a `hostgroup`, which keep the host path under
|
|
485
|
+
`/var/lib/di-framework/storage` on the `storage` pool.
|
|
380
486
|
|
|
381
487
|
Generated managed platforms set `operator.allowSharedHosts: false`. Existing generated
|
|
382
488
|
platforms and external clusters, including di-framework-kube, need their operator Helm
|
|
@@ -406,3 +512,72 @@ deletion remove obsolete deployment-owned associations. Shared projections stay
|
|
|
406
512
|
while other workloads use them.
|
|
407
513
|
|
|
408
514
|
See [PostgreSQL storage, deletion, and recovery](../di-framework-platform/README.md#dedicated-postgresql-upcoming-release).
|
|
515
|
+
|
|
516
|
+
### Blobstore services
|
|
517
|
+
|
|
518
|
+
`di-framework platform service create blobstore --name catalog --wait` provisions a
|
|
519
|
+
JetStream NATS object store through the default `blobstore-nats` class. It takes the
|
|
520
|
+
same `--class`, `--memory`, `--storage`, `--cpu`, `--deletion-policy`, and `--timeout`
|
|
521
|
+
flags as the other types. Bind it to an application in the console (or with a
|
|
522
|
+
`ServiceBinding` whose `bindingName` is `objects` and `capability` is `blobstore`); the
|
|
523
|
+
controller projects ConfigMap `di-binding-objects`, and the guest selects it with
|
|
524
|
+
`configFrom`:
|
|
525
|
+
|
|
526
|
+
```ts
|
|
527
|
+
@WasmCloudBinding('objects', { configFrom: 'di-binding-objects' })
|
|
528
|
+
@Container()
|
|
529
|
+
export class MeshObjects extends Blobstore {}
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
The host interface stays unnamed; `configFrom` is the only addition. Each guest
|
|
533
|
+
container becomes its own object-store bucket. An unnamed blobstore without
|
|
534
|
+
`configFrom` uses the host default, which in wash 2.8 is an in-memory store that is
|
|
535
|
+
neither shared between components nor kept across restarts, so a workload whose
|
|
536
|
+
members share objects should bind a created service. `serviceName` stays
|
|
537
|
+
Postgres-only.
|
|
538
|
+
|
|
539
|
+
### Egress on tenant targets
|
|
540
|
+
|
|
541
|
+
Tenant credentials cannot write `allowedHosts` or `allowedIpNameLookups` into a
|
|
542
|
+
WorkloadDeployment. On a tenant target (one with a `hostgroup`), `deploy` turns the
|
|
543
|
+
project's `allowedIpNameLookups` into a platform request instead:
|
|
544
|
+
|
|
545
|
+
- BackingService `<deployment>-egress` with `spec.type: egress` and
|
|
546
|
+
`spec.destinations` set to the names, and
|
|
547
|
+
- ServiceBinding `<deployment>-egress` with `capability: egress`,
|
|
548
|
+
`bindingName: egress`, and `workloadName: <deployment>`.
|
|
549
|
+
|
|
550
|
+
`<deployment>` is the WorkloadDeployment name. Deploys update the destinations when the
|
|
551
|
+
names change, and remove both resources when the setting is removed or the application is
|
|
552
|
+
destroyed. The resources carry `app.kubernetes.io/managed-by: di-framework`; deploy refuses
|
|
553
|
+
to adopt same-named resources it did not create. `"*"` cannot be requested on a tenant
|
|
554
|
+
target. The WorkloadDeployment itself carries neither field: once the platform approves
|
|
555
|
+
the destinations, its controller patches `allowedHosts` and `allowedIpNameLookups` in and
|
|
556
|
+
opens the tenant host's network policy for the approved ports.
|
|
557
|
+
|
|
558
|
+
Approval comes from the egress class policy (`egressAllowedDestinations` in the platform's
|
|
559
|
+
Pulumi config, empty by default). After the rollout, deploy prints the approved `host:port`
|
|
560
|
+
entries, or a note when the service is `NotApproved` or not yet Ready. The deploy itself
|
|
561
|
+
still succeeds; outbound connections stay blocked until a platform admin allows the
|
|
562
|
+
destination.
|
|
563
|
+
|
|
564
|
+
You can also create and bind an egress service yourself:
|
|
565
|
+
|
|
566
|
+
```sh
|
|
567
|
+
di-framework platform service create egress outbound \
|
|
568
|
+
--destination api.example.com:443 --destination '*.example.org'
|
|
569
|
+
di-framework platform service get outbound # Destinations / Approved / Ready reason
|
|
570
|
+
```
|
|
571
|
+
|
|
572
|
+
Each destination is `host`, `*.suffix`, `host:port`, or `*.suffix:port`; a destination
|
|
573
|
+
without a port is approved for the policy ports that match its name. Bind it from the
|
|
574
|
+
console's Bindings tab (single-part applications only, since egress is granted per
|
|
575
|
+
WorkloadDeployment). `list`, `get`, and `delete` work for egress like the other types; the
|
|
576
|
+
console create form does not offer egress because it does not collect destinations.
|
|
577
|
+
|
|
578
|
+
**TLS.** If the built component imports `wasi:tls` and the target is a tenant
|
|
579
|
+
(`hostgroup = "tenant-<t>"`), deploy reads the image of the host pods labelled
|
|
580
|
+
`wasmcloud.com/hostgroup=tenant-<t>` in `di-runtime-<t>`. Unless the image tag contains
|
|
581
|
+
`wasi-tls` (for example `…/wash:2.8.0-wasi-tls`), it warns that TLS connections will fail;
|
|
582
|
+
stock `ghcr.io/wasmcloud/wash:<version>` images have no `wasi:tls` provider. The check
|
|
583
|
+
never blocks the deploy and stays silent when the pods cannot be read.
|
package/dist/args.d.ts
CHANGED
|
@@ -4,7 +4,8 @@ export type AppCommandOptions = {
|
|
|
4
4
|
yes: boolean;
|
|
5
5
|
};
|
|
6
6
|
export type PlatformCommandOptions = {
|
|
7
|
-
target
|
|
7
|
+
/** Omitted when the command should use default-target. */
|
|
8
|
+
target?: string;
|
|
8
9
|
yes: boolean;
|
|
9
10
|
};
|
|
10
11
|
export declare function parseAppCommandArgs(args: readonly string[], command: string): AppCommandOptions;
|
package/dist/args.js
CHANGED
|
@@ -44,13 +44,20 @@ export function parsePlatformInitArgs(args) {
|
|
|
44
44
|
export function parsePlatformCommandArgs(args, command) {
|
|
45
45
|
let target;
|
|
46
46
|
let yes = false;
|
|
47
|
-
for (
|
|
47
|
+
for (let position = 0; position < args.length; position++) {
|
|
48
|
+
const token = args[position] ?? '';
|
|
48
49
|
if (token === '--yes') {
|
|
49
50
|
if (yes)
|
|
50
51
|
invalidUsage(`Option may be provided only once: ${token}`, token);
|
|
51
52
|
yes = true;
|
|
52
53
|
continue;
|
|
53
54
|
}
|
|
55
|
+
if (token === '--target') {
|
|
56
|
+
if (target !== undefined)
|
|
57
|
+
invalidUsage(`Option may be provided only once: ${token}`, token);
|
|
58
|
+
target = readOptionValue(args, ++position, token);
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
54
61
|
if (token.startsWith('--')) {
|
|
55
62
|
invalidUsage(`Unknown option: ${token}`, token, { command });
|
|
56
63
|
}
|
|
@@ -59,8 +66,5 @@ export function parsePlatformCommandArgs(args, command) {
|
|
|
59
66
|
}
|
|
60
67
|
target = token;
|
|
61
68
|
}
|
|
62
|
-
|
|
63
|
-
invalidUsage(`Missing target name for ${command}`, command, { command });
|
|
64
|
-
}
|
|
65
|
-
return { target, yes };
|
|
69
|
+
return { ...(target === undefined ? {} : { target }), yes };
|
|
66
70
|
}
|
|
@@ -684,6 +684,60 @@ class ResponsePolyfill {
|
|
|
684
684
|
return JSON.parse(await this.text());
|
|
685
685
|
}
|
|
686
686
|
}
|
|
687
|
+
|
|
688
|
+
class AbortSignalPolyfill {
|
|
689
|
+
aborted = false;
|
|
690
|
+
reason = undefined;
|
|
691
|
+
onabort = null;
|
|
692
|
+
#listeners = [];
|
|
693
|
+
addEventListener(type, listener) {
|
|
694
|
+
if (type === "abort")
|
|
695
|
+
this.#listeners.push(listener);
|
|
696
|
+
}
|
|
697
|
+
removeEventListener(type, listener) {
|
|
698
|
+
if (type !== "abort")
|
|
699
|
+
return;
|
|
700
|
+
this.#listeners = this.#listeners.filter((item) => item !== listener);
|
|
701
|
+
}
|
|
702
|
+
dispatchEvent(event) {
|
|
703
|
+
for (const listener of this.#listeners)
|
|
704
|
+
listener(event);
|
|
705
|
+
return true;
|
|
706
|
+
}
|
|
707
|
+
throwIfAborted() {
|
|
708
|
+
if (this.aborted)
|
|
709
|
+
throw this.reason instanceof Error ? this.reason : new Error("This operation was aborted");
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
class AbortControllerPolyfill {
|
|
714
|
+
signal = new AbortSignalPolyfill;
|
|
715
|
+
abort(reason) {
|
|
716
|
+
if (this.signal.aborted)
|
|
717
|
+
return;
|
|
718
|
+
this.signal.aborted = true;
|
|
719
|
+
this.signal.reason = reason ?? new Error("This operation was aborted");
|
|
720
|
+
const event = { type: "abort" };
|
|
721
|
+
this.signal.onabort?.(event);
|
|
722
|
+
this.signal.dispatchEvent(event);
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
class BlobPolyfill {
|
|
727
|
+
size;
|
|
728
|
+
type;
|
|
729
|
+
constructor(parts = [], options) {
|
|
730
|
+
let size = 0;
|
|
731
|
+
for (const part of parts) {
|
|
732
|
+
if (typeof part === "string")
|
|
733
|
+
size += new TextEncoder().encode(part).length;
|
|
734
|
+
else
|
|
735
|
+
size += part.byteLength;
|
|
736
|
+
}
|
|
737
|
+
this.size = size;
|
|
738
|
+
this.type = options?.type ?? "";
|
|
739
|
+
}
|
|
740
|
+
}
|
|
687
741
|
var noopConsole = {
|
|
688
742
|
log() {},
|
|
689
743
|
info() {},
|
|
@@ -708,6 +762,15 @@ function installFetchRuntime(force = false) {
|
|
|
708
762
|
global.Request = RequestPolyfill;
|
|
709
763
|
if (force || typeof global.Response !== "function")
|
|
710
764
|
global.Response = ResponsePolyfill;
|
|
765
|
+
if (force || typeof global.Blob !== "function")
|
|
766
|
+
global.Blob = BlobPolyfill;
|
|
767
|
+
if (force || typeof global.AbortSignal !== "function")
|
|
768
|
+
global.AbortSignal = AbortSignalPolyfill;
|
|
769
|
+
if (force || typeof global.AbortController !== "function") {
|
|
770
|
+
global.AbortController = AbortControllerPolyfill;
|
|
771
|
+
}
|
|
772
|
+
if (force || typeof global.self !== "object" || global.self === null)
|
|
773
|
+
global.self = globalThis;
|
|
711
774
|
if (force || typeof global.console !== "object" || global.console === null) {
|
|
712
775
|
global.console = noopConsole;
|
|
713
776
|
}
|
|
@@ -11,7 +11,7 @@ This generated Pulumi project provisions platform resources only:
|
|
|
11
11
|
Application components, Services, and WorkloadDeployments remain owned by
|
|
12
12
|
`di-framework platform deploy`. No application name is stored here.
|
|
13
13
|
|
|
14
|
-
`di-framework platform cluster up
|
|
14
|
+
`di-framework platform cluster up --yes` runs `pulumi install`
|
|
15
15
|
before selecting the stack, so this directory does not need a manual package
|
|
16
16
|
manager install and does not need to belong to a root workspace.
|
|
17
17
|
|
|
@@ -56,12 +56,15 @@ registry content.
|
|
|
56
56
|
From the workspace root:
|
|
57
57
|
|
|
58
58
|
```sh
|
|
59
|
-
di-framework platform cluster up
|
|
59
|
+
di-framework platform cluster up --yes
|
|
60
60
|
di-framework platform deploy <configured-project-name>
|
|
61
61
|
di-framework platform destroy <configured-project-name>
|
|
62
|
-
di-framework platform cluster destroy
|
|
62
|
+
di-framework platform cluster destroy --yes
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
+
These use `default-target` (`local` after `di-framework platform cluster init`). Add
|
|
66
|
+
`--target <name>` to choose another target.
|
|
67
|
+
|
|
65
68
|
Send the configured project name as the HTTP `Host` header, for example:
|
|
66
69
|
|
|
67
70
|
```sh
|
|
@@ -96,7 +99,7 @@ config:
|
|
|
96
99
|
role: viewer
|
|
97
100
|
```
|
|
98
101
|
|
|
99
|
-
Run the existing `di-framework platform cluster up
|
|
102
|
+
Run the existing `di-framework platform cluster up --yes` command.
|
|
100
103
|
Pulumi installs the cluster-scoped `Tenant` and `User` CRDs in
|
|
101
104
|
`platform.di-framework.dev/v1alpha1`, admission policies, a TypeScript controller,
|
|
102
105
|
and the declared custom resources. It waits for their `Ready` conditions. There
|
|
@@ -146,8 +149,21 @@ certificate/key. Kubernetes may shorten the requested token lifetime. Tokens are
|
|
|
146
149
|
never stored in User status or Pulumi outputs. The `users` output identifies the
|
|
147
150
|
ServiceAccount; `tenants` identifies the namespaces and host group.
|
|
148
151
|
|
|
149
|
-
Configure a deployment target with the user's kubeconfig
|
|
150
|
-
`namespace = "di-tenant-warehouse"` and `hostgroup = "tenant-warehouse"
|
|
152
|
+
Configure a deployment target with the user's kubeconfig and `tenant = "warehouse"`,
|
|
153
|
+
which selects `namespace = "di-tenant-warehouse"` and `hostgroup = "tenant-warehouse"`:
|
|
154
|
+
|
|
155
|
+
```toml
|
|
156
|
+
default-target = "alice"
|
|
157
|
+
|
|
158
|
+
[targets.alice]
|
|
159
|
+
kubeconfig = "${ALICE_KUBECONFIG}"
|
|
160
|
+
tenant = "warehouse"
|
|
161
|
+
registry = "<registry>/warehouse"
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
That target is a local deploy destination; the tenant is the isolation unit declared
|
|
165
|
+
here. Each user of a tenant can have their own target.
|
|
166
|
+
|
|
151
167
|
Port-forward `service/di-http` in `di-runtime-warehouse` to reach its HTTP routes.
|
|
152
168
|
The default platform HTTP entrypoint continues to target the default host group.
|
|
153
169
|
For shared tenant keyvalue storage, reference the controller-managed ConfigMap
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
package wasi:clocks@0.2.12;
|
|
2
|
+
interface monotonic-clock {
|
|
3
|
+
use wasi:io/poll@0.2.12.{pollable};
|
|
4
|
+
type instant = u64;
|
|
5
|
+
type duration = u64;
|
|
6
|
+
now: func() -> instant;
|
|
7
|
+
resolution: func() -> duration;
|
|
8
|
+
subscribe-instant: func(
|
|
9
|
+
when: instant,
|
|
10
|
+
) -> pollable;
|
|
11
|
+
subscribe-duration: func(
|
|
12
|
+
when: duration,
|
|
13
|
+
) -> pollable;
|
|
14
|
+
}
|
|
15
|
+
@unstable(feature = clocks-timezone)
|
|
16
|
+
interface timezone {
|
|
17
|
+
@unstable(feature = clocks-timezone)
|
|
18
|
+
use wall-clock.{datetime};
|
|
19
|
+
@unstable(feature = clocks-timezone)
|
|
20
|
+
display: func(when: datetime) -> timezone-display;
|
|
21
|
+
@unstable(feature = clocks-timezone)
|
|
22
|
+
utc-offset: func(when: datetime) -> s32;
|
|
23
|
+
@unstable(feature = clocks-timezone)
|
|
24
|
+
record timezone-display {
|
|
25
|
+
utc-offset: s32,
|
|
26
|
+
name: string,
|
|
27
|
+
in-daylight-saving-time: bool,
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
interface wall-clock {
|
|
31
|
+
record datetime {
|
|
32
|
+
seconds: u64,
|
|
33
|
+
nanoseconds: u32,
|
|
34
|
+
}
|
|
35
|
+
now: func() -> datetime;
|
|
36
|
+
resolution: func() -> datetime;
|
|
37
|
+
}
|
|
38
|
+
world imports {
|
|
39
|
+
import monotonic-clock;
|
|
40
|
+
import wall-clock;
|
|
41
|
+
@unstable(feature = clocks-timezone)
|
|
42
|
+
import timezone;
|
|
43
|
+
}
|