@highstate/library 0.9.18 → 0.9.19

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 (78) hide show
  1. package/dist/highstate.library.msgpack +0 -0
  2. package/dist/index.js +3467 -3083
  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 +3 -0
  55. package/src/{mullvad.ts → third-party/mullvad.ts} +6 -4
  56. package/src/third-party/timeweb.ts +99 -0
  57. package/src/utils.ts +24 -3
  58. package/src/wireguard.ts +171 -48
  59. package/src/apps/code-server.ts +0 -34
  60. package/src/apps/deployment.ts +0 -60
  61. package/src/apps/dns.ts +0 -107
  62. package/src/apps/gitea.ts +0 -18
  63. package/src/apps/grocy.ts +0 -20
  64. package/src/apps/hubble.ts +0 -20
  65. package/src/apps/kubernetes-dashboard.ts +0 -19
  66. package/src/apps/mariadb.ts +0 -81
  67. package/src/apps/maybe.ts +0 -25
  68. package/src/apps/mongodb.ts +0 -81
  69. package/src/apps/network.ts +0 -55
  70. package/src/apps/postgresql.ts +0 -81
  71. package/src/apps/shared.ts +0 -289
  72. package/src/apps/test.ts +0 -19
  73. package/src/apps/traefik.ts +0 -36
  74. package/src/apps/vaultwarden.ts +0 -23
  75. package/src/apps/zitadel.ts +0 -21
  76. package/src/cloudflare.ts +0 -26
  77. package/src/timeweb.ts +0 -75
  78. package/src/{obfuscators → k8s/obfuscators}/index.ts +1 -1
@@ -0,0 +1,99 @@
1
+ import { defineEntity, defineUnit, z } from "@highstate/contract"
2
+ import { serverOutputs, vmSecrets, vmSshArgs } from "../common"
3
+ import * as ssh from "../ssh"
4
+
5
+ export const connectionEntity = defineEntity({
6
+ type: "timeweb.connection.v1",
7
+
8
+ schema: z.object({
9
+ name: z.string(),
10
+ apiToken: z.string(),
11
+ }),
12
+ })
13
+
14
+ /**
15
+ * The Timeweb connection for a single account.
16
+ */
17
+ export const connection = defineUnit({
18
+ type: "timeweb.connection.v1",
19
+
20
+ secrets: {
21
+ /**
22
+ * The API token for the Timeweb account.
23
+ *
24
+ * Can be obtained from the Timeweb control panel.
25
+ */
26
+ apiToken: z.string(),
27
+ },
28
+
29
+ outputs: {
30
+ connection: connectionEntity,
31
+ },
32
+
33
+ meta: {
34
+ title: "Timeweb Connection",
35
+ icon: "material-symbols:cloud",
36
+ category: "Timeweb",
37
+ },
38
+
39
+ source: {
40
+ package: "@highstate/timeweb",
41
+ path: "connection",
42
+ },
43
+ })
44
+
45
+ export const virtualMachine = defineUnit({
46
+ type: "timeweb.virtual-machine.v1",
47
+
48
+ args: {
49
+ /**
50
+ * The ID of the preset to use for the virtual machine.
51
+ *
52
+ * Can be obtained from the Timeweb control panel when creating a new virtual machine.
53
+ */
54
+ presetId: z.number().optional(),
55
+
56
+ /**
57
+ * The ID of the operating system to use for the virtual machine.
58
+ *
59
+ * Can be obtained from the Timeweb control panel when creating a new virtual machine.
60
+ */
61
+ osId: z.number().optional(),
62
+
63
+ /**
64
+ * The ID of the connection to use for the virtual machine.
65
+ *
66
+ * Can be obtained from the Timeweb control panel when creating a new virtual machine.
67
+ */
68
+ availabilityZone: z.string(),
69
+
70
+ /**
71
+ * The SSH arguments to use for the virtual machine.
72
+ */
73
+ ssh: vmSshArgs,
74
+ },
75
+
76
+ inputs: {
77
+ connection: connectionEntity,
78
+ ...ssh.inputs,
79
+ },
80
+
81
+ secrets: vmSecrets,
82
+
83
+ outputs: {
84
+ ...serverOutputs,
85
+ },
86
+
87
+ meta: {
88
+ title: "Timeweb Virtual Machine",
89
+ description: "Creates a new Timeweb virtual machine.",
90
+ icon: "material-symbols:cloud",
91
+ secondaryIcon: "codicon:vm",
92
+ category: "Timeweb",
93
+ },
94
+
95
+ source: {
96
+ package: "@highstate/timeweb",
97
+ path: "virtual-machine",
98
+ },
99
+ })
package/src/utils.ts CHANGED
@@ -17,6 +17,17 @@ type PrefixedKeys<T extends Record<string, unknown>, Prefix extends string> = {
17
17
  [K in keyof T as PrefixWith<Extract<K, string>, Prefix>]: T[K]
18
18
  }
19
19
 
20
+ /**
21
+ * The helper function to prefix the keys of an object with a given prefix.
22
+ *
23
+ * If the prefix is not provided, the keys will not be modified.
24
+ *
25
+ * All keys after prefixing will be capitalized.
26
+ *
27
+ * @param prefix The prefix to use. If not provided, the keys will not be modified.
28
+ * @param obj The object to prefix the keys of.
29
+ * @returns The object with prefixed keys.
30
+ */
20
31
  export function prefixKeysWith<T extends Record<string, unknown>, Prefix extends string>(
21
32
  prefix: Prefix | undefined,
22
33
  obj: T,
@@ -27,11 +38,21 @@ export function prefixKeysWith<T extends Record<string, unknown>, Prefix extends
27
38
  }
28
39
 
29
40
  export const arrayPatchModeSchema = z.enum(["prepend", "replace"])
41
+ export const booleanPatchSchema = z.enum(["keep", "true", "false"])
30
42
 
31
43
  /**
32
- * The mode to use when patching some array.
44
+ * The mode to use when patching some array:
33
45
  *
34
- * - `prepend`: Prepend the values of the new array to the existing array.
35
- * - `replace`: Replace the existing array with the new array.
46
+ * - `prepend`: prepend the values of the new array to the existing array;
47
+ * - `replace`: replace the existing array with the new array.
36
48
  */
37
49
  export type ArrayPatchMode = z.infer<typeof arrayPatchModeSchema>
50
+
51
+ /**
52
+ * The boolean patch:
53
+ *
54
+ * - `keep`: keep the existing value;
55
+ * - `true`: set the value to `true`;
56
+ * - `false`: set the value to `false`.
57
+ */
58
+ export type BooleanPatch = z.infer<typeof booleanPatchSchema>
package/src/wireguard.ts CHANGED
@@ -1,26 +1,55 @@
1
1
  import { defineEntity, defineUnit, z } from "@highstate/contract"
2
2
  import { omit } from "remeda"
3
- import { clusterEntity, interfaceEntity, exposableWorkloadEntity } from "./k8s"
3
+ import { serverEntity } from "./common/server"
4
+ import { exposableWorkloadEntity, networkInterfaceEntity } from "./k8s"
4
5
  import { l3EndpointEntity, l4EndpointEntity } from "./network"
6
+ import { clusterEntity } from "./k8s"
5
7
  import { arrayPatchModeSchema } from "./utils"
6
8
 
7
9
  export const backendSchema = z.enum(["wireguard", "amneziawg"])
8
10
 
9
11
  export type Backend = z.infer<typeof backendSchema>
10
12
 
13
+ const networkArgs = {
14
+ /**
15
+ * The backend to use for the WireGuard network.
16
+ *
17
+ * Possible values are:
18
+ * - `wireguard` - the default backend;
19
+ * - `amneziawg` - the censorship-resistant fork of WireGuard.
20
+ */
21
+ backend: backendSchema.default("wireguard"),
22
+
23
+ /**
24
+ * Whether to enable IPv4 support in the network.
25
+ *
26
+ * By default, IPv4 support is enabled.
27
+ */
28
+ ipv4: z.boolean().default(true),
29
+
30
+ /**
31
+ * Whether to enable IPv6 support in the network.
32
+ *
33
+ * By default, IPv6 support is disabled.
34
+ */
35
+ ipv6: z.boolean().default(false),
36
+ }
37
+
38
+ /**
39
+ * The entity representing the WireGuard network configuration.
40
+ *
41
+ * It holds shared configuration for WireGuard identities, peers, and nodes.
42
+ */
11
43
  export const networkEntity = defineEntity({
12
- type: "wireguard.network",
44
+ type: "wireguard.network.v1",
13
45
 
14
- schema: z.object({
15
- backend: backendSchema,
16
- ipv6: z.boolean(),
17
- }),
46
+ schema: z.object(networkArgs),
18
47
  })
19
48
 
20
49
  export const nodeExposePolicySchema = z.enum(["always", "when-has-endpoint", "never"])
21
50
 
22
51
  export const peerEntity = defineEntity({
23
- type: "wireguard.peer",
52
+ type: "wireguard.peer.v1",
24
53
 
25
54
  schema: z.object({
26
55
  name: z.string(),
@@ -58,7 +87,7 @@ export const peerEntity = defineEntity({
58
87
  })
59
88
 
60
89
  export const identityEntity = defineEntity({
61
- type: "wireguard.identity",
90
+ type: "wireguard.identity.v1",
62
91
 
63
92
  schema: z.object({
64
93
  peer: peerEntity.schema,
@@ -76,37 +105,18 @@ export type Peer = z.infer<typeof peerEntity.schema>
76
105
  export type NodeExposePolicy = z.infer<typeof nodeExposePolicySchema>
77
106
 
78
107
  /**
79
- * The network hols the shared configuration for the WireGuard identities, peers and nodes.
108
+ * Holds the shared configuration for WireGuard identities, peers, and nodes.
80
109
  */
81
110
  export const network = defineUnit({
82
- type: "wireguard.network",
83
-
84
- args: {
85
- /**
86
- * The backend to use for the WireGuard network.
87
- *
88
- * Possible values are:
89
- * 1. `wireguard` - The default backend.
90
- * 2. `amneziawg` - The censorship-resistant fork of WireGuard.
91
- *
92
- * By default, the `wireguard` backend is used.
93
- */
94
- backend: backendSchema.default("wireguard"),
111
+ type: "wireguard.network.v1",
95
112
 
96
- /**
97
- * The option to enable IPv6 support in the network.
98
- *
99
- * By default, IPv6 support is disabled.
100
- */
101
- ipv6: z.boolean().default(false),
102
- },
113
+ args: networkArgs,
103
114
 
104
115
  outputs: {
105
116
  network: networkEntity,
106
117
  },
107
118
 
108
119
  meta: {
109
- description: "The WireGuard network with some shared configuration.",
110
120
  icon: "simple-icons:wireguard",
111
121
  iconColor: "#88171a",
112
122
  secondaryIcon: "mdi:local-area-network-connect",
@@ -146,9 +156,9 @@ const sharedPeerArgs = {
146
156
  *
147
157
  * Implementation notes:
148
158
  *
149
- * - This list will not be used to generate the allowed IPs for the peer.
150
- * - Instead, the node will setup extra direct routes to these IPs via default gateway.
151
- * - This allows to use `0.0.0.0/0, ::/0` in the `allowedIps` (and corresponding fwmark magic) and still have some IPs excluded from the tunnel.
159
+ * - this list will not be used to generate the allowed IPs for the peer;
160
+ * - instead, the node will setup extra direct routes to these IPs via default gateway;
161
+ * - this allows to use `0.0.0.0/0, ::/0` in the `allowedIps` (and corresponding fwmark magic) and still have some IPs excluded from the tunnel.
152
162
  */
153
163
  excludedIps: z.string().array().default([]),
154
164
 
@@ -285,8 +295,11 @@ export type SharedPeerArgs = {
285
295
  listenPort?: number
286
296
  }
287
297
 
298
+ /**
299
+ * The WireGuard peer with the public key.
300
+ */
288
301
  export const peer = defineUnit({
289
- type: "wireguard.peer",
302
+ type: "wireguard.peer.v1",
290
303
 
291
304
  args: {
292
305
  ...sharedPeerArgs,
@@ -308,7 +321,6 @@ export const peer = defineUnit({
308
321
  outputs: sharedPeerOutputs,
309
322
 
310
323
  meta: {
311
- description: "The WireGuard peer with the public key.",
312
324
  icon: "simple-icons:wireguard",
313
325
  iconColor: "#88171a",
314
326
  secondaryIcon: "mdi:badge-account-horizontal",
@@ -321,8 +333,11 @@ export const peer = defineUnit({
321
333
  },
322
334
  })
323
335
 
336
+ /**
337
+ * Patches some properties of the WireGuard peer.
338
+ */
324
339
  export const peerPatch = defineUnit({
325
- type: "wireguard.peer-patch",
340
+ type: "wireguard.peer-patch.v1",
326
341
 
327
342
  args: {
328
343
  /**
@@ -373,7 +388,6 @@ export const peerPatch = defineUnit({
373
388
 
374
389
  meta: {
375
390
  title: "WireGuard Peer Patch",
376
- description: "Patches some properties of the WireGuard peer.",
377
391
  icon: "simple-icons:wireguard",
378
392
  iconColor: "#88171a",
379
393
  secondaryIcon: "mdi:badge-account-horizontal",
@@ -386,8 +400,11 @@ export const peerPatch = defineUnit({
386
400
  },
387
401
  })
388
402
 
403
+ /**
404
+ * The WireGuard identity with the public key.
405
+ */
389
406
  export const identity = defineUnit({
390
- type: "wireguard.identity",
407
+ type: "wireguard.identity.v1",
391
408
 
392
409
  args: {
393
410
  ...sharedPeerArgs,
@@ -433,7 +450,6 @@ export const identity = defineUnit({
433
450
  },
434
451
 
435
452
  meta: {
436
- description: "The WireGuard identity with the public key.",
437
453
  icon: "simple-icons:wireguard",
438
454
  iconColor: "#88171a",
439
455
  secondaryIcon: "mdi:account",
@@ -446,8 +462,11 @@ export const identity = defineUnit({
446
462
  },
447
463
  })
448
464
 
449
- export const node = defineUnit({
450
- type: "wireguard.node",
465
+ /**
466
+ * The WireGuard node deployed in the Kubernetes cluster.
467
+ */
468
+ export const nodeK8s = defineUnit({
469
+ type: "wireguard.node.k8s.v1",
451
470
 
452
471
  args: {
453
472
  /**
@@ -501,7 +520,7 @@ export const node = defineUnit({
501
520
  },
502
521
 
503
522
  interface: {
504
- entity: interfaceEntity,
523
+ entity: networkInterfaceEntity,
505
524
  required: false,
506
525
  },
507
526
 
@@ -514,7 +533,7 @@ export const node = defineUnit({
514
533
 
515
534
  outputs: {
516
535
  interface: {
517
- entity: interfaceEntity,
536
+ entity: networkInterfaceEntity,
518
537
  required: false,
519
538
  },
520
539
 
@@ -531,7 +550,107 @@ export const node = defineUnit({
531
550
  },
532
551
 
533
552
  meta: {
534
- description: "The WireGuard node running on the Kubernetes.",
553
+ title: "WireGuard Kubernetes Node",
554
+ icon: "simple-icons:wireguard",
555
+ iconColor: "#88171a",
556
+ secondaryIcon: "devicon:kubernetes",
557
+ category: "VPN",
558
+ },
559
+
560
+ source: {
561
+ package: "@highstate/wireguard",
562
+ path: "node.k8s",
563
+ },
564
+ })
565
+
566
+ /**
567
+ * The WireGuard node deployed on a server using wg-quick systemd service.
568
+ */
569
+ export const node = defineUnit({
570
+ type: "wireguard.node.v1",
571
+
572
+ args: {
573
+ /**
574
+ * The name of the WireGuard interface.
575
+ *
576
+ * By default, the name is `wg-${identity.name}` (truncated to 15 characters).
577
+ */
578
+ interfaceName: z.string().optional(),
579
+
580
+ /**
581
+ * The name of the default interface for excluded routes.
582
+ *
583
+ * This is used to route excluded IPs through the default interface instead of the WireGuard tunnel.
584
+ */
585
+ defaultInterface: z.string().default("eth0"),
586
+
587
+ /**
588
+ * List of CIDR blocks that should be blocked from forwarding through this WireGuard node.
589
+ *
590
+ * This prevents other peers from reaching these destination CIDRs while still allowing
591
+ * the peers in those CIDRs to access the internet and other allowed endpoints.
592
+ *
593
+ * Useful for peer isolation where you want to prevent cross-peer communication.
594
+ */
595
+ forwardRestrictedIps: z.string().array().default([]),
596
+
597
+ /**
598
+ * Whether to enable IP masquerading (NAT) for outgoing traffic.
599
+ *
600
+ * By default, IP masquerading is enabled.
601
+ */
602
+ enableMasquerade: z.boolean().default(true),
603
+
604
+ /**
605
+ * Script to run before bringing up the interface.
606
+ */
607
+ preUpScript: z.string().optional().meta({ language: "shell" }),
608
+
609
+ /**
610
+ * Script to run after bringing up the interface.
611
+ */
612
+ postUpScript: z.string().optional().meta({ language: "shell" }),
613
+
614
+ /**
615
+ * Script to run before bringing down the interface.
616
+ */
617
+ preDownScript: z.string().optional().meta({ language: "shell" }),
618
+
619
+ /**
620
+ * Script to run after bringing down the interface.
621
+ */
622
+ postDownScript: z.string().optional().meta({ language: "shell" }),
623
+ },
624
+
625
+ inputs: {
626
+ identity: identityEntity,
627
+ server: {
628
+ entity: serverEntity,
629
+ required: true,
630
+ },
631
+
632
+ peers: {
633
+ entity: peerEntity,
634
+ multiple: true,
635
+ required: false,
636
+ },
637
+ },
638
+
639
+ outputs: {
640
+ peer: {
641
+ entity: peerEntity,
642
+ required: false,
643
+ },
644
+
645
+ endpoints: {
646
+ entity: l4EndpointEntity,
647
+ required: false,
648
+ multiple: true,
649
+ },
650
+ },
651
+
652
+ meta: {
653
+ title: "WireGuard Server Node",
535
654
  icon: "simple-icons:wireguard",
536
655
  iconColor: "#88171a",
537
656
  secondaryIcon: "mdi:server",
@@ -544,8 +663,11 @@ export const node = defineUnit({
544
663
  },
545
664
  })
546
665
 
666
+ /**
667
+ * Just the WireGuard configuration for the identity and peers.
668
+ */
547
669
  export const config = defineUnit({
548
- type: "wireguard.config",
670
+ type: "wireguard.config.v1",
549
671
 
550
672
  args: {
551
673
  /**
@@ -567,7 +689,6 @@ export const config = defineUnit({
567
689
 
568
690
  meta: {
569
691
  title: "WireGuard Config",
570
- description: "Just the WireGuard configuration for the identity and peers.",
571
692
  icon: "simple-icons:wireguard",
572
693
  iconColor: "#88171a",
573
694
  secondaryIcon: "mdi:settings",
@@ -580,8 +701,11 @@ export const config = defineUnit({
580
701
  },
581
702
  })
582
703
 
704
+ /**
705
+ * The WireGuard configuration bundle for the identity and peers.
706
+ */
583
707
  export const configBundle = defineUnit({
584
- type: "wireguard.config-bundle",
708
+ type: "wireguard.config-bundle.v1",
585
709
 
586
710
  inputs: {
587
711
  identity: identityEntity,
@@ -598,7 +722,6 @@ export const configBundle = defineUnit({
598
722
 
599
723
  meta: {
600
724
  title: "WireGuard Config Bundle",
601
- description: "The WireGuard configuration bundle for the identity and peers.",
602
725
  icon: "simple-icons:wireguard",
603
726
  iconColor: "#88171a",
604
727
  secondaryIcon: "mdi:folder-settings-variant",
@@ -1,34 +0,0 @@
1
- import { defineUnit, z } from "@highstate/contract"
2
- import { persistentVolumeClaimEntity, statefulSetEntity } from "../k8s"
3
- import { createArgs, createInputs, createSecrets } from "./shared"
4
-
5
- export const codeServer = defineUnit({
6
- type: "apps.code-server",
7
-
8
- args: createArgs("code-server", ["fqdn"]),
9
-
10
- secrets: {
11
- ...createSecrets(["backupPassword"]),
12
- password: z.string().optional(),
13
- sudoPassword: z.string().optional(),
14
- },
15
-
16
- inputs: createInputs(["accessPoint", "resticRepo", "dnsProviders", "volume"]),
17
-
18
- outputs: {
19
- statefulSet: statefulSetEntity,
20
- volume: persistentVolumeClaimEntity,
21
- },
22
-
23
- meta: {
24
- title: "Code Server",
25
- description: "The Code Server instance deployed on Kubernetes.",
26
- icon: "material-icon-theme:vscode",
27
- category: "Development",
28
- },
29
-
30
- source: {
31
- package: "@highstate/apps",
32
- path: "code-server",
33
- },
34
- })
@@ -1,60 +0,0 @@
1
- import { defineUnit, z } from "@highstate/contract"
2
- import { deploymentEntity, serviceEntity, serviceTypeSchema } from "../k8s"
3
- import { createInputs, createSource } from "./shared"
4
-
5
- export const deployment = defineUnit({
6
- type: "apps.deployment",
7
-
8
- args: {
9
- appName: z.string().optional(),
10
-
11
- fqdn: z.string().optional(),
12
- serviceType: serviceTypeSchema.optional(),
13
-
14
- image: z.string().optional(),
15
- port: z.number().optional(),
16
- replicas: z.number().optional(),
17
-
18
- dataPath: z.string().optional(),
19
-
20
- env: z.record(z.string(), z.any()).optional(),
21
-
22
- mariadbEnvMapping: z.record(z.string(), z.any()).optional(),
23
- postgresqlEnvMapping: z.record(z.string(), z.any()).optional(),
24
- mongodbEnvMapping: z.record(z.string(), z.any()).optional(),
25
-
26
- manifest: z.record(z.string(), z.any()).optional(),
27
- serviceManifest: z.record(z.string(), z.any()).optional(),
28
- httpRouteManifest: z.record(z.string(), z.any()).optional(),
29
- },
30
-
31
- secrets: {
32
- mariadbPassword: z.string().optional(),
33
- postgresqlPassword: z.string().optional(),
34
- mongodbPassword: z.string().optional(),
35
- },
36
-
37
- inputs: createInputs([
38
- "accessPoint",
39
- "mariadb",
40
- "postgresql",
41
- "mongodb",
42
- "resticRepo",
43
- "dnsProviders",
44
- ]),
45
-
46
- outputs: {
47
- deployment: deploymentEntity,
48
- service: serviceEntity,
49
- },
50
-
51
- meta: {
52
- title: "Kubernetes Deployment",
53
- description: "A generic Kubernetes deployment with optional service and gateway routes.",
54
- icon: "devicon:kubernetes",
55
- secondaryIcon: "mdi:cube-outline",
56
- category: "Kubernetes",
57
- },
58
-
59
- source: createSource("deployment"),
60
- })
package/src/apps/dns.ts DELETED
@@ -1,107 +0,0 @@
1
- import { defineUnit, z } from "@highstate/contract"
2
- import { l3EndpointEntity, l4EndpointEntity } from "../network"
3
- import { providerEntity } from "../dns"
4
- import { createSource } from "./shared"
5
-
6
- const endpointFilterSchema = z.enum(["all", "public", "external", "internal"])
7
-
8
- export const recordSet = defineUnit({
9
- type: "apps.dns-record-set",
10
-
11
- args: {
12
- /**
13
- * The name of the DNS record.
14
- *
15
- * If not provided, will use the name of the unit.
16
- */
17
- recordName: z.string().optional(),
18
-
19
- /**
20
- * The type of the DNS record.
21
- *
22
- * If not specified, will use the default type for the provider.
23
- */
24
- type: z.string().optional(),
25
-
26
- /**
27
- * The values of the DNS record.
28
- */
29
- values: z.string().array(),
30
-
31
- /**
32
- * The TTL of the DNS record.
33
- */
34
- ttl: z.number().optional(),
35
-
36
- /**
37
- * The priority of the DNS record.
38
- */
39
- priority: z.number().optional(),
40
-
41
- /**
42
- * Whether the DNS record is proxied.
43
- *
44
- * Available only for public IPs and some DNS providers like Cloudflare.
45
- */
46
- proxied: z.boolean().optional(),
47
-
48
- /**
49
- * The filter to apply to the endpoints.
50
- *
51
- * - `all`: All endpoints.
52
- * - `public`: Only public endpoints accessible from the internet (default).
53
- * - `external`: Only external endpoints (e.g. NodePort, LoadBalancer) accessible from outside the cluster, but not from the internet.
54
- * - `internal`: Only internal endpoints (e.g. ClusterIP) accessible from within the cluster.
55
- */
56
- endpointFilter: endpointFilterSchema.default("public"),
57
- },
58
-
59
- inputs: {
60
- dnsProviders: {
61
- entity: providerEntity,
62
- multiple: true,
63
- },
64
- l3Endpoints: {
65
- entity: l3EndpointEntity,
66
- required: false,
67
- multiple: true,
68
- },
69
- l4Endpoints: {
70
- entity: l4EndpointEntity,
71
- required: false,
72
- multiple: true,
73
- },
74
- },
75
-
76
- outputs: {
77
- /**
78
- * The single L3 endpoint representing created DNS records.
79
- */
80
- l3Endpoint: l3EndpointEntity,
81
-
82
- /**
83
- * Multiple L4 endpoints representing created DNS records for each unique port/protocol combination from the input L4 endpoints.
84
- */
85
- l4Endpoints: {
86
- entity: l4EndpointEntity,
87
- multiple: true,
88
- },
89
- },
90
-
91
- meta: {
92
- title: "DNS Record Set",
93
- description: "A set of DNS records to be created.",
94
- icon: "mdi:server",
95
- defaultNamePrefix: "record",
96
- category: "Network",
97
- },
98
-
99
- source: createSource("dns-record-set"),
100
- })
101
-
102
- export const sharedArgs = {
103
- /**
104
- * The FQDN to register the cluster nodes with.
105
- */
106
- fqdn: z.string().optional(),
107
- }