@highstate/library 0.9.16 → 0.9.18
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/highstate.library.msgpack +0 -0
- package/dist/index.js +727 -548
- package/dist/index.js.map +1 -1
- package/package.json +4 -5
- package/src/apps/code-server.ts +5 -5
- package/src/apps/deployment.ts +20 -20
- package/src/apps/dns.ts +12 -12
- package/src/apps/gitea.ts +2 -2
- package/src/apps/grocy.ts +2 -2
- package/src/apps/hubble.ts +2 -2
- package/src/apps/kubernetes-dashboard.ts +2 -2
- package/src/apps/mariadb.ts +10 -10
- package/src/apps/maybe.ts +5 -5
- package/src/apps/mongodb.ts +10 -10
- package/src/apps/network.ts +6 -6
- package/src/apps/postgresql.ts +10 -10
- package/src/apps/shared.ts +16 -17
- package/src/apps/syncthing.ts +6 -6
- package/src/apps/traefik.ts +4 -4
- package/src/apps/vaultwarden.ts +4 -4
- package/src/apps/zitadel.ts +2 -2
- package/src/cloudflare.ts +4 -4
- package/src/common.ts +24 -24
- package/src/distributions/ubuntu.ts +8 -8
- package/src/dns.ts +10 -10
- package/src/files.ts +53 -64
- package/src/git.ts +7 -7
- package/src/k3s.ts +9 -9
- package/src/k8s.ts +118 -119
- package/src/mullvad.ts +5 -5
- package/src/network.ts +44 -44
- package/src/nixos.ts +15 -69
- package/src/obfuscators/phantun.ts +4 -4
- package/src/obfuscators/shared.ts +9 -9
- package/src/proxmox.ts +179 -59
- package/src/restic.ts +14 -14
- package/src/sops.ts +4 -4
- package/src/ssh.ts +19 -19
- package/src/talos.ts +15 -15
- package/src/timeweb.ts +13 -13
- package/src/utils.ts +3 -3
- package/src/wireguard.ts +82 -71
package/src/proxmox.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { defineEntity, defineUnit,
|
1
|
+
import { defineEntity, defineUnit, z } from "@highstate/contract"
|
2
2
|
import { checksumSchema, fileEntity, serverOutputs } from "./common"
|
3
3
|
import { credentialsSchema, keyPairEntity } from "./ssh"
|
4
4
|
import { l7EndpointEntity } from "./network"
|
@@ -6,18 +6,18 @@ import { l7EndpointEntity } from "./network"
|
|
6
6
|
export const clusterEntity = defineEntity({
|
7
7
|
type: "proxmox.cluster",
|
8
8
|
|
9
|
-
schema:
|
9
|
+
schema: z.object({
|
10
10
|
endpoint: l7EndpointEntity.schema,
|
11
|
-
insecure:
|
12
|
-
username:
|
11
|
+
insecure: z.boolean().optional(),
|
12
|
+
username: z.string().optional(),
|
13
13
|
|
14
|
-
defaultNodeName:
|
15
|
-
defaultDatastoreId:
|
14
|
+
defaultNodeName: z.string(),
|
15
|
+
defaultDatastoreId: z.string(),
|
16
16
|
|
17
|
-
password:
|
18
|
-
apiToken:
|
17
|
+
password: z.string().optional(),
|
18
|
+
apiToken: z.string().optional(),
|
19
19
|
|
20
|
-
ssh:
|
20
|
+
ssh: credentialsSchema.optional(),
|
21
21
|
}),
|
22
22
|
|
23
23
|
meta: {
|
@@ -28,8 +28,8 @@ export const clusterEntity = defineEntity({
|
|
28
28
|
export const imageEntity = defineEntity({
|
29
29
|
type: "proxmox.image",
|
30
30
|
|
31
|
-
schema:
|
32
|
-
id:
|
31
|
+
schema: z.object({
|
32
|
+
id: z.string(),
|
33
33
|
}),
|
34
34
|
|
35
35
|
meta: {
|
@@ -44,47 +44,47 @@ export const connection = defineUnit({
|
|
44
44
|
/**
|
45
45
|
* The endpoint of the Proxmox API.
|
46
46
|
*/
|
47
|
-
endpoint:
|
47
|
+
endpoint: z.string(),
|
48
48
|
|
49
49
|
/**
|
50
50
|
* Whether to allow insecure connections to the Proxmox API.
|
51
51
|
*/
|
52
|
-
insecure:
|
52
|
+
insecure: z.boolean().optional(),
|
53
53
|
|
54
54
|
/**
|
55
55
|
* The username to use for the Proxmox API.
|
56
56
|
*
|
57
57
|
* Only required for password token authentication.
|
58
58
|
*/
|
59
|
-
username:
|
59
|
+
username: z.string().optional(),
|
60
60
|
|
61
61
|
/**
|
62
62
|
* The name of the default Proxmox node to use for operations.
|
63
63
|
*
|
64
64
|
* If not specified, the first node in the cluster will be used.
|
65
65
|
*/
|
66
|
-
defaultNodeName:
|
66
|
+
defaultNodeName: z.string().optional(),
|
67
67
|
|
68
68
|
/**
|
69
69
|
* The ID of the default Proxmox datastore to use for operations.
|
70
70
|
*
|
71
71
|
* If not specified, the first datastore in the cluster will be used.
|
72
72
|
*/
|
73
|
-
defaultDatastoreId:
|
73
|
+
defaultDatastoreId: z.string().optional(),
|
74
74
|
|
75
75
|
/**
|
76
76
|
* The username to use for SSH connections to the Proxmox nodes.
|
77
77
|
*
|
78
78
|
* By default, this is set to "root".
|
79
79
|
*/
|
80
|
-
sshUser:
|
80
|
+
sshUser: z.string().default("root"),
|
81
81
|
|
82
82
|
/**
|
83
83
|
* The port to use for SSH connections to the Proxmox nodes.
|
84
84
|
*
|
85
85
|
* By default, this is set to 22.
|
86
86
|
*/
|
87
|
-
sshPort:
|
87
|
+
sshPort: z.number().default(22),
|
88
88
|
},
|
89
89
|
|
90
90
|
secrets: {
|
@@ -94,9 +94,9 @@ export const connection = defineUnit({
|
|
94
94
|
* Requires `username` to be set.
|
95
95
|
*/
|
96
96
|
password: {
|
97
|
-
schema:
|
97
|
+
schema: z.string().optional(),
|
98
98
|
meta: {
|
99
|
-
|
99
|
+
title: "Proxmox Password",
|
100
100
|
},
|
101
101
|
},
|
102
102
|
|
@@ -104,16 +104,16 @@ export const connection = defineUnit({
|
|
104
104
|
* The Proxmox API token to use for authentication.
|
105
105
|
*/
|
106
106
|
apiToken: {
|
107
|
-
schema:
|
107
|
+
schema: z.string().optional(),
|
108
108
|
meta: {
|
109
|
-
|
109
|
+
title: "Proxmox API Token",
|
110
110
|
},
|
111
111
|
},
|
112
112
|
|
113
113
|
/**
|
114
114
|
* The SSH password to use for connecting to the Proxmox nodes.
|
115
115
|
*/
|
116
|
-
sshPassword:
|
116
|
+
sshPassword: z.string().optional(),
|
117
117
|
},
|
118
118
|
|
119
119
|
inputs: {
|
@@ -131,11 +131,11 @@ export const connection = defineUnit({
|
|
131
131
|
},
|
132
132
|
|
133
133
|
meta: {
|
134
|
-
|
134
|
+
title: "Proxmox Connection",
|
135
135
|
description: "The connection to an existing Proxmox cluster.",
|
136
136
|
category: "Proxmox",
|
137
|
-
|
138
|
-
|
137
|
+
icon: "simple-icons:proxmox",
|
138
|
+
iconColor: "#e56901",
|
139
139
|
},
|
140
140
|
|
141
141
|
source: {
|
@@ -154,31 +154,31 @@ export const image = defineUnit({
|
|
154
154
|
* If not specified, the default name is `<unitName>-<sha256>.<extension>`
|
155
155
|
* or `<unitName>.<extension>` if `sha256` is not provided.
|
156
156
|
*/
|
157
|
-
fileName:
|
157
|
+
fileName: z.string().optional(),
|
158
158
|
|
159
159
|
/**
|
160
160
|
* The URL of the image to upload.
|
161
161
|
*/
|
162
|
-
url:
|
162
|
+
url: z.string().optional(),
|
163
163
|
|
164
164
|
/**
|
165
165
|
* The checksum of the image file to verify.
|
166
166
|
*/
|
167
|
-
checksum:
|
167
|
+
checksum: checksumSchema.optional(),
|
168
168
|
|
169
169
|
/**
|
170
170
|
* The name of the Proxmox node to upload the image to.
|
171
171
|
*
|
172
172
|
* If not specified, the default node name from the cluster will be used.
|
173
173
|
*/
|
174
|
-
nodeName:
|
174
|
+
nodeName: z.string().optional(),
|
175
175
|
|
176
176
|
/**
|
177
177
|
* The ID of the Proxmox datastore to upload the image to.
|
178
178
|
*
|
179
179
|
* If not specified, the default datastore ID from the cluster will be used.
|
180
180
|
*/
|
181
|
-
datastoreId:
|
181
|
+
datastoreId: z.string().optional(),
|
182
182
|
},
|
183
183
|
|
184
184
|
inputs: {
|
@@ -203,11 +203,11 @@ export const image = defineUnit({
|
|
203
203
|
},
|
204
204
|
|
205
205
|
meta: {
|
206
|
-
|
206
|
+
title: "Proxmox Image",
|
207
207
|
description: "The image to upload to a Proxmox cluster.",
|
208
208
|
category: "Proxmox",
|
209
|
-
|
210
|
-
|
209
|
+
icon: "simple-icons:proxmox",
|
210
|
+
iconColor: "#e56901",
|
211
211
|
secondaryIcon: "mage:compact-disk-fill",
|
212
212
|
},
|
213
213
|
|
@@ -221,7 +221,7 @@ export const existingImage = defineUnit({
|
|
221
221
|
type: "proxmox.existing-image",
|
222
222
|
|
223
223
|
args: {
|
224
|
-
id:
|
224
|
+
id: z.string(),
|
225
225
|
},
|
226
226
|
|
227
227
|
inputs: {
|
@@ -233,11 +233,11 @@ export const existingImage = defineUnit({
|
|
233
233
|
},
|
234
234
|
|
235
235
|
meta: {
|
236
|
-
|
236
|
+
title: "Proxmox Existing Image",
|
237
237
|
description: "The existing image on a Proxmox cluster.",
|
238
238
|
category: "Proxmox",
|
239
|
-
|
240
|
-
|
239
|
+
icon: "simple-icons:proxmox",
|
240
|
+
iconColor: "#e56901",
|
241
241
|
secondaryIcon: "mage:compact-disk-fill",
|
242
242
|
},
|
243
243
|
|
@@ -251,35 +251,155 @@ export const virtualMachine = defineUnit({
|
|
251
251
|
type: "proxmox.virtual-machine",
|
252
252
|
|
253
253
|
args: {
|
254
|
-
|
254
|
+
/**
|
255
|
+
* The name of the node to create the virtual machine on.
|
256
|
+
*
|
257
|
+
* If not specified, the default node name from the cluster will be used.
|
258
|
+
*/
|
259
|
+
nodeName: z.string().optional(),
|
255
260
|
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
261
|
+
/**
|
262
|
+
* The ID of the Proxmox datastore to create the virtual machine on.
|
263
|
+
*
|
264
|
+
* If not specified, the default datastore ID from the cluster will be used.
|
265
|
+
*/
|
266
|
+
datastoreId: z.string().optional(),
|
260
267
|
|
261
268
|
/**
|
262
|
-
* The
|
269
|
+
* The type of CPU to use for the virtual machine.
|
263
270
|
*
|
264
|
-
*
|
271
|
+
* By default, this is set to "host" which offers the best performance.
|
265
272
|
*/
|
266
|
-
|
267
|
-
ipv4Gateway: Type.Optional(Type.String()),
|
268
|
-
dns: Type.Optional(Type.Array(Type.String())),
|
273
|
+
cpuType: z.string().default("host"),
|
269
274
|
|
270
|
-
|
271
|
-
|
272
|
-
|
275
|
+
/**
|
276
|
+
* The resources to allocate to the virtual machine.
|
277
|
+
*/
|
278
|
+
resources: z
|
279
|
+
.object({
|
280
|
+
/**
|
281
|
+
* The number of CPU cores to allocate to the virtual machine.
|
282
|
+
*
|
283
|
+
* By default, this is set to 1.
|
284
|
+
*/
|
285
|
+
cores: z.number(),
|
286
|
+
|
287
|
+
/**
|
288
|
+
* The number of CPU sockets to allocate to the virtual machine.
|
289
|
+
*
|
290
|
+
* By default, this is set to 1.
|
291
|
+
*/
|
292
|
+
sockets: z.number(),
|
293
|
+
|
294
|
+
/**
|
295
|
+
* The amount of dedicated memory to allocate to the virtual machine, in MB.
|
296
|
+
*
|
297
|
+
* By default, this is set to 512 MB.
|
298
|
+
*/
|
299
|
+
memory: z.number(),
|
300
|
+
|
301
|
+
/**
|
302
|
+
* The size of the disk to create for the virtual machine, in GB.
|
303
|
+
*
|
304
|
+
* By default, this is set to 8 GB.
|
305
|
+
*/
|
306
|
+
diskSize: z.number(),
|
307
|
+
})
|
308
|
+
.default({
|
309
|
+
cores: 1,
|
310
|
+
sockets: 1,
|
311
|
+
memory: 512,
|
312
|
+
diskSize: 8,
|
313
|
+
}),
|
273
314
|
|
274
|
-
|
275
|
-
|
315
|
+
/**
|
316
|
+
* The IPv4 address configuration for the virtual machine.
|
317
|
+
*/
|
318
|
+
ipv4: z
|
319
|
+
.discriminatedUnion("type", [
|
320
|
+
z.object({
|
321
|
+
type: z.literal("dhcp"),
|
322
|
+
}),
|
323
|
+
z.object({
|
324
|
+
type: z.literal("static"),
|
325
|
+
|
326
|
+
/**
|
327
|
+
* The IPv4 address to assign to the virtual machine.
|
328
|
+
*/
|
329
|
+
address: z.string(),
|
330
|
+
|
331
|
+
/**
|
332
|
+
* The CIDR prefix for the IPv4 address.
|
333
|
+
*
|
334
|
+
* By default, this is set to 24.
|
335
|
+
*/
|
336
|
+
prefix: z.number().default(24),
|
337
|
+
|
338
|
+
/**
|
339
|
+
* The IPv4 gateway for the virtual machine.
|
340
|
+
*
|
341
|
+
* If not specified, will be set to the first address in the subnet.
|
342
|
+
*/
|
343
|
+
gateway: z.string().optional(),
|
344
|
+
}),
|
345
|
+
])
|
346
|
+
.default({ type: "dhcp" }),
|
276
347
|
|
277
|
-
|
278
|
-
|
348
|
+
/**
|
349
|
+
* The network configuration for the virtual machine.
|
350
|
+
*/
|
351
|
+
network: z
|
352
|
+
.object({
|
353
|
+
/**
|
354
|
+
* The list of DNS servers to use for the virtual machine.
|
355
|
+
*/
|
356
|
+
dns: z.string().array(),
|
357
|
+
|
358
|
+
/**
|
359
|
+
* The name of the network bridge to connect the virtual machine to.
|
360
|
+
*
|
361
|
+
* By default, this is set to "vmbr0".
|
362
|
+
*/
|
363
|
+
bridge: z.string(),
|
364
|
+
})
|
365
|
+
.default({ dns: [], bridge: "vmbr0" }),
|
366
|
+
|
367
|
+
/**
|
368
|
+
* The SSH configuration for the virtual machine.
|
369
|
+
*/
|
370
|
+
ssh: z
|
371
|
+
.object({
|
372
|
+
/**
|
373
|
+
* The port to use for SSH connections to the virtual machine.
|
374
|
+
*
|
375
|
+
* By default, this is set to 22.
|
376
|
+
*/
|
377
|
+
port: z.number(),
|
378
|
+
|
379
|
+
/**
|
380
|
+
* The user to use for SSH connections to the virtual machine.
|
381
|
+
*
|
382
|
+
* By default, this is set to "root".
|
383
|
+
*/
|
384
|
+
user: z.string(),
|
385
|
+
})
|
386
|
+
.default({ port: 22, user: "root" }),
|
387
|
+
|
388
|
+
/**
|
389
|
+
* Whether to wait for the Proxmox agent to be ready before returning.
|
390
|
+
*/
|
391
|
+
waitForAgent: z.boolean().default(true),
|
392
|
+
|
393
|
+
/**
|
394
|
+
* The cloud-init vendor data to use for the virtual machine.
|
395
|
+
*
|
396
|
+
* Will take precedence over the `vendorData` input.
|
397
|
+
*/
|
398
|
+
vendorData: z.string().optional().meta({ multiline: true }),
|
279
399
|
},
|
280
400
|
|
281
401
|
secrets: {
|
282
|
-
sshPassword:
|
402
|
+
sshPassword: z.string().optional(),
|
283
403
|
},
|
284
404
|
|
285
405
|
inputs: {
|
@@ -305,11 +425,11 @@ export const virtualMachine = defineUnit({
|
|
305
425
|
outputs: serverOutputs,
|
306
426
|
|
307
427
|
meta: {
|
308
|
-
|
428
|
+
title: "Proxmox Virtual Machine",
|
309
429
|
description: "The virtual machine on a Proxmox cluster.",
|
310
430
|
category: "Proxmox",
|
311
|
-
|
312
|
-
|
431
|
+
icon: "simple-icons:proxmox",
|
432
|
+
iconColor: "#e56901",
|
313
433
|
secondaryIcon: "codicon:vm",
|
314
434
|
},
|
315
435
|
|
package/src/restic.ts
CHANGED
@@ -1,16 +1,16 @@
|
|
1
|
-
import { defineEntity, defineUnit,
|
1
|
+
import { defineEntity, defineUnit, z } from "@highstate/contract"
|
2
2
|
import { l3EndpointEntity, l4EndpointEntity } from "./network"
|
3
3
|
|
4
4
|
export const repositoryEntity = defineEntity({
|
5
5
|
type: "restic.repository",
|
6
6
|
|
7
|
-
schema:
|
8
|
-
remoteEndpoints:
|
7
|
+
schema: z.object({
|
8
|
+
remoteEndpoints: z.union([l3EndpointEntity.schema, l4EndpointEntity.schema]).array(),
|
9
9
|
|
10
|
-
type:
|
11
|
-
rcloneConfig:
|
12
|
-
remoteName:
|
13
|
-
pathPattern:
|
10
|
+
type: z.literal("rclone"),
|
11
|
+
rcloneConfig: z.string(),
|
12
|
+
remoteName: z.string(),
|
13
|
+
pathPattern: z.string(),
|
14
14
|
}),
|
15
15
|
|
16
16
|
meta: {
|
@@ -22,7 +22,7 @@ export const repo = defineUnit({
|
|
22
22
|
type: "restic.repo",
|
23
23
|
|
24
24
|
args: {
|
25
|
-
remoteEndpoints:
|
25
|
+
remoteEndpoints: z.string().array().default([]),
|
26
26
|
|
27
27
|
/**
|
28
28
|
* The pattern for the path where backups will be stored for the specific application.
|
@@ -35,11 +35,11 @@ export const repo = defineUnit({
|
|
35
35
|
*
|
36
36
|
* By default, the path pattern is `backups/$clusterName/$appName`.
|
37
37
|
*/
|
38
|
-
pathPattern:
|
38
|
+
pathPattern: z.string().default("backups/$clusterName/$appName"),
|
39
39
|
},
|
40
40
|
|
41
41
|
secrets: {
|
42
|
-
rcloneConfig:
|
42
|
+
rcloneConfig: z.string(),
|
43
43
|
},
|
44
44
|
|
45
45
|
inputs: {
|
@@ -60,10 +60,10 @@ export const repo = defineUnit({
|
|
60
60
|
},
|
61
61
|
|
62
62
|
meta: {
|
63
|
-
|
63
|
+
title: "Restic Repo",
|
64
64
|
description: "Holds the configuration for a Restic repository and its remote storage.",
|
65
|
-
|
66
|
-
|
65
|
+
iconColor: "#e56901",
|
66
|
+
icon: "material-symbols:backup",
|
67
67
|
category: "Infrastructure",
|
68
68
|
},
|
69
69
|
|
@@ -73,4 +73,4 @@ export const repo = defineUnit({
|
|
73
73
|
},
|
74
74
|
})
|
75
75
|
|
76
|
-
export type Repository =
|
76
|
+
export type Repository = z.infer<typeof repositoryEntity.schema>
|
package/src/sops.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { defineUnit,
|
1
|
+
import { defineUnit, z } from "@highstate/contract"
|
2
2
|
import { fileEntity } from "./files"
|
3
3
|
import { serverEntity } from "./common"
|
4
4
|
|
@@ -6,7 +6,7 @@ export const secrets = defineUnit({
|
|
6
6
|
type: "sops.secrets",
|
7
7
|
|
8
8
|
secrets: {
|
9
|
-
data:
|
9
|
+
data: z.record(z.string(), z.any()),
|
10
10
|
},
|
11
11
|
|
12
12
|
inputs: {
|
@@ -22,9 +22,9 @@ export const secrets = defineUnit({
|
|
22
22
|
},
|
23
23
|
|
24
24
|
meta: {
|
25
|
-
|
25
|
+
title: "SOPS Secrets",
|
26
26
|
description: "Encrypts secrets using SOPS for the specified servers.",
|
27
|
-
|
27
|
+
icon: "mdi:file-lock",
|
28
28
|
category: "Secrets",
|
29
29
|
},
|
30
30
|
|
package/src/ssh.ts
CHANGED
@@ -1,17 +1,17 @@
|
|
1
|
-
import { defineEntity, defineUnit,
|
1
|
+
import { defineEntity, defineUnit, z } from "@highstate/contract"
|
2
2
|
import { l4EndpointEntity } from "./network"
|
3
3
|
import { fileEntity } from "./files"
|
4
4
|
|
5
|
-
export const keyTypeSchema =
|
5
|
+
export const keyTypeSchema = z.enum(["ed25519"])
|
6
6
|
|
7
7
|
export const keyPairEntity = defineEntity({
|
8
8
|
type: "ssh.key-pair",
|
9
9
|
|
10
|
-
schema:
|
10
|
+
schema: z.object({
|
11
11
|
type: keyTypeSchema,
|
12
|
-
fingerprint:
|
13
|
-
publicKey:
|
14
|
-
privateKey:
|
12
|
+
fingerprint: z.string(),
|
13
|
+
publicKey: z.string(),
|
14
|
+
privateKey: z.string(),
|
15
15
|
}),
|
16
16
|
|
17
17
|
meta: {
|
@@ -19,19 +19,19 @@ export const keyPairEntity = defineEntity({
|
|
19
19
|
},
|
20
20
|
})
|
21
21
|
|
22
|
-
export const credentialsSchema =
|
23
|
-
endpoints:
|
24
|
-
hostKey:
|
25
|
-
user:
|
26
|
-
password:
|
27
|
-
keyPair:
|
22
|
+
export const credentialsSchema = z.object({
|
23
|
+
endpoints: l4EndpointEntity.schema.array(),
|
24
|
+
hostKey: z.string(),
|
25
|
+
user: z.string(),
|
26
|
+
password: z.string().optional(),
|
27
|
+
keyPair: keyPairEntity.schema.optional(),
|
28
28
|
})
|
29
29
|
|
30
30
|
export const keyPair = defineUnit({
|
31
31
|
type: "ssh.key-pair",
|
32
32
|
|
33
33
|
secrets: {
|
34
|
-
privateKey:
|
34
|
+
privateKey: z.string().optional(),
|
35
35
|
},
|
36
36
|
|
37
37
|
outputs: {
|
@@ -40,11 +40,11 @@ export const keyPair = defineUnit({
|
|
40
40
|
},
|
41
41
|
|
42
42
|
meta: {
|
43
|
-
|
43
|
+
title: "SSH Key Pair",
|
44
44
|
description: "Holds the ED25519 SSH key pair and generates the private key if not provided.",
|
45
45
|
category: "ssh",
|
46
|
-
|
47
|
-
|
46
|
+
icon: "charm:key",
|
47
|
+
iconColor: "#ffffff",
|
48
48
|
secondaryIcon: "mdi:lock",
|
49
49
|
secondaryIconColor: "#ffffff",
|
50
50
|
},
|
@@ -55,6 +55,6 @@ export const keyPair = defineUnit({
|
|
55
55
|
},
|
56
56
|
})
|
57
57
|
|
58
|
-
export type KeyType =
|
59
|
-
export type Credentials =
|
60
|
-
export type KeyPair =
|
58
|
+
export type KeyType = z.infer<typeof keyTypeSchema>
|
59
|
+
export type Credentials = z.infer<typeof credentialsSchema>
|
60
|
+
export type KeyPair = z.infer<typeof keyPairEntity.schema>
|
package/src/talos.ts
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
import { defineEntity, defineUnit,
|
1
|
+
import { defineEntity, defineUnit, z } from "@highstate/contract"
|
2
2
|
import { clusterInputs, clusterOutputs, scheduleOnMastersPolicyArgs } from "./k8s"
|
3
3
|
|
4
4
|
export const clusterEntity = defineEntity({
|
5
5
|
type: "talos.cluster",
|
6
6
|
|
7
|
-
schema:
|
8
|
-
clientConfiguration:
|
9
|
-
machineSecrets:
|
7
|
+
schema: z.object({
|
8
|
+
clientConfiguration: z.string(),
|
9
|
+
machineSecrets: z.string(),
|
10
10
|
}),
|
11
11
|
|
12
12
|
meta: {
|
@@ -14,8 +14,8 @@ export const clusterEntity = defineEntity({
|
|
14
14
|
},
|
15
15
|
})
|
16
16
|
|
17
|
-
export const cniSchema =
|
18
|
-
export const csiSchema =
|
17
|
+
export const cniSchema = z.enum(["none", "cilium", "flannel"])
|
18
|
+
export const csiSchema = z.enum(["none", "local-path-provisioner"])
|
19
19
|
|
20
20
|
export const cluster = defineUnit({
|
21
21
|
type: "talos.cluster",
|
@@ -28,7 +28,7 @@ export const cluster = defineUnit({
|
|
28
28
|
*
|
29
29
|
* By default, the name of the instance is used.
|
30
30
|
*/
|
31
|
-
clusterName:
|
31
|
+
clusterName: z.string().optional(),
|
32
32
|
|
33
33
|
/**
|
34
34
|
* The CNI plugin to use.
|
@@ -40,7 +40,7 @@ export const cluster = defineUnit({
|
|
40
40
|
*
|
41
41
|
* The "cilium" CNI plugin is recommended to cover advanced network policies like FQDNs.
|
42
42
|
*/
|
43
|
-
cni:
|
43
|
+
cni: cniSchema.default("cilium"),
|
44
44
|
|
45
45
|
/**
|
46
46
|
* The CSI plugin to use.
|
@@ -49,25 +49,25 @@ export const cluster = defineUnit({
|
|
49
49
|
* - "local-path-provisioner" (default)
|
50
50
|
* - "none" (disable CSI, must be installed manually if needed)
|
51
51
|
*/
|
52
|
-
csi:
|
52
|
+
csi: csiSchema.default("local-path-provisioner"),
|
53
53
|
|
54
54
|
/**
|
55
55
|
* The shared configuration patch.
|
56
56
|
* It will be applied to all nodes.
|
57
57
|
*/
|
58
|
-
sharedConfigPatch:
|
58
|
+
sharedConfigPatch: z.record(z.string(), z.any()).optional(),
|
59
59
|
|
60
60
|
/**
|
61
61
|
* The master configuration patch.
|
62
62
|
* It will be applied to all master nodes.
|
63
63
|
*/
|
64
|
-
masterConfigPatch:
|
64
|
+
masterConfigPatch: z.record(z.string(), z.any()).optional(),
|
65
65
|
|
66
66
|
/**
|
67
67
|
* The worker configuration patch.
|
68
68
|
* It will be applied to all worker nodes.
|
69
69
|
*/
|
70
|
-
workerConfigPatch:
|
70
|
+
workerConfigPatch: z.record(z.string(), z.any()).optional(),
|
71
71
|
|
72
72
|
/**
|
73
73
|
* Whether to enable the Tun device plugin.
|
@@ -76,7 +76,7 @@ export const cluster = defineUnit({
|
|
76
76
|
*
|
77
77
|
* By default, this option is set to true.
|
78
78
|
*/
|
79
|
-
enableTunDevicePlugin:
|
79
|
+
enableTunDevicePlugin: z.boolean().default(true),
|
80
80
|
},
|
81
81
|
|
82
82
|
inputs: clusterInputs,
|
@@ -87,11 +87,11 @@ export const cluster = defineUnit({
|
|
87
87
|
},
|
88
88
|
|
89
89
|
meta: {
|
90
|
-
|
90
|
+
title: "Talos Cluster",
|
91
91
|
description: "A Kubernetes cluster managed by Talos.",
|
92
92
|
category: "Talos",
|
93
93
|
color: "#2d2d2d",
|
94
|
-
|
94
|
+
icon: "simple-icons:talos",
|
95
95
|
secondaryIcon: "devicon:kubernetes",
|
96
96
|
},
|
97
97
|
|