@fnndsc/stratus 0.1.0 → 0.2.1

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.
Files changed (134) hide show
  1. package/README.md +6 -1
  2. package/dist/args.d.ts +20 -6
  3. package/dist/args.js +45 -2
  4. package/dist/args.js.map +1 -1
  5. package/dist/backend.d.ts +35 -4
  6. package/dist/backend.js +77 -12
  7. package/dist/backend.js.map +1 -1
  8. package/dist/cloud/builder.d.ts +172 -0
  9. package/dist/cloud/builder.js +41 -0
  10. package/dist/cloud/builder.js.map +1 -0
  11. package/dist/cloud/driver.d.ts +149 -0
  12. package/dist/cloud/fake/builder.d.ts +147 -0
  13. package/dist/cloud/fake/builder.js +213 -0
  14. package/dist/cloud/fake/builder.js.map +1 -0
  15. package/dist/cloud/fake/driver.d.ts +73 -1
  16. package/dist/cloud/fake/driver.js +122 -0
  17. package/dist/cloud/fake/driver.js.map +1 -1
  18. package/dist/cloud/oci/api.d.ts +3 -2
  19. package/dist/cloud/oci/api.js +2 -0
  20. package/dist/cloud/oci/api.js.map +1 -1
  21. package/dist/cloud/oci/buildApi.d.ts +61 -0
  22. package/dist/cloud/oci/buildApi.js +132 -0
  23. package/dist/cloud/oci/buildApi.js.map +1 -0
  24. package/dist/cloud/oci/builder.d.ts +172 -0
  25. package/dist/cloud/oci/builder.js +370 -0
  26. package/dist/cloud/oci/builder.js.map +1 -0
  27. package/dist/cloud/oci/driver.d.ts +23 -2
  28. package/dist/cloud/oci/driver.js +107 -1
  29. package/dist/cloud/oci/driver.js.map +1 -1
  30. package/dist/cloud/oci/planRead.d.ts +38 -0
  31. package/dist/cloud/oci/planRead.js +67 -0
  32. package/dist/cloud/oci/planRead.js.map +1 -0
  33. package/dist/cloud/oci/prices.d.ts +22 -1
  34. package/dist/cloud/oci/prices.js +35 -0
  35. package/dist/cloud/oci/prices.js.map +1 -1
  36. package/dist/cloud/oci/resourceApi.d.ts +114 -0
  37. package/dist/cloud/oci/resourceApi.js +261 -0
  38. package/dist/cloud/oci/resourceApi.js.map +1 -0
  39. package/dist/cloud/oci/resourceMap.d.ts +44 -0
  40. package/dist/cloud/oci/resourceMap.js +70 -0
  41. package/dist/cloud/oci/resourceMap.js.map +1 -0
  42. package/dist/cloud/oci/rmApi.d.ts +74 -0
  43. package/dist/cloud/oci/rmApi.js +141 -0
  44. package/dist/cloud/oci/rmApi.js.map +1 -0
  45. package/dist/cloud/oci/stackVars.d.ts +49 -0
  46. package/dist/cloud/oci/stackVars.js +70 -0
  47. package/dist/cloud/oci/stackVars.js.map +1 -0
  48. package/dist/cluster/fakeKube.d.ts +43 -0
  49. package/dist/cluster/fakeKube.js +86 -0
  50. package/dist/cluster/fakeKube.js.map +1 -0
  51. package/dist/cluster/kube.d.ts +40 -0
  52. package/dist/cluster/kube.js +46 -0
  53. package/dist/cluster/kube.js.map +1 -0
  54. package/dist/cluster/kubeHttp.d.ts +16 -0
  55. package/dist/cluster/kubeHttp.js +86 -0
  56. package/dist/cluster/kubeHttp.js.map +1 -0
  57. package/dist/commands/build.d.ts +90 -0
  58. package/dist/commands/build.js +358 -0
  59. package/dist/commands/build.js.map +1 -0
  60. package/dist/commands/capacity.d.ts +37 -0
  61. package/dist/commands/capacity.js +93 -0
  62. package/dist/commands/capacity.js.map +1 -0
  63. package/dist/commands/domain.d.ts +45 -0
  64. package/dist/commands/domain.js +150 -0
  65. package/dist/commands/domain.js.map +1 -0
  66. package/dist/commands/spend.d.ts +22 -0
  67. package/dist/commands/spend.js +65 -0
  68. package/dist/commands/spend.js.map +1 -0
  69. package/dist/commands/teardown.d.ts +10 -0
  70. package/dist/commands/teardown.js +72 -0
  71. package/dist/commands/teardown.js.map +1 -0
  72. package/dist/commands/verify.d.ts +28 -0
  73. package/dist/commands/verify.js +98 -0
  74. package/dist/commands/verify.js.map +1 -0
  75. package/dist/domain/adopt.d.ts +60 -0
  76. package/dist/domain/adopt.js +143 -0
  77. package/dist/domain/adopt.js.map +1 -0
  78. package/dist/domain/sizing.d.ts +55 -0
  79. package/dist/domain/sizing.js +66 -0
  80. package/dist/domain/sizing.js.map +1 -0
  81. package/dist/domain/spec.d.ts +101 -0
  82. package/dist/domain/spec.js +191 -0
  83. package/dist/domain/spec.js.map +1 -0
  84. package/dist/domain/spend.d.ts +84 -0
  85. package/dist/domain/spend.js +109 -0
  86. package/dist/domain/spend.js.map +1 -0
  87. package/dist/domain/state.d.ts +149 -0
  88. package/dist/domain/state.js +182 -0
  89. package/dist/domain/state.js.map +1 -0
  90. package/dist/domain/steps.d.ts +82 -0
  91. package/dist/domain/steps.js +311 -0
  92. package/dist/domain/steps.js.map +1 -0
  93. package/dist/domain/teardown.d.ts +38 -0
  94. package/dist/domain/teardown.js +48 -0
  95. package/dist/domain/teardown.js.map +1 -0
  96. package/dist/domain/verify.d.ts +68 -0
  97. package/dist/domain/verify.js +216 -0
  98. package/dist/domain/verify.js.map +1 -0
  99. package/dist/domain/view.d.ts +24 -0
  100. package/dist/domain/view.js +38 -0
  101. package/dist/domain/view.js.map +1 -0
  102. package/dist/domains/harborOci.d.ts +75 -0
  103. package/dist/domains/harborOci.js +165 -0
  104. package/dist/domains/harborOci.js.map +1 -0
  105. package/dist/index.d.ts +7 -0
  106. package/dist/index.js +6 -0
  107. package/dist/index.js.map +1 -1
  108. package/dist/installer/assisted.d.ts +97 -0
  109. package/dist/installer/assisted.js +171 -0
  110. package/dist/installer/assisted.js.map +1 -0
  111. package/dist/installer/installer.d.ts +86 -0
  112. package/dist/installer/installer.js +15 -0
  113. package/dist/installer/installer.js.map +1 -0
  114. package/dist/prompt.d.ts +33 -0
  115. package/dist/prompt.js +46 -0
  116. package/dist/prompt.js.map +1 -0
  117. package/dist/session.d.ts +2 -0
  118. package/dist/session.js +4 -0
  119. package/dist/session.js.map +1 -1
  120. package/dist/stratus.js +75 -3
  121. package/dist/stratus.js.map +1 -1
  122. package/dist/vfs/domains.d.ts +39 -0
  123. package/dist/vfs/domains.js +128 -0
  124. package/dist/vfs/domains.js.map +1 -0
  125. package/dist/vfs/look.d.ts +10 -0
  126. package/dist/vfs/look.js +43 -8
  127. package/dist/vfs/look.js.map +1 -1
  128. package/dist/vfs/resources.d.ts +136 -0
  129. package/dist/vfs/resources.js +325 -0
  130. package/dist/vfs/resources.js.map +1 -0
  131. package/dist/vfs/tenancy.d.ts +15 -2
  132. package/dist/vfs/tenancy.js +53 -17
  133. package/dist/vfs/tenancy.js.map +1 -1
  134. package/package.json +13 -6
@@ -0,0 +1,182 @@
1
+ /**
2
+ * @file A domain's own state, kept on the daemon's host (docs/stratus.adoc,
3
+ * D4): `$XDG_STATE_HOME/stratus/domains/<name>/` holds `spec.yaml`,
4
+ * `state.json` (the ids the build recorded and each step's history, written
5
+ * whole, mode 600) and `auth/` (the secrets the build fetched, mode 600,
6
+ * never served). The tree's `domains/<name>/` is a view of that folder.
7
+ *
8
+ * @module
9
+ */
10
+ import * as fs from 'fs';
11
+ import * as os from 'os';
12
+ import * as path from 'path';
13
+ import { specYaml_parse, specYaml_render } from './spec.js';
14
+ /**
15
+ * The folder a daemon keeps its domains in.
16
+ *
17
+ * @param env - The environment.
18
+ * @returns `$XDG_STATE_HOME/stratus/domains`, or `~/.local/state/stratus/domains`.
19
+ */
20
+ export function domainsRoot_of(env = process.env) {
21
+ return path.join(env['XDG_STATE_HOME'] || path.join(os.homedir(), '.local', 'state'), 'stratus', 'domains');
22
+ }
23
+ /** A domain name is a DNS label: lower-case letters, digits and hyphens, at most 54. */
24
+ export const DOMAIN_NAME = /^[a-z]([a-z0-9-]{0,52}[a-z0-9])?$/;
25
+ /**
26
+ * Writes a file whole or not at all, readable by its owner only.
27
+ *
28
+ * @param file - Where.
29
+ * @param text - What.
30
+ */
31
+ function file_writeAtomic(file, text) {
32
+ const temporary = `${file}.${process.pid}.tmp`;
33
+ fs.writeFileSync(temporary, text, { mode: 0o600 });
34
+ fs.renameSync(temporary, file);
35
+ }
36
+ /** The domains this daemon builds, on its host. */
37
+ export class DomainStore {
38
+ root;
39
+ /**
40
+ * @param root - The folder the domains live in.
41
+ */
42
+ constructor(root) {
43
+ this.root = root;
44
+ }
45
+ /**
46
+ * A domain's folder.
47
+ *
48
+ * @param name - The domain.
49
+ * @returns Its folder.
50
+ */
51
+ folder_of(name) {
52
+ return path.join(this.root, name);
53
+ }
54
+ /** The names of the domains kept, sorted. */
55
+ names_list() {
56
+ if (!fs.existsSync(this.root))
57
+ return [];
58
+ return fs.readdirSync(this.root).filter((name) => fs.existsSync(path.join(this.root, name, 'state.json'))).sort();
59
+ }
60
+ /**
61
+ * Makes a domain.
62
+ *
63
+ * @param record - Its first state.
64
+ * @param spec - Its spec.
65
+ * @throws Error - When one of that name is already kept.
66
+ */
67
+ create(record, spec) {
68
+ const folder = this.folder_of(record.name);
69
+ if (fs.existsSync(path.join(folder, 'state.json')))
70
+ throw new Error(`${record.name}: a domain of that name is already kept (${folder})`);
71
+ fs.mkdirSync(path.join(folder, 'auth'), { recursive: true, mode: 0o700 });
72
+ file_writeAtomic(path.join(folder, 'spec.yaml'), specYaml_render(spec));
73
+ this.record_write(record);
74
+ }
75
+ /**
76
+ * A domain's state.
77
+ *
78
+ * @param name - The domain.
79
+ * @returns Its record, or null when none is kept.
80
+ */
81
+ record_read(name) {
82
+ const file = path.join(this.folder_of(name), 'state.json');
83
+ if (!fs.existsSync(file))
84
+ return null;
85
+ return JSON.parse(fs.readFileSync(file, 'utf-8'));
86
+ }
87
+ /**
88
+ * Saves a domain's state.
89
+ *
90
+ * @param record - Its record.
91
+ */
92
+ record_write(record) {
93
+ file_writeAtomic(path.join(this.folder_of(record.name), 'state.json'), `${JSON.stringify(record, null, 2)}\n`);
94
+ }
95
+ /**
96
+ * Changes a domain's state and saves it.
97
+ *
98
+ * @param name - The domain.
99
+ * @param change - What to change.
100
+ * @returns The record as saved.
101
+ * @throws Error - When none is kept.
102
+ */
103
+ record_update(name, change) {
104
+ const record = this.record_read(name);
105
+ if (record === null)
106
+ throw new Error(`${name}: no such domain`);
107
+ change(record);
108
+ this.record_write(record);
109
+ return record;
110
+ }
111
+ /**
112
+ * A domain's spec, as written and as read.
113
+ *
114
+ * @param name - The domain.
115
+ * @returns The text and the spec (or why it does not read), or null when there is no file.
116
+ */
117
+ spec_read(name) {
118
+ const file = path.join(this.folder_of(name), 'spec.yaml');
119
+ if (!fs.existsSync(file))
120
+ return null;
121
+ const text = fs.readFileSync(file, 'utf-8');
122
+ const parsed = specYaml_parse(text);
123
+ return 'spec' in parsed ? { text, spec: parsed.spec } : { text, spec: null, error: parsed.error };
124
+ }
125
+ /**
126
+ * Writes one of the domain's own files (`plan.json`), whole.
127
+ *
128
+ * @param name - The domain.
129
+ * @param file - The file's name in the domain's folder.
130
+ * @param text - Its content.
131
+ */
132
+ file_write(name, file, text) {
133
+ file_writeAtomic(path.join(this.folder_of(name), file), text);
134
+ }
135
+ /**
136
+ * Reads one of the domain's own files.
137
+ *
138
+ * @param name - The domain.
139
+ * @param file - The file's name in the domain's folder.
140
+ * @returns Its content, or null when it is not there.
141
+ */
142
+ file_read(name, file) {
143
+ const where = path.join(this.folder_of(name), file);
144
+ return fs.existsSync(where) ? fs.readFileSync(where, 'utf-8') : null;
145
+ }
146
+ /**
147
+ * Keeps a secret the build fetched.
148
+ *
149
+ * @param name - The domain.
150
+ * @param file - Its file name under `auth/`.
151
+ * @param text - Its content.
152
+ */
153
+ secret_write(name, file, text) {
154
+ const folder = path.join(this.folder_of(name), 'auth');
155
+ fs.mkdirSync(folder, { recursive: true, mode: 0o700 });
156
+ file_writeAtomic(path.join(folder, file), text);
157
+ }
158
+ /**
159
+ * Reads a secret the build kept, for the build's own next step; never served.
160
+ *
161
+ * @param name - The domain.
162
+ * @param file - Its file name under `auth/`.
163
+ * @returns Its content, or null.
164
+ */
165
+ secret_read(name, file) {
166
+ const where = path.join(this.folder_of(name), 'auth', file);
167
+ return fs.existsSync(where) ? fs.readFileSync(where, 'utf-8') : null;
168
+ }
169
+ /**
170
+ * The secrets kept, by name and host path; their content is never read here.
171
+ *
172
+ * @param name - The domain.
173
+ * @returns The files.
174
+ */
175
+ secrets_list(name) {
176
+ const folder = path.join(this.folder_of(name), 'auth');
177
+ if (!fs.existsSync(folder))
178
+ return [];
179
+ return fs.readdirSync(folder).sort().map((file) => ({ name: file, hostPath: path.join(folder, file) }));
180
+ }
181
+ }
182
+ //# sourceMappingURL=state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/domain/state.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,eAAe,EAAmB,MAAM,WAAW,CAAC;AAyC7E;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,MAAyB,OAAO,CAAC,GAAG;IACjE,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AAC9G,CAAC;AAED,wFAAwF;AACxF,MAAM,CAAC,MAAM,WAAW,GAAW,mCAAmC,CAAC;AAEvE;;;;;GAKG;AACH,SAAS,gBAAgB,CAAC,IAAY,EAAE,IAAY;IAClD,MAAM,SAAS,GAAW,GAAG,IAAI,IAAI,OAAO,CAAC,GAAG,MAAM,CAAC;IACvD,EAAE,CAAC,aAAa,CAAC,SAAS,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACnD,EAAE,CAAC,UAAU,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AACjC,CAAC;AAED,mDAAmD;AACnD,MAAM,OAAO,WAAW;IAID;IAHrB;;OAEG;IACH,YAAqB,IAAY;QAAZ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AAI,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QACpE,OAAO,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACvE,CAAC;IAED;;;;;OAKG;IACH,YAAY,CAAC,IAAY;QACvB,MAAM,MAAM,GAAW,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;QAC/D,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC;YAAE,OAAO,EAAE,CAAC;QACtC,OAAO,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,IAAY,EAAsC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;IACtJ,CAAC;CACF"}
@@ -0,0 +1,82 @@
1
+ /**
2
+ * @file A domain's build steps, written once over the three drivers
3
+ * (docs/stratus.adoc, D3): their names and order, what each asks of the
4
+ * cloud's builder and of the installer, and the run that takes a domain from
5
+ * its first step not done to where it was asked to stop.
6
+ *
7
+ * A run is one of the core runner's jobs (`/proc/steps/<domain>-build`): it
8
+ * outlives the command that started it and every surface. It stops on its
9
+ * own before the first step that bills until the operator has accepted the
10
+ * cost, which only the foreground `domain build` asks; and before a step
11
+ * this session does not have yet. Every step records what later ones need in
12
+ * the domain's state, so a run picked up after a restart starts from the
13
+ * first step not done and repeats nothing the cloud already holds.
14
+ *
15
+ * The order and the waits are `harbor-oci`'s, proven live once: the hosts
16
+ * have 45 minutes to register, the install 120.
17
+ *
18
+ * @module
19
+ */
20
+ import type { JobRun } from '@fnndsc/brasa/core';
21
+ import { type CloudBuilder } from '../cloud/builder.js';
22
+ import type { Installer } from '../installer/installer.js';
23
+ import type { DomainRecord, DomainStore } from './state.js';
24
+ /** The build's steps, in order: the machine, then ChRIS on it. */
25
+ export declare const BUILD_STEPS: ReadonlyArray<string>;
26
+ /** The first step that bills: the run stops before it until the cost is accepted. */
27
+ export declare const FIRST_BILLING_STEP: string;
28
+ /** The steps this session has; the run stops before any other. */
29
+ export declare const STEPS_WRITTEN: ReadonlyArray<string>;
30
+ /** The task source the runs are kept in. */
31
+ export declare const STEPS_SOURCE: string;
32
+ /** What the steps run over. */
33
+ export interface BuildDeps {
34
+ readonly store: DomainStore;
35
+ readonly builder: CloudBuilder;
36
+ readonly installer: Installer;
37
+ /** How many availability domains the region has. */
38
+ readonly zones: number;
39
+ /** The OpenShift version a cluster is made at. */
40
+ readonly version: string;
41
+ /** How often a wait asks again, in milliseconds. */
42
+ readonly pollMs: number;
43
+ /** How long the hosts have to register, in milliseconds. */
44
+ readonly hostsWaitMs: number;
45
+ /** How long the install has, in milliseconds. */
46
+ readonly installWaitMs: number;
47
+ }
48
+ /** The waits `harbor-oci` proved, polled each minute. */
49
+ export declare const BUILD_WAITS: Pick<BuildDeps, 'pollMs' | 'hostsWaitMs' | 'installWaitMs'>;
50
+ /**
51
+ * A run's job id.
52
+ *
53
+ * @param domain - The domain.
54
+ * @returns `<domain>-build`.
55
+ */
56
+ export declare function buildJob_id(domain: string): string;
57
+ /**
58
+ * The first step not done.
59
+ *
60
+ * @param record - The domain's state.
61
+ * @returns The step, or null when every step is done.
62
+ */
63
+ export declare function stepNext_of(record: DomainRecord): string | null;
64
+ /**
65
+ * The run that builds a domain from its first step not done.
66
+ *
67
+ * @param name - The domain.
68
+ * @param through - The last step to run; absent, as far as this session's steps go.
69
+ * @param deps - What the steps run over.
70
+ * @returns The job's work.
71
+ */
72
+ export declare function buildRun_make(name: string, through: string | undefined, deps: BuildDeps): JobRun;
73
+ /**
74
+ * The run that plans a domain against its stack and records the plan:
75
+ * an adopted domain's, or a built one's re-plan. It applies nothing.
76
+ *
77
+ * @param name - The domain.
78
+ * @param builder - The cloud's build half.
79
+ * @param store - The domains.
80
+ * @returns The job's work.
81
+ */
82
+ export declare function planRun_make(name: string, builder: CloudBuilder, store: DomainStore): JobRun;
@@ -0,0 +1,311 @@
1
+ import { planCounts_alter, planCounts_of, planCounts_words } from '../cloud/builder.js';
2
+ import { specNodes_of } from './spec.js';
3
+ /** The build's steps, in order: the machine, then ChRIS on it. */
4
+ export const BUILD_STEPS = ['preflight', 'cluster', 'iso', 'infra-plan', 'infra-apply', 'dns', 'manifests', 'hosts', 'run', 'postinstall', 'verify', 'chris-deploy', 'chris-seed', 'smoke'];
5
+ /** The first step that bills: the run stops before it until the cost is accepted. */
6
+ export const FIRST_BILLING_STEP = 'infra-apply';
7
+ /** The steps this session has; the run stops before any other. */
8
+ export const STEPS_WRITTEN = ['preflight', 'cluster', 'iso', 'infra-plan', 'infra-apply', 'dns', 'manifests', 'hosts', 'run'];
9
+ /** The task source the runs are kept in. */
10
+ export const STEPS_SOURCE = 'steps';
11
+ /** The waits `harbor-oci` proved, polled each minute. */
12
+ export const BUILD_WAITS = { pollMs: 60_000, hostsWaitMs: 45 * 60_000, installWaitMs: 120 * 60_000 };
13
+ /**
14
+ * A run's job id.
15
+ *
16
+ * @param domain - The domain.
17
+ * @returns `<domain>-build`.
18
+ */
19
+ export function buildJob_id(domain) {
20
+ return `${domain}-build`;
21
+ }
22
+ /**
23
+ * The first step not done.
24
+ *
25
+ * @param record - The domain's state.
26
+ * @returns The step, or null when every step is done.
27
+ */
28
+ export function stepNext_of(record) {
29
+ return BUILD_STEPS.find((step) => record.steps[step]?.state !== 'done') ?? null;
30
+ }
31
+ /**
32
+ * Waits a poll, unless stopped.
33
+ *
34
+ * @param ms - How long.
35
+ * @param signal - Stops it.
36
+ */
37
+ function poll_wait(ms, signal) {
38
+ if (ms <= 0 || signal.aborted)
39
+ return Promise.resolve();
40
+ return new Promise((resolve) => {
41
+ const timer = setTimeout(resolve, ms);
42
+ signal.addEventListener('abort', () => { clearTimeout(timer); resolve(); }, { once: true });
43
+ });
44
+ }
45
+ /**
46
+ * An id a later step needs, or why it is missing.
47
+ *
48
+ * @param record - The domain's state.
49
+ * @param key - The id.
50
+ * @param step - The step that records it.
51
+ * @returns The id.
52
+ * @throws Error - When it was never recorded.
53
+ */
54
+ function id_need(record, key, step) {
55
+ const value = record.ids[key];
56
+ if (value === undefined)
57
+ throw new Error(`no ${key} recorded: ${step} has not been done`);
58
+ return value;
59
+ }
60
+ /**
61
+ * The installer's ids, or why they are missing.
62
+ *
63
+ * @param record - The domain's state.
64
+ * @returns The ids.
65
+ */
66
+ function ids_need(record) {
67
+ return { clusterId: id_need(record, 'clusterId', 'cluster'), infraEnvId: id_need(record, 'infraEnvId', 'cluster') };
68
+ }
69
+ /** Each step's work. */
70
+ const STEP_WORK = {
71
+ preflight: async (call) => {
72
+ const record = call.record();
73
+ const checks = await call.deps.builder.preflight({ domain: call.name, spec: call.spec, region: record.region, baseDomain: record.baseDomain, compartmentId: record.compartmentId ?? '' }, call);
74
+ const failed = checks.filter((check) => !check.ok);
75
+ if (failed.length > 0)
76
+ throw new Error(`preflight: ${failed.map((check) => `${check.name}: ${check.note}`).join('; ')}`);
77
+ return `${checks.length} checks pass`;
78
+ },
79
+ cluster: async (call) => {
80
+ const record = call.record();
81
+ if (record.ids['clusterId'] !== undefined)
82
+ return `already made: ${record.ids['clusterId']}`;
83
+ const made = await call.deps.installer.cluster_create({ name: call.name, baseDomain: record.baseDomain, version: call.deps.version, controlPlaneCount: call.spec.controlPlane.count });
84
+ call.remember({ clusterId: made.clusterId, infraEnvId: made.infraEnvId });
85
+ call.log(`installer: cluster ${made.clusterId}, infra-env ${made.infraEnvId}`);
86
+ return `cluster ${made.clusterId}`;
87
+ },
88
+ iso: async (call) => {
89
+ const record = call.record();
90
+ const image = await call.deps.installer.isoUrl_get(ids_need(record));
91
+ const stored = await call.deps.builder.iso_store({ domain: call.name, url: image.url, region: record.region, compartmentId: record.compartmentId ?? '' }, call);
92
+ call.remember({ isoObject: stored.object, isoExpires: stored.expires, isoLinkId: stored.linkId });
93
+ // The link opens the image to anyone holding it: a secret, kept on the host.
94
+ call.deps.store.secret_write(call.name, 'iso-link', stored.link);
95
+ return `${stored.object}, linked until ${stored.expires.slice(0, 10)}`;
96
+ },
97
+ 'infra-plan': async (call) => {
98
+ const record = call.record();
99
+ const plan = await call.deps.builder.infra_plan({
100
+ domain: call.name, spec: call.spec, region: record.region, isoObject: id_need(record, 'isoObject', 'iso'),
101
+ baseDomain: record.baseDomain, isoLink: call.deps.store.secret_read(call.name, 'iso-link') ?? '',
102
+ ...(record.compartmentId !== undefined ? { compartmentId: record.compartmentId } : {}),
103
+ ...(record.ids['stackRef'] !== undefined ? { stackRef: record.ids['stackRef'] } : {}),
104
+ }, call);
105
+ const counts = planCounts_of(plan);
106
+ call.deps.store.file_write(call.name, 'plan.json', `${JSON.stringify(plan, null, 2)}\n`);
107
+ call.remember({ planRef: plan.ref, ...(plan.stackRef !== undefined ? { stackRef: plan.stackRef } : {}) });
108
+ if (planCounts_alter(counts))
109
+ throw new Error(`the plan touches what exists (${planCounts_words(counts)}): refused`);
110
+ return planCounts_words(counts);
111
+ },
112
+ 'infra-apply': async (call) => {
113
+ const record = call.record();
114
+ if (record.ids['appliedAt'] !== undefined)
115
+ return `already applied: ${record.ids['stackRef'] ?? ''}`;
116
+ const text = call.deps.store.file_read(call.name, 'plan.json');
117
+ if (text === null)
118
+ throw new Error('no plan recorded: infra-plan has not been done');
119
+ const plan = JSON.parse(text);
120
+ const outputs = await call.deps.builder.infra_apply({ domain: call.name, plan, region: record.region, ...(record.ids['stackRef'] !== undefined ? { stackRef: record.ids['stackRef'] } : {}) }, call);
121
+ call.remember({ stackRef: outputs.stackRef, apiIp: outputs.apiIp, apiIntIp: outputs.apiIntIp, appsIp: outputs.appsIp, appliedAt: new Date().toISOString() });
122
+ // The manifests the stack made, for the manifests step, kept with the domain.
123
+ call.deps.store.file_write(call.name, 'manifests.json', `${JSON.stringify(outputs.manifests, null, 2)}\n`);
124
+ return `${planCounts_of(plan).create} created; billing since ${new Date().toISOString().slice(0, 16)}`;
125
+ },
126
+ dns: async (call) => {
127
+ const record = call.record();
128
+ const outputs = { stackRef: id_need(record, 'stackRef', 'infra-apply'), apiIp: id_need(record, 'apiIp', 'infra-apply'), apiIntIp: id_need(record, 'apiIntIp', 'infra-apply'), appsIp: id_need(record, 'appsIp', 'infra-apply'), manifests: [] };
129
+ const names = await call.deps.builder.dns_upsert({ domain: call.name, baseDomain: record.baseDomain, outputs, compartmentId: record.compartmentId ?? '', region: record.region }, call);
130
+ return `${names.length} records`;
131
+ },
132
+ manifests: async (call) => {
133
+ const text = call.deps.store.file_read(call.name, 'manifests.json');
134
+ if (text === null)
135
+ throw new Error('no manifests recorded: infra-apply has not been done');
136
+ const manifests = JSON.parse(text);
137
+ await call.deps.installer.manifests_upload(ids_need(call.record()), manifests);
138
+ call.log(`sent ${manifests.map((manifest) => manifest.name).join(', ')}`);
139
+ return `${manifests.length} platform manifests sent`;
140
+ },
141
+ hosts: async (call) => {
142
+ const ids = ids_need(call.record());
143
+ const nodes = specNodes_of(call.name, call.spec, call.deps.zones);
144
+ const deadline = Date.now() + call.deps.hostsWaitMs;
145
+ const assigned = new Set();
146
+ let seen = -1;
147
+ while (!call.signal.aborted) {
148
+ const hosts = await call.deps.installer.hosts_list(ids);
149
+ for (const host of hosts.filter((entry) => !assigned.has(entry.id))) {
150
+ const role = nodes.find((node) => node.name === host.name)?.role === 'worker' ? 'worker' : 'master';
151
+ if (host.role !== role)
152
+ await call.deps.installer.role_set(ids, host, role);
153
+ assigned.add(host.id);
154
+ call.log(`${host.name} registered${host.zone !== '' ? ` in ${host.zone}` : ''} · role ${role}`);
155
+ }
156
+ const ready = hosts.filter((host) => host.ready).length;
157
+ if (ready !== seen) {
158
+ call.progress({ current: ready, total: nodes.length, unit: 'nodes' });
159
+ seen = ready;
160
+ }
161
+ // Every host registered and passing the installer's checks (Assisted: `known`).
162
+ if (hosts.length >= nodes.length && ready >= nodes.length)
163
+ return `${hosts.length} of ${nodes.length} hosts registered and ready`;
164
+ if (Date.now() >= deadline)
165
+ throw new Error(`${hosts.length} of ${nodes.length} hosts registered, ${ready} ready, after ${Math.round(call.deps.hostsWaitMs / 60_000)} minutes`);
166
+ await poll_wait(call.deps.pollMs, call.signal);
167
+ }
168
+ return 'stopped while waiting for hosts';
169
+ },
170
+ run: async (call) => {
171
+ const record = call.record();
172
+ const ids = ids_need(record);
173
+ const deadline = Date.now() + call.deps.installWaitMs;
174
+ let last = -1;
175
+ while (!call.signal.aborted) {
176
+ const status = await call.deps.installer.install_status(ids);
177
+ // The installer says when the cluster is ready; the install starts then, once.
178
+ if (status.state === 'ready' && call.record().ids['installStarted'] === undefined) {
179
+ await call.deps.installer.install_start(ids);
180
+ call.remember({ installStarted: new Date().toISOString() });
181
+ call.log('install started');
182
+ continue;
183
+ }
184
+ if (status.percent !== last) {
185
+ call.progress({ current: status.percent, total: 100 });
186
+ call.log(`install ${status.percent}% · ${status.note}`);
187
+ last = status.percent;
188
+ }
189
+ if (status.state === 'installed') {
190
+ call.deps.store.secret_write(call.name, 'kubeconfig', await call.deps.installer.kubeconfig_get(ids));
191
+ call.deps.store.secret_write(call.name, 'kubeadmin-password', `${(await call.deps.installer.credentials_get(ids)).password}\n`);
192
+ return 'installed; the kubeconfig and the administrator\'s password are on the host';
193
+ }
194
+ if (status.state === 'error')
195
+ throw new Error(`the install failed: ${status.note}`);
196
+ if (Date.now() >= deadline)
197
+ throw new Error(`the install was at ${status.percent}% after ${Math.round(call.deps.installWaitMs / 60_000)} minutes`);
198
+ await poll_wait(call.deps.pollMs, call.signal);
199
+ }
200
+ return 'stopped while installing';
201
+ },
202
+ };
203
+ /**
204
+ * Records a step's state.
205
+ *
206
+ * @param store - The domains.
207
+ * @param name - The domain.
208
+ * @param step - The step.
209
+ * @param change - What changed.
210
+ */
211
+ function step_record(store, name, step, change) {
212
+ store.record_update(name, (record) => { record.steps[step] = { ...record.steps[step], ...change }; });
213
+ }
214
+ /**
215
+ * The run that builds a domain from its first step not done.
216
+ *
217
+ * @param name - The domain.
218
+ * @param through - The last step to run; absent, as far as this session's steps go.
219
+ * @param deps - What the steps run over.
220
+ * @returns The job's work.
221
+ */
222
+ export function buildRun_make(name, through, deps) {
223
+ return async (context) => {
224
+ const spec = deps.store.spec_read(name)?.spec ?? null;
225
+ if (spec === null)
226
+ throw new Error(`${name}: its spec.yaml does not read`);
227
+ if (deps.store.record_read(name)?.adopted !== undefined)
228
+ throw new Error(`${name} was adopted: building on it is refused until it is allowed by name`);
229
+ if (deps.store.record_read(name)?.gone !== undefined)
230
+ throw new Error(`${name} was torn down: domain new makes another`);
231
+ for (;;) {
232
+ if (context.signal.aborted)
233
+ return;
234
+ const record = deps.store.record_read(name);
235
+ if (record === null)
236
+ throw new Error(`${name}: no such domain`);
237
+ const step = stepNext_of(record);
238
+ if (step === null) {
239
+ context.log_write('every step is done');
240
+ return;
241
+ }
242
+ if (!STEPS_WRITTEN.includes(step)) {
243
+ context.log_write(`stopping before ${step}: not a step this session has yet`);
244
+ context.data_set('stoppedBefore', step);
245
+ return;
246
+ }
247
+ if (step === FIRST_BILLING_STEP && record.billingAccepted === undefined) {
248
+ context.log_write(`stopping before ${step}: it starts billing, and waits on the operator's answer (domain build ${name})`);
249
+ context.data_set('stoppedBefore', step);
250
+ return;
251
+ }
252
+ context.data_set('step', step);
253
+ step_record(deps.store, name, step, { state: 'running', started: new Date().toISOString() });
254
+ context.log_write(`${step}: started`);
255
+ const call = {
256
+ name, spec, deps,
257
+ log: (line) => context.log_write(`${step}: ${line}`),
258
+ signal: context.signal,
259
+ record: () => deps.store.record_read(name),
260
+ remember: (ids) => { deps.store.record_update(name, (current) => { Object.assign(current.ids, ids); }); },
261
+ progress: (progress) => context.progress_set(progress),
262
+ };
263
+ let note;
264
+ try {
265
+ note = await STEP_WORK[step](call);
266
+ }
267
+ catch (error) {
268
+ const reason = error instanceof Error ? error.message : String(error);
269
+ step_record(deps.store, name, step, { state: 'failed', ended: new Date().toISOString(), note: reason });
270
+ throw new Error(`${step}: ${reason}`);
271
+ }
272
+ if (context.signal.aborted) {
273
+ step_record(deps.store, name, step, { state: 'not done', note: 'stopped when asked' });
274
+ return;
275
+ }
276
+ step_record(deps.store, name, step, { state: 'done', ended: new Date().toISOString(), note });
277
+ context.log_write(`${step}: done · ${note}`);
278
+ if (step === through) {
279
+ context.data_set('stoppedBefore', stepNext_of(deps.store.record_read(name)) ?? '');
280
+ return;
281
+ }
282
+ }
283
+ };
284
+ }
285
+ /**
286
+ * The run that plans a domain against its stack and records the plan:
287
+ * an adopted domain's, or a built one's re-plan. It applies nothing.
288
+ *
289
+ * @param name - The domain.
290
+ * @param builder - The cloud's build half.
291
+ * @param store - The domains.
292
+ * @returns The job's work.
293
+ */
294
+ export function planRun_make(name, builder, store) {
295
+ return async (context) => {
296
+ const record = store.record_read(name);
297
+ const spec = store.spec_read(name)?.spec ?? null;
298
+ if (record === null || spec === null)
299
+ throw new Error(`${name}: no such domain, or its spec.yaml does not read`);
300
+ const stackRef = record.ids['stackRef'];
301
+ if (stackRef === undefined)
302
+ throw new Error(`${name}: no stack yet`);
303
+ const plan = await builder.infra_plan({ domain: name, spec, region: record.region, isoObject: record.ids['isoObject'] ?? '', stackRef }, { log: (line) => context.log_write(line), signal: context.signal });
304
+ if (context.signal.aborted)
305
+ return;
306
+ store.file_write(name, 'plan.json', `${JSON.stringify(plan, null, 2)}\n`);
307
+ const counts = planCounts_of(plan);
308
+ context.log_write(`plan: ${planCounts_words(counts)}`);
309
+ };
310
+ }
311
+ //# sourceMappingURL=steps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"steps.js","sourceRoot":"","sources":["../../src/domain/steps.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,gBAAgB,EAA6F,MAAM,qBAAqB,CAAC;AAEnL,OAAO,EAAE,YA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AC,IAAI,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;QAC1E,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;QACnC,OAAO,CAAC,SAAS,CAAC,SAAS,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACzD,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @file A domain's teardown, its first form (docs/stratus.adoc, D6, decided
3
+ * 2026-10-22): what this daemon built, removed, and nothing else.
4
+ *
5
+ * The stack's own resources go by a destroy job; then the cluster's DNS
6
+ * records, the discovery image and its link, the volumes the cluster's CSI
7
+ * driver made for its claims (which the stack never knew), and the
8
+ * installer's records. The CSI volumes are named by the cluster itself, read
9
+ * from its PersistentVolumes before the destroy: OCI's attribution tag on them
10
+ * is the same for every cluster, so it cannot say whose they are.
11
+ *
12
+ * @module
13
+ */
14
+ import type { JobRun } from '@fnndsc/brasa/core';
15
+ import type { KubeApi } from '../cluster/kube.js';
16
+ import type { CloudBuilder } from '../cloud/builder.js';
17
+ import type { Installer } from '../installer/installer.js';
18
+ import type { DomainStore } from './state.js';
19
+ /** The CSI driver whose volumes are the cloud's block volumes. */
20
+ export declare const OCI_BLOCK_DRIVER: string;
21
+ /**
22
+ * The block volumes a cluster's claims hold, from its PersistentVolumes.
23
+ *
24
+ * @param kube - The cluster.
25
+ * @returns The volumes' ids.
26
+ */
27
+ export declare function clusterVolumes_read(kube: KubeApi): Promise<string[]>;
28
+ /**
29
+ * The job that tears a domain down.
30
+ *
31
+ * @param store - The domains.
32
+ * @param builder - The cloud's build half.
33
+ * @param installer - The installer, or null when none is reachable.
34
+ * @param name - The domain.
35
+ * @param volumeIds - The cluster's own volumes, read before.
36
+ * @returns The job's work.
37
+ */
38
+ export declare function teardownRun_make(store: DomainStore, builder: CloudBuilder, installer: Installer | null, name: string, volumeIds: ReadonlyArray<string>): JobRun;