@homeflare/alchemy 0.10.1 → 0.12.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/README.md +3 -3
- package/dist/caddy/admin-guard.d.ts +1 -1
- package/dist/caddy/index.js.map +4 -4
- package/dist/cloudflare/client.d.ts +1 -1
- package/dist/cloudflare/index.js.map +2 -2
- package/dist/cloudflare/lock-rules.d.ts +1 -1
- package/dist/forgejo/branch-protection-form.d.ts +1 -1
- package/dist/forgejo/branch-protection.d.ts +1 -1
- package/dist/forgejo/index.js.map +10 -10
- package/dist/forgejo/org-actions-secrets.d.ts +1 -1
- package/dist/forgejo/org-label.d.ts +1 -1
- package/dist/forgejo/org-team.d.ts +1 -1
- package/dist/forgejo/repo-webhook.d.ts +1 -1
- package/dist/forgejo/repository.d.ts +2 -2
- package/dist/forgejo/repository.d.ts.map +1 -1
- package/dist/forgejo/resource.d.ts +2 -2
- package/dist/forgejo/team-member.d.ts +1 -1
- package/dist/launchd/index.js.map +2 -2
- package/dist/openbao/auth-role.d.ts +1 -1
- package/dist/openbao/bao-http.d.ts +4 -4
- package/dist/openbao/cloudflare-permission-groups.d.ts +1 -1
- package/dist/openbao/cloudflare-role-form.d.ts +2 -2
- package/dist/openbao/cloudflare-role-form.d.ts.map +1 -1
- package/dist/openbao/cloudflare-roles-expand.d.ts +1 -1
- package/dist/openbao/digest.d.ts +1 -1
- package/dist/openbao/forgejo-bootstrap-parse.d.ts +2 -2
- package/dist/openbao/forgejo-bootstrap-parse.d.ts.map +1 -1
- package/dist/openbao/forgejo-bootstrap.d.ts +1 -1
- package/dist/openbao/index.js +10 -8
- package/dist/openbao/index.js.map +18 -18
- package/dist/openbao/mount.d.ts +1 -1
- package/dist/openbao/pki-role.d.ts +1 -1
- package/dist/openbao/policy.d.ts +2 -2
- package/dist/openbao/proxmox-role-form.d.ts +2 -2
- package/dist/openbao/proxmox-role-form.d.ts.map +1 -1
- package/dist/openbao/proxmox-role.d.ts +10 -10
- package/dist/openbao/ssh-role.d.ts +3 -3
- package/dist/ownership/adopting.d.ts +34 -0
- package/dist/ownership/adopting.d.ts.map +1 -0
- package/dist/ownership/probe.d.ts +15 -5
- package/dist/ownership/probe.d.ts.map +1 -1
- package/dist/ownership/rows.d.ts +12 -0
- package/dist/ownership/rows.d.ts.map +1 -1
- package/dist/ownership/store-fixture.d.ts +10 -0
- package/dist/ownership/store-fixture.d.ts.map +1 -0
- package/dist/proxmox/acl.d.ts +2 -2
- package/dist/proxmox/acl.d.ts.map +1 -1
- package/dist/proxmox/api-token-form.d.ts +2 -2
- package/dist/proxmox/api-token.d.ts +11 -11
- package/dist/proxmox/ceph-daemon-form.d.ts +3 -3
- package/dist/proxmox/ceph-daemon.d.ts +19 -19
- package/dist/proxmox/ceph-daemon.d.ts.map +1 -1
- package/dist/proxmox/ceph-flag.d.ts +5 -5
- package/dist/proxmox/ceph-fs-wire.d.ts +5 -5
- package/dist/proxmox/ceph-fs.d.ts +16 -16
- package/dist/proxmox/ceph-osd-tree.d.ts +16 -16
- package/dist/proxmox/ceph-osd.d.ts +5 -5
- package/dist/proxmox/ceph-pool-form.d.ts +13 -13
- package/dist/proxmox/ceph-pool-form.d.ts.map +1 -1
- package/dist/proxmox/ceph-pool.d.ts +3 -3
- package/dist/proxmox/client.d.ts +2 -2
- package/dist/proxmox/credentials.d.ts +8 -8
- package/dist/proxmox/credentials.d.ts.map +1 -1
- package/dist/proxmox/fake-pve-lxc.d.ts +8 -0
- package/dist/proxmox/fake-pve-lxc.d.ts.map +1 -1
- package/dist/proxmox/firewall-alias-form.d.ts +1 -1
- package/dist/proxmox/firewall-alias.d.ts +1 -1
- package/dist/proxmox/generated/pbs.d.ts +1 -1
- package/dist/proxmox/generated/pve.d.ts +1 -1
- package/dist/proxmox/group.d.ts +8 -8
- package/dist/proxmox/ha-resource.d.ts +3 -2
- package/dist/proxmox/ha-resource.d.ts.map +1 -1
- package/dist/proxmox/ha-rule-form.d.ts +5 -5
- package/dist/proxmox/ha-rule.d.ts +3 -3
- package/dist/proxmox/index.d.ts +6 -0
- package/dist/proxmox/index.d.ts.map +1 -1
- package/dist/proxmox/index.js +465 -217
- package/dist/proxmox/index.js.map +63 -58
- package/dist/proxmox/lease-cache.d.ts +4 -4
- package/dist/proxmox/lxc-adoption.d.ts +32 -0
- package/dist/proxmox/lxc-adoption.d.ts.map +1 -0
- package/dist/proxmox/lxc-harness.d.ts +12 -0
- package/dist/proxmox/lxc-harness.d.ts.map +1 -1
- package/dist/proxmox/lxc-props.d.ts +2 -2
- package/dist/proxmox/lxc.d.ts +8 -8
- package/dist/proxmox/lxc.d.ts.map +1 -1
- package/dist/proxmox/members.d.ts +3 -3
- package/dist/proxmox/network-apply-read.d.ts +5 -5
- package/dist/proxmox/network-apply.d.ts +9 -9
- package/dist/proxmox/node-network-form.d.ts +6 -6
- package/dist/proxmox/node-network.d.ts +17 -17
- package/dist/proxmox/node-network.d.ts.map +1 -1
- package/dist/proxmox/notification-target.d.ts +3 -2
- package/dist/proxmox/notification-target.d.ts.map +1 -1
- package/dist/proxmox/pbs-datastore-guard.d.ts +1 -1
- package/dist/proxmox/pbs-datastore.d.ts +10 -10
- package/dist/proxmox/pbs-prune-job.d.ts +2 -2
- package/dist/proxmox/pbs-sync-job.d.ts +4 -4
- package/dist/proxmox/pbs-verify-job.d.ts +1 -1
- package/dist/proxmox/pool.d.ts +4 -4
- package/dist/proxmox/provision-baseline.d.ts +74 -0
- package/dist/proxmox/provision-baseline.d.ts.map +1 -0
- package/dist/proxmox/provision-bootstrap.d.ts +33 -0
- package/dist/proxmox/provision-bootstrap.d.ts.map +1 -0
- package/dist/proxmox/provision-cli-fake.d.ts +38 -0
- package/dist/proxmox/provision-cli-fake.d.ts.map +1 -0
- package/dist/proxmox/provision-declare.d.ts +25 -0
- package/dist/proxmox/provision-declare.d.ts.map +1 -0
- package/dist/proxmox/replication-job.d.ts +9 -8
- package/dist/proxmox/replication-job.d.ts.map +1 -1
- package/dist/proxmox/resource.d.ts +2 -2
- package/dist/proxmox/resource.d.ts.map +1 -1
- package/dist/proxmox/sdn-apply-read.d.ts +7 -7
- package/dist/proxmox/sdn-apply.d.ts +1 -1
- package/dist/proxmox/sdn-subnet-form.d.ts +1 -1
- package/dist/proxmox/sdn-subnet.d.ts +5 -5
- package/dist/proxmox/sdn-vnet.d.ts +5 -6
- package/dist/proxmox/sdn-vnet.d.ts.map +1 -1
- package/dist/proxmox/storage.d.ts +4 -3
- package/dist/proxmox/storage.d.ts.map +1 -1
- package/dist/proxmox/user.d.ts +3 -2
- package/dist/proxmox/user.d.ts.map +1 -1
- package/dist/proxmox/values.d.ts +1 -1
- package/dist/proxmox/zfs-pool-write.d.ts +1 -1
- package/dist/proxmox/zfs-pool.d.ts +5 -5
- package/dist/talos/credentials.d.ts +1 -1
- package/dist/talos/credentials.d.ts.map +1 -1
- package/dist/talos/index.js.map +1 -1
- package/docs/adopt-verify.md +21 -5
- package/docs/adopted-deploys.md +5 -3
- package/docs/ownership.md +27 -2
- package/docs/provision-baseline.md +106 -0
- package/docs/proxmox-lxc-adopt.md +83 -0
- package/docs/proxmox-lxc.md +12 -49
- package/docs/proxmox.md +8 -0
- package/package.json +1 -1
- package/src/caddy/admin-guard.ts +1 -1
- package/src/caddy/local-admin.ts +1 -1
- package/src/cloudflare/client.ts +1 -1
- package/src/cloudflare/lock-rules.ts +1 -1
- package/src/forgejo/branch-protection-form.ts +1 -1
- package/src/forgejo/branch-protection.ts +1 -1
- package/src/forgejo/client.ts +1 -1
- package/src/forgejo/org-actions-secrets.ts +1 -1
- package/src/forgejo/org-label.ts +1 -1
- package/src/forgejo/org-team.ts +1 -1
- package/src/forgejo/repo-webhook.ts +1 -1
- package/src/forgejo/repository.ts +2 -2
- package/src/forgejo/resource.ts +2 -2
- package/src/forgejo/team-member.ts +1 -1
- package/src/openbao/README.md +4 -4
- package/src/openbao/auth-role.ts +1 -1
- package/src/openbao/bao-http.test.ts +2 -2
- package/src/openbao/bao-http.ts +6 -6
- package/src/openbao/bao-status.test.ts +1 -1
- package/src/openbao/bao-status.ts +1 -1
- package/src/openbao/cloudflare-group-scope.test.ts +1 -1
- package/src/openbao/cloudflare-permission-groups.test.ts +1 -1
- package/src/openbao/cloudflare-permission-groups.ts +3 -3
- package/src/openbao/cloudflare-policy.ts +1 -1
- package/src/openbao/cloudflare-role-form.ts +2 -2
- package/src/openbao/cloudflare-roles-expand.ts +1 -1
- package/src/openbao/digest.ts +1 -1
- package/src/openbao/forgejo-bootstrap-parse.test.ts +3 -3
- package/src/openbao/forgejo-bootstrap-parse.ts +2 -2
- package/src/openbao/forgejo-bootstrap.ts +4 -4
- package/src/openbao/kubernetes-role-form.test.ts +5 -5
- package/src/openbao/mount.ts +1 -1
- package/src/openbao/pki-role.ts +1 -1
- package/src/openbao/policy-wire.test.ts +3 -3
- package/src/openbao/policy.ts +2 -2
- package/src/openbao/proxmox-role-form.ts +5 -5
- package/src/openbao/proxmox-role.ts +11 -11
- package/src/openbao/ssh-role.ts +3 -3
- package/src/ownership/adopting.test.ts +63 -0
- package/src/ownership/adopting.ts +46 -0
- package/src/ownership/ownership.test.ts +1 -34
- package/src/ownership/probe.ts +27 -14
- package/src/ownership/rows.ts +8 -2
- package/src/ownership/store-fixture.ts +50 -0
- package/src/proxmox/acl.ts +4 -4
- package/src/proxmox/adopt-noop.test.ts +6 -6
- package/src/proxmox/api-token-form.ts +4 -4
- package/src/proxmox/api-token.ts +13 -13
- package/src/proxmox/ceph-daemon-form.ts +3 -3
- package/src/proxmox/ceph-daemon.ts +20 -20
- package/src/proxmox/ceph-flag.ts +7 -7
- package/src/proxmox/ceph-fs-wire.ts +7 -7
- package/src/proxmox/ceph-fs.ts +18 -18
- package/src/proxmox/ceph-osd-tree.ts +16 -16
- package/src/proxmox/ceph-osd.ts +6 -6
- package/src/proxmox/ceph-pool-adopt.test.ts +14 -14
- package/src/proxmox/ceph-pool-form.ts +13 -13
- package/src/proxmox/ceph-pool.ts +6 -6
- package/src/proxmox/client.test.ts +3 -3
- package/src/proxmox/client.ts +3 -3
- package/src/proxmox/credentials.test.ts +6 -8
- package/src/proxmox/credentials.ts +8 -8
- package/src/proxmox/fake-pve-lxc.ts +13 -1
- package/src/proxmox/firewall-alias-form.ts +1 -1
- package/src/proxmox/firewall-alias.ts +1 -1
- package/src/proxmox/generated/pbs.ts +1 -1
- package/src/proxmox/generated/pve.ts +1 -1
- package/src/proxmox/group.ts +10 -10
- package/src/proxmox/ha-resource.ts +3 -2
- package/src/proxmox/ha-rule-form.ts +5 -5
- package/src/proxmox/ha-rule.ts +3 -3
- package/src/proxmox/index.test.ts +7 -0
- package/src/proxmox/index.ts +14 -0
- package/src/proxmox/lease-cache.test.ts +19 -19
- package/src/proxmox/lease-cache.ts +4 -4
- package/src/proxmox/lxc-adopt.test.ts +16 -23
- package/src/proxmox/lxc-adoption.ts +50 -0
- package/src/proxmox/lxc-create-form.ts +1 -1
- package/src/proxmox/lxc-guards.test.ts +10 -17
- package/src/proxmox/lxc-harness.ts +27 -4
- package/src/proxmox/lxc-judge.test.ts +5 -5
- package/src/proxmox/lxc-lifecycle.ts +1 -1
- package/src/proxmox/lxc-ownership.test.ts +19 -14
- package/src/proxmox/lxc-props.ts +2 -2
- package/src/proxmox/lxc-read.test.ts +3 -3
- package/src/proxmox/lxc-strict-adopt.test.ts +104 -0
- package/src/proxmox/lxc-volume.test.ts +9 -9
- package/src/proxmox/lxc-volume.ts +1 -1
- package/src/proxmox/lxc-wire.ts +1 -1
- package/src/proxmox/lxc.ts +19 -15
- package/src/proxmox/members.test.ts +1 -1
- package/src/proxmox/members.ts +3 -3
- package/src/proxmox/metric-server-otel.ts +2 -2
- package/src/proxmox/network-apply-read.ts +10 -10
- package/src/proxmox/network-apply.ts +10 -10
- package/src/proxmox/node-network-form.ts +7 -7
- package/src/proxmox/node-network.ts +18 -18
- package/src/proxmox/notification-target.ts +3 -2
- package/src/proxmox/pbs-datastore-guard.ts +1 -1
- package/src/proxmox/pbs-datastore.ts +10 -10
- package/src/proxmox/pbs-prune-job.ts +2 -2
- package/src/proxmox/pbs-sync-job.ts +4 -4
- package/src/proxmox/pbs-verify-job.ts +1 -1
- package/src/proxmox/pool.test.ts +2 -2
- package/src/proxmox/pool.ts +4 -4
- package/src/proxmox/provision-baseline.test.ts +87 -0
- package/src/proxmox/provision-baseline.ts +162 -0
- package/src/proxmox/provision-bootstrap.test.ts +132 -0
- package/src/proxmox/provision-bootstrap.ts +135 -0
- package/src/proxmox/provision-cli-fake.ts +217 -0
- package/src/proxmox/provision-declare.test.ts +111 -0
- package/src/proxmox/provision-declare.ts +103 -0
- package/src/proxmox/replication-job.ts +9 -8
- package/src/proxmox/resource.ts +3 -3
- package/src/proxmox/sdn-apply-read.test.ts +16 -16
- package/src/proxmox/sdn-apply-read.ts +7 -7
- package/src/proxmox/sdn-apply.ts +3 -3
- package/src/proxmox/sdn-subnet-form.ts +1 -1
- package/src/proxmox/sdn-subnet.ts +5 -5
- package/src/proxmox/sdn-vnet.ts +5 -6
- package/src/proxmox/storage.ts +4 -3
- package/src/proxmox/user.ts +3 -2
- package/src/proxmox/values.test.ts +2 -2
- package/src/proxmox/values.ts +1 -1
- package/src/proxmox/zfs-pool-write.ts +1 -1
- package/src/proxmox/zfs-pool.ts +6 -6
- package/src/talos/credentials.ts +3 -3
- package/src/talos/values.test.ts +9 -9
- package/src/verify/cli.test.ts +1 -1
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The provisioning baseline: the access every PVE cluster and node needs before a stack built on
|
|
3
|
+
* this package can manage it — one role, the users OpenBao mints tokens for, the group that fences
|
|
4
|
+
* the mint, and the grants that bind them. ONE description, read by both halves:
|
|
5
|
+
* · provision-declare.ts turns it into `Proxmox.Role`/`Group`/`User`/`Acl` resources, so a stack
|
|
6
|
+
* adopts the baseline and keeps it (drift is a plan, not a 403 weeks later);
|
|
7
|
+
* · provision-bootstrap.ts turns it into the one-time root commands for a NEW cluster or node.
|
|
8
|
+
* The two cannot drift apart because neither holds a name or a privilege of its own.
|
|
9
|
+
*
|
|
10
|
+
* ⛔ THE PROVISION LANE CANNOT CREATE ITSELF. Every write here runs as a token OpenBao mints for the
|
|
11
|
+
* provision user, and minting needs that user to exist, in the mint group, bound to this role.
|
|
12
|
+
* So a new cluster is bootstrapped ONCE by root@pam with the generated commands, and the stack
|
|
13
|
+
* then adopts what they made (docs/provision-baseline.md).
|
|
14
|
+
*
|
|
15
|
+
* ★ ONE PRIVILEGE LIST FOR EVERY FAMILY, NOT A ROLE PER RESOURCE. The list is what the families'
|
|
16
|
+
* reconciles need, unioned — the set a hand-kept provision role reached one 403 at a time, each
|
|
17
|
+
* step recorded where it was hit (pool.ts, sdn-vnet.ts, ha-rule.ts). It includes what the lane needs
|
|
18
|
+
* to manage THIS baseline (`Sys.Modify` for the role, `Realm.AllocateUser`/`User.Modify` for the
|
|
19
|
+
* users, `Group.Allocate`, `Permissions.Modify` for the grants), so declaring it can never narrow
|
|
20
|
+
* the lane out of its own repair (role.ts: "A ROLE CAN LOCK ITS OWN PROVIDER OUT").
|
|
21
|
+
* ⚠️ NOT EVERY FAMILY: root@pam-only writes (device passthrough, bind mounts — lxc-judge.ts) and
|
|
22
|
+
* privileges a family names as still missing (`VM.Replicate`, replication-job.ts) are outside it.
|
|
23
|
+
*/
|
|
24
|
+
/** The provision role's privileges, sorted — the exact set, never an addition to a live one. */
|
|
25
|
+
export declare const PROVISION_PRIVILEGES: readonly string[];
|
|
26
|
+
/** The names a baseline uses. Every field has a generic default (`PROVISION_DEFAULTS`). */
|
|
27
|
+
export interface ProvisionNames {
|
|
28
|
+
/** The role holding `PROVISION_PRIVILEGES` on `/`. */
|
|
29
|
+
readonly role?: string | undefined;
|
|
30
|
+
/** The user OpenBao's `provision` role mints tokens for, realm-qualified. */
|
|
31
|
+
readonly provisionUser?: string | undefined;
|
|
32
|
+
/** The group whose members OpenBao may mint for — the fence around the mint. */
|
|
33
|
+
readonly mintGroup?: string | undefined;
|
|
34
|
+
/** The user OpenBao's `read` role mints for, or `null` for a baseline with no read lane. */
|
|
35
|
+
readonly readUser?: string | null | undefined;
|
|
36
|
+
/** The role the read user holds on `/`. ⛔ It must already exist: a built-in, or one you declare. */
|
|
37
|
+
readonly readRole?: string | undefined;
|
|
38
|
+
/** The comment on the group and both users — how a person on the node learns what they are. */
|
|
39
|
+
readonly comment?: string | undefined;
|
|
40
|
+
}
|
|
41
|
+
/** Every name, resolved: what `PROVISION_DEFAULTS` holds and what a baseline is built from. */
|
|
42
|
+
export type ResolvedProvisionNames = {
|
|
43
|
+
readonly [K in keyof ProvisionNames]-?: Exclude<ProvisionNames[K], undefined>;
|
|
44
|
+
};
|
|
45
|
+
/** ★ Generic, kit-prefixed names: nothing here is any one estate's. */
|
|
46
|
+
export declare const PROVISION_DEFAULTS: ResolvedProvisionNames;
|
|
47
|
+
/** Which credential lane a user or a grant belongs to — the OpenBao role that mints for it. */
|
|
48
|
+
export type ProvisionLane = 'provision' | 'read';
|
|
49
|
+
/** A baseline, resolved: exactly what the declaration holds and the bootstrap makes. */
|
|
50
|
+
export interface ProvisionBaseline {
|
|
51
|
+
readonly role: {
|
|
52
|
+
readonly roleid: string;
|
|
53
|
+
readonly privs: readonly string[];
|
|
54
|
+
};
|
|
55
|
+
readonly group: {
|
|
56
|
+
readonly groupid: string;
|
|
57
|
+
readonly comment: string;
|
|
58
|
+
};
|
|
59
|
+
readonly users: readonly {
|
|
60
|
+
readonly lane: ProvisionLane;
|
|
61
|
+
readonly userid: string;
|
|
62
|
+
readonly comment: string;
|
|
63
|
+
readonly groups: readonly string[];
|
|
64
|
+
}[];
|
|
65
|
+
/** Each binds one user to one role on `/`, with propagate — the only shape the lanes need. */
|
|
66
|
+
readonly grants: readonly {
|
|
67
|
+
readonly lane: ProvisionLane;
|
|
68
|
+
readonly userid: string;
|
|
69
|
+
readonly roleid: string;
|
|
70
|
+
}[];
|
|
71
|
+
}
|
|
72
|
+
/** Resolve `names` over the defaults and check them. Throws with every problem at once. */
|
|
73
|
+
export declare const provisionBaseline: (names?: ProvisionNames) => ProvisionBaseline;
|
|
74
|
+
//# sourceMappingURL=provision-baseline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provision-baseline.d.ts","sourceRoot":"","sources":["../../src/proxmox/provision-baseline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,gGAAgG;AAChG,eAAO,MAAM,oBAAoB,EAAE,SAAS,MAAM,EA4BhD,CAAC;AAEH,2FAA2F;AAC3F,MAAM,WAAW,cAAc;IAC7B,sDAAsD;IACtD,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,6EAA6E;IAC7E,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5C,gFAAgF;IAChF,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,4FAA4F;IAC5F,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC9C,oGAAoG;IACpG,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,+FAA+F;IAC/F,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACvC;AAED,+FAA+F;AAC/F,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,EAAE,CAAC,IAAI,MAAM,cAAc,CAAC,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC;CAC9E,CAAC;AAEF,uEAAuE;AACvE,eAAO,MAAM,kBAAkB,EAAE,sBAQ/B,CAAC;AAEH,+FAA+F;AAC/F,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,MAAM,CAAC;AAEjD,wFAAwF;AACxF,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE;QAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,CAAC;IAC9E,QAAQ,CAAC,KAAK,EAAE;QAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IACvE,QAAQ,CAAC,KAAK,EAAE,SAAS;QACvB,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;QAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;KACpC,EAAE,CAAC;IACJ,8FAA8F;IAC9F,QAAQ,CAAC,MAAM,EAAE,SAAS;QACxB,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;QAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;KACzB,EAAE,CAAC;CACL;AA8BD,2FAA2F;AAC3F,eAAO,MAAM,iBAAiB,WAAW,cAAc,KAAQ,iBAwB9D,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `provisionBootstrap` — the provisioning baseline (provision-baseline.ts) as the one-time root
|
|
3
|
+
* commands for a NEW cluster or node: a POSIX `sh` script, printed, never run from here.
|
|
4
|
+
*
|
|
5
|
+
* bun -e "import { provisionBootstrap } from '@homeflare/alchemy/proxmox';
|
|
6
|
+
* process.stdout.write(provisionBootstrap())" | ssh root@<node> sh
|
|
7
|
+
*
|
|
8
|
+
* ⛔ WHY IT EXISTS: THE PROVISION LANE CANNOT CREATE ITSELF. Every resource in this package runs as a
|
|
9
|
+
* token OpenBao mints for the provision user, and a cluster without that user, its group and its
|
|
10
|
+
* grant has nothing to mint for — the plan that would create them cannot authenticate. So root
|
|
11
|
+
* makes them once, and the stack adopts and keeps them (provision-declare.ts). This is the only
|
|
12
|
+
* hand step, and it is generated from the same baseline the stack declares.
|
|
13
|
+
* ⛔ NEVER A TOKEN, NEVER A PASSWORD. The users are created with neither: OpenBao mints short-lived
|
|
14
|
+
* tokens for them later, and an `@pve` user with no password cannot log in to the UI. Nothing
|
|
15
|
+
* secret is in the script, so it can be read, reviewed and pasted.
|
|
16
|
+
* ★ CHECK, THEN CHANGE — IDEMPOTENT BY CONSTRUCTION. Each object is read first (`pvesh get … json`,
|
|
17
|
+
* parsed with Perl's core JSON::PP, which every PVE node has), compared with the baseline, and
|
|
18
|
+
* written only when it differs, naming what it does. A second run prints `ok` for everything and
|
|
19
|
+
* writes nothing. It also CONVERGES: a role with other privileges is set to exactly the baseline,
|
|
20
|
+
* as the stack's `Proxmox.Role` would set it (role.ts: a declaration replaces the set).
|
|
21
|
+
* ★ ONE NODE PER CLUSTER. Users, groups, roles and ACLs live in `/etc/pve/user.cfg`, which pmxcfs
|
|
22
|
+
* shares across the cluster: a node joining a cluster that has the baseline needs nothing, and a
|
|
23
|
+
* run there is all `ok`. A new standalone node or a new cluster is where it creates.
|
|
24
|
+
* ⚠️ NAMES ARE NOT QUOTED INTO SAFETY, THEY ARE REFUSED INTO IT: provision-baseline.ts admits only
|
|
25
|
+
* characters that need no quoting in `sh` or in a Perl `q{}`.
|
|
26
|
+
*/
|
|
27
|
+
import { type ProvisionNames } from './provision-baseline.ts';
|
|
28
|
+
/**
|
|
29
|
+
* The script for `names` (defaults: `PROVISION_DEFAULTS`). Pure: it reads nothing and runs nothing.
|
|
30
|
+
* Throws, like `provisionBaseline`, on a name the baseline refuses.
|
|
31
|
+
*/
|
|
32
|
+
export declare const provisionBootstrap: (names?: ProvisionNames) => string;
|
|
33
|
+
//# sourceMappingURL=provision-bootstrap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provision-bootstrap.d.ts","sourceRoot":"","sources":["../../src/proxmox/provision-bootstrap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,EAEL,KAAK,cAAc,EAEpB,MAAM,yBAAyB,CAAC;AAsFjC;;;GAGG;AACH,eAAO,MAAM,kBAAkB,WAAW,cAAc,KAAQ,MAc/D,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export type CliUser = {
|
|
2
|
+
comment: string;
|
|
3
|
+
email: string;
|
|
4
|
+
enable: number;
|
|
5
|
+
expire: number;
|
|
6
|
+
firstname: string;
|
|
7
|
+
lastname: string;
|
|
8
|
+
groups: string[];
|
|
9
|
+
};
|
|
10
|
+
export type CliGrant = {
|
|
11
|
+
path: string;
|
|
12
|
+
type: string;
|
|
13
|
+
ugid: string;
|
|
14
|
+
roleid: string;
|
|
15
|
+
propagate: number;
|
|
16
|
+
};
|
|
17
|
+
export type CliState = {
|
|
18
|
+
roles: Record<string, string[]>;
|
|
19
|
+
groups: Record<string, {
|
|
20
|
+
comment: string;
|
|
21
|
+
}>;
|
|
22
|
+
users: Record<string, CliUser>;
|
|
23
|
+
acl: CliGrant[];
|
|
24
|
+
};
|
|
25
|
+
/** A cluster as PVE installs it: the built-in auditor role, and nothing of the baseline. */
|
|
26
|
+
export declare const freshCluster: () => CliState;
|
|
27
|
+
/** Every item GET the scripts and the providers make, keyed `access/…` without a leading slash. */
|
|
28
|
+
export declare const apiView: (state: CliState) => Record<string, unknown>;
|
|
29
|
+
export type ScriptRun = {
|
|
30
|
+
code: number;
|
|
31
|
+
stdout: string;
|
|
32
|
+
stderr: string;
|
|
33
|
+
writes: string[];
|
|
34
|
+
state: CliState;
|
|
35
|
+
};
|
|
36
|
+
/** Run `script` under `sh` against `state`, with the fakes first on PATH. */
|
|
37
|
+
export declare const runScript: (script: string, state: CliState) => Promise<ScriptRun>;
|
|
38
|
+
//# sourceMappingURL=provision-cli-fake.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provision-cli-fake.d.ts","sourceRoot":"","sources":["../../src/proxmox/provision-cli-fake.ts"],"names":[],"mappings":"AAkBA,MAAM,MAAM,OAAO,GAAG;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AACF,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AACF,MAAM,MAAM,QAAQ,GAAG;IACrB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC5C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,GAAG,EAAE,QAAQ,EAAE,CAAC;CACjB,CAAC;AAEF,4FAA4F;AAC5F,eAAO,MAAM,YAAY,QAAO,QAc9B,CAAC;AAIH,mGAAmG;AACnG,eAAO,MAAM,OAAO,UAAW,QAAQ,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAsB/D,CAAC;AA0FF,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,EAAE,QAAQ,CAAC;CACjB,CAAC;AAEF,6EAA6E;AAC7E,eAAO,MAAM,SAAS,WAAkB,MAAM,SAAS,QAAQ,KAAG,OAAO,CAAC,SAAS,CAkClF,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as Effect from 'effect/Effect';
|
|
2
|
+
import { ProxmoxAcl } from './acl.ts';
|
|
3
|
+
import type { PveTarget } from './credentials.ts';
|
|
4
|
+
import { ProxmoxGroup } from './group.ts';
|
|
5
|
+
import { type ProvisionNames } from './provision-baseline.ts';
|
|
6
|
+
import { ProxmoxRole } from './role.ts';
|
|
7
|
+
import { ProxmoxUser } from './user.ts';
|
|
8
|
+
export interface DeclareProvisionOptions {
|
|
9
|
+
/** `true`/`false` pipe `adopt(…)` onto every resource; omitted, the deploy's policy decides. */
|
|
10
|
+
readonly adopt?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The baseline for one cluster. `id` prefixes every logical id (`<id>-role`, `<id>-mint-group`,
|
|
14
|
+
* `<id>-provision-user`, `<id>-provision-grant`, and the `read` pair), so one stack can declare a
|
|
15
|
+
* baseline per cluster. `users` and `grants` come back in `baseline.users` / `baseline.grants`
|
|
16
|
+
* order: provision, then read. Fails, before declaring anything, on a name the baseline refuses.
|
|
17
|
+
*/
|
|
18
|
+
export declare const declareProvisionBaseline: (id: string, target: PveTarget, names?: ProvisionNames, options?: DeclareProvisionOptions) => Effect.Effect<{
|
|
19
|
+
baseline: import("./provision-baseline.ts").ProvisionBaseline;
|
|
20
|
+
grants: ProxmoxAcl[];
|
|
21
|
+
group: ProxmoxGroup;
|
|
22
|
+
role: ProxmoxRole;
|
|
23
|
+
users: ProxmoxUser[];
|
|
24
|
+
}, Error, import("effect/unstable/http/HttpClient").HttpClient>;
|
|
25
|
+
//# sourceMappingURL=provision-declare.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provision-declare.d.ts","sourceRoot":"","sources":["../../src/proxmox/provision-declare.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,KAAK,cAAc,EAAqB,MAAM,yBAAyB,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,MAAM,WAAW,uBAAuB;IACtC,gGAAgG;IAChG,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,OAC/B,MAAM,UACF,SAAS,UACV,cAAc,YACZ,uBAAuB;;;;;;+DAgD9B,CAAC"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `Proxmox.ReplicationJob` — a guest's ZFS storage replication to a second node, declared.
|
|
3
3
|
*
|
|
4
|
-
* ⛔ NOTHING ON
|
|
4
|
+
* ⛔ NOTHING ON C1 CAN USE THIS FAMILY, AND THAT IS SAID HERE RATHER THAN FOUND OUT LATER. PVE
|
|
5
5
|
* storage replication is ZFS-only: `POST /cluster/replication` calls `get_replicatable_volumes`
|
|
6
|
-
* and refuses a guest whose disks are anywhere else with "No replicatable volumes found".
|
|
6
|
+
* and refuses a guest whose disks are anywhere else with "No replicatable volumes found". C1 is
|
|
7
7
|
* Ceph/RBD-backed — shared storage, where replication means nothing because every node already
|
|
8
|
-
* sees the volume — so `GET /cluster/replication` answers `[]` (MEASURED on
|
|
9
|
-
* on this cluster always will. The file is written for a ZFS cluster; against
|
|
8
|
+
* sees the volume — so `GET /cluster/replication` answers `[]` (MEASURED on node-b, 2026-09-13) and
|
|
9
|
+
* on this cluster always will. The file is written for a ZFS cluster; against C1 a declaration
|
|
10
10
|
* is a create that fails with PVE's own sentence, not a plan that quietly does nothing.
|
|
11
11
|
*
|
|
12
|
-
* ★ WHAT IS MEASURED HERE AND WHAT IS REASONED. Measured on
|
|
12
|
+
* ★ WHAT IS MEASURED HERE AND WHAT IS REASONED. Measured on node-b (pve-manager 9.2.11), read-only:
|
|
13
13
|
* the published schema for all five methods; `PVE/ReplicationConfig.pm` and
|
|
14
14
|
* `PVE/API2/ReplicationConfig.pm` line by line; `GET /cluster/replication` -> `[]`; and the ACL
|
|
15
15
|
* row `{"path":"/","propagate":1,"roleid":"PVEAuditor","ugid":"hf-read@pve"}`. NOT measured: any
|
|
@@ -45,12 +45,13 @@
|
|
|
45
45
|
* declarations differing only in `jobnum` but naming the same target are not two jobs; the second
|
|
46
46
|
* is a create that fails.
|
|
47
47
|
*
|
|
48
|
-
* ⚠️ RECONCILE NEEDS `VM.Replicate` ON `/vms/<guest>`, WHICH
|
|
48
|
+
* ⚠️ RECONCILE NEEDS `VM.Replicate` ON `/vms/<guest>`, WHICH THE PROVISION ROLE DOES NOT HOLD. All
|
|
49
49
|
* three writes check it (MEASURED in API2/ReplicationConfig.pm: create, update and delete each
|
|
50
50
|
* call `$rpcenv->check($authuser, "/vms/$vmid", ['VM.Replicate'])`), and the role's 27 privileges
|
|
51
51
|
* include `VM.Allocate`, `VM.Audit`, `VM.Backup`, `VM.Config.*` and `VM.PowerMgmt` but not
|
|
52
|
-
* `VM.Replicate
|
|
53
|
-
*
|
|
52
|
+
* `VM.Replicate` (`PROVISION_PRIVILEGES`). Do NOT widen it by hand: the baseline declares the
|
|
53
|
+
* role's exact set, so a hand-added privilege is removed on the next deploy. Grant a second role
|
|
54
|
+
* holding `VM.Replicate` on `/vms/<guest>` instead.
|
|
54
55
|
* ★ THE READ LANE NEEDS NOTHING EXTRA, which is why there is no `readRole` below. The ITEM read
|
|
55
56
|
* checks `VM.Audit` on `/vms/<guest>`, `hf-read@pve` holds the built-in `PVEAuditor` at `/`
|
|
56
57
|
* with propagate — both MEASURED — and `PVEAuditor` carries `VM.Audit`. This family is not a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replication-job.d.ts","sourceRoot":"","sources":["../../src/proxmox/replication-job.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"replication-job.d.ts","sourceRoot":"","sources":["../../src/proxmox/replication-job.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoFG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAG7C,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,UAAU,EAAe,MAAM,eAAe,CAAC;AAGnF,MAAM,WAAW,mBAAoB,SAAQ,UAAU;IACrD,4FAA4F;IAC5F,KAAK,EAAE,MAAM,CAAC;IACd,iGAAiG;IACjG,MAAM,EAAE,MAAM,CAAC;IACf;;;;;;;;;OASG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2FAA2F;IAC3F,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,+FAA+F;IAC/F,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,wFAAwF;IACxF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,wBAAwB;IACvC,iDAAiD;IACjD,EAAE,EAAE,MAAM,CAAC;IACX;;;;;OAKG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,iGAAiG;IACjG,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB,6FAA6F;IAC7F,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,qBAAsB,SAAQ,QAAQ,CACrD,wBAAwB,EACxB,mBAAmB,EACnB,wBAAwB,EACxB,KAAK,EACL,eAAe,CAChB;CAAG;AAEJ,eAAO,MAAM,qBAAqB,wDAA4D,CAAC;AAwE/F;;;;;;;GAOG;AACH,eAAO,MAAM,6BAA6B,2IAIvC,CAAC"}
|
|
@@ -52,9 +52,9 @@ export type WithApiTarget = {
|
|
|
52
52
|
target: ApiTarget;
|
|
53
53
|
};
|
|
54
54
|
export type PveSpec<Props extends WithApiTarget, Attributes> = {
|
|
55
|
-
/** `pools/
|
|
55
|
+
/** `pools/lab`, `nodes/node-b/lxc/101` — where ONE object is read, updated and deleted. */
|
|
56
56
|
readonly path: (props: Props) => string;
|
|
57
|
-
/** `pools`, `nodes/
|
|
57
|
+
/** `pools`, `nodes/node-b/lxc` — where a NEW one is POSTed. */
|
|
58
58
|
readonly collection: (props: Props) => string;
|
|
59
59
|
/** Live JSON to attributes. Returning undefined means "this is not really there". */
|
|
60
60
|
readonly attributes: (live: Record<string, unknown>, props: Props) => Attributes | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../src/proxmox/resource.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,UAAU,MAAM,iCAAiC,CAAC;AAEnE,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGjF;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;;;GAKG;AACH;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,UAAU,CAAC;AAEpD,MAAM,MAAM,UAAU,GAAG;IAAE,MAAM,EAAE,SAAS,CAAA;CAAE,CAAC;AAC/C,MAAM,MAAM,aAAa,GAAG;IAAE,MAAM,EAAE,SAAS,CAAA;CAAE,CAAC;AAClD,MAAM,MAAM,aAAa,GAAG;IAAE,MAAM,EAAE,SAAS,CAAA;CAAE,CAAC;AAElD,MAAM,MAAM,OAAO,CAAC,KAAK,SAAS,aAAa,EAAE,UAAU,IAAI;IAC7D,
|
|
1
|
+
{"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../src/proxmox/resource.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,UAAU,MAAM,iCAAiC,CAAC;AAEnE,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGjF;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;;;GAKG;AACH;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,UAAU,CAAC;AAEpD,MAAM,MAAM,UAAU,GAAG;IAAE,MAAM,EAAE,SAAS,CAAA;CAAE,CAAC;AAC/C,MAAM,MAAM,aAAa,GAAG;IAAE,MAAM,EAAE,SAAS,CAAA;CAAE,CAAC;AAClD,MAAM,MAAM,aAAa,GAAG;IAAE,MAAM,EAAE,SAAS,CAAA;CAAE,CAAC;AAElD,MAAM,MAAM,OAAO,CAAC,KAAK,SAAS,aAAa,EAAE,UAAU,IAAI;IAC7D,2FAA2F;IAC3F,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,MAAM,CAAC;IACxC,+DAA+D;IAC/D,QAAQ,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,MAAM,CAAC;IAC9C,qFAAqF;IACrF,QAAQ,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,KAAK,EAAE,KAAK,KAAK,UAAU,GAAG,SAAS,CAAC;IAC7F,0EAA0E;IAC1E,QAAQ,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9D;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/D,oEAAoE;IACpE,QAAQ,CAAC,OAAO,EAAE,CAAC,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC;IACpE;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,KAAK,SAAS,aAAa,EAAE,UAAU,QAC7D,OAAO,CAAC,KAAK,EAAE,UAAU,CAAC;kBAGX,KAAK;iBAiBX,KAAK,CAAC,KAAK,CAAC,UAAU,UAAU,GAAG,SAAS;yBASZ,QAAQ;;yBACF,MAAM;;yBAGtC,SAAS;;sBAIV,KAAK;IA4DvB;;;;OAIG;oBACa,KAAK;CAExB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,WAAW,GAAI,KAAK,SAAS,aAAa,EAAE,UAAU,SAAS,MAAM,QAC1E,OAAO,CAAC,KAAK,EAAE,UAAU,CAAC;IAI9B,IAAI;IACJ,IAAI,aAAa;QAAE,IAAI,EAAE,KAAK,CAAA;KAAE;IAChC,IAAI,qBAAqB;QAAE,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;QAAC,MAAM,EAAE,UAAU,GAAG,SAAS,CAAA;KAAE;yBArHlC,QAAQ;;yBACF,MAAM;;yBAGtC,SAAS;;IAmH5B,SAAS,aAAa;QAAE,IAAI,EAAE,KAAK,CAAA;KAAE;IACrC,MAAM,aAAa;QAAE,IAAI,EAAE,KAAK,CAAA;KAAE;CAErC,CAAC"}
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
* collections this package declares resources for.
|
|
4
4
|
*
|
|
5
5
|
* 🔴 THE GAP THIS FILE CLOSES, AND IT WAS FOUND BY ALMOST DECLARING THE APPLY. `pendingCount` in
|
|
6
|
-
* sdn-apply.ts counted `cluster/sdn/zones` and `cluster/sdn/vnets`.
|
|
7
|
-
* staged OSPF FABRIC that nothing counted. MEASURED 2026-09-13 on
|
|
6
|
+
* sdn-apply.ts counted `cluster/sdn/zones` and `cluster/sdn/vnets`. C1 has zero of each — and a
|
|
7
|
+
* staged OSPF FABRIC that nothing counted. MEASURED 2026-09-13 on node-b:
|
|
8
8
|
*
|
|
9
|
-
* /etc/pve/sdn/fabrics.cfg ospf_fabric:
|
|
10
|
-
* ospf_node:
|
|
11
|
-
* ip
|
|
9
|
+
* /etc/pve/sdn/fabrics.cfg ospf_fabric: c1, area 1, ip_prefix 203.0.113.0/24
|
|
10
|
+
* ospf_node: c1_n2/node-c/node-d, interfaces tb0 + tb1,
|
|
11
|
+
* ip 203.0.113.102 / .103 / .104
|
|
12
12
|
* /etc/network/interfaces.d/sdn the file PVE GENERATES from it, carrying those /32s
|
|
13
13
|
*
|
|
14
14
|
* Those addresses are Ceph's `cluster_network`. So `diff` would have answered `noop` for ever
|
|
@@ -38,7 +38,7 @@ import type { PveTarget } from './credentials.ts';
|
|
|
38
38
|
*
|
|
39
39
|
* ⚠️ NAMED RATHER THAN SILENTLY SKIPPED. `ipams` and `dns` answer HTTP 400 to both `?pending=1` and
|
|
40
40
|
* `?running=1`, so there is no way to ask them what is staged. They are a REAL blind spot: an
|
|
41
|
-
* ipam edited by hand is published by the apply and cannot be seen from here.
|
|
41
|
+
* ipam edited by hand is published by the apply and cannot be seen from here. C1 has one ipam
|
|
42
42
|
* (`pve`, the built-in) and zero dns entries, so the blind spot is currently empty — which is a
|
|
43
43
|
* fact about today, not a property of the design.
|
|
44
44
|
*/
|
|
@@ -74,7 +74,7 @@ export declare const canonical: (value: unknown) => string;
|
|
|
74
74
|
*
|
|
75
75
|
* ⛔ ZERO HERE IS THE ONLY THING THAT MAKES DECLARING THE APPLY SAFE. `reconcile` runs on CREATE —
|
|
76
76
|
* Alchemy always calls it the first time a resource appears — and `PUT /cluster/sdn` regenerates
|
|
77
|
-
* `/etc/network/interfaces.d/sdn` on every node. On
|
|
77
|
+
* `/etc/network/interfaces.d/sdn` on every node. On C1 that file carries Ceph's cluster network.
|
|
78
78
|
*/
|
|
79
79
|
export declare const sdnPendingCount: (target: PveTarget) => Effect.Effect<number, Error, import("effect/unstable/http/HttpClient").HttpClient>;
|
|
80
80
|
//# sourceMappingURL=sdn-apply-read.d.ts.map
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* is the apply, and it is CLUSTER-WIDE — it publishes every staged object at once, not the one
|
|
7
7
|
* that happened to reconcile.
|
|
8
8
|
*
|
|
9
|
-
* ★ MEASURED ON
|
|
9
|
+
* ★ MEASURED ON C1 ON 2026-09-13, NOT INFERRED. A probe zone was created, inspected and removed:
|
|
10
10
|
*
|
|
11
11
|
* pvesh create /cluster/sdn/zones --zone zzprobe --type simple
|
|
12
12
|
* GET /cluster/sdn/zones/zzprobe -> {"digest":"c438…","type":"simple","zone":"zzprobe"}
|
|
@@ -22,7 +22,7 @@ export type DhcpRange = {
|
|
|
22
22
|
*
|
|
23
23
|
* ⛔ MEASURED from `/usr/share/perl5/PVE/API2/Network/SDN/Subnets.pm` on pve-manager 9.2.11, in
|
|
24
24
|
* the create handler: `my $id = $cidr =~ s/\//-/r; $id = "$zoneid-$id";`. So `subnet=10.0.0.0/24`
|
|
25
|
-
* goes out and `
|
|
25
|
+
* goes out and `lab-10.0.0.0-24` is what exists afterwards. A CIDR cannot be a path segment
|
|
26
26
|
* anyway — it carries a slash — so there is no spelling of this endpoint that takes the CIDR.
|
|
27
27
|
*
|
|
28
28
|
* ⚠️ `.replace`, NOT `.replaceAll`, AND THE PARITY IS DELIBERATE. Perl's `s/\//-/r` has no `/g`, so
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* `vnet`; a literal buys no ordering, and here it also buys a wrong path.
|
|
12
12
|
*
|
|
13
13
|
* ⛔ THE ID PVE FILES A SUBNET UNDER IS NOT THE ONE YOU WRITE, AND IT IS THIS FAMILY'S SHARPEST
|
|
14
|
-
* EDGE. `POST` takes `subnet=10.0.0.0/24` while GET, PUT and DELETE address `
|
|
14
|
+
* EDGE. `POST` takes `subnet=10.0.0.0/24` while GET, PUT and DELETE address `lab-10.0.0.0-24`.
|
|
15
15
|
* One PVE parameter name, `subnet`, carrying two different values — so they are named APART here,
|
|
16
16
|
* `cidr` for the declared one and `subnetId` for the derived one, for the reason values.ts gives
|
|
17
17
|
* about `flag`: a name that means two things is a bug waiting for whoever reads one meaning. The
|
|
@@ -50,11 +50,11 @@
|
|
|
50
50
|
* seven privileges include SDN.Audit — at `/` with propagate=1. So the default 3600s auditor
|
|
51
51
|
* lease reads this family, and a `readRole: 'provision'` here would be privilege nobody needed.
|
|
52
52
|
* Writes are a different answer: POST, PUT and DELETE all require SDN.Allocate on
|
|
53
|
-
* `/sdn/zones/<zone>/<vnet>`, which
|
|
53
|
+
* `/sdn/zones/<zone>/<vnet>`, which the provision role gained on 2026-09-13 (`PROVISION_PRIVILEGES`).
|
|
54
54
|
*
|
|
55
|
-
* ⚠️ NO LIVE SUBNET EXISTS ON
|
|
55
|
+
* ⚠️ NO LIVE SUBNET EXISTS ON C1 TO ROUND-TRIP AGAINST — there are no SDN zones and no vnets, so
|
|
56
56
|
* there can be no subnets. Every claim above is read off PVE 9.2.11's own schema and Perl sources
|
|
57
|
-
* on
|
|
57
|
+
* on node-b, and the noop argument below rests on those rather than on a plan this file has watched.
|
|
58
58
|
*
|
|
59
59
|
* ⚠️ TWO REFUSALS TO EXPECT, both from `SubnetPlugin::on_update_hook`: PVE will not put a subnet on
|
|
60
60
|
* a vnet with `vlanaware` set ("you can't add a subnet on a vlanaware vnet"), and it rejects a
|
|
@@ -88,7 +88,7 @@ export interface SdnSubnetProps extends WithTarget {
|
|
|
88
88
|
gateway?: string;
|
|
89
89
|
/**
|
|
90
90
|
* Masquerade this subnet. ⚠️ INERT UNTIL THE CLUSTER FIREWALL IS ON — PVE's own description is
|
|
91
|
-
* "enable masquerade for this subnet if pve-firewall", and
|
|
91
|
+
* "enable masquerade for this subnet if pve-firewall", and C1's cluster firewall was empty and
|
|
92
92
|
* disabled when this was written. It still round-trips, so declaring it does not diff.
|
|
93
93
|
*/
|
|
94
94
|
snat?: boolean;
|
|
@@ -35,12 +35,11 @@
|
|
|
35
35
|
* than an error — see the ⛔ in sdn-zone.ts and docs/privileges.md.
|
|
36
36
|
*
|
|
37
37
|
* ⚠️ PRIVILEGES, AND THE ESTATE'S CREDENTIAL HELD NONE OF THEM UNTIL 2026-09-13. reconcile and
|
|
38
|
-
* delete mint `provision` and need SDN.Allocate on `/sdn/zones`, or on the one zone if scoped.
|
|
39
|
-
* SDN.Use, which is what a GUEST needs in order to attach to a vnet and NOT what
|
|
40
|
-
* needs, so a container
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* preserving every existing privilege.
|
|
38
|
+
* delete mint `provision` and need SDN.Allocate on `/sdn/zones`, or on the one zone if scoped. The provision role granted
|
|
39
|
+
* only SDN.Use then, which is what a GUEST needs in order to attach to a vnet and NOT what
|
|
40
|
+
* creating one needs, so a container on a vnet worked while the vnet itself 403'd. It was widened
|
|
41
|
+
* the way Pool.Allocate was, and `PROVISION_PRIVILEGES` (provision-baseline.ts) now carries
|
|
42
|
+
* SDN.Allocate and SDN.Audit.
|
|
44
43
|
*/
|
|
45
44
|
import { Resource } from 'alchemy';
|
|
46
45
|
import * as Provider from 'alchemy/Provider';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdn-vnet.d.ts","sourceRoot":"","sources":["../../src/proxmox/sdn-vnet.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"sdn-vnet.d.ts","sourceRoot":"","sources":["../../src/proxmox/sdn-vnet.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,UAAU,EAAe,MAAM,eAAe,CAAC;AAGnF,MAAM,WAAW,YAAa,SAAQ,UAAU;IAC9C;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,gGAAgG;IAChG,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0FAA0F;IAC1F,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,oEAAoE;IACpE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd;;;;;;OAMG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,cAAe,SAAQ,QAAQ,CAC9C,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,KAAK,EACL,eAAe,CAChB;CAAG;AAEJ,eAAO,MAAM,cAAc,iDAA8C,CAAC;AAyG1E;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,sBAAsB,oIACoD,CAAC"}
|
|
@@ -21,9 +21,10 @@
|
|
|
21
21
|
* messages point away from the cause.
|
|
22
22
|
* ★ SO WIDEN OR RE-POINT BEFORE THE FIRST PLAN, outside this file: give the credential mount's
|
|
23
23
|
* `read` role `Datastore.Allocate` on `/storage`, or read this family with `provision`. The
|
|
24
|
-
* provision role in the estate this was written for
|
|
24
|
+
* provision role in the estate this was written for held only `Datastore.AllocateSpace` and
|
|
25
25
|
* `Datastore.Audit`, and NEITHER IS IT — AllocateSpace writes volumes INTO a storage, Allocate
|
|
26
|
-
* DEFINES one — so it
|
|
26
|
+
* DEFINES one — so it 403'd here until widened the way `Pool.Allocate` was for `Proxmox.Pool`.
|
|
27
|
+
* The provisioning baseline (`provision-baseline.ts`) carries `Datastore.Allocate`.
|
|
27
28
|
*
|
|
28
29
|
* ⛔ THERE IS NO `password` PROP AND THERE MUST NEVER BE ONE. PBS and CIFS storages take one at
|
|
29
30
|
* create time, and Alchemy persists attributes UNENCRYPTED — a secret in props is one careless
|
|
@@ -64,7 +65,7 @@ export interface StorageProps extends WithTarget {
|
|
|
64
65
|
/** `images,rootdir,vztmpl,iso,backup,snippets`. PVE reports `none` for an empty set. */
|
|
65
66
|
content?: string;
|
|
66
67
|
/**
|
|
67
|
-
* Node restriction, e.g. `
|
|
68
|
+
* Node restriction, e.g. `node-a,node-b`. ⚠️ A STORAGE WITH A `nodes` LIST DOES NOT EXIST ANYWHERE ELSE:
|
|
68
69
|
* an LXC declared on a node outside it fails at create with "storage not available on node".
|
|
69
70
|
*/
|
|
70
71
|
nodes?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/proxmox/storage.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/proxmox/storage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,UAAU,EAAe,MAAM,eAAe,CAAC;AAGnF;;;;;;;;;GASG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG;IACpD,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,OAAO,CAAC,EAAE,KAAK,CAAC;IAChB,gBAAgB,CAAC,EAAE,KAAK,CAAC;CAC1B,CAAC;AAEF,MAAM,WAAW,YAAa,SAAQ,UAAU;IAC9C,6FAA6F;IAC7F,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,wFAAwF;IACxF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mDAAmD;IACnD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,yFAAyF;IACzF,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,uEAAuE;IACvE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,sFAAsF;IACtF,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,2FAA2F;IAC3F,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,cAAe,SAAQ,QAAQ,CAC9C,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,KAAK,EACL,eAAe,CAChB;CAAG;AAEJ,qGAAqG;AACrG,eAAO,MAAM,cAAc,iDAEzB,CAAC;AAgHH;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,sBAAsB,oIACoD,CAAC"}
|
package/dist/proxmox/user.d.ts
CHANGED
|
@@ -29,8 +29,9 @@
|
|
|
29
29
|
* can then say what a delete would take with it — and kept OUT of `matches`, exactly like
|
|
30
30
|
* `pool.members`. Reported, never declared.
|
|
31
31
|
*
|
|
32
|
-
* ⚠️ RECONCILE NEEDS PRIVILEGES
|
|
33
|
-
* 403 in the middle of a deploy (pool.ts records how that went the last time)
|
|
32
|
+
* ⚠️ RECONCILE NEEDS PRIVILEGES A GUEST-ONLY ROLE DOES NOT HOLD, so they are stated rather than met
|
|
33
|
+
* as a 403 in the middle of a deploy (pool.ts records how that went the last time).
|
|
34
|
+
* `PROVISION_PRIVILEGES` (provision-baseline.ts) carries every one of them:
|
|
34
35
|
* · `Realm.AllocateUser` on `/access/realm/<realm>` — create and delete.
|
|
35
36
|
* · `User.Modify` on `/access/groups`, and on `/access/groups/<group>` for EVERY group named in
|
|
36
37
|
* `groups` — create, update and delete. PVE checks the groups you are granting, not just the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../src/proxmox/user.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../src/proxmox/user.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,UAAU,EAAe,MAAM,eAAe,CAAC;AAGnF,MAAM,WAAW,SAAU,SAAQ,UAAU;IAC3C;;;;;;;OAOG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4EAA4E;IAC5E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mGAAmG;IACnG,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,kFAAkF;IAClF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2FAA2F;IAC3F,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,qFAAqF;IACrF,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,WAAY,SAAQ,QAAQ,CAC3C,cAAc,EACd,SAAS,EACT,cAAc,EACd,KAAK,EACL,eAAe,CAChB;CAAG;AAEJ,eAAO,MAAM,WAAW,8CAAwC,CAAC;AAiGjE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,mBAAmB,iIACiD,CAAC"}
|
package/dist/proxmox/values.d.ts
CHANGED
|
@@ -108,7 +108,7 @@ export declare const int: (value: unknown, fallback: number) => number;
|
|
|
108
108
|
* A PVE update form with its clear-list attached, and the two guaranteed not to overlap.
|
|
109
109
|
*
|
|
110
110
|
* ⛔ PVE DIES IF A KEY IS SET AND DELETED IN ONE CALL, AND SIX FAMILIES HERE BUILT THAT FORM BY
|
|
111
|
-
* HAND. Measured in the shipped Perl on
|
|
111
|
+
* HAND. Measured in the shipped Perl on node-b — `PVE::SectionConfig::delete_from_config`, line 1860:
|
|
112
112
|
*
|
|
113
113
|
* die "cannot set and delete property '$k' at the same time!\n"
|
|
114
114
|
* if defined($new_options->{$k});
|
|
@@ -37,7 +37,7 @@ export declare const createForm: (props: ZfsPoolProps) => Record<string, string>
|
|
|
37
37
|
/**
|
|
38
38
|
* Create the pool if it is absent, and otherwise leave it completely alone.
|
|
39
39
|
*
|
|
40
|
-
* ⛔ THE POST ONLY FORKS A WORKER. MEASURED in `/usr/share/perl5/PVE/API2/Disks/ZFS.pm` on
|
|
40
|
+
* ⛔ THE POST ONLY FORKS A WORKER. MEASURED in `/usr/share/perl5/PVE/API2/Disks/ZFS.pm` on node-b: the
|
|
41
41
|
* create handler ends in `$rpcenv->fork_worker('zfscreate', ...)` and its HTTP answer is a UPID
|
|
42
42
|
* returned the instant the worker is forked — before `zpool create` has run, let alone finished.
|
|
43
43
|
* A read-back taken immediately, as `pveOperations.reconcile` takes it, finds nothing and would
|
|
@@ -22,22 +22,22 @@
|
|
|
22
22
|
* that one line turns a text edit into an unrecoverable one.
|
|
23
23
|
*
|
|
24
24
|
* ⛔ THERE IS NO PUT ON THIS FAMILY AT ALL. MEASURED from the cluster's own published schema
|
|
25
|
-
* (`/usr/share/pve-docs/api-viewer/apidoc.js`, read on
|
|
25
|
+
* (`/usr/share/pve-docs/api-viewer/apidoc.js`, read on node-b 2026-09-13): `/nodes/{node}/disks/zfs`
|
|
26
26
|
* has GET and POST, `/nodes/{node}/disks/zfs/{name}` has GET and DELETE, and that is the whole
|
|
27
27
|
* surface. So `updateForm` is omitted — which, per `resource.ts`, makes any `matches` = false a
|
|
28
28
|
* REPLACE. A replace is a delete followed by a create, and on this family the delete is the
|
|
29
29
|
* thing above. Read the ⛔ on `matches` before adding anything to it.
|
|
30
30
|
*
|
|
31
31
|
* ⛔ NOT ONE CREATE PARAMETER COMES BACK ON READ, SO `matches` COMPARES NOTHING. MEASURED against
|
|
32
|
-
* the live cluster: `GET /nodes/
|
|
32
|
+
* the live cluster: `GET /nodes/node-b/disks/zfs/rpool` answers exactly
|
|
33
33
|
* `{action, children, errors, leaf, name, scan, state, status}` — no `ashift`, no `compression`,
|
|
34
34
|
* no `raidlevel`, no `devices`, no `add_storage`. Every create parameter is write-only. There is
|
|
35
35
|
* therefore no field a declaration and a live pool can both be asked about, and a `matches` that
|
|
36
36
|
* invented one would plan a replace — i.e. a `zpool destroy` — over a difference it could never
|
|
37
37
|
* verify in the first place.
|
|
38
38
|
*
|
|
39
|
-
* ⚠️ AND WHAT THE INDEX RETURNS IS LIVE TELEMETRY, NOT CONFIGURATION. `GET /nodes/
|
|
40
|
-
* gives `alloc`, `free`, `frag`, `dedup`, `size`, `health`. MEASURED: two reads of
|
|
39
|
+
* ⚠️ AND WHAT THE INDEX RETURNS IS LIVE TELEMETRY, NOT CONFIGURATION. `GET /nodes/node-b/disks/zfs`
|
|
40
|
+
* gives `alloc`, `free`, `frag`, `dedup`, `size`, `health`. MEASURED: two reads of node-b seconds
|
|
41
41
|
* apart returned `alloc` 14474944512 then 14472740864 — it moves on its own, with no declaration
|
|
42
42
|
* anywhere near it. `scan` in the detail read moves the same way (it carries the last scrub), and
|
|
43
43
|
* `status`/`action` appear and vanish as ZFS feature flags and faults come and go. None of them
|
|
@@ -133,7 +133,7 @@ export interface ZfsPoolAttributes {
|
|
|
133
133
|
*
|
|
134
134
|
* ⚠️ THIS IS WHAT ZFS RESOLVED, NOT WHAT WAS DECLARED, and the two normally differ: PVE rewrites
|
|
135
135
|
* a `/dev/sdb` into a by-id link before creating, and ZFS reports partition paths (`…-part3`)
|
|
136
|
-
* for a pool built on partitions — MEASURED, that is exactly what
|
|
136
|
+
* for a pool built on partitions — MEASURED, that is exactly what node-b's `rpool` reports. Never
|
|
137
137
|
* compare it with `props.devices`.
|
|
138
138
|
*/
|
|
139
139
|
devices: string;
|
|
@@ -2,7 +2,7 @@ import * as Effect from 'effect/Effect';
|
|
|
2
2
|
import * as ChildProcessSpawner from 'effect/unstable/process/ChildProcessSpawner';
|
|
3
3
|
/** Where credentials come from. HomeFlare-specific mount names live in the stack, not here. */
|
|
4
4
|
export type TalosTarget = {
|
|
5
|
-
/** OpenBao KV mount holding Talos material, e.g. `talos-
|
|
5
|
+
/** OpenBao KV mount holding Talos material, e.g. `talos-c1`. */
|
|
6
6
|
readonly mount: string;
|
|
7
7
|
/** Logical cluster name — safe to persist and log. */
|
|
8
8
|
readonly cluster: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../src/talos/credentials.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,KAAK,mBAAmB,MAAM,6CAA6C,CAAC;AAEnF,+FAA+F;AAC/F,MAAM,MAAM,WAAW,GAAG;IACxB,
|
|
1
|
+
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../src/talos/credentials.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,KAAK,mBAAmB,MAAM,6CAA6C,CAAC;AAEnF,+FAA+F;AAC/F,MAAM,MAAM,WAAW,GAAG;IACxB,gEAAgE;IAChE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,sDAAsD;IACtD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB;;;;;OAKG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,gFAAgF;IAChF,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;CAClC,CAAC;AAIF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,WAAY,WAAW;;iGAsFhD,CAAC"}
|
package/dist/talos/index.js.map
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"sources": ["../src/talos/kubeconfig.ts", "../src/talos/credentials.ts", "../src/talos/talosctl.ts", "../src/talos/values.ts", "../src/talos/talos-bootstrap.ts", "../src/talos/talos-cluster-health.ts", "../src/talos/talos-machine-config.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"/**\n * `Talos.Kubeconfig` — fetch admin kubeconfig so `Kubernetes.*` workloads can connect.\n *\n * ★ REASONED FROM talosctl kubeconfig (Talos v1.13 CLI reference): writes a kubeconfig file;\n * `--merge=false` keeps it isolated; `-f/--force` overwrites an existing file.\n *\n * ⛔ THE KUBECONFIG FILE CONTAINS A CLIENT CERTIFICATE — IT MUST NOT BE AN ATTRIBUTE. Alchemy\n * persists attributes unencrypted. This resource:\n * - writes the file to `runtimePath` at reconcile time (re-minted each deploy),\n * - persists ONLY public metadata + fingerprints,\n * - exposes a `connection` field referencing the runtime path for `Kubernetes.ClusterAdapter`.\n *\n * ⚠️ `runtimePath` IS PERSISTED AS A STRING, NOT AS FILE CONTENTS. The path is a contract between\n * this resource and the host filesystem — same pattern as pointing Kubernetes.KubeConfig at\n * `/opt/homeflare/...` rendered outside Postgres.\n */\nimport { Resource } from 'alchemy';\nimport { isResolved } from 'alchemy/Diff';\nimport type { Input } from 'alchemy/Input';\nimport type { Connection } from 'alchemy/Kubernetes/Connection';\nimport * as Provider from 'alchemy/Provider';\nimport * as Effect from 'effect/Effect';\nimport { mintTalosconfig } from './credentials.ts';\nimport type { TalosRequirements, WithTarget } from './resource.ts';\nimport { talosctl } from './talosctl.ts';\nimport { kubeconfigMetadata, sha256 } from './values.ts';\n\nexport interface KubeconfigProps extends WithTarget {\n /** Node that serves `talosctl kubeconfig`. */\n node: string;\n /** Context name inside the generated kubeconfig — not secret. */\n context: string;\n /**\n * Host path where talosctl writes the kubeconfig each reconcile.\n *\n * ⛔ Must be outside Alchemy state and rotated by redeploy, never copied into attributes.\n */\n runtimePath: string;\n after?: readonly unknown[];\n}\n\nexport interface KubeconfigAttributes {\n context: string;\n endpoint: string;\n certificateAuthorityFingerprint: string;\n clientCertificateFingerprint: string;\n /** Digest of endpoint+context+fingerprints — detects credential rotation without storing PEM. */\n credentialGeneration: string;\n /**\n * Serializable `Kubernetes.Connection` for downstream workloads.\n *\n * ★ auth.kind `kubeconfig` is the stock ClusterAdapter — provider-roadmap.md names this seam.\n * Only `path` and `context` appear here; the adapter reads credentials from disk at call time.\n */\n connection: Connection;\n}\n\nexport interface TalosKubeconfig extends Resource<\n 'Talos.Kubeconfig',\n KubeconfigProps,\n KubeconfigAttributes,\n never,\n TalosRequirements\n> {}\n\nexport const TalosKubeconfig = Resource<TalosKubeconfig>('Talos.Kubeconfig');\n\nconst generation = (meta: {\n endpoint: string;\n caFingerprint: string;\n clientFingerprint: string;\n context: string;\n}) => sha256(`${meta.context}\\n${meta.endpoint}\\n${meta.caFingerprint}\\n${meta.clientFingerprint}`);\n\nconst toConnection = (props: KubeconfigProps): Connection => ({\n auth: { context: props.context, kind: 'kubeconfig', path: props.runtimePath },\n});\n\nconst readFileMeta = (props: KubeconfigProps) =>\n Effect.gen(function* () {\n const text = yield* Effect.tryPromise({\n try: () => Bun.file(props.runtimePath).text(),\n catch: (cause) => new Error(String(cause)),\n }).pipe(Effect.orElseSucceed(() => undefined as string | undefined));\n if (text === undefined) return undefined;\n const meta = kubeconfigMetadata(text, props.context);\n if (meta === undefined) return undefined;\n return {\n certificateAuthorityFingerprint: meta.caFingerprint,\n clientCertificateFingerprint: meta.clientFingerprint,\n connection: toConnection(props),\n context: props.context,\n credentialGeneration: generation({ ...meta, context: props.context }),\n endpoint: meta.endpoint,\n };\n });\n\nconst read = (props: KubeconfigProps) =>\n readFileMeta(props).pipe(\n Effect.map((meta) =>\n meta === undefined\n ? {\n certificateAuthorityFingerprint: '',\n clientCertificateFingerprint: '',\n connection: toConnection(props),\n context: props.context,\n credentialGeneration: '',\n endpoint: '',\n }\n : meta,\n ),\n );\n\nconst diff = (news: Input<KubeconfigProps>, output: KubeconfigAttributes | undefined) =>\n Effect.gen(function* () {\n if (output === undefined || !isResolved(news)) return undefined;\n const live = yield* read(news);\n if (\n live.credentialGeneration !== '' &&\n output.credentialGeneration === live.credentialGeneration &&\n output.context === live.context &&\n output.endpoint === live.endpoint\n ) {\n return { action: 'noop' } as const;\n }\n return { action: 'update' } as const;\n });\n\nconst reconcile = (props: KubeconfigProps) =>\n Effect.gen(function* () {\n const credential = yield* mintTalosconfig(props.target);\n yield* talosctl(\n [\n 'kubeconfig',\n props.runtimePath,\n '--merge=false',\n '--force',\n '--force-context-name',\n props.context,\n ],\n { nodes: [props.node], talosconfigPath: credential.talosconfigPath },\n );\n const meta = yield* readFileMeta(props);\n if (meta === undefined) {\n return yield* Effect.die(\n new Error(\n `${props.runtimePath}: talosctl kubeconfig returned no error but the file is missing ` +\n 'or unparsable. Read back rather than trusting the exit code alone.',\n ),\n );\n }\n return meta;\n });\n\nconst handlers = {\n delete: () => Effect.void,\n diff: ({\n news,\n output,\n }: {\n news: Input<KubeconfigProps>;\n output: KubeconfigAttributes | undefined;\n }) => diff(news, output),\n list: () => Effect.succeed([]),\n read: ({ olds }: { olds: KubeconfigProps }) => read(olds),\n reconcile: ({ news }: { news: KubeconfigProps }) => reconcile(news),\n};\n\nexport const TalosKubeconfigProvider = () =>\n Provider.effect(TalosKubeconfig, Effect.succeed(TalosKubeconfig.Provider.of(handlers)));\n",
|
|
6
|
-
"/**\n * The Talos client credential a reconcile runs with: minted from OpenBao, written to a temp file.\n *\n * ⛔ TALOSCONFIG AND secrets.yaml HOLD CLIENT CERTIFICATES AND CLUSTER CA PRIVATE KEYS. Alchemy\n * persists resource attributes WITHOUT encryption — StateEncoding.ts writes `Redacted` as\n * `{\"@redacted\": <plaintext>}` — and this estate's state store is the `alchemy` Postgres that\n *
|
|
6
|
+
"/**\n * The Talos client credential a reconcile runs with: minted from OpenBao, written to a temp file.\n *\n * ⛔ TALOSCONFIG AND secrets.yaml HOLD CLIENT CERTIFICATES AND CLUSTER CA PRIVATE KEYS. Alchemy\n * persists resource attributes WITHOUT encryption — StateEncoding.ts writes `Redacted` as\n * `{\"@redacted\": <plaintext>}` — and this estate's state store is the `alchemy` Postgres that\n * a nightly job dumps. Neither file may be a prop, an attribute, or a log line.\n *\n * ★ MODELED ON <estate>/proxmox/src/credentials.ts: mint at call time through `ChildProcessSpawner`,\n * use the material to build a client, drop it when the scope ends. The difference is Talos wants a\n * FILE (`--talosconfig` / `TALOSCONFIG`), so mint writes a temp path and registers cleanup.\n *\n * ⚠️ REASONED FROM THE PUBLISHED TALOS WORKFLOW, NOT MEASURED ON THIS ESTATE. There is no Talos\n * cluster here yet; paths below follow the same `mount/data/…` shape other infra mounts use.\n */\nimport { closeSync, openSync, writeFileSync } from 'node:fs';\nimport * as Effect from 'effect/Effect';\nimport * as Stream from 'effect/Stream';\nimport * as ChildProcess from 'effect/unstable/process/ChildProcess';\nimport * as ChildProcessSpawner from 'effect/unstable/process/ChildProcessSpawner';\n\n/** Where credentials come from. HomeFlare-specific mount names live in the stack, not here. */\nexport type TalosTarget = {\n /** OpenBao KV mount holding Talos material, e.g. `talos-c1`. */\n readonly mount: string;\n /** Logical cluster name — safe to persist and log. */\n readonly cluster: string;\n /**\n * Path under the mount for the talosconfig YAML.\n *\n * ⚠️ DEFAULT IS REASONED. The first real deploy will confirm or correct the path; a wrong path\n * fails closed with a bao error rather than writing an empty talosconfig.\n */\n readonly talosconfigKey?: string;\n};\n\nexport type TalosCredential = {\n /** Absolute path to a temp talosconfig. ⛔ NEVER PERSIST, NEVER LOG CONTENTS. */\n readonly talosconfigPath: string;\n};\n\nconst defaultKey = (target: TalosTarget) => target.talosconfigKey ?? 'data/talosconfig';\n\n/**\n * Mint one talosconfig file for `target`.\n *\n * ★ SHELLS OUT TO `bao` RATHER THAN SPEAKING THE HTTP API — same reasoning as proxmox credentials.\n * The estate's BAO_ADDR / BAO_NAMESPACE / approle contract already lives in that binary.\n */\nexport const mintTalosconfig = (target: TalosTarget) =>\n Effect.scoped(\n Effect.gen(function* () {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const key = defaultKey(target);\n const result = yield* ChildProcess.make(\n 'bao',\n ['kv', 'get', '-format=json', `${target.mount}/${key}`],\n { detached: false, extendEnv: true, stderr: 'pipe', stdin: 'ignore', stdout: 'pipe' },\n ).pipe(\n spawner.spawn,\n Effect.flatMap((child) =>\n Effect.all(\n {\n exitCode: child.exitCode,\n stderr: child.stderr.pipe(\n Stream.decodeText,\n Stream.mkString,\n Effect.map((text) => text.trim()),\n ),\n stdout: child.stdout.pipe(\n Stream.decodeText,\n Stream.mkString,\n Effect.map((text) => text.trim()),\n ),\n },\n { concurrency: 'unbounded' },\n ),\n ),\n Effect.scoped,\n );\n\n if (result.exitCode !== 0) {\n // ⛔ stderr ONLY — stdout may hold talosconfig YAML with client credentials.\n return yield* Effect.fail(\n new Error(\n `bao kv get ${target.mount}/${key} exited ${String(result.exitCode)}: ${result.stderr}`,\n ),\n );\n }\n\n const parsed = JSON.parse(result.stdout) as { data?: { data?: Record<string, unknown> } };\n const data = parsed.data?.data;\n const raw = data?.['talosconfig'] ?? data?.['config'];\n if (typeof raw !== 'string' || raw.trim() === '') {\n return yield* Effect.fail(\n new Error(\n `${target.mount}/${key} returned no talosconfig field. Expected a KV key named 'talosconfig' or 'config' — never store the value in Alchemy props.`,\n ),\n );\n }\n\n const talosconfigPath = `${Bun.env['TMPDIR'] ?? '/tmp'}/hf-talos-${target.cluster}-${Bun.randomUUIDv7()}.yaml`;\n /**\n * ⛔ 0600, CREATED EXCLUSIVELY, AND `Bun.write` CANNOT DO EITHER. This file holds the\n * cluster's admin client certificate — everything talosctl needs to reconfigure or wipe a\n * node. `Bun.write` takes no mode, so it lands at the process umask, which on this estate\n * is 0644: world-readable, in a world-readable directory, for as long as the resource\n * runs. The name is unguessable, and \"unguessable\" is not a permission.\n * ⚠️ `wx` IS THE OTHER HALF. Opening with O_EXCL means this cannot be made to write through\n * a path an attacker pre-created — the classic /tmp symlink race — and with a UUIDv7 name\n * a collision is a genuine error rather than something to paper over.\n * ⚠️ THE FINALIZER BELOW REMOVES IT ON EVERY EXIT PATH, but a hard kill (SIGKILL, power\n * loss) leaves it behind. 0600 is what makes that survivable rather than a disclosure.\n */\n yield* Effect.try({\n try: () => {\n const fd = openSync(talosconfigPath, 'wx', 0o600);\n try {\n writeFileSync(fd, raw);\n } finally {\n closeSync(fd);\n }\n },\n catch: (cause) => new Error(`writing temp talosconfig: ${String(cause)}`),\n });\n\n yield* Effect.addFinalizer(() =>\n Effect.tryPromise({\n try: () => Bun.file(talosconfigPath).delete(),\n catch: () => undefined,\n }).pipe(Effect.orElseSucceed(() => undefined)),\n );\n\n return { talosconfigPath } satisfies TalosCredential;\n }),\n );\n",
|
|
7
7
|
"/**\n * One `talosctl` invocation — stdout/stderr captured, secrets never echoed.\n *\n * ★ SHELL OUT LIKE ALCHEMY'S DOCKER PROVIDER (ChildProcessSpawner), NOT A SECOND SDK. Talos speaks\n * gRPC; the published, stable surface for operators is `talosctl`. No Talos npm package is added.\n *\n * ⚠️ REASONED FROM docs.siderolabs.com/talos/v1.13/reference/cli — nothing here was measured on a\n * live cluster in this session.\n *\n * ⛔ DO NOT LOG STDOUT ON FAILURE. `talosctl kubeconfig` and error paths have been observed in the\n * wild to include credential material; stderr is the safe diagnostic channel.\n */\nimport * as Effect from 'effect/Effect';\nimport * as Stream from 'effect/Stream';\nimport * as ChildProcess from 'effect/unstable/process/ChildProcess';\nimport * as ChildProcessSpawner from 'effect/unstable/process/ChildProcessSpawner';\n\nexport class TalosError extends Error {\n constructor(\n readonly command: string,\n readonly exitCode: number,\n detail: string,\n ) {\n super(`talosctl ${command} -> ${String(exitCode)}: ${detail}`);\n this.name = 'TalosError';\n }\n}\n\nexport type TalosRunOptions = {\n readonly talosconfigPath: string;\n readonly nodes?: readonly string[];\n readonly endpoints?: readonly string[];\n};\n\n/** Run `talosctl <args…>`. Returns trimmed stdout, or '' when empty. */\nexport const talosctl = (args: readonly string[], options: TalosRunOptions) =>\n Effect.gen(function* () {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const argv = [\n ...args,\n '--talosconfig',\n options.talosconfigPath,\n ...(options.nodes === undefined ? [] : ['--nodes', options.nodes.join(',')]),\n ...(options.endpoints === undefined ? [] : ['--endpoints', options.endpoints.join(',')]),\n ];\n const result = yield* ChildProcess.make('talosctl', argv, {\n detached: false,\n extendEnv: true,\n stderr: 'pipe',\n stdin: 'ignore',\n stdout: 'pipe',\n }).pipe(\n spawner.spawn,\n Effect.flatMap((child) =>\n Effect.all(\n {\n exitCode: child.exitCode,\n stderr: child.stderr.pipe(\n Stream.decodeText,\n Stream.mkString,\n Effect.map((text) => text.trim()),\n ),\n stdout: child.stdout.pipe(\n Stream.decodeText,\n Stream.mkString,\n Effect.map((text) => text.trim()),\n ),\n },\n { concurrency: 'unbounded' },\n ),\n ),\n Effect.scoped,\n );\n\n const command = args.join(' ');\n if (result.exitCode !== 0) {\n return yield* Effect.fail(\n new TalosError(command, result.exitCode, result.stderr.slice(0, 300)),\n );\n }\n return result.stdout;\n });\n\n/** Like `talosctl`, but exit code 1 with \"already\" in stderr is treated as success. */\nexport const talosctlOrAlready = (args: readonly string[], options: TalosRunOptions) =>\n talosctl(args, options).pipe(\n Effect.catchIf(\n (cause): cause is TalosError =>\n cause instanceof TalosError &&\n cause.exitCode !== 0 &&\n /already|exists|bootstrapped/i.test(cause.message),\n () => Effect.succeed(''),\n ),\n );\n",
|
|
8
8
|
"/**\n * Coercions and digests for Talos resources — every function here exists because a trap does.\n *\n * ⚠️ NOTHING IN THIS FILE TOUCHES A LIVE CLUSTER. Digests are computed from repo files or from\n * kubeconfig YAML already on disk at reconcile time; tests use fixtures only.\n */\nimport { createHash } from 'node:crypto';\n\n/** Trim trailing whitespace only — leading space in YAML is meaningful. */\nexport const canonicalText = (text: string) => text.trimEnd();\n\n/** SHA-256 hex digest of canonical text. Safe to persist — it is not reversible to the input. */\nexport const sha256 = (text: string) =>\n createHash('sha256').update(canonicalText(text)).digest('hex');\n\n/** Digest of a machine config file read from the repo. ⛔ Never persist the file body itself. */\nexport const configDigest = (text: string) => sha256(text);\n\ntype KubeconfigDoc = {\n clusters?: {\n cluster?: { server?: string; 'certificate-authority-data'?: string };\n name?: string;\n }[];\n contexts?: { context?: { cluster?: string; user?: string }; name?: string }[];\n users?: {\n name?: string;\n user?: { 'client-certificate-data'?: string; 'client-key-data'?: string };\n }[];\n 'current-context'?: string;\n};\n\n/**\n * Public metadata extracted from a kubeconfig file on disk.\n *\n * ⛔ RETURNS FINGERPRINTS ONLY. The admin kubeconfig contains a client certificate; Alchemy state\n * may hold the API server URL and CA/client cert digests, never the PEM bytes.\n */\nexport const kubeconfigMetadata = (\n yamlText: string,\n contextName: string,\n): { endpoint: string; caFingerprint: string; clientFingerprint: string } | undefined => {\n let doc: KubeconfigDoc;\n try {\n doc = Bun.YAML.parse(yamlText) as KubeconfigDoc;\n } catch {\n return undefined;\n }\n\n const ctx = doc.contexts?.find((row) => row.name === contextName)?.context;\n const clusterName = ctx?.cluster;\n const userName = ctx?.user;\n if (clusterName === undefined || userName === undefined) return undefined;\n\n const cluster = doc.clusters?.find((row) => row.name === clusterName)?.cluster;\n const user = doc.users?.find((row) => row.name === userName)?.user;\n const endpoint = cluster?.server;\n const ca = cluster?.['certificate-authority-data'];\n const cert = user?.['client-certificate-data'] ?? user?.['client-key-data'];\n if (endpoint === undefined || ca === undefined || cert === undefined) return undefined;\n\n return {\n caFingerprint: sha256(ca),\n clientFingerprint: sha256(cert),\n endpoint,\n };\n};\n\n/** Resolve a config file path relative to the declaring stack file. */\nexport const resolveConfigPath = (stackDir: string, configFile: string) =>\n configFile.startsWith('/') ? configFile : `${stackDir}/${configFile}`;\n",
|
|
9
9
|
"/**\n * `Talos.Bootstrap` — initialize etcd once on ONE control-plane node.\n *\n * ★ REASONED FROM talosctl bootstrap (Talos v1.13 CLI reference): one node aborts the etcd join\n * loop and forms the initial cluster; other control-plane nodes join after Kubernetes starts on\n * the bootstrap node. This command must run exactly once per cluster.\n *\n * ⛔ NOT A FACTORY RESOURCE — bootstrap cannot be deleted or updated in place; `delete` is a no-op.\n */\nimport { Resource } from 'alchemy';\nimport { isResolved } from 'alchemy/Diff';\nimport type { Input } from 'alchemy/Input';\nimport * as Provider from 'alchemy/Provider';\nimport * as Effect from 'effect/Effect';\nimport { mintTalosconfig } from './credentials.ts';\nimport type { TalosRequirements, WithTarget } from './resource.ts';\nimport { talosctl, talosctlOrAlready } from './talosctl.ts';\n\nexport interface BootstrapProps extends WithTarget {\n /** The ONE control-plane node that receives `talosctl bootstrap`. */\n node: string;\n /** Machine configs for this node (and peers) must be applied first. */\n after?: readonly unknown[];\n}\n\nexport interface BootstrapAttributes {\n node: string;\n bootstrapped: boolean;\n}\n\nexport interface TalosBootstrap extends Resource<\n 'Talos.Bootstrap',\n BootstrapProps,\n BootstrapAttributes,\n never,\n TalosRequirements\n> {}\n\nexport const TalosBootstrap = Resource<TalosBootstrap>('Talos.Bootstrap', {\n /** etcd data is irreplaceable — opt into destroy explicitly if Talos ever adds an undo. */\n defaultRemovalPolicy: 'retain',\n});\n\n/**\n * REASONED: `talosctl get etcdmembers -o json` should list members after bootstrap.\n * ⚠️ NOT MEASURED — first live deploy confirms the resource type name.\n */\nconst isBootstrapped = (props: BootstrapProps, talosconfigPath: string) =>\n talosctl(['get', 'etcdmembers', '-o', 'json'], {\n nodes: [props.node],\n talosconfigPath,\n }).pipe(\n Effect.map((text) => text.includes('\"id\"') || text.includes('\"member\"')),\n Effect.orElseSucceed(() => false),\n );\n\nconst read = (props: BootstrapProps) =>\n Effect.gen(function* () {\n const credential = yield* mintTalosconfig(props.target);\n const bootstrapped = yield* isBootstrapped(props, credential.talosconfigPath);\n return { bootstrapped, node: props.node };\n });\n\nconst diff = (news: Input<BootstrapProps>, output: BootstrapAttributes | undefined) =>\n Effect.gen(function* () {\n if (output === undefined || !isResolved(news)) return undefined;\n const live = yield* read(news);\n if (live.bootstrapped) return { action: 'noop' } as const;\n return { action: 'update' } as const;\n });\n\nconst reconcile = (props: BootstrapProps) =>\n Effect.gen(function* () {\n const credential = yield* mintTalosconfig(props.target);\n const before = yield* isBootstrapped(props, credential.talosconfigPath);\n if (!before) {\n yield* talosctlOrAlready(['bootstrap'], {\n nodes: [props.node],\n talosconfigPath: credential.talosconfigPath,\n });\n }\n const after = yield* isBootstrapped(props, credential.talosconfigPath);\n if (!after) {\n return yield* Effect.die(\n new Error(\n `${props.node}: bootstrap returned no error but etcd members are still absent. ` +\n 'Read back rather than trusting the exit code alone.',\n ),\n );\n }\n return { bootstrapped: true, node: props.node };\n });\n\nconst handlers = {\n delete: () => Effect.void,\n diff: ({\n news,\n output,\n }: {\n news: Input<BootstrapProps>;\n output: BootstrapAttributes | undefined;\n }) => diff(news, output),\n list: () => Effect.succeed([]),\n read: ({ olds }: { olds: BootstrapProps }) => read(olds),\n reconcile: ({ news }: { news: BootstrapProps }) => reconcile(news),\n};\n\nexport const TalosBootstrapProvider = () =>\n Provider.effect(TalosBootstrap, Effect.succeed(TalosBootstrap.Provider.of(handlers)));\n",
|