@highstate/library 0.9.18 → 0.9.20

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 (79) hide show
  1. package/dist/highstate.library.msgpack +0 -0
  2. package/dist/index.js +3684 -3126
  3. package/dist/index.js.map +1 -1
  4. package/package.json +5 -4
  5. package/src/common/access-point.ts +105 -0
  6. package/src/{files.ts → common/files.ts} +10 -8
  7. package/src/common/index.ts +3 -0
  8. package/src/{common.ts → common/server.ts} +69 -38
  9. package/src/databases/index.ts +4 -0
  10. package/src/databases/mariadb.ts +37 -0
  11. package/src/databases/mongodb.ts +37 -0
  12. package/src/databases/postgresql.ts +37 -0
  13. package/src/databases/shared.ts +61 -0
  14. package/src/distributions/ubuntu.ts +6 -4
  15. package/src/dns.ts +110 -12
  16. package/src/git.ts +7 -3
  17. package/src/impl-ref.ts +26 -0
  18. package/src/index.ts +14 -15
  19. package/src/k3s.ts +7 -5
  20. package/src/k8s/apps/code-server.ts +48 -0
  21. package/src/k8s/apps/gitea.ts +25 -0
  22. package/src/k8s/apps/grocy.ts +39 -0
  23. package/src/k8s/apps/hubble.ts +30 -0
  24. package/src/{apps → k8s/apps}/index.ts +16 -13
  25. package/src/k8s/apps/kubernetes-dashboard.ts +28 -0
  26. package/src/k8s/apps/mariadb.ts +83 -0
  27. package/src/k8s/apps/maybe.ts +39 -0
  28. package/src/k8s/apps/mongodb.ts +84 -0
  29. package/src/k8s/apps/postgresql.ts +86 -0
  30. package/src/k8s/apps/shared.ts +149 -0
  31. package/src/{apps → k8s/apps}/syncthing.ts +27 -9
  32. package/src/k8s/apps/traefik.ts +40 -0
  33. package/src/k8s/apps/vaultwarden.ts +31 -0
  34. package/src/k8s/apps/workload.ts +214 -0
  35. package/src/k8s/apps/zitadel.ts +26 -0
  36. package/src/k8s/cert-manager.ts +80 -0
  37. package/src/k8s/cilium.ts +64 -0
  38. package/src/k8s/gateway.ts +70 -0
  39. package/src/k8s/index.ts +9 -0
  40. package/src/{obfuscators → k8s/obfuscators}/phantun.ts +10 -6
  41. package/src/{obfuscators → k8s/obfuscators}/shared.ts +11 -5
  42. package/src/k8s/resources.ts +111 -0
  43. package/src/k8s/service.ts +65 -0
  44. package/src/{k8s.ts → k8s/shared.ts} +35 -329
  45. package/src/k8s/workload.ts +77 -0
  46. package/src/network.ts +208 -22
  47. package/src/nixos.ts +23 -8
  48. package/src/proxmox.ts +62 -75
  49. package/src/restic.ts +15 -6
  50. package/src/sops.ts +16 -5
  51. package/src/ssh.ts +107 -9
  52. package/src/talos.ts +6 -4
  53. package/src/third-party/cloudflare.ts +59 -0
  54. package/src/third-party/index.ts +4 -0
  55. package/src/{mullvad.ts → third-party/mullvad.ts} +6 -4
  56. package/src/third-party/timeweb.ts +99 -0
  57. package/src/third-party/yandex.ts +211 -0
  58. package/src/utils.ts +24 -3
  59. package/src/wireguard.ts +171 -48
  60. package/src/apps/code-server.ts +0 -34
  61. package/src/apps/deployment.ts +0 -60
  62. package/src/apps/dns.ts +0 -107
  63. package/src/apps/gitea.ts +0 -18
  64. package/src/apps/grocy.ts +0 -20
  65. package/src/apps/hubble.ts +0 -20
  66. package/src/apps/kubernetes-dashboard.ts +0 -19
  67. package/src/apps/mariadb.ts +0 -81
  68. package/src/apps/maybe.ts +0 -25
  69. package/src/apps/mongodb.ts +0 -81
  70. package/src/apps/network.ts +0 -55
  71. package/src/apps/postgresql.ts +0 -81
  72. package/src/apps/shared.ts +0 -289
  73. package/src/apps/test.ts +0 -19
  74. package/src/apps/traefik.ts +0 -36
  75. package/src/apps/vaultwarden.ts +0 -23
  76. package/src/apps/zitadel.ts +0 -21
  77. package/src/cloudflare.ts +0 -26
  78. package/src/timeweb.ts +0 -75
  79. package/src/{obfuscators → k8s/obfuscators}/index.ts +1 -1
package/src/proxmox.ts CHANGED
@@ -1,10 +1,17 @@
1
1
  import { defineEntity, defineUnit, z } from "@highstate/contract"
2
- import { checksumSchema, fileEntity, serverOutputs } from "./common"
3
- import { credentialsSchema, keyPairEntity } from "./ssh"
4
- import { l7EndpointEntity } from "./network"
2
+ import {
3
+ checksumSchema,
4
+ fileEntity,
5
+ serverEntity,
6
+ serverOutputs,
7
+ vmSecrets,
8
+ vmSshArgs,
9
+ } from "./common"
10
+ import { ipv4PrefixSchema, ipv46Schema, l7EndpointEntity } from "./network"
11
+ import * as ssh from "./ssh"
5
12
 
6
13
  export const clusterEntity = defineEntity({
7
- type: "proxmox.cluster",
14
+ type: "proxmox.cluster.v1",
8
15
 
9
16
  schema: z.object({
10
17
  endpoint: l7EndpointEntity.schema,
@@ -17,7 +24,7 @@ export const clusterEntity = defineEntity({
17
24
  password: z.string().optional(),
18
25
  apiToken: z.string().optional(),
19
26
 
20
- ssh: credentialsSchema.optional(),
27
+ ssh: ssh.connectionSchema.optional(),
21
28
  }),
22
29
 
23
30
  meta: {
@@ -26,7 +33,7 @@ export const clusterEntity = defineEntity({
26
33
  })
27
34
 
28
35
  export const imageEntity = defineEntity({
29
- type: "proxmox.image",
36
+ type: "proxmox.image.v1",
30
37
 
31
38
  schema: z.object({
32
39
  id: z.string(),
@@ -37,8 +44,11 @@ export const imageEntity = defineEntity({
37
44
  },
38
45
  })
39
46
 
47
+ /**
48
+ * The connection to an existing Proxmox cluster.
49
+ */
40
50
  export const connection = defineUnit({
41
- type: "proxmox.connection",
51
+ type: "proxmox.connection.v1",
42
52
 
43
53
  args: {
44
54
  /**
@@ -73,18 +83,9 @@ export const connection = defineUnit({
73
83
  defaultDatastoreId: z.string().optional(),
74
84
 
75
85
  /**
76
- * The username to use for SSH connections to the Proxmox nodes.
77
- *
78
- * By default, this is set to "root".
79
- */
80
- sshUser: z.string().default("root"),
81
-
82
- /**
83
- * The port to use for SSH connections to the Proxmox nodes.
84
- *
85
- * By default, this is set to 22.
86
+ * The SSH configuration to use for connecting to the Proxmox nodes.
86
87
  */
87
- sshPort: z.number().default(22),
88
+ ssh: ssh.argsSchema.prefault({}),
88
89
  },
89
90
 
90
91
  secrets: {
@@ -110,29 +111,30 @@ export const connection = defineUnit({
110
111
  },
111
112
  },
112
113
 
113
- /**
114
- * The SSH password to use for connecting to the Proxmox nodes.
115
- */
116
- sshPassword: z.string().optional(),
114
+ ...ssh.secrets,
117
115
  },
118
116
 
119
117
  inputs: {
120
- /**
121
- * The key pair to use for SSH connections to the Proxmox nodes.
122
- */
123
- sshKeyPair: {
124
- entity: keyPairEntity,
125
- required: false,
126
- },
118
+ ...ssh.inputs,
127
119
  },
128
120
 
129
121
  outputs: {
122
+ /**
123
+ * The Proxmox cluster.
124
+ */
130
125
  proxmoxCluster: clusterEntity,
126
+
127
+ /**
128
+ * The server representing the Proxmox API endpoint.
129
+ */
130
+ server: {
131
+ entity: serverEntity,
132
+ required: false,
133
+ },
131
134
  },
132
135
 
133
136
  meta: {
134
137
  title: "Proxmox Connection",
135
- description: "The connection to an existing Proxmox cluster.",
136
138
  category: "Proxmox",
137
139
  icon: "simple-icons:proxmox",
138
140
  iconColor: "#e56901",
@@ -144,8 +146,11 @@ export const connection = defineUnit({
144
146
  },
145
147
  })
146
148
 
149
+ /**
150
+ * The image to upload to a Proxmox cluster.
151
+ */
147
152
  export const image = defineUnit({
148
- type: "proxmox.image",
153
+ type: "proxmox.image.v1",
149
154
 
150
155
  args: {
151
156
  /**
@@ -204,7 +209,6 @@ export const image = defineUnit({
204
209
 
205
210
  meta: {
206
211
  title: "Proxmox Image",
207
- description: "The image to upload to a Proxmox cluster.",
208
212
  category: "Proxmox",
209
213
  icon: "simple-icons:proxmox",
210
214
  iconColor: "#e56901",
@@ -217,8 +221,11 @@ export const image = defineUnit({
217
221
  },
218
222
  })
219
223
 
224
+ /**
225
+ * The existing image on a Proxmox cluster.
226
+ */
220
227
  export const existingImage = defineUnit({
221
- type: "proxmox.existing-image",
228
+ type: "proxmox.existing-image.v1",
222
229
 
223
230
  args: {
224
231
  id: z.string(),
@@ -234,7 +241,6 @@ export const existingImage = defineUnit({
234
241
 
235
242
  meta: {
236
243
  title: "Proxmox Existing Image",
237
- description: "The existing image on a Proxmox cluster.",
238
244
  category: "Proxmox",
239
245
  icon: "simple-icons:proxmox",
240
246
  iconColor: "#e56901",
@@ -247,8 +253,11 @@ export const existingImage = defineUnit({
247
253
  },
248
254
  })
249
255
 
256
+ /**
257
+ * The virtual machine on a Proxmox cluster.
258
+ */
250
259
  export const virtualMachine = defineUnit({
251
- type: "proxmox.virtual-machine",
260
+ type: "proxmox.virtual-machine.v1",
252
261
 
253
262
  args: {
254
263
  /**
@@ -282,35 +291,30 @@ export const virtualMachine = defineUnit({
282
291
  *
283
292
  * By default, this is set to 1.
284
293
  */
285
- cores: z.number(),
294
+ cores: z.number().default(1),
286
295
 
287
296
  /**
288
297
  * The number of CPU sockets to allocate to the virtual machine.
289
298
  *
290
299
  * By default, this is set to 1.
291
300
  */
292
- sockets: z.number(),
301
+ sockets: z.number().default(1),
293
302
 
294
303
  /**
295
304
  * The amount of dedicated memory to allocate to the virtual machine, in MB.
296
305
  *
297
306
  * By default, this is set to 512 MB.
298
307
  */
299
- memory: z.number(),
308
+ memory: z.number().default(512),
300
309
 
301
310
  /**
302
311
  * The size of the disk to create for the virtual machine, in GB.
303
312
  *
304
313
  * By default, this is set to 8 GB.
305
314
  */
306
- diskSize: z.number(),
315
+ diskSize: z.number().default(8),
307
316
  })
308
- .default({
309
- cores: 1,
310
- sockets: 1,
311
- memory: 512,
312
- diskSize: 8,
313
- }),
317
+ .prefault({}),
314
318
 
315
319
  /**
316
320
  * The IPv4 address configuration for the virtual machine.
@@ -326,21 +330,21 @@ export const virtualMachine = defineUnit({
326
330
  /**
327
331
  * The IPv4 address to assign to the virtual machine.
328
332
  */
329
- address: z.string(),
333
+ address: z.ipv4(),
330
334
 
331
335
  /**
332
336
  * The CIDR prefix for the IPv4 address.
333
337
  *
334
338
  * By default, this is set to 24.
335
339
  */
336
- prefix: z.number().default(24),
340
+ prefix: ipv4PrefixSchema.default(24),
337
341
 
338
342
  /**
339
343
  * The IPv4 gateway for the virtual machine.
340
344
  *
341
345
  * If not specified, will be set to the first address in the subnet.
342
346
  */
343
- gateway: z.string().optional(),
347
+ gateway: z.ipv4().optional(),
344
348
  }),
345
349
  ])
346
350
  .default({ type: "dhcp" }),
@@ -353,37 +357,21 @@ export const virtualMachine = defineUnit({
353
357
  /**
354
358
  * The list of DNS servers to use for the virtual machine.
355
359
  */
356
- dns: z.string().array(),
360
+ dns: ipv46Schema.array().default([]),
357
361
 
358
362
  /**
359
363
  * The name of the network bridge to connect the virtual machine to.
360
364
  *
361
365
  * By default, this is set to "vmbr0".
362
366
  */
363
- bridge: z.string(),
367
+ bridge: z.string().default("vmbr0"),
364
368
  })
365
- .default({ dns: [], bridge: "vmbr0" }),
369
+ .prefault({}),
366
370
 
367
371
  /**
368
372
  * The SSH configuration for the virtual machine.
369
373
  */
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" }),
374
+ ssh: vmSshArgs,
387
375
 
388
376
  /**
389
377
  * Whether to wait for the Proxmox agent to be ready before returning.
@@ -399,18 +387,13 @@ export const virtualMachine = defineUnit({
399
387
  },
400
388
 
401
389
  secrets: {
402
- sshPassword: z.string().optional(),
390
+ ...vmSecrets,
403
391
  },
404
392
 
405
393
  inputs: {
406
394
  proxmoxCluster: clusterEntity,
407
395
  image: imageEntity,
408
396
 
409
- sshKeyPair: {
410
- entity: keyPairEntity,
411
- required: false,
412
- },
413
-
414
397
  /**
415
398
  * The cloud-init vendor data to use for the virtual machine.
416
399
  *
@@ -420,13 +403,14 @@ export const virtualMachine = defineUnit({
420
403
  entity: fileEntity,
421
404
  required: false,
422
405
  },
406
+
407
+ ...ssh.inputs,
423
408
  },
424
409
 
425
410
  outputs: serverOutputs,
426
411
 
427
412
  meta: {
428
413
  title: "Proxmox Virtual Machine",
429
- description: "The virtual machine on a Proxmox cluster.",
430
414
  category: "Proxmox",
431
415
  icon: "simple-icons:proxmox",
432
416
  iconColor: "#e56901",
@@ -438,3 +422,6 @@ export const virtualMachine = defineUnit({
438
422
  path: "virtual-machine",
439
423
  },
440
424
  })
425
+
426
+ export type Cluster = z.infer<typeof clusterEntity.schema>
427
+ export type Image = z.infer<typeof imageEntity.schema>
package/src/restic.ts CHANGED
@@ -2,7 +2,7 @@ import { defineEntity, defineUnit, z } from "@highstate/contract"
2
2
  import { l3EndpointEntity, l4EndpointEntity } from "./network"
3
3
 
4
4
  export const repositoryEntity = defineEntity({
5
- type: "restic.repository",
5
+ type: "restic.repository.v1",
6
6
 
7
7
  schema: z.object({
8
8
  remoteEndpoints: z.union([l3EndpointEntity.schema, l4EndpointEntity.schema]).array(),
@@ -18,10 +18,20 @@ export const repositoryEntity = defineEntity({
18
18
  },
19
19
  })
20
20
 
21
- export const repo = defineUnit({
22
- type: "restic.repo",
21
+ /**
22
+ * Holds the configuration for a Restic repository and its remote storage.
23
+ */
24
+ export const repository = defineUnit({
25
+ type: "restic.repository.v1",
23
26
 
24
27
  args: {
28
+ /**
29
+ * The remote endpoints of the cloud storage where the Restic repository will be stored.
30
+ *
31
+ * They will be used to create network policies to allow access to the storage.
32
+ *
33
+ * For some cloud providers, these endpoints can be automatically discovered.
34
+ */
25
35
  remoteEndpoints: z.string().array().default([]),
26
36
 
27
37
  /**
@@ -39,7 +49,7 @@ export const repo = defineUnit({
39
49
  },
40
50
 
41
51
  secrets: {
42
- rcloneConfig: z.string(),
52
+ rcloneConfig: z.string().meta({ language: "ini" }),
43
53
  },
44
54
 
45
55
  inputs: {
@@ -61,7 +71,6 @@ export const repo = defineUnit({
61
71
 
62
72
  meta: {
63
73
  title: "Restic Repo",
64
- description: "Holds the configuration for a Restic repository and its remote storage.",
65
74
  iconColor: "#e56901",
66
75
  icon: "material-symbols:backup",
67
76
  category: "Infrastructure",
@@ -69,7 +78,7 @@ export const repo = defineUnit({
69
78
 
70
79
  source: {
71
80
  package: "@highstate/restic",
72
- path: "repo",
81
+ path: "repository",
73
82
  },
74
83
  })
75
84
 
package/src/sops.ts CHANGED
@@ -1,12 +1,20 @@
1
1
  import { defineUnit, z } from "@highstate/contract"
2
- import { fileEntity } from "./files"
3
- import { serverEntity } from "./common"
2
+ import { fileEntity } from "./common/files"
3
+ import { serverEntity } from "./common/server"
4
4
 
5
+ /**
6
+ * Encrypts secrets using SOPS for the specified servers.
7
+ */
5
8
  export const secrets = defineUnit({
6
- type: "sops.secrets",
9
+ type: "sops.secrets.v1",
7
10
 
8
11
  secrets: {
9
- data: z.record(z.string(), z.any()),
12
+ /**
13
+ * The content of the SOPS secrets file.
14
+ *
15
+ * Will take precedence over the `data` input.
16
+ */
17
+ data: z.record(z.string(), z.unknown()),
10
18
  },
11
19
 
12
20
  inputs: {
@@ -15,6 +23,10 @@ export const secrets = defineUnit({
15
23
  required: false,
16
24
  multiple: true,
17
25
  },
26
+ data: {
27
+ entity: fileEntity,
28
+ required: false,
29
+ },
18
30
  },
19
31
 
20
32
  outputs: {
@@ -23,7 +35,6 @@ export const secrets = defineUnit({
23
35
 
24
36
  meta: {
25
37
  title: "SOPS Secrets",
26
- description: "Encrypts secrets using SOPS for the specified servers.",
27
38
  icon: "mdi:file-lock",
28
39
  category: "Secrets",
29
40
  },
package/src/ssh.ts CHANGED
@@ -1,16 +1,36 @@
1
- import { defineEntity, defineUnit, z } from "@highstate/contract"
2
- import { l4EndpointEntity } from "./network"
3
- import { fileEntity } from "./files"
1
+ import { $inputs, $secrets, defineEntity, defineUnit, z } from "@highstate/contract"
2
+ import { fileEntity } from "./common/files"
3
+ import { l4EndpointEntity, portSchema } from "./network"
4
4
 
5
5
  export const keyTypeSchema = z.enum(["ed25519"])
6
6
 
7
+ /**
8
+ * The entity representing an SSH key pair.
9
+ */
7
10
  export const keyPairEntity = defineEntity({
8
- type: "ssh.key-pair",
11
+ type: "ssh.key-pair.v1",
9
12
 
10
13
  schema: z.object({
14
+ /**
15
+ * The type of the SSH key.
16
+ *
17
+ * For now, only `ed25519` is supported.
18
+ */
11
19
  type: keyTypeSchema,
20
+
21
+ /**
22
+ * The fingerprint of the SSH key.
23
+ */
12
24
  fingerprint: z.string(),
25
+
26
+ /**
27
+ * The public key in OpenSSH format.
28
+ */
13
29
  publicKey: z.string(),
30
+
31
+ /**
32
+ * The private key in PEM format.
33
+ */
14
34
  privateKey: z.string(),
15
35
  }),
16
36
 
@@ -19,19 +39,97 @@ export const keyPairEntity = defineEntity({
19
39
  },
20
40
  })
21
41
 
22
- export const credentialsSchema = z.object({
42
+ /**
43
+ * The schema for the SSH connection configuration.
44
+ *
45
+ * Contains enough information to connect to an SSH server.
46
+ */
47
+ export const connectionSchema = z.object({
48
+ /**
49
+ * The list of L4 endpoints which can be used to connect to the SSH server.
50
+ */
23
51
  endpoints: l4EndpointEntity.schema.array(),
52
+
53
+ /**
54
+ * The host key of the SSH server which will be used to verify the server's identity.
55
+ */
24
56
  hostKey: z.string(),
57
+
58
+ /**
59
+ * The user to connect as.
60
+ */
25
61
  user: z.string(),
62
+
63
+ /**
64
+ * The password to use for authentication.
65
+ */
26
66
  password: z.string().optional(),
67
+
68
+ /**
69
+ * The SSH key pair to use for authentication.
70
+ */
27
71
  keyPair: keyPairEntity.schema.optional(),
28
72
  })
29
73
 
74
+ export const argsSchema = z.object({
75
+ /**
76
+ * Whether the SSH is enabled on the server.
77
+ *
78
+ * If set to `false`, all SSH-related functionality will be disabled.
79
+ */
80
+ enabled: z.boolean().default(true),
81
+
82
+ /**
83
+ * The alternate host to connect to.
84
+ */
85
+ host: z.string().optional(),
86
+
87
+ /**
88
+ * The SSH port to connect to.
89
+ */
90
+ port: portSchema.default(22),
91
+
92
+ /**
93
+ * The SSH user to connect as.
94
+ */
95
+ user: z.string().default("root"),
96
+ })
97
+
98
+ export const secrets = $secrets({
99
+ /**
100
+ * The SSH private key in PEM format.
101
+ */
102
+ sshPrivateKey: z.string().optional().meta({ multiline: true }),
103
+
104
+ /**
105
+ * The SSH password to use for authentication.
106
+ */
107
+ sshPassword: z.string().optional(),
108
+ })
109
+
110
+ export const inputs = $inputs({
111
+ /**
112
+ * The SSH key pair to use for authentication.
113
+ */
114
+ sshKeyPair: {
115
+ entity: keyPairEntity,
116
+ required: false,
117
+ },
118
+ })
119
+
120
+ /**
121
+ * Holds the ED25519 SSH key pair and generates the private key if not provided.
122
+ */
30
123
  export const keyPair = defineUnit({
31
- type: "ssh.key-pair",
124
+ type: "ssh.key-pair.v1",
32
125
 
33
126
  secrets: {
34
- privateKey: z.string().optional(),
127
+ /**
128
+ * The SSH private key in PEM format.
129
+ *
130
+ * If not provided, a new key pair will be generated and stored.
131
+ */
132
+ privateKey: z.string().optional().meta({ multiline: true }),
35
133
  },
36
134
 
37
135
  outputs: {
@@ -41,7 +139,6 @@ export const keyPair = defineUnit({
41
139
 
42
140
  meta: {
43
141
  title: "SSH Key Pair",
44
- description: "Holds the ED25519 SSH key pair and generates the private key if not provided.",
45
142
  category: "ssh",
46
143
  icon: "charm:key",
47
144
  iconColor: "#ffffff",
@@ -55,6 +152,7 @@ export const keyPair = defineUnit({
55
152
  },
56
153
  })
57
154
 
155
+ export type Args = z.infer<typeof argsSchema>
58
156
  export type KeyType = z.infer<typeof keyTypeSchema>
59
- export type Credentials = z.infer<typeof credentialsSchema>
60
157
  export type KeyPair = z.infer<typeof keyPairEntity.schema>
158
+ export type Connection = z.infer<typeof connectionSchema>
package/src/talos.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { defineEntity, defineUnit, z } from "@highstate/contract"
2
- import { clusterInputs, clusterOutputs, scheduleOnMastersPolicyArgs } from "./k8s"
2
+ import { clusterInputs, clusterOutputs, scheduleOnMastersPolicyArgs } from "./k8s/shared"
3
3
 
4
4
  export const clusterEntity = defineEntity({
5
- type: "talos.cluster",
5
+ type: "talos.cluster.v1",
6
6
 
7
7
  schema: z.object({
8
8
  clientConfiguration: z.string(),
@@ -17,8 +17,11 @@ export const clusterEntity = defineEntity({
17
17
  export const cniSchema = z.enum(["none", "cilium", "flannel"])
18
18
  export const csiSchema = z.enum(["none", "local-path-provisioner"])
19
19
 
20
+ /**
21
+ * The Talos cluster created on top of the server.
22
+ */
20
23
  export const cluster = defineUnit({
21
- type: "talos.cluster",
24
+ type: "talos.cluster.v1",
22
25
 
23
26
  args: {
24
27
  ...scheduleOnMastersPolicyArgs,
@@ -88,7 +91,6 @@ export const cluster = defineUnit({
88
91
 
89
92
  meta: {
90
93
  title: "Talos Cluster",
91
- description: "A Kubernetes cluster managed by Talos.",
92
94
  category: "Talos",
93
95
  color: "#2d2d2d",
94
96
  icon: "simple-icons:talos",
@@ -0,0 +1,59 @@
1
+ import { defineUnit, z } from "@highstate/contract"
2
+ import { providerEntity } from "../dns"
3
+
4
+ export const providerDataSchema = z.object({
5
+ /**
6
+ * The zone ID of the Cloudflare zone.
7
+ */
8
+ zoneId: z.string(),
9
+
10
+ /**
11
+ * The API token for the Cloudflare account.
12
+ *
13
+ * The API key must have permissions to manage DNS records for exactly one zone.
14
+ * If multiple zones are specified, the unit will fail.
15
+ *
16
+ * The required permissions are:
17
+ * - `Zone:Read`
18
+ * - `Zone:DNS:Edit`
19
+ */
20
+ apiToken: z.string(),
21
+ })
22
+
23
+ /**
24
+ * The Cloudflare connection for a single zone.
25
+ */
26
+ export const connection = defineUnit({
27
+ type: "cloudflare.connection.v1",
28
+
29
+ secrets: {
30
+ /**
31
+ * The API token for the Cloudflare account.
32
+ *
33
+ * The API key must have permissions to manage DNS records for exactly one zone.
34
+ * If multiple zones are specified, the unit will fail.
35
+ *
36
+ * The required permissions are:
37
+ * - `Zone.Zone:Read`
38
+ * - `Zone.DNS:Edit`
39
+ */
40
+ apiToken: z.string(),
41
+ },
42
+
43
+ outputs: {
44
+ dnsProvider: providerEntity,
45
+ },
46
+
47
+ meta: {
48
+ title: "Cloudflare Connection",
49
+ icon: "simple-icons:cloudflare",
50
+ category: "Cloudflare",
51
+ },
52
+
53
+ source: {
54
+ package: "@highstate/cloudflare",
55
+ path: "connection",
56
+ },
57
+ })
58
+
59
+ export type ProviderData = z.infer<typeof providerDataSchema>
@@ -0,0 +1,4 @@
1
+ export * as cloudflare from "./cloudflare"
2
+ export * as mullvad from "./mullvad"
3
+ export * as timeweb from "./timeweb"
4
+ export * as yandex from "./yandex"
@@ -1,9 +1,12 @@
1
1
  import { defineUnit, z } from "@highstate/contract"
2
- import { networkEntity, peerEntity } from "./wireguard"
3
- import { l4EndpointEntity } from "./network"
2
+ import { l4EndpointEntity } from "../network"
3
+ import { networkEntity, peerEntity } from "../wireguard"
4
4
 
5
+ /**
6
+ * The Mullvad WireGuard peer fetched from the Mullvad API.
7
+ */
5
8
  export const peer = defineUnit({
6
- type: "mullvad.peer",
9
+ type: "mullvad.peer.v1",
7
10
 
8
11
  args: {
9
12
  hostname: z.string().optional(),
@@ -37,7 +40,6 @@ export const peer = defineUnit({
37
40
 
38
41
  meta: {
39
42
  title: "Mullvad Peer",
40
- description: "The Mullvad WireGuard peer fetched from the Mullvad API.",
41
43
  icon: "simple-icons:mullvad",
42
44
  secondaryIcon: "cib:wireguard",
43
45
  secondaryIconColor: "#88171a",