@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,84 @@
1
+ import { defineUnit } from "@highstate/contract"
2
+ import { pick } from "remeda"
3
+ import * as databases from "../../databases"
4
+ import { l4EndpointEntity } from "../../network"
5
+ import { serviceEntity } from "../service"
6
+ import {
7
+ appName,
8
+ optionalSharedInputs,
9
+ sharedArgs,
10
+ sharedDatabaseArgs,
11
+ sharedDatabaseSecrets,
12
+ sharedInputs,
13
+ sharedSecrets,
14
+ source,
15
+ } from "./shared"
16
+
17
+ /**
18
+ * The MongoDB instance deployed on Kubernetes.
19
+ */
20
+ export const mongodb = defineUnit({
21
+ type: "k8s.apps.mongodb.v1",
22
+
23
+ args: {
24
+ ...appName("mongodb"),
25
+ ...pick(sharedArgs, ["external"]),
26
+ },
27
+
28
+ secrets: {
29
+ ...pick(sharedSecrets, ["rootPassword", "backupPassword"]),
30
+ },
31
+
32
+ inputs: {
33
+ ...pick(sharedInputs, ["k8sCluster"]),
34
+ ...pick(optionalSharedInputs, ["resticRepo"]),
35
+ },
36
+
37
+ outputs: {
38
+ mongodb: databases.mongodbEntity,
39
+ service: serviceEntity,
40
+ endpoints: {
41
+ entity: l4EndpointEntity,
42
+ multiple: true,
43
+ },
44
+ },
45
+
46
+ meta: {
47
+ title: "MongoDB",
48
+ icon: "simple-icons:mongodb",
49
+ secondaryIcon: "mdi:database",
50
+ category: "Databases",
51
+ },
52
+
53
+ source: source("mongodb/app"),
54
+ })
55
+
56
+ /**
57
+ * The virtual MongoDB database created on the MongoDB instance.
58
+ *
59
+ * Requires a Kubernetes cluster to place init jobs and secrets.
60
+ */
61
+ export const mongodbDatabase = defineUnit({
62
+ type: "k8s.apps.mongodb.database.v1",
63
+
64
+ args: sharedDatabaseArgs,
65
+ secrets: sharedDatabaseSecrets,
66
+
67
+ inputs: {
68
+ ...pick(sharedInputs, ["k8sCluster", "mongodb"]),
69
+ ...pick(optionalSharedInputs, ["namespace"]),
70
+ },
71
+
72
+ outputs: {
73
+ mongodb: databases.mongodbEntity,
74
+ },
75
+
76
+ meta: {
77
+ title: "MongoDB Database",
78
+ icon: "simple-icons:mongodb",
79
+ secondaryIcon: "mdi:database-plus",
80
+ category: "Databases",
81
+ },
82
+
83
+ source: source("mongodb/database"),
84
+ })
@@ -0,0 +1,86 @@
1
+ import { defineUnit } from "@highstate/contract"
2
+ import { pick } from "remeda"
3
+ import * as databases from "../../databases"
4
+ import { l4EndpointEntity } from "../../network"
5
+ import { serviceEntity } from "../service"
6
+ import {
7
+ appName,
8
+ optionalSharedInputs,
9
+ sharedArgs,
10
+ sharedDatabaseArgs,
11
+ sharedDatabaseSecrets,
12
+ sharedInputs,
13
+ sharedSecrets,
14
+ source,
15
+ } from "./shared"
16
+
17
+ /**
18
+ * The PostgreSQL instance deployed on Kubernetes.
19
+ */
20
+ export const postgresql = defineUnit({
21
+ type: "k8s.apps.postgresql.v1",
22
+
23
+ args: {
24
+ ...appName("postgresql"),
25
+ ...pick(sharedArgs, ["external"]),
26
+ },
27
+
28
+ secrets: {
29
+ ...pick(sharedSecrets, ["rootPassword", "backupPassword"]),
30
+ },
31
+
32
+ inputs: {
33
+ ...pick(sharedInputs, ["k8sCluster"]),
34
+ ...pick(optionalSharedInputs, ["resticRepo"]),
35
+ },
36
+
37
+ outputs: {
38
+ postgresql: databases.postgresqlEntity,
39
+ service: serviceEntity,
40
+ endpoints: {
41
+ entity: l4EndpointEntity,
42
+ multiple: true,
43
+ },
44
+ },
45
+
46
+ meta: {
47
+ title: "PostgreSQL",
48
+ icon: "simple-icons:postgresql",
49
+ secondaryIcon: "mdi:database",
50
+ category: "Databases",
51
+ },
52
+
53
+ source: source("postgresql/app"),
54
+ })
55
+
56
+ /**
57
+ * The virtual PostgreSQL database created on the PostgreSQL instance.
58
+ *
59
+ * The provided database must be authorized to create databases and users.
60
+ *
61
+ * Requires a Kubernetes cluster to place init jobs and secrets.
62
+ */
63
+ export const postgresqlDatabase = defineUnit({
64
+ type: "k8s.apps.postgresql.database.v1",
65
+
66
+ args: sharedDatabaseArgs,
67
+ secrets: sharedDatabaseSecrets,
68
+
69
+ inputs: {
70
+ ...pick(sharedInputs, ["k8sCluster", "postgresql"]),
71
+ ...pick(optionalSharedInputs, ["namespace"]),
72
+ },
73
+
74
+ outputs: {
75
+ postgresql: databases.postgresqlEntity,
76
+ },
77
+
78
+ meta: {
79
+ title: "PostgreSQL Database",
80
+ icon: "simple-icons:postgresql",
81
+ secondaryIcon: "mdi:database-plus",
82
+ category: "Databases",
83
+ },
84
+
85
+ source: source("postgresql/database"),
86
+ })
@@ -0,0 +1,149 @@
1
+ /** biome-ignore-all lint/style/noNonNullAssertion: to define shared inputs */
2
+
3
+ import type { Simplify } from "type-fest"
4
+ import {
5
+ $args,
6
+ $inputs,
7
+ $secrets,
8
+ type FullComponentArgumentOptions,
9
+ type FullComponentInputOptions,
10
+ z,
11
+ } from "@highstate/contract"
12
+ import { mapValues } from "remeda"
13
+ import { accessPointEntity } from "../../common"
14
+ import { mariadbEntity, mongodbEntity, postgresqlEntity } from "../../databases"
15
+ import { providerEntity } from "../../dns"
16
+ import { repositoryEntity } from "../../restic"
17
+ import { namespaceEntity, persistentVolumeClaimEntity } from "../resources"
18
+ import { clusterEntity } from "../shared"
19
+
20
+ export const sharedArgs = $args({
21
+ /**
22
+ * The FQDN where the application will be accessible.
23
+ */
24
+ fqdn: z.string(),
25
+
26
+ /**
27
+ * The endpoints where the application will or should be accessible.
28
+ */
29
+ endpoints: z.string().array(),
30
+
31
+ /**
32
+ * Whether the application should be exposed externally by NodePort or LoadBalancer service.
33
+ */
34
+ external: z.boolean().default(false),
35
+
36
+ /**
37
+ * The number of replicas for the application.
38
+ */
39
+ replicas: z.number().default(1),
40
+ })
41
+
42
+ type ToOptionalArgs<T extends Record<string, FullComponentArgumentOptions>> = Simplify<{
43
+ [K in keyof T]: Simplify<Omit<T[K], "schema"> & { schema: z.ZodOptional<T[K]["schema"]> }>
44
+ }>
45
+
46
+ export const optionalSharedArgs = mapValues(sharedArgs, arg => ({
47
+ ...arg,
48
+ schema: arg.schema.optional(),
49
+ })) as ToOptionalArgs<typeof sharedArgs>
50
+
51
+ /**
52
+ * Return the arguments definition for the application name.
53
+ *
54
+ * @param defaultAppName The default name of the application.
55
+ */
56
+ export function appName(defaultAppName: string) {
57
+ return {
58
+ appName: {
59
+ schema: z.string().default(defaultAppName),
60
+ meta: {
61
+ description: "The name of the application to deploy.",
62
+ },
63
+ },
64
+ }
65
+ }
66
+
67
+ export const sharedSecrets = $secrets({
68
+ /**
69
+ * The root password for the database instance. If not provided, a random password will be generated.
70
+ */
71
+ rootPassword: z.string().optional(),
72
+
73
+ /**
74
+ * The password to use for backup encryption. If not provided, a random password will be generated.
75
+ */
76
+ backupPassword: z.string().optional(),
77
+ })
78
+
79
+ export const sharedDatabaseArgs = $args({
80
+ /**
81
+ * The username for the database user.
82
+ *
83
+ * If not provided, defaults to the name of the instance.
84
+ */
85
+ username: z.string().optional(),
86
+
87
+ /**
88
+ * The name of the database to create.
89
+ *
90
+ * If not provided, defaults to the username.
91
+ */
92
+ database: z.string().optional(),
93
+ })
94
+
95
+ export const sharedDatabaseSecrets = $secrets({
96
+ /**
97
+ * The password for the database user.
98
+ *
99
+ * If not provided, a random password will be generated.
100
+ */
101
+ password: z.string().optional(),
102
+ })
103
+
104
+ export const sharedInputs = $inputs({
105
+ k8sCluster: {
106
+ entity: clusterEntity,
107
+ },
108
+ namespace: {
109
+ entity: namespaceEntity,
110
+ },
111
+ accessPoint: {
112
+ entity: accessPointEntity,
113
+ },
114
+ resticRepo: {
115
+ entity: repositoryEntity,
116
+ },
117
+ dnsProviders: {
118
+ entity: providerEntity,
119
+ multiple: true,
120
+ },
121
+ volume: {
122
+ entity: persistentVolumeClaimEntity,
123
+ },
124
+ mariadb: {
125
+ entity: mariadbEntity,
126
+ },
127
+ postgresql: {
128
+ entity: postgresqlEntity,
129
+ },
130
+ mongodb: {
131
+ entity: mongodbEntity,
132
+ },
133
+ })
134
+
135
+ type ToOptionalInputs<T extends Record<string, FullComponentInputOptions>> = Simplify<{
136
+ [K in keyof T]: T[K] & { required: false }
137
+ }>
138
+
139
+ export const optionalSharedInputs = mapValues(sharedInputs, input => ({
140
+ ...input,
141
+ required: false,
142
+ })) as ToOptionalInputs<typeof sharedInputs>
143
+
144
+ export function source(path: string) {
145
+ return {
146
+ package: "@highstate/k8s.apps",
147
+ path,
148
+ }
149
+ }
@@ -1,15 +1,28 @@
1
1
  import { defineUnit, z } from "@highstate/contract"
2
- import { persistentVolumeClaimEntity, serviceEntity } from "../k8s"
3
- import { l4EndpointEntity } from "../network"
4
- import { createArgs, createInputs, createSecrets, createSource } from "./shared"
2
+ import { pick } from "remeda"
3
+ import { l4EndpointEntity } from "../../network"
4
+ import { persistentVolumeClaimEntity } from "../resources"
5
+ import { serviceEntity } from "../service"
6
+ import {
7
+ appName,
8
+ optionalSharedInputs,
9
+ sharedArgs,
10
+ sharedInputs,
11
+ sharedSecrets,
12
+ source,
13
+ } from "./shared"
5
14
 
6
15
  export const backupModeSchema = z.enum(["state", "full"])
7
16
 
17
+ /**
18
+ * The Syncthing instance deployed on Kubernetes.
19
+ */
8
20
  export const syncthing = defineUnit({
9
- type: "apps.syncthing",
21
+ type: "k8s.apps.syncthing.v1",
10
22
 
11
23
  args: {
12
- ...createArgs("syncthing", ["fqdn", "external"]),
24
+ ...appName("syncthing"),
25
+ ...pick(sharedArgs, ["fqdn", "external"]),
13
26
 
14
27
  /**
15
28
  * The FQDN of the Syncthing instance used to sync with other devices.
@@ -31,8 +44,14 @@ export const syncthing = defineUnit({
31
44
  backupMode: backupModeSchema.default("state"),
32
45
  },
33
46
 
34
- secrets: createSecrets(["backupPassword"]),
35
- inputs: createInputs(["accessPoint", "resticRepo", "volume"]),
47
+ secrets: {
48
+ ...pick(sharedSecrets, ["backupPassword"]),
49
+ },
50
+
51
+ inputs: {
52
+ ...pick(sharedInputs, ["k8sCluster", "accessPoint"]),
53
+ ...pick(optionalSharedInputs, ["resticRepo", "volume"]),
54
+ },
36
55
 
37
56
  outputs: {
38
57
  volume: persistentVolumeClaimEntity,
@@ -45,10 +64,9 @@ export const syncthing = defineUnit({
45
64
 
46
65
  meta: {
47
66
  title: "Syncthing",
48
- description: "The Syncthing instance deployed on Kubernetes.",
49
67
  icon: "simple-icons:syncthing",
50
68
  category: "File Sync",
51
69
  },
52
70
 
53
- source: createSource("syncthing"),
71
+ source: source("syncthing"),
54
72
  })
@@ -0,0 +1,40 @@
1
+ import { defineUnit, z } from "@highstate/contract"
2
+ import { pick } from "remeda"
3
+ import { gatewayEntity } from "../../common"
4
+ import { l4EndpointEntity } from "../../network"
5
+ import { serviceEntity } from "../service"
6
+ import { appName, sharedArgs, sharedInputs, source } from "./shared"
7
+
8
+ /**
9
+ * The Traefik instance + gateway implementation.
10
+ */
11
+ export const traefik = defineUnit({
12
+ type: "k8s.apps.traefik.v1",
13
+
14
+ args: {
15
+ ...appName("traefik"),
16
+ ...pick(sharedArgs, ["external", "replicas"]),
17
+ className: z.string().optional(),
18
+ },
19
+
20
+ inputs: {
21
+ ...pick(sharedInputs, ["k8sCluster"]),
22
+ },
23
+
24
+ outputs: {
25
+ gateway: gatewayEntity,
26
+ service: serviceEntity,
27
+ endpoints: {
28
+ entity: l4EndpointEntity,
29
+ multiple: true,
30
+ },
31
+ },
32
+
33
+ meta: {
34
+ title: "Traefik Gateway",
35
+ icon: "simple-icons:traefikproxy",
36
+ category: "Network",
37
+ },
38
+
39
+ source: source("traefik"),
40
+ })
@@ -0,0 +1,31 @@
1
+ import { defineUnit, z } from "@highstate/contract"
2
+ import { pick } from "remeda"
3
+ import { appName, sharedArgs, sharedInputs, source } from "./shared"
4
+
5
+ /**
6
+ * The Vaultwarden password manager deployed on Kubernetes.
7
+ */
8
+ export const vaultwarden = defineUnit({
9
+ type: "k8s.apps.vaultwarden.v1",
10
+
11
+ args: {
12
+ ...appName("vaultwarden"),
13
+ ...pick(sharedArgs, ["fqdn"]),
14
+ },
15
+
16
+ secrets: {
17
+ mariadbPassword: z.string().optional(),
18
+ },
19
+
20
+ inputs: {
21
+ ...pick(sharedInputs, ["k8sCluster", "accessPoint", "mariadb"]),
22
+ },
23
+
24
+ meta: {
25
+ title: "Vaultwarden",
26
+ icon: "simple-icons:vaultwarden",
27
+ category: "Security",
28
+ },
29
+
30
+ source: source("vaultwarden"),
31
+ })
@@ -0,0 +1,214 @@
1
+ import { defineUnit, z } from "@highstate/contract"
2
+ import { pick } from "remeda"
3
+ import { portSchema } from "../../network"
4
+ import { serviceEntity, serviceTypeSchema } from "../service"
5
+ import { deploymentEntity } from "../workload"
6
+ import { optionalSharedInputs, sharedInputs, source } from "./shared"
7
+
8
+ export const databaseConfigKeySchema = z.enum([
9
+ "url",
10
+ "host",
11
+ "port",
12
+ "username",
13
+ "password",
14
+ "database",
15
+ ])
16
+
17
+ export const environmentVariableSchema = z.union([
18
+ z.string(),
19
+ z.object({
20
+ dependencyKey: z.templateLiteral([
21
+ z.enum(["mariadb", "postgresql", "mongodb"]),
22
+ z.literal("."),
23
+ databaseConfigKeySchema,
24
+ ]),
25
+ }),
26
+ z.object({
27
+ configKey: z.string(),
28
+ }),
29
+ z.object({
30
+ secretKey: z.string(),
31
+ }),
32
+ ])
33
+
34
+ /**
35
+ * The generic Kubernetes workload with optional service and gateway routes.
36
+ *
37
+ * May reference known databases and other services.
38
+ */
39
+ export const workload = defineUnit({
40
+ type: "k8s.apps.workload.v1",
41
+
42
+ args: {
43
+ /**
44
+ * The name of the application.
45
+ *
46
+ * If not provided, the name of the unit will be used.
47
+ */
48
+ appName: z.string().optional(),
49
+
50
+ /**
51
+ * The name of the new namespace to create for the workload.
52
+ *
53
+ * If not provided, the `appName` will be used as the namespace name.
54
+ */
55
+ namespace: z.string().optional(),
56
+
57
+ /**
58
+ * The name of the existing namespace to use for the workload.
59
+ */
60
+ existingNamespace: z.string().optional(),
61
+
62
+ /**
63
+ * The type of the workload to create.
64
+ */
65
+ type: z
66
+ .enum(["Deployment", "StatefulSet", "DaemonSet", "Job", "CronJob"])
67
+ .default("Deployment"),
68
+
69
+ /**
70
+ * The image to use for the workload.
71
+ */
72
+ image: z.string(),
73
+
74
+ /**
75
+ * The port to expose for the workload.
76
+ *
77
+ * If specified, a service will be created for the workload.
78
+ */
79
+ port: portSchema.optional(),
80
+
81
+ /**
82
+ * The FQDN of the workload.
83
+ *
84
+ * If specified, a service and an HTTP route will be created for the workload.
85
+ */
86
+ fqdn: z.string().optional(),
87
+
88
+ /**
89
+ * The type of the service to create for the workload.
90
+ */
91
+ serviceType: serviceTypeSchema.default("ClusterIP"),
92
+
93
+ /**
94
+ * The number of replicas for the workload.
95
+ *
96
+ * By default, it is set to 1.
97
+ */
98
+ replicas: z.number().default(1),
99
+
100
+ /**
101
+ * The path where the workload data will be stored.
102
+ *
103
+ * If specified, a persistent volume claim will be created for the workload.
104
+ *
105
+ * If `resticRepo` input is provided, the automatic backup will be enabled for this path.
106
+ */
107
+ dataPath: z.string().optional(),
108
+
109
+ /**
110
+ * The environment variables to set for the workload.
111
+ *
112
+ * The values can be:
113
+ * 1. a static string value;
114
+ * 2. a dependency key to service configuration (e.g., `mariadb.username`);
115
+ * 3. a config key to reference a configuration value provided via `config` argument;
116
+ * 4. a secret key to reference a secret value provided via `secretData` secret.
117
+ */
118
+ env: z.record(z.string(), environmentVariableSchema).default({}),
119
+
120
+ /**
121
+ * The configuration for the workload.
122
+ *
123
+ * If provided, the config map will be created.
124
+ *
125
+ * You can reference the configuration values in the environment variables using `configKey`.
126
+ */
127
+ config: z.record(z.string(), z.unknown()).default({}),
128
+
129
+ /**
130
+ * The Kubernetes manifest patch for the deployment.
131
+ *
132
+ * Will be applied to the deployment manifest before it is created.
133
+ */
134
+ manifest: z.record(z.string(), z.unknown()).default({}),
135
+
136
+ /**
137
+ * The Kubernetes service manifest for the deployment.
138
+ *
139
+ * Will be applied to the service manifest before it is created.
140
+ */
141
+ serviceManifest: z.record(z.string(), z.unknown()).default({}),
142
+
143
+ /**
144
+ * The Kubernetes HTTP route manifest for the deployment.
145
+ *
146
+ * Will be applied to the HTTP route manifest before it is created.
147
+ */
148
+ httpRouteManifest: z.record(z.string(), z.unknown()).default({}),
149
+ },
150
+
151
+ secrets: {
152
+ /**
153
+ * The password for the MariaDB database.
154
+ *
155
+ * If not provided and requested, a random password will be generated.
156
+ */
157
+ mariadbPassword: z.string().optional(),
158
+
159
+ /**
160
+ * The password for the PostgreSQL database.
161
+ *
162
+ * If not provided and requested, a random password will be generated.
163
+ */
164
+ postgresqlPassword: z.string().optional(),
165
+
166
+ /**
167
+ * The password for the MongoDB database.
168
+ *
169
+ * If not provided and requested, a random password will be generated.
170
+ */
171
+ mongodbPassword: z.string().optional(),
172
+
173
+ /**
174
+ * The password for the backup.
175
+ *
176
+ * If not provided and requested, a random password will be generated.
177
+ */
178
+ backupPassword: z.string().optional(),
179
+
180
+ /**
181
+ * The secret configuration for the workload.
182
+ *
183
+ * If provided, the secret will be created with the specified content.
184
+ *
185
+ * You can reference the secret values in the environment variables using `secretKey`.
186
+ */
187
+ secretData: z.record(z.string(), z.string()).default({}),
188
+ },
189
+
190
+ inputs: {
191
+ ...pick(sharedInputs, ["k8sCluster"]),
192
+ ...pick(optionalSharedInputs, [
193
+ "accessPoint",
194
+ "resticRepo",
195
+ "mariadb",
196
+ "postgresql",
197
+ "mongodb",
198
+ ]),
199
+ },
200
+
201
+ outputs: {
202
+ deployment: deploymentEntity,
203
+ service: serviceEntity,
204
+ },
205
+
206
+ meta: {
207
+ title: "Kubernetes Workload",
208
+ icon: "devicon:kubernetes",
209
+ secondaryIcon: "mdi:cube-outline",
210
+ category: "Kubernetes",
211
+ },
212
+
213
+ source: source("deployment"),
214
+ })
@@ -0,0 +1,26 @@
1
+ import { defineUnit } from "@highstate/contract"
2
+ import { pick } from "remeda"
3
+ import { appName, sharedArgs, sharedInputs, source } from "./shared"
4
+
5
+ /**
6
+ * The Zitadel IAM deployed on Kubernetes.
7
+ */
8
+ export const zitadel = defineUnit({
9
+ type: "k8s.apps.zitadel.v1",
10
+
11
+ args: {
12
+ ...appName("zitadel"),
13
+ ...pick(sharedArgs, ["fqdn"]),
14
+ },
15
+
16
+ inputs: {
17
+ ...pick(sharedInputs, ["k8sCluster", "accessPoint", "postgresql"]),
18
+ },
19
+
20
+ meta: {
21
+ title: "Zitadel",
22
+ icon: "hugeicons:access",
23
+ },
24
+
25
+ source: source("zitadel"),
26
+ })