@kinotic-ai/system-api 5.0.0-beta.4 → 5.0.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +0 -70
- package/dist/index.d.cts +8 -216
- package/dist/index.d.ts +8 -216
- package/dist/index.js +0 -70
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -40,10 +40,8 @@ var __export = (target, all) => {
|
|
|
40
40
|
// packages/system-api/src/index.ts
|
|
41
41
|
var exports_src = {};
|
|
42
42
|
__export(exports_src, {
|
|
43
|
-
WorkloadStatus: () => WorkloadStatus,
|
|
44
43
|
WorkloadServiceProxy: () => WorkloadServiceProxy,
|
|
45
44
|
WorkloadOrchestrationService: () => WorkloadOrchestrationService,
|
|
46
|
-
Workload: () => Workload,
|
|
47
45
|
VmProviderType: () => VmProviderType,
|
|
48
46
|
VmNodeStatusType: () => VmNodeStatusType,
|
|
49
47
|
VmNodeStatus: () => VmNodeStatus,
|
|
@@ -55,12 +53,8 @@ __export(exports_src, {
|
|
|
55
53
|
SystemApiPlugin: () => SystemApiPlugin,
|
|
56
54
|
SingleLoggerLevelsDescriptor: () => SingleLoggerLevelsDescriptor,
|
|
57
55
|
SYSTEM_API_ZONE: () => import_management_api8.SYSTEM_API_ZONE,
|
|
58
|
-
PortProtocol: () => PortProtocol,
|
|
59
|
-
NetworkPolicy: () => NetworkPolicy,
|
|
60
|
-
NetworkMode: () => NetworkMode,
|
|
61
56
|
LoggersDescriptor: () => LoggersDescriptor,
|
|
62
57
|
LoggerLevelsDescriptor: () => LoggerLevelsDescriptor,
|
|
63
|
-
LogPolicy: () => LogPolicy,
|
|
64
58
|
LogManager: () => LogManager,
|
|
65
59
|
LogLevel: () => LogLevel,
|
|
66
60
|
KinoticNodeInfo: () => KinoticNodeInfo,
|
|
@@ -71,28 +65,6 @@ __export(exports_src, {
|
|
|
71
65
|
module.exports = __toCommonJS(exports_src);
|
|
72
66
|
var import_management_api8 = require("@kinotic-ai/management-api");
|
|
73
67
|
|
|
74
|
-
// packages/system-api/src/api/model/workload/LogPolicy.ts
|
|
75
|
-
class LogPolicy {
|
|
76
|
-
maxSizeMb = 10;
|
|
77
|
-
maxFiles = 3;
|
|
78
|
-
}
|
|
79
|
-
// packages/system-api/src/api/model/workload/NetworkMode.ts
|
|
80
|
-
var NetworkMode;
|
|
81
|
-
((NetworkMode2) => {
|
|
82
|
-
NetworkMode2["ENABLED"] = "ENABLED";
|
|
83
|
-
NetworkMode2["DISABLED"] = "DISABLED";
|
|
84
|
-
})(NetworkMode ||= {});
|
|
85
|
-
// packages/system-api/src/api/model/workload/NetworkPolicy.ts
|
|
86
|
-
class NetworkPolicy {
|
|
87
|
-
mode = "ENABLED" /* ENABLED */;
|
|
88
|
-
allowedHosts = [];
|
|
89
|
-
}
|
|
90
|
-
// packages/system-api/src/api/model/workload/PortProtocol.ts
|
|
91
|
-
var PortProtocol;
|
|
92
|
-
((PortProtocol2) => {
|
|
93
|
-
PortProtocol2["TCP"] = "TCP";
|
|
94
|
-
PortProtocol2["UDP"] = "UDP";
|
|
95
|
-
})(PortProtocol ||= {});
|
|
96
68
|
// packages/system-api/src/api/model/workload/VmNodeStatusType.ts
|
|
97
69
|
var VmNodeStatusType;
|
|
98
70
|
((VmNodeStatusType2) => {
|
|
@@ -135,48 +107,6 @@ class VmNode {
|
|
|
135
107
|
this.hostname = hostname;
|
|
136
108
|
}
|
|
137
109
|
}
|
|
138
|
-
// packages/system-api/src/api/model/workload/WorkloadStatus.ts
|
|
139
|
-
var WorkloadStatus;
|
|
140
|
-
((WorkloadStatus2) => {
|
|
141
|
-
WorkloadStatus2["PENDING"] = "PENDING";
|
|
142
|
-
WorkloadStatus2["STARTING"] = "STARTING";
|
|
143
|
-
WorkloadStatus2["RUNNING"] = "RUNNING";
|
|
144
|
-
WorkloadStatus2["STOPPING"] = "STOPPING";
|
|
145
|
-
WorkloadStatus2["STOPPED"] = "STOPPED";
|
|
146
|
-
WorkloadStatus2["FAILED"] = "FAILED";
|
|
147
|
-
})(WorkloadStatus ||= {});
|
|
148
|
-
|
|
149
|
-
// packages/system-api/src/api/model/workload/Workload.ts
|
|
150
|
-
class Workload {
|
|
151
|
-
id = null;
|
|
152
|
-
name;
|
|
153
|
-
description;
|
|
154
|
-
nodeId = null;
|
|
155
|
-
organizationId = null;
|
|
156
|
-
applicationId = null;
|
|
157
|
-
image;
|
|
158
|
-
vcpus = 1;
|
|
159
|
-
memoryMb = 512;
|
|
160
|
-
diskSizeMb = 1024;
|
|
161
|
-
network = new NetworkPolicy;
|
|
162
|
-
logPolicy = new LogPolicy;
|
|
163
|
-
detached = true;
|
|
164
|
-
autoRemove = false;
|
|
165
|
-
status = "PENDING" /* PENDING */;
|
|
166
|
-
exitCode = null;
|
|
167
|
-
environment = {};
|
|
168
|
-
secrets = {};
|
|
169
|
-
portMappings = [];
|
|
170
|
-
volumeMounts = [];
|
|
171
|
-
entrypoint = [];
|
|
172
|
-
cmd = [];
|
|
173
|
-
created = null;
|
|
174
|
-
updated = null;
|
|
175
|
-
constructor(name, image) {
|
|
176
|
-
this.name = name;
|
|
177
|
-
this.image = image;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
110
|
// packages/system-api/src/api/model/VmNodeRegistration.ts
|
|
181
111
|
class VmNodeRegistration {
|
|
182
112
|
id;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,67 +1,4 @@
|
|
|
1
1
|
import { SYSTEM_API_ZONE } from "@kinotic-ai/management-api";
|
|
2
|
-
/**
|
|
3
|
-
* How much of a workload's log output is kept on the node. The workload's own image and
|
|
4
|
-
* entrypoint have no say in it: the policy is applied by the VM provider, which owns the
|
|
5
|
-
* log files, so a workload cannot fill the node by writing to stdout.
|
|
6
|
-
*/
|
|
7
|
-
declare class LogPolicy {
|
|
8
|
-
/**
|
|
9
|
-
* Size at which the workload's current log file is rotated.
|
|
10
|
-
*/
|
|
11
|
-
maxSizeMb: number;
|
|
12
|
-
/**
|
|
13
|
-
* How many rotated files are kept alongside the current one. The oldest is discarded
|
|
14
|
-
* once this many exist, so a workload's logs occupy at most maxSizeMb * (maxFiles + 1).
|
|
15
|
-
*/
|
|
16
|
-
maxFiles: number;
|
|
17
|
-
}
|
|
18
|
-
declare enum NetworkMode {
|
|
19
|
-
ENABLED = "ENABLED",
|
|
20
|
-
/**
|
|
21
|
-
* No network access. Nothing outside the VM is reachable, by name or by address, and
|
|
22
|
-
* any NetworkPolicy.allowedHosts the workload declares does not apply.
|
|
23
|
-
*/
|
|
24
|
-
DISABLED = "DISABLED"
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* The network access granted to a workload's VM. The workload's own image and entrypoint
|
|
28
|
-
* have no say in it: the policy is applied by the VM provider when the VM is created,
|
|
29
|
-
* which is what makes it safe to run code the platform does not trust.
|
|
30
|
-
*/
|
|
31
|
-
declare class NetworkPolicy {
|
|
32
|
-
/**
|
|
33
|
-
* Whether the VM has network access at all.
|
|
34
|
-
*/
|
|
35
|
-
mode: NetworkMode;
|
|
36
|
-
/**
|
|
37
|
-
* The outbound destinations the VM may reach, including the api-gateway the workload is
|
|
38
|
-
* deployed to talk to. An empty list denies every destination, leaving the VM able to
|
|
39
|
-
* resolve names and reach nothing. Applies only when mode is ENABLED.
|
|
40
|
-
*
|
|
41
|
-
* What an entry may be follows the provider of the node the workload is placed on:
|
|
42
|
-
* CLOUD_HYPERVISOR takes IPv4 addresses and CIDRs, enforced by the node's firewall, and
|
|
43
|
-
* BOXLITE takes hostnames, enforced on the connection so an unlisted destination is
|
|
44
|
-
* unreachable by name and by raw IP alike.
|
|
45
|
-
*/
|
|
46
|
-
allowedHosts: string[];
|
|
47
|
-
}
|
|
48
|
-
declare enum PortProtocol {
|
|
49
|
-
TCP = "TCP",
|
|
50
|
-
UDP = "UDP"
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* A guest port exposed on the host for a workload's VM.
|
|
54
|
-
*/
|
|
55
|
-
interface PortMapping {
|
|
56
|
-
/** Host port to expose. When omitted, the provider assigns one. */
|
|
57
|
-
hostPort?: number;
|
|
58
|
-
/** Guest port to map to the host. */
|
|
59
|
-
guestPort: number;
|
|
60
|
-
/** Transport protocol. When omitted, the provider's default applies. */
|
|
61
|
-
protocol?: PortProtocol;
|
|
62
|
-
/** Host interface to bind on. When omitted, the provider's default applies. */
|
|
63
|
-
hostIp?: string;
|
|
64
|
-
}
|
|
65
2
|
import { Identifiable } from "@kinotic-ai/core";
|
|
66
3
|
declare enum VmNodeStatusType {
|
|
67
4
|
ONLINE = "ONLINE",
|
|
@@ -149,154 +86,6 @@ declare class VmNode implements Identifiable<string> {
|
|
|
149
86
|
constructor(id: string, name: string, hostname: string);
|
|
150
87
|
}
|
|
151
88
|
/**
|
|
152
|
-
* A host directory exposed inside a workload's guest VM.
|
|
153
|
-
*/
|
|
154
|
-
interface VolumeMount {
|
|
155
|
-
/** Absolute path on the host to mount into the guest. */
|
|
156
|
-
hostPath: string;
|
|
157
|
-
/** Absolute path inside the guest where the host path is mounted. */
|
|
158
|
-
guestPath: string;
|
|
159
|
-
/** When true, the mount is exposed read-only inside the guest. Defaults to false. */
|
|
160
|
-
readOnly?: boolean;
|
|
161
|
-
/**
|
|
162
|
-
* Hard cap in megabytes on what the guest may write through this mount. Unset leaves the
|
|
163
|
-
* mount bounded only by the host filesystem it comes from. Applies to writable mounts,
|
|
164
|
-
* since a read-only mount is already unwritable.
|
|
165
|
-
*/
|
|
166
|
-
sizeLimitMb?: number;
|
|
167
|
-
}
|
|
168
|
-
import { Identifiable as Identifiable2 } from "@kinotic-ai/core";
|
|
169
|
-
declare enum WorkloadStatus {
|
|
170
|
-
PENDING = "PENDING",
|
|
171
|
-
STARTING = "STARTING",
|
|
172
|
-
RUNNING = "RUNNING",
|
|
173
|
-
STOPPING = "STOPPING",
|
|
174
|
-
STOPPED = "STOPPED",
|
|
175
|
-
FAILED = "FAILED"
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* Represents a workload to be managed by the VM manager.
|
|
179
|
-
* A workload defines the configuration for a micro VM instance.
|
|
180
|
-
*/
|
|
181
|
-
declare class Workload implements Identifiable2<string> {
|
|
182
|
-
/**
|
|
183
|
-
* Unique identifier for this workload.
|
|
184
|
-
*/
|
|
185
|
-
id: string | null;
|
|
186
|
-
/**
|
|
187
|
-
* Human-readable name for the workload.
|
|
188
|
-
*/
|
|
189
|
-
name: string;
|
|
190
|
-
/**
|
|
191
|
-
* Optional description of the workload.
|
|
192
|
-
*/
|
|
193
|
-
description?: string;
|
|
194
|
-
/**
|
|
195
|
-
* The id of the node this workload is deployed to, assigned by the orchestrator
|
|
196
|
-
* during deployment, or set by the caller before deploying to pin the workload to a
|
|
197
|
-
* specific node. Null until the workload has been placed.
|
|
198
|
-
*/
|
|
199
|
-
nodeId: string | null;
|
|
200
|
-
/**
|
|
201
|
-
* The Organization this workload runs on behalf of, and which may view its logs.
|
|
202
|
-
* Null for platform workloads (SYSTEM scope).
|
|
203
|
-
*/
|
|
204
|
-
organizationId: string | null;
|
|
205
|
-
/**
|
|
206
|
-
* The Application this workload runs on behalf of, or null if none.
|
|
207
|
-
* When set, organizationId must also be set.
|
|
208
|
-
*/
|
|
209
|
-
applicationId: string | null;
|
|
210
|
-
/**
|
|
211
|
-
* The image or rootfs to use for the VM.
|
|
212
|
-
*/
|
|
213
|
-
image: string;
|
|
214
|
-
/**
|
|
215
|
-
* Number of vCPUs allocated to the VM.
|
|
216
|
-
*/
|
|
217
|
-
vcpus: number;
|
|
218
|
-
/**
|
|
219
|
-
* Memory allocated to the VM in megabytes.
|
|
220
|
-
*/
|
|
221
|
-
memoryMb: number;
|
|
222
|
-
/**
|
|
223
|
-
* Disk size allocated to the VM in megabytes.
|
|
224
|
-
*/
|
|
225
|
-
diskSizeMb: number;
|
|
226
|
-
/**
|
|
227
|
-
* The network access granted to this workload's VM.
|
|
228
|
-
*/
|
|
229
|
-
network: NetworkPolicy;
|
|
230
|
-
/**
|
|
231
|
-
* How much of this workload's log output the node keeps.
|
|
232
|
-
*/
|
|
233
|
-
logPolicy: LogPolicy;
|
|
234
|
-
/**
|
|
235
|
-
* When true the VM runs detached from the vm-manager process and survives its restarts,
|
|
236
|
-
* and calls that start its run (deploy, restart) complete as soon as it is running.
|
|
237
|
-
* When false the workload runs in the foreground: it ends when the vm-manager exits,
|
|
238
|
-
* and calls that start its run complete only once the run has ended — STOPPED or
|
|
239
|
-
* FAILED, with the exit code set.
|
|
240
|
-
*/
|
|
241
|
-
detached: boolean;
|
|
242
|
-
/**
|
|
243
|
-
* When true the VM and its disk are discarded when the workload stops, so a
|
|
244
|
-
* stopped workload cannot be restarted. When false the disk is kept and the
|
|
245
|
-
* workload may be restarted in place.
|
|
246
|
-
*/
|
|
247
|
-
autoRemove: boolean;
|
|
248
|
-
/**
|
|
249
|
-
* Current status of the workload.
|
|
250
|
-
*/
|
|
251
|
-
status: WorkloadStatus;
|
|
252
|
-
/**
|
|
253
|
-
* The exit status of the workload's process once it has stopped, null while it has not.
|
|
254
|
-
* A workload killed by a signal reports 128 plus the signal number, so 137 is a SIGKILL —
|
|
255
|
-
* which is what a workload that exceeded its memory limit receives, with no chance to
|
|
256
|
-
* shut down first. FAILED alone does not distinguish that from code that threw.
|
|
257
|
-
*/
|
|
258
|
-
exitCode: number | null;
|
|
259
|
-
/**
|
|
260
|
-
* Optional environment variables to pass to the VM. Persisted verbatim on the workload
|
|
261
|
-
* record — put values that must not be readable there in secrets instead.
|
|
262
|
-
*/
|
|
263
|
-
environment: Record<string, string>;
|
|
264
|
-
/**
|
|
265
|
-
* Optional secret environment variables to pass to the VM, delivered to the guest
|
|
266
|
-
* exactly like environment and overriding it on a duplicate key. The persisted workload
|
|
267
|
-
* record holds a masked value for every entry — reading a workload back returns the keys
|
|
268
|
-
* but never the values, which only the node receives.
|
|
269
|
-
*/
|
|
270
|
-
secrets: Record<string, string>;
|
|
271
|
-
/**
|
|
272
|
-
* Port mappings that expose guest ports on the host.
|
|
273
|
-
*/
|
|
274
|
-
portMappings: PortMapping[];
|
|
275
|
-
/**
|
|
276
|
-
* Volume mounts that expose host directories inside the guest VM.
|
|
277
|
-
*/
|
|
278
|
-
volumeMounts: VolumeMount[];
|
|
279
|
-
/**
|
|
280
|
-
* Overrides the image entrypoint. Empty keeps the image default.
|
|
281
|
-
*/
|
|
282
|
-
entrypoint: string[];
|
|
283
|
-
/**
|
|
284
|
-
* Overrides the image command (CMD). Empty keeps the image default, unless
|
|
285
|
-
* entrypoint is declared — then the image CMD is dropped so the entrypoint
|
|
286
|
-
* runs exactly as given.
|
|
287
|
-
*/
|
|
288
|
-
cmd: string[];
|
|
289
|
-
/**
|
|
290
|
-
* The date and time the workload was created.
|
|
291
|
-
*/
|
|
292
|
-
created: number | null;
|
|
293
|
-
/**
|
|
294
|
-
* The date and time the workload was last updated.
|
|
295
|
-
*/
|
|
296
|
-
updated: number | null;
|
|
297
|
-
constructor(name: string, image: string);
|
|
298
|
-
}
|
|
299
|
-
/**
|
|
300
89
|
* DTO sent by a vm-manager process when it registers with the server.
|
|
301
90
|
* Contains only the information the node knows about itself.
|
|
302
91
|
*/
|
|
@@ -335,6 +124,7 @@ declare class VmNodeRegistration {
|
|
|
335
124
|
workloadDataDir: string | null;
|
|
336
125
|
constructor(id: string, name: string, hostname: string);
|
|
337
126
|
}
|
|
127
|
+
import { WorkloadStatus } from "@kinotic-ai/management-api";
|
|
338
128
|
/**
|
|
339
129
|
* A vm-manager node's view of one workload's status, reported to the orchestrator.
|
|
340
130
|
*/
|
|
@@ -370,6 +160,7 @@ declare class VmNodeServiceProxy extends CrudServiceProxy<VmNode> implements IVm
|
|
|
370
160
|
findAvailableNode(requiredCpus: number, requiredMemoryMb: number, requiredDiskMb: number): Promise<VmNode | null>;
|
|
371
161
|
syncIndex(): Promise<void>;
|
|
372
162
|
}
|
|
163
|
+
import { Workload } from "@kinotic-ai/management-api";
|
|
373
164
|
import { CrudServiceProxy as CrudServiceProxy2, IKinotic as IKinotic2, ICrudServiceProxy as ICrudServiceProxy2, IterablePage, Page, Pageable } from "@kinotic-ai/core";
|
|
374
165
|
interface IWorkloadService extends ICrudServiceProxy2<Workload> {
|
|
375
166
|
/**
|
|
@@ -398,6 +189,7 @@ declare class WorkloadServiceProxy extends CrudServiceProxy2<Workload> implement
|
|
|
398
189
|
countForNode(nodeId: string): Promise<number>;
|
|
399
190
|
syncIndex(): Promise<void>;
|
|
400
191
|
}
|
|
192
|
+
import { Workload as Workload2 } from "@kinotic-ai/management-api";
|
|
401
193
|
import { IKinotic as IKinotic3 } from "@kinotic-ai/core";
|
|
402
194
|
/**
|
|
403
195
|
* Orchestrates workload deployment across the cluster, acting as the intermediary between
|
|
@@ -414,7 +206,7 @@ interface IWorkloadOrchestrationService {
|
|
|
414
206
|
* @param workload the workload configuration to deploy
|
|
415
207
|
* @return a Promise resolving to the deployed workload (including assigned nodeId and id)
|
|
416
208
|
*/
|
|
417
|
-
deployWorkload(workload:
|
|
209
|
+
deployWorkload(workload: Workload2): Promise<Workload2>;
|
|
418
210
|
/**
|
|
419
211
|
* Restarts a stopped workload in place on the node it is deployed to. Fails unless the
|
|
420
212
|
* workload is stopped; a workload stopped with autoRemove true has no VM left to restart.
|
|
@@ -422,7 +214,7 @@ interface IWorkloadOrchestrationService {
|
|
|
422
214
|
* @param workloadId the id of the workload to restart
|
|
423
215
|
* @return a Promise resolving to the restarted workload
|
|
424
216
|
*/
|
|
425
|
-
restartWorkload(workloadId: string): Promise<
|
|
217
|
+
restartWorkload(workloadId: string): Promise<Workload2>;
|
|
426
218
|
/**
|
|
427
219
|
* Stops a running workload.
|
|
428
220
|
* @param workloadId the id of the workload to stop
|
|
@@ -439,8 +231,8 @@ interface IWorkloadOrchestrationService {
|
|
|
439
231
|
declare class WorkloadOrchestrationService implements IWorkloadOrchestrationService {
|
|
440
232
|
private readonly serviceProxy;
|
|
441
233
|
constructor(kinotic: IKinotic3);
|
|
442
|
-
deployWorkload(workload:
|
|
443
|
-
restartWorkload(workloadId: string): Promise<
|
|
234
|
+
deployWorkload(workload: Workload2): Promise<Workload2>;
|
|
235
|
+
restartWorkload(workloadId: string): Promise<Workload2>;
|
|
444
236
|
stopWorkload(workloadId: string): Promise<void>;
|
|
445
237
|
destroyWorkload(workloadId: string): Promise<void>;
|
|
446
238
|
}
|
|
@@ -619,4 +411,4 @@ declare class LogManager implements ILogManager {
|
|
|
619
411
|
declare module "@kinotic-ai/core" {
|
|
620
412
|
interface KinoticSingleton extends ISystemApiExtension {}
|
|
621
413
|
}
|
|
622
|
-
export { WorkloadStatusReport,
|
|
414
|
+
export { WorkloadStatusReport, WorkloadServiceProxy, WorkloadOrchestrationService, VmProviderType, VmNodeStatusType, VmNodeStatus, VmNodeServiceProxy, VmNodeRegistration, VmNodeOrchestrationServiceProxy, VmNode, SystemOrganizationService, SystemApiPlugin, SingleLoggerLevelsDescriptor, SYSTEM_API_ZONE, LoggersDescriptor, LoggerLevelsDescriptor, LogManager, LogLevel, KinoticNodeInfo, KinoticClusterInfoService, KinoticClusterInfo, IWorkloadService, IWorkloadOrchestrationService, IVmNodeService, ISystemOrganizationService, ISystemApiExtension, ILogManager, IKinoticClusterInfoService, GroupLoggerLevelsDescriptor };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,67 +1,4 @@
|
|
|
1
1
|
import { SYSTEM_API_ZONE } from "@kinotic-ai/management-api";
|
|
2
|
-
/**
|
|
3
|
-
* How much of a workload's log output is kept on the node. The workload's own image and
|
|
4
|
-
* entrypoint have no say in it: the policy is applied by the VM provider, which owns the
|
|
5
|
-
* log files, so a workload cannot fill the node by writing to stdout.
|
|
6
|
-
*/
|
|
7
|
-
declare class LogPolicy {
|
|
8
|
-
/**
|
|
9
|
-
* Size at which the workload's current log file is rotated.
|
|
10
|
-
*/
|
|
11
|
-
maxSizeMb: number;
|
|
12
|
-
/**
|
|
13
|
-
* How many rotated files are kept alongside the current one. The oldest is discarded
|
|
14
|
-
* once this many exist, so a workload's logs occupy at most maxSizeMb * (maxFiles + 1).
|
|
15
|
-
*/
|
|
16
|
-
maxFiles: number;
|
|
17
|
-
}
|
|
18
|
-
declare enum NetworkMode {
|
|
19
|
-
ENABLED = "ENABLED",
|
|
20
|
-
/**
|
|
21
|
-
* No network access. Nothing outside the VM is reachable, by name or by address, and
|
|
22
|
-
* any NetworkPolicy.allowedHosts the workload declares does not apply.
|
|
23
|
-
*/
|
|
24
|
-
DISABLED = "DISABLED"
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* The network access granted to a workload's VM. The workload's own image and entrypoint
|
|
28
|
-
* have no say in it: the policy is applied by the VM provider when the VM is created,
|
|
29
|
-
* which is what makes it safe to run code the platform does not trust.
|
|
30
|
-
*/
|
|
31
|
-
declare class NetworkPolicy {
|
|
32
|
-
/**
|
|
33
|
-
* Whether the VM has network access at all.
|
|
34
|
-
*/
|
|
35
|
-
mode: NetworkMode;
|
|
36
|
-
/**
|
|
37
|
-
* The outbound destinations the VM may reach, including the api-gateway the workload is
|
|
38
|
-
* deployed to talk to. An empty list denies every destination, leaving the VM able to
|
|
39
|
-
* resolve names and reach nothing. Applies only when mode is ENABLED.
|
|
40
|
-
*
|
|
41
|
-
* What an entry may be follows the provider of the node the workload is placed on:
|
|
42
|
-
* CLOUD_HYPERVISOR takes IPv4 addresses and CIDRs, enforced by the node's firewall, and
|
|
43
|
-
* BOXLITE takes hostnames, enforced on the connection so an unlisted destination is
|
|
44
|
-
* unreachable by name and by raw IP alike.
|
|
45
|
-
*/
|
|
46
|
-
allowedHosts: string[];
|
|
47
|
-
}
|
|
48
|
-
declare enum PortProtocol {
|
|
49
|
-
TCP = "TCP",
|
|
50
|
-
UDP = "UDP"
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* A guest port exposed on the host for a workload's VM.
|
|
54
|
-
*/
|
|
55
|
-
interface PortMapping {
|
|
56
|
-
/** Host port to expose. When omitted, the provider assigns one. */
|
|
57
|
-
hostPort?: number;
|
|
58
|
-
/** Guest port to map to the host. */
|
|
59
|
-
guestPort: number;
|
|
60
|
-
/** Transport protocol. When omitted, the provider's default applies. */
|
|
61
|
-
protocol?: PortProtocol;
|
|
62
|
-
/** Host interface to bind on. When omitted, the provider's default applies. */
|
|
63
|
-
hostIp?: string;
|
|
64
|
-
}
|
|
65
2
|
import { Identifiable } from "@kinotic-ai/core";
|
|
66
3
|
declare enum VmNodeStatusType {
|
|
67
4
|
ONLINE = "ONLINE",
|
|
@@ -149,154 +86,6 @@ declare class VmNode implements Identifiable<string> {
|
|
|
149
86
|
constructor(id: string, name: string, hostname: string);
|
|
150
87
|
}
|
|
151
88
|
/**
|
|
152
|
-
* A host directory exposed inside a workload's guest VM.
|
|
153
|
-
*/
|
|
154
|
-
interface VolumeMount {
|
|
155
|
-
/** Absolute path on the host to mount into the guest. */
|
|
156
|
-
hostPath: string;
|
|
157
|
-
/** Absolute path inside the guest where the host path is mounted. */
|
|
158
|
-
guestPath: string;
|
|
159
|
-
/** When true, the mount is exposed read-only inside the guest. Defaults to false. */
|
|
160
|
-
readOnly?: boolean;
|
|
161
|
-
/**
|
|
162
|
-
* Hard cap in megabytes on what the guest may write through this mount. Unset leaves the
|
|
163
|
-
* mount bounded only by the host filesystem it comes from. Applies to writable mounts,
|
|
164
|
-
* since a read-only mount is already unwritable.
|
|
165
|
-
*/
|
|
166
|
-
sizeLimitMb?: number;
|
|
167
|
-
}
|
|
168
|
-
import { Identifiable as Identifiable2 } from "@kinotic-ai/core";
|
|
169
|
-
declare enum WorkloadStatus {
|
|
170
|
-
PENDING = "PENDING",
|
|
171
|
-
STARTING = "STARTING",
|
|
172
|
-
RUNNING = "RUNNING",
|
|
173
|
-
STOPPING = "STOPPING",
|
|
174
|
-
STOPPED = "STOPPED",
|
|
175
|
-
FAILED = "FAILED"
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* Represents a workload to be managed by the VM manager.
|
|
179
|
-
* A workload defines the configuration for a micro VM instance.
|
|
180
|
-
*/
|
|
181
|
-
declare class Workload implements Identifiable2<string> {
|
|
182
|
-
/**
|
|
183
|
-
* Unique identifier for this workload.
|
|
184
|
-
*/
|
|
185
|
-
id: string | null;
|
|
186
|
-
/**
|
|
187
|
-
* Human-readable name for the workload.
|
|
188
|
-
*/
|
|
189
|
-
name: string;
|
|
190
|
-
/**
|
|
191
|
-
* Optional description of the workload.
|
|
192
|
-
*/
|
|
193
|
-
description?: string;
|
|
194
|
-
/**
|
|
195
|
-
* The id of the node this workload is deployed to, assigned by the orchestrator
|
|
196
|
-
* during deployment, or set by the caller before deploying to pin the workload to a
|
|
197
|
-
* specific node. Null until the workload has been placed.
|
|
198
|
-
*/
|
|
199
|
-
nodeId: string | null;
|
|
200
|
-
/**
|
|
201
|
-
* The Organization this workload runs on behalf of, and which may view its logs.
|
|
202
|
-
* Null for platform workloads (SYSTEM scope).
|
|
203
|
-
*/
|
|
204
|
-
organizationId: string | null;
|
|
205
|
-
/**
|
|
206
|
-
* The Application this workload runs on behalf of, or null if none.
|
|
207
|
-
* When set, organizationId must also be set.
|
|
208
|
-
*/
|
|
209
|
-
applicationId: string | null;
|
|
210
|
-
/**
|
|
211
|
-
* The image or rootfs to use for the VM.
|
|
212
|
-
*/
|
|
213
|
-
image: string;
|
|
214
|
-
/**
|
|
215
|
-
* Number of vCPUs allocated to the VM.
|
|
216
|
-
*/
|
|
217
|
-
vcpus: number;
|
|
218
|
-
/**
|
|
219
|
-
* Memory allocated to the VM in megabytes.
|
|
220
|
-
*/
|
|
221
|
-
memoryMb: number;
|
|
222
|
-
/**
|
|
223
|
-
* Disk size allocated to the VM in megabytes.
|
|
224
|
-
*/
|
|
225
|
-
diskSizeMb: number;
|
|
226
|
-
/**
|
|
227
|
-
* The network access granted to this workload's VM.
|
|
228
|
-
*/
|
|
229
|
-
network: NetworkPolicy;
|
|
230
|
-
/**
|
|
231
|
-
* How much of this workload's log output the node keeps.
|
|
232
|
-
*/
|
|
233
|
-
logPolicy: LogPolicy;
|
|
234
|
-
/**
|
|
235
|
-
* When true the VM runs detached from the vm-manager process and survives its restarts,
|
|
236
|
-
* and calls that start its run (deploy, restart) complete as soon as it is running.
|
|
237
|
-
* When false the workload runs in the foreground: it ends when the vm-manager exits,
|
|
238
|
-
* and calls that start its run complete only once the run has ended — STOPPED or
|
|
239
|
-
* FAILED, with the exit code set.
|
|
240
|
-
*/
|
|
241
|
-
detached: boolean;
|
|
242
|
-
/**
|
|
243
|
-
* When true the VM and its disk are discarded when the workload stops, so a
|
|
244
|
-
* stopped workload cannot be restarted. When false the disk is kept and the
|
|
245
|
-
* workload may be restarted in place.
|
|
246
|
-
*/
|
|
247
|
-
autoRemove: boolean;
|
|
248
|
-
/**
|
|
249
|
-
* Current status of the workload.
|
|
250
|
-
*/
|
|
251
|
-
status: WorkloadStatus;
|
|
252
|
-
/**
|
|
253
|
-
* The exit status of the workload's process once it has stopped, null while it has not.
|
|
254
|
-
* A workload killed by a signal reports 128 plus the signal number, so 137 is a SIGKILL —
|
|
255
|
-
* which is what a workload that exceeded its memory limit receives, with no chance to
|
|
256
|
-
* shut down first. FAILED alone does not distinguish that from code that threw.
|
|
257
|
-
*/
|
|
258
|
-
exitCode: number | null;
|
|
259
|
-
/**
|
|
260
|
-
* Optional environment variables to pass to the VM. Persisted verbatim on the workload
|
|
261
|
-
* record — put values that must not be readable there in secrets instead.
|
|
262
|
-
*/
|
|
263
|
-
environment: Record<string, string>;
|
|
264
|
-
/**
|
|
265
|
-
* Optional secret environment variables to pass to the VM, delivered to the guest
|
|
266
|
-
* exactly like environment and overriding it on a duplicate key. The persisted workload
|
|
267
|
-
* record holds a masked value for every entry — reading a workload back returns the keys
|
|
268
|
-
* but never the values, which only the node receives.
|
|
269
|
-
*/
|
|
270
|
-
secrets: Record<string, string>;
|
|
271
|
-
/**
|
|
272
|
-
* Port mappings that expose guest ports on the host.
|
|
273
|
-
*/
|
|
274
|
-
portMappings: PortMapping[];
|
|
275
|
-
/**
|
|
276
|
-
* Volume mounts that expose host directories inside the guest VM.
|
|
277
|
-
*/
|
|
278
|
-
volumeMounts: VolumeMount[];
|
|
279
|
-
/**
|
|
280
|
-
* Overrides the image entrypoint. Empty keeps the image default.
|
|
281
|
-
*/
|
|
282
|
-
entrypoint: string[];
|
|
283
|
-
/**
|
|
284
|
-
* Overrides the image command (CMD). Empty keeps the image default, unless
|
|
285
|
-
* entrypoint is declared — then the image CMD is dropped so the entrypoint
|
|
286
|
-
* runs exactly as given.
|
|
287
|
-
*/
|
|
288
|
-
cmd: string[];
|
|
289
|
-
/**
|
|
290
|
-
* The date and time the workload was created.
|
|
291
|
-
*/
|
|
292
|
-
created: number | null;
|
|
293
|
-
/**
|
|
294
|
-
* The date and time the workload was last updated.
|
|
295
|
-
*/
|
|
296
|
-
updated: number | null;
|
|
297
|
-
constructor(name: string, image: string);
|
|
298
|
-
}
|
|
299
|
-
/**
|
|
300
89
|
* DTO sent by a vm-manager process when it registers with the server.
|
|
301
90
|
* Contains only the information the node knows about itself.
|
|
302
91
|
*/
|
|
@@ -335,6 +124,7 @@ declare class VmNodeRegistration {
|
|
|
335
124
|
workloadDataDir: string | null;
|
|
336
125
|
constructor(id: string, name: string, hostname: string);
|
|
337
126
|
}
|
|
127
|
+
import { WorkloadStatus } from "@kinotic-ai/management-api";
|
|
338
128
|
/**
|
|
339
129
|
* A vm-manager node's view of one workload's status, reported to the orchestrator.
|
|
340
130
|
*/
|
|
@@ -370,6 +160,7 @@ declare class VmNodeServiceProxy extends CrudServiceProxy<VmNode> implements IVm
|
|
|
370
160
|
findAvailableNode(requiredCpus: number, requiredMemoryMb: number, requiredDiskMb: number): Promise<VmNode | null>;
|
|
371
161
|
syncIndex(): Promise<void>;
|
|
372
162
|
}
|
|
163
|
+
import { Workload } from "@kinotic-ai/management-api";
|
|
373
164
|
import { CrudServiceProxy as CrudServiceProxy2, IKinotic as IKinotic2, ICrudServiceProxy as ICrudServiceProxy2, IterablePage, Page, Pageable } from "@kinotic-ai/core";
|
|
374
165
|
interface IWorkloadService extends ICrudServiceProxy2<Workload> {
|
|
375
166
|
/**
|
|
@@ -398,6 +189,7 @@ declare class WorkloadServiceProxy extends CrudServiceProxy2<Workload> implement
|
|
|
398
189
|
countForNode(nodeId: string): Promise<number>;
|
|
399
190
|
syncIndex(): Promise<void>;
|
|
400
191
|
}
|
|
192
|
+
import { Workload as Workload2 } from "@kinotic-ai/management-api";
|
|
401
193
|
import { IKinotic as IKinotic3 } from "@kinotic-ai/core";
|
|
402
194
|
/**
|
|
403
195
|
* Orchestrates workload deployment across the cluster, acting as the intermediary between
|
|
@@ -414,7 +206,7 @@ interface IWorkloadOrchestrationService {
|
|
|
414
206
|
* @param workload the workload configuration to deploy
|
|
415
207
|
* @return a Promise resolving to the deployed workload (including assigned nodeId and id)
|
|
416
208
|
*/
|
|
417
|
-
deployWorkload(workload:
|
|
209
|
+
deployWorkload(workload: Workload2): Promise<Workload2>;
|
|
418
210
|
/**
|
|
419
211
|
* Restarts a stopped workload in place on the node it is deployed to. Fails unless the
|
|
420
212
|
* workload is stopped; a workload stopped with autoRemove true has no VM left to restart.
|
|
@@ -422,7 +214,7 @@ interface IWorkloadOrchestrationService {
|
|
|
422
214
|
* @param workloadId the id of the workload to restart
|
|
423
215
|
* @return a Promise resolving to the restarted workload
|
|
424
216
|
*/
|
|
425
|
-
restartWorkload(workloadId: string): Promise<
|
|
217
|
+
restartWorkload(workloadId: string): Promise<Workload2>;
|
|
426
218
|
/**
|
|
427
219
|
* Stops a running workload.
|
|
428
220
|
* @param workloadId the id of the workload to stop
|
|
@@ -439,8 +231,8 @@ interface IWorkloadOrchestrationService {
|
|
|
439
231
|
declare class WorkloadOrchestrationService implements IWorkloadOrchestrationService {
|
|
440
232
|
private readonly serviceProxy;
|
|
441
233
|
constructor(kinotic: IKinotic3);
|
|
442
|
-
deployWorkload(workload:
|
|
443
|
-
restartWorkload(workloadId: string): Promise<
|
|
234
|
+
deployWorkload(workload: Workload2): Promise<Workload2>;
|
|
235
|
+
restartWorkload(workloadId: string): Promise<Workload2>;
|
|
444
236
|
stopWorkload(workloadId: string): Promise<void>;
|
|
445
237
|
destroyWorkload(workloadId: string): Promise<void>;
|
|
446
238
|
}
|
|
@@ -619,4 +411,4 @@ declare class LogManager implements ILogManager {
|
|
|
619
411
|
declare module "@kinotic-ai/core" {
|
|
620
412
|
interface KinoticSingleton extends ISystemApiExtension {}
|
|
621
413
|
}
|
|
622
|
-
export { WorkloadStatusReport,
|
|
414
|
+
export { WorkloadStatusReport, WorkloadServiceProxy, WorkloadOrchestrationService, VmProviderType, VmNodeStatusType, VmNodeStatus, VmNodeServiceProxy, VmNodeRegistration, VmNodeOrchestrationServiceProxy, VmNode, SystemOrganizationService, SystemApiPlugin, SingleLoggerLevelsDescriptor, SYSTEM_API_ZONE, LoggersDescriptor, LoggerLevelsDescriptor, LogManager, LogLevel, KinoticNodeInfo, KinoticClusterInfoService, KinoticClusterInfo, IWorkloadService, IWorkloadOrchestrationService, IVmNodeService, ISystemOrganizationService, ISystemApiExtension, ILogManager, IKinoticClusterInfoService, GroupLoggerLevelsDescriptor };
|
package/dist/index.js
CHANGED
|
@@ -1,28 +1,6 @@
|
|
|
1
1
|
// packages/system-api/src/index.ts
|
|
2
2
|
import { SYSTEM_API_ZONE as SYSTEM_API_ZONE8 } from "@kinotic-ai/management-api";
|
|
3
3
|
|
|
4
|
-
// packages/system-api/src/api/model/workload/LogPolicy.ts
|
|
5
|
-
class LogPolicy {
|
|
6
|
-
maxSizeMb = 10;
|
|
7
|
-
maxFiles = 3;
|
|
8
|
-
}
|
|
9
|
-
// packages/system-api/src/api/model/workload/NetworkMode.ts
|
|
10
|
-
var NetworkMode;
|
|
11
|
-
((NetworkMode2) => {
|
|
12
|
-
NetworkMode2["ENABLED"] = "ENABLED";
|
|
13
|
-
NetworkMode2["DISABLED"] = "DISABLED";
|
|
14
|
-
})(NetworkMode ||= {});
|
|
15
|
-
// packages/system-api/src/api/model/workload/NetworkPolicy.ts
|
|
16
|
-
class NetworkPolicy {
|
|
17
|
-
mode = "ENABLED" /* ENABLED */;
|
|
18
|
-
allowedHosts = [];
|
|
19
|
-
}
|
|
20
|
-
// packages/system-api/src/api/model/workload/PortProtocol.ts
|
|
21
|
-
var PortProtocol;
|
|
22
|
-
((PortProtocol2) => {
|
|
23
|
-
PortProtocol2["TCP"] = "TCP";
|
|
24
|
-
PortProtocol2["UDP"] = "UDP";
|
|
25
|
-
})(PortProtocol ||= {});
|
|
26
4
|
// packages/system-api/src/api/model/workload/VmNodeStatusType.ts
|
|
27
5
|
var VmNodeStatusType;
|
|
28
6
|
((VmNodeStatusType2) => {
|
|
@@ -65,48 +43,6 @@ class VmNode {
|
|
|
65
43
|
this.hostname = hostname;
|
|
66
44
|
}
|
|
67
45
|
}
|
|
68
|
-
// packages/system-api/src/api/model/workload/WorkloadStatus.ts
|
|
69
|
-
var WorkloadStatus;
|
|
70
|
-
((WorkloadStatus2) => {
|
|
71
|
-
WorkloadStatus2["PENDING"] = "PENDING";
|
|
72
|
-
WorkloadStatus2["STARTING"] = "STARTING";
|
|
73
|
-
WorkloadStatus2["RUNNING"] = "RUNNING";
|
|
74
|
-
WorkloadStatus2["STOPPING"] = "STOPPING";
|
|
75
|
-
WorkloadStatus2["STOPPED"] = "STOPPED";
|
|
76
|
-
WorkloadStatus2["FAILED"] = "FAILED";
|
|
77
|
-
})(WorkloadStatus ||= {});
|
|
78
|
-
|
|
79
|
-
// packages/system-api/src/api/model/workload/Workload.ts
|
|
80
|
-
class Workload {
|
|
81
|
-
id = null;
|
|
82
|
-
name;
|
|
83
|
-
description;
|
|
84
|
-
nodeId = null;
|
|
85
|
-
organizationId = null;
|
|
86
|
-
applicationId = null;
|
|
87
|
-
image;
|
|
88
|
-
vcpus = 1;
|
|
89
|
-
memoryMb = 512;
|
|
90
|
-
diskSizeMb = 1024;
|
|
91
|
-
network = new NetworkPolicy;
|
|
92
|
-
logPolicy = new LogPolicy;
|
|
93
|
-
detached = true;
|
|
94
|
-
autoRemove = false;
|
|
95
|
-
status = "PENDING" /* PENDING */;
|
|
96
|
-
exitCode = null;
|
|
97
|
-
environment = {};
|
|
98
|
-
secrets = {};
|
|
99
|
-
portMappings = [];
|
|
100
|
-
volumeMounts = [];
|
|
101
|
-
entrypoint = [];
|
|
102
|
-
cmd = [];
|
|
103
|
-
created = null;
|
|
104
|
-
updated = null;
|
|
105
|
-
constructor(name, image) {
|
|
106
|
-
this.name = name;
|
|
107
|
-
this.image = image;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
46
|
// packages/system-api/src/api/model/VmNodeRegistration.ts
|
|
111
47
|
class VmNodeRegistration {
|
|
112
48
|
id;
|
|
@@ -344,10 +280,8 @@ class KinoticNodeInfo {
|
|
|
344
280
|
version = "";
|
|
345
281
|
}
|
|
346
282
|
export {
|
|
347
|
-
WorkloadStatus,
|
|
348
283
|
WorkloadServiceProxy,
|
|
349
284
|
WorkloadOrchestrationService,
|
|
350
|
-
Workload,
|
|
351
285
|
VmProviderType,
|
|
352
286
|
VmNodeStatusType,
|
|
353
287
|
VmNodeStatus,
|
|
@@ -359,12 +293,8 @@ export {
|
|
|
359
293
|
SystemApiPlugin,
|
|
360
294
|
SingleLoggerLevelsDescriptor,
|
|
361
295
|
SYSTEM_API_ZONE8 as SYSTEM_API_ZONE,
|
|
362
|
-
PortProtocol,
|
|
363
|
-
NetworkPolicy,
|
|
364
|
-
NetworkMode,
|
|
365
296
|
LoggersDescriptor,
|
|
366
297
|
LoggerLevelsDescriptor,
|
|
367
|
-
LogPolicy,
|
|
368
298
|
LogManager,
|
|
369
299
|
LogLevel,
|
|
370
300
|
KinoticNodeInfo,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kinotic-ai/system-api",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Client API for the Kinotic platform's system plane: the workload and node orchestration services platform machines and operators use.",
|
|
6
6
|
"files": [
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"coverage": "bun test --coverage --pass-with-no-tests"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@kinotic-ai/management-api": "5.0.0-beta.
|
|
41
|
+
"@kinotic-ai/management-api": "5.0.0-beta.23"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"@kinotic-ai/core": ">=5.0.0-beta.8"
|