@highstate/library 0.9.15 → 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.
Files changed (46) hide show
  1. package/dist/highstate.library.msgpack +0 -0
  2. package/dist/highstate.manifest.json +5 -0
  3. package/dist/index.js +1716 -1166
  4. package/dist/index.js.map +1 -1
  5. package/package.json +8 -6
  6. package/src/abbreviations.ts +35 -0
  7. package/src/apps/code-server.ts +5 -5
  8. package/src/apps/deployment.ts +20 -20
  9. package/src/apps/dns.ts +12 -14
  10. package/src/apps/gitea.ts +2 -2
  11. package/src/apps/grocy.ts +2 -2
  12. package/src/apps/hubble.ts +2 -2
  13. package/src/apps/kubernetes-dashboard.ts +2 -2
  14. package/src/apps/mariadb.ts +10 -10
  15. package/src/apps/maybe.ts +5 -5
  16. package/src/apps/mongodb.ts +10 -10
  17. package/src/apps/network.ts +6 -6
  18. package/src/apps/postgresql.ts +10 -10
  19. package/src/apps/shared.ts +18 -19
  20. package/src/apps/syncthing.ts +6 -6
  21. package/src/apps/traefik.ts +4 -4
  22. package/src/apps/vaultwarden.ts +4 -4
  23. package/src/apps/zitadel.ts +2 -2
  24. package/src/cloudflare.ts +4 -4
  25. package/src/common.ts +25 -78
  26. package/src/distributions/index.ts +1 -0
  27. package/src/distributions/ubuntu.ts +32 -0
  28. package/src/dns.ts +10 -18
  29. package/src/files.ts +135 -0
  30. package/src/git.ts +58 -0
  31. package/src/index.ts +5 -0
  32. package/src/k3s.ts +9 -17
  33. package/src/k8s.ts +130 -146
  34. package/src/mullvad.ts +5 -9
  35. package/src/network.ts +69 -44
  36. package/src/nixos.ts +51 -86
  37. package/src/obfuscators/phantun.ts +4 -4
  38. package/src/obfuscators/shared.ts +23 -43
  39. package/src/proxmox.ts +301 -60
  40. package/src/restic.ts +17 -19
  41. package/src/sops.ts +7 -6
  42. package/src/ssh.ts +21 -19
  43. package/src/talos.ts +15 -27
  44. package/src/timeweb.ts +13 -13
  45. package/src/utils.ts +3 -3
  46. package/src/wireguard.ts +90 -127
package/src/k3s.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { defineUnit, Type } from "@highstate/contract"
1
+ import { defineUnit, z } from "@highstate/contract"
2
2
  import { clusterInputs, clusterOutputs } from "./k8s"
3
3
 
4
4
  export const packagedComponents = [
@@ -18,9 +18,9 @@ export const internalComponents = [
18
18
  "helm-controller",
19
19
  ] as const
20
20
 
21
- export const componentSchema = Type.StringEnum([...packagedComponents, ...internalComponents])
21
+ export const componentSchema = z.enum([...packagedComponents, ...internalComponents])
22
22
 
23
- export const cniSchema = Type.StringEnum(["none", "flannel"])
23
+ export const cniSchema = z.enum(["none", "flannel"])
24
24
 
25
25
  export const cluster = defineUnit({
26
26
  type: "k3s.cluster",
@@ -28,48 +28,40 @@ export const cluster = defineUnit({
28
28
  args: {
29
29
  /**
30
30
  * The components to disable in the K3S cluster.
31
- *
32
- * @schema
33
31
  */
34
- disabledComponents: Type.Default(Type.Array(componentSchema), []),
32
+ disabledComponents: componentSchema.array().default([]),
35
33
 
36
34
  /**
37
35
  * The CNI to use in the K3S cluster.
38
36
  *
39
37
  * Setting this to "none" will disable default Flannel CNI, but will not disable network policy controller and kube-proxy.
40
38
  * If needed, you can disable them using `disabledComponents` argument.
41
- *
42
- * @schema
43
39
  */
44
- cni: Type.Default(cniSchema, "flannel"),
40
+ cni: cniSchema.default("flannel"),
45
41
 
46
42
  /**
47
43
  * The K3S configuration to pass to each server or agent in the cluster.
48
44
  *
49
45
  * See: https://docs.k3s.io/installation/configuration
50
- *
51
- * @schema
52
46
  */
53
- config: Type.Optional(Type.Record(Type.String(), Type.Any())),
47
+ config: z.record(z.string(), z.any()).optional(),
54
48
 
55
49
  /**
56
50
  * The configuration of the registries to use for the K3S cluster.
57
51
  *
58
52
  * See: https://docs.k3s.io/installation/private-registry
59
- *
60
- * @schema
61
53
  */
62
- registries: Type.Optional(Type.Record(Type.String(), Type.Any())),
54
+ registries: z.record(z.string(), z.any()).optional(),
63
55
  },
64
56
 
65
57
  inputs: clusterInputs,
66
58
  outputs: clusterOutputs,
67
59
 
68
60
  meta: {
69
- displayName: "K3s Cluster",
61
+ title: "K3s Cluster",
70
62
  description: "The K3s cluster created on top of the server.",
71
63
  category: "k3s",
72
- primaryIcon: "devicon:k3s",
64
+ icon: "devicon:k3s",
73
65
  secondaryIcon: "devicon:kubernetes",
74
66
  },
75
67
 
package/src/k8s.ts CHANGED
@@ -1,39 +1,36 @@
1
- import { defineEntity, defineUnit, Type, type Static } from "@highstate/contract"
2
- import { Literal } from "@sinclair/typebox"
1
+ import { $args, defineEntity, defineUnit, z } from "@highstate/contract"
3
2
  import * as dns from "./dns"
4
3
  import { l3EndpointEntity, l4EndpointEntity } from "./network"
5
4
  import { serverEntity } from "./common"
6
5
  import { arrayPatchModeSchema } from "./utils"
7
6
 
8
- export const fallbackKubeApiAccessSchema = Type.Object({
9
- serverIp: Type.String(),
10
- serverPort: Type.Number(),
7
+ export const fallbackKubeApiAccessSchema = z.object({
8
+ serverIp: z.string(),
9
+ serverPort: z.number(),
11
10
  })
12
11
 
13
- export const tunDevicePolicySchema = Type.Union([
14
- Type.Object({
15
- type: Literal("host"),
12
+ export const tunDevicePolicySchema = z.union([
13
+ z.object({
14
+ type: z.literal("host"),
16
15
  }),
17
- Type.Object({
18
- type: Literal("plugin"),
19
- resourceName: Type.String(),
20
- resourceValue: Type.String(),
16
+ z.object({
17
+ type: z.literal("plugin"),
18
+ resourceName: z.string(),
19
+ resourceValue: z.string(),
21
20
  }),
22
21
  ])
23
22
 
24
- export const externalServiceTypeSchema = Type.StringEnum(["NodePort", "LoadBalancer"])
25
- export const scheduleOnMastersPolicySchema = Type.StringEnum(["always", "when-no-workers", "never"])
26
- export const cniSchema = Type.StringEnum(["cilium", "other"])
23
+ export const externalServiceTypeSchema = z.enum(["NodePort", "LoadBalancer"])
24
+ export const scheduleOnMastersPolicySchema = z.enum(["always", "when-no-workers", "never"])
25
+ export const cniSchema = z.enum(["cilium", "other"])
27
26
 
28
- export const clusterQuirksSchema = Type.Object({
27
+ export const clusterQuirksSchema = z.object({
29
28
  /**
30
29
  * The IP and port of the kube-apiserver available from the cluster.
31
30
  *
32
31
  * Will be used to create fallback network policy in CNIs which does not support allowing access to the kube-apiserver.
33
- *
34
- * @schema
35
32
  */
36
- fallbackKubeApiAccess: Type.Optional(fallbackKubeApiAccessSchema),
33
+ fallbackKubeApiAccess: fallbackKubeApiAccessSchema.optional(),
37
34
 
38
35
  /**
39
36
  * Specifies the policy for using the tun device inside containers.
@@ -41,19 +38,15 @@ export const clusterQuirksSchema = Type.Object({
41
38
  * If not provided, the default policy is `host` which assumes just mounting /dev/net/tun from the host.
42
39
  *
43
40
  * For some runtimes, like Talos's one, the /dev/net/tun device is not available in the host, so the plugin policy should be used.
44
- *
45
- * @schema
46
41
  */
47
- tunDevicePolicy: Type.Optional(tunDevicePolicySchema),
42
+ tunDevicePolicy: tunDevicePolicySchema.optional(),
48
43
 
49
44
  /**
50
45
  * The service type to use for external services.
51
46
  *
52
47
  * If not provided, the default service type is `NodePort` since `LoadBalancer` may not be available.
53
- *
54
- * @schema
55
48
  */
56
- externalServiceType: Type.Optional(externalServiceTypeSchema),
49
+ externalServiceType: externalServiceTypeSchema.optional(),
57
50
  })
58
51
 
59
52
  export const clusterInfoProperties = {
@@ -61,17 +54,13 @@ export const clusterInfoProperties = {
61
54
  * The unique identifier of the cluster.
62
55
  *
63
56
  * Should be defined as a UUID of the `kube-system` namespace which is always present in the cluster.
64
- *
65
- * @schema
66
57
  */
67
- id: Type.String(),
58
+ id: z.string(),
68
59
 
69
60
  /**
70
61
  * The name of the cluster.
71
- *
72
- * @schema
73
62
  */
74
- name: Type.String(),
63
+ name: z.string(),
75
64
 
76
65
  /**
77
66
  * The name of the CNI plugin used by the cluster.
@@ -79,8 +68,6 @@ export const clusterInfoProperties = {
79
68
  * Supported values are:
80
69
  * - `cilium`
81
70
  * - `other`
82
- *
83
- * @schema
84
71
  */
85
72
  cni: cniSchema,
86
73
 
@@ -90,10 +77,8 @@ export const clusterInfoProperties = {
90
77
  * The entry may represent real node endpoint or virtual endpoint (like a load balancer).
91
78
  *
92
79
  * The same node may also be represented by multiple entries (e.g. a node with private and public IP).
93
- *
94
- * @schema
95
80
  */
96
- endpoints: Type.Array(l3EndpointEntity.schema),
81
+ endpoints: l3EndpointEntity.schema.array(),
97
82
 
98
83
  /**
99
84
  * The endpoints of the API server.
@@ -102,51 +87,45 @@ export const clusterInfoProperties = {
102
87
  *
103
88
  * The same node may also be represented by multiple entries (e.g. a node with private and public IP).
104
89
  */
105
- apiEndpoints: Type.Array(l4EndpointEntity.schema),
90
+ apiEndpoints: l4EndpointEntity.schema.array(),
106
91
 
107
92
  /**
108
93
  * The external IPs of the cluster nodes allowed to be used for external access.
109
- *
110
- * @schema
111
94
  */
112
- externalIps: Type.Array(Type.String()),
95
+ externalIps: z.string().array(),
113
96
 
114
97
  /**
115
98
  * The extra quirks of the cluster to improve compatibility.
116
- *
117
- * @schema
118
99
  */
119
- quirks: Type.Optional(clusterQuirksSchema),
100
+ quirks: clusterQuirksSchema.optional(),
120
101
 
121
102
  /**
122
103
  * The extra metadata to attach to the cluster.
123
- *
124
- * @schema
125
104
  */
126
- metadata: Type.Optional(Type.Record(Type.String(), Type.Unknown())),
105
+ metadata: z.record(z.string(), z.unknown()).optional(),
127
106
  } as const
128
107
 
129
- export const serviceTypeSchema = Type.StringEnum(["NodePort", "LoadBalancer", "ClusterIP"])
108
+ export const serviceTypeSchema = z.enum(["NodePort", "LoadBalancer", "ClusterIP"])
130
109
 
131
- export const metadataSchema = Type.Object({
132
- name: Type.String(),
133
- namespace: Type.String(),
134
- labels: Type.Optional(Type.Record(Type.String(), Type.String())),
135
- annotations: Type.Optional(Type.Record(Type.String(), Type.String())),
110
+ export const metadataSchema = z.object({
111
+ name: z.string(),
112
+ namespace: z.string(),
113
+ labels: z.record(z.string(), z.string()).optional(),
114
+ annotations: z.record(z.string(), z.string()).optional(),
136
115
  })
137
116
 
138
- export const resourceSchema = Type.Object({
139
- clusterId: Type.String(),
117
+ export const resourceSchema = z.object({
118
+ clusterId: z.string(),
140
119
  metadata: metadataSchema,
141
120
  })
142
121
 
143
122
  export const serviceEntity = defineEntity({
144
123
  type: "k8s.service",
145
124
 
146
- schema: Type.Object({
147
- type: Type.Literal("k8s.service"),
148
- ...resourceSchema.properties,
149
- endpoints: Type.Array(l4EndpointEntity.schema),
125
+ schema: z.object({
126
+ type: z.literal("k8s.service"),
127
+ ...resourceSchema.shape,
128
+ endpoints: l4EndpointEntity.schema.array(),
150
129
  }),
151
130
 
152
131
  meta: {
@@ -157,9 +136,9 @@ export const serviceEntity = defineEntity({
157
136
  export const clusterEntity = defineEntity({
158
137
  type: "k8s.cluster",
159
138
 
160
- schema: Type.Object({
139
+ schema: z.object({
161
140
  ...clusterInfoProperties,
162
- kubeconfig: Type.String(),
141
+ kubeconfig: z.string(),
163
142
  }),
164
143
 
165
144
  meta: {
@@ -167,20 +146,18 @@ export const clusterEntity = defineEntity({
167
146
  },
168
147
  })
169
148
 
170
- export const internalIpsPolicySchema = Type.StringEnum(["always", "public", "never"])
149
+ export const internalIpsPolicySchema = z.enum(["always", "public", "never"])
171
150
 
172
- export const scheduleOnMastersPolicyArgs = {
151
+ export const scheduleOnMastersPolicyArgs = $args({
173
152
  /**
174
153
  * The policy for scheduling workloads on master nodes.
175
154
  *
176
155
  * - `always`: always schedule workloads on master nodes regardless of the number of workers;
177
156
  * - `when-no-workers`: schedule workloads on master nodes only if there are no workers (default);
178
157
  * - `never`: never schedule workloads on master nodes.
179
- *
180
- * @schema
181
158
  */
182
- scheduleOnMastersPolicy: Type.Default(scheduleOnMastersPolicySchema, "when-no-workers"),
183
- }
159
+ scheduleOnMastersPolicy: scheduleOnMastersPolicySchema.default("when-no-workers"),
160
+ })
184
161
 
185
162
  export const clusterInputs = {
186
163
  masters: {
@@ -214,10 +191,8 @@ export const existingCluster = defineUnit({
214
191
  * The list of external IPs of the cluster nodes allowed to be used for external access.
215
192
  *
216
193
  * If not provided, will be automatically detected by querying the cluster nodes.
217
- *
218
- * @schema
219
194
  */
220
- externalIps: Type.Optional(Type.Array(Type.String())),
195
+ externalIps: z.string().array().optional(),
221
196
 
222
197
  /**
223
198
  * The policy for using internal IPs of the nodes as external IPs.
@@ -225,17 +200,13 @@ export const existingCluster = defineUnit({
225
200
  * - `always`: always use internal IPs as external IPs;
226
201
  * - `public`: use internal IPs as external IPs only if they are (theoretically) routable from the public internet **(default)**;
227
202
  * - `never`: never use internal IPs as external IPs.
228
- *
229
- * @schema
230
203
  */
231
- internalIpsPolicy: Type.Default(internalIpsPolicySchema, "public"),
204
+ internalIpsPolicy: internalIpsPolicySchema.default("public"),
232
205
 
233
206
  /**
234
207
  * The extra quirks of the cluster to improve compatibility.
235
- *
236
- * @schema
237
208
  */
238
- quirks: Type.Optional(clusterQuirksSchema),
209
+ quirks: clusterQuirksSchema.optional(),
239
210
  },
240
211
 
241
212
  secrets: {
@@ -243,18 +214,16 @@ export const existingCluster = defineUnit({
243
214
  * The kubeconfig of the cluster to use for connecting to the cluster.
244
215
  *
245
216
  * Will be available for all components using `cluster` output of this unit.
246
- *
247
- * @schema
248
217
  */
249
- kubeconfig: Type.Record(Type.String(), Type.Any()),
218
+ kubeconfig: z.record(z.string(), z.unknown()),
250
219
  },
251
220
 
252
221
  outputs: clusterOutputs,
253
222
 
254
223
  meta: {
255
- displayName: "Existing Cluster",
224
+ title: "Existing Cluster",
256
225
  description: "An existing Kubernetes cluster.",
257
- primaryIcon: "devicon:kubernetes",
226
+ icon: "devicon:kubernetes",
258
227
  category: "Kubernetes",
259
228
  },
260
229
 
@@ -274,10 +243,8 @@ export const clusterPatch = defineUnit({
274
243
  * The entry may represent real node endpoint or virtual endpoint (like a load balancer).
275
244
  *
276
245
  * The same node may also be represented by multiple entries (e.g. a node with private and public IP).
277
- *
278
- * @schema
279
246
  */
280
- apiEndpoints: Type.Default(Type.Array(Type.String()), []),
247
+ apiEndpoints: z.string().array().default([]),
281
248
 
282
249
  /**
283
250
  * The mode to use for patching the API endpoints.
@@ -285,7 +252,7 @@ export const clusterPatch = defineUnit({
285
252
  * - `prepend`: prepend the new endpoints to the existing ones (default);
286
253
  * - `replace`: replace the existing endpoints with the new ones.
287
254
  */
288
- apiEndpointsPatchMode: Type.Default(arrayPatchModeSchema, "prepend"),
255
+ apiEndpointsPatchMode: arrayPatchModeSchema.default("prepend"),
289
256
 
290
257
  /**
291
258
  * The endpoints of the cluster nodes.
@@ -293,10 +260,8 @@ export const clusterPatch = defineUnit({
293
260
  * The entry may represent real node endpoint or virtual endpoint (like a load balancer).
294
261
  *
295
262
  * The same node may also be represented by multiple entries (e.g. a node with private and public IP).
296
- *
297
- * @schema
298
263
  */
299
- endpoints: Type.Default(Type.Array(Type.String()), []),
264
+ endpoints: z.string().array().default([]),
300
265
 
301
266
  /**
302
267
  * The mode to use for patching the endpoints.
@@ -304,7 +269,7 @@ export const clusterPatch = defineUnit({
304
269
  * - `prepend`: prepend the new endpoints to the existing ones (default);
305
270
  * - `replace`: replace the existing endpoints with the new ones.
306
271
  */
307
- endpointsPatchMode: Type.Default(arrayPatchModeSchema, "prepend"),
272
+ endpointsPatchMode: arrayPatchModeSchema.default("prepend"),
308
273
  },
309
274
 
310
275
  inputs: {
@@ -324,9 +289,9 @@ export const clusterPatch = defineUnit({
324
289
  outputs: clusterOutputs,
325
290
 
326
291
  meta: {
327
- displayName: "Cluster Patch",
292
+ title: "Cluster Patch",
328
293
  description: "Patches some properties of the cluster.",
329
- primaryIcon: "devicon:kubernetes",
294
+ icon: "devicon:kubernetes",
330
295
  secondaryIcon: "fluent:patch-20-filled",
331
296
  category: "Kubernetes",
332
297
  },
@@ -353,9 +318,9 @@ export const clusterDns = defineUnit({
353
318
  outputs: clusterOutputs,
354
319
 
355
320
  meta: {
356
- displayName: "Cluster DNS",
321
+ title: "Cluster DNS",
357
322
  description: "Creates DNS records for the cluster and updates endpoints.",
358
- primaryIcon: "devicon:kubernetes",
323
+ icon: "devicon:kubernetes",
359
324
  secondaryIcon: "mdi:dns",
360
325
  category: "Kubernetes",
361
326
  },
@@ -369,12 +334,12 @@ export const clusterDns = defineUnit({
369
334
  export const gatewayEntity = defineEntity({
370
335
  type: "k8s.gateway",
371
336
 
372
- schema: Type.Object({
373
- clusterId: Type.String(),
374
- gatewayClassName: Type.String(),
375
- httpListenerPort: Type.Number(),
376
- httpsListenerPort: Type.Number(),
377
- endpoints: Type.Array(l3EndpointEntity.schema),
337
+ schema: z.object({
338
+ clusterId: z.string(),
339
+ gatewayClassName: z.string(),
340
+ httpListenerPort: z.number(),
341
+ httpsListenerPort: z.number(),
342
+ endpoints: l3EndpointEntity.schema.array(),
378
343
  }),
379
344
 
380
345
  meta: {
@@ -385,9 +350,9 @@ export const gatewayEntity = defineEntity({
385
350
  export const tlsIssuerEntity = defineEntity({
386
351
  type: "k8s.tls-issuer",
387
352
 
388
- schema: Type.Object({
389
- clusterId: Type.String(),
390
- clusterIssuerName: Type.String(),
353
+ schema: z.object({
354
+ clusterId: z.string(),
355
+ clusterIssuerName: z.string(),
391
356
  }),
392
357
 
393
358
  meta: {
@@ -398,11 +363,11 @@ export const tlsIssuerEntity = defineEntity({
398
363
  export const accessPointEntity = defineEntity({
399
364
  type: "k8s.access-point",
400
365
 
401
- schema: Type.Object({
402
- clusterId: Type.String(),
366
+ schema: z.object({
367
+ clusterId: z.string(),
403
368
  gateway: gatewayEntity.schema,
404
369
  tlsIssuer: tlsIssuerEntity.schema,
405
- dnsProviders: Type.Array(dns.providerEntity.schema),
370
+ dnsProviders: dns.providerEntity.schema.array(),
406
371
  }),
407
372
 
408
373
  meta: {
@@ -427,9 +392,9 @@ export const accessPoint = defineUnit({
427
392
  },
428
393
 
429
394
  meta: {
430
- displayName: "Access Point",
395
+ title: "Access Point",
431
396
  description: "An access point which can be used to connect to services.",
432
- primaryIcon: "mdi:access-point",
397
+ icon: "mdi:access-point",
433
398
  category: "Kubernetes",
434
399
  },
435
400
 
@@ -451,9 +416,9 @@ export const certManager = defineUnit({
451
416
  },
452
417
 
453
418
  meta: {
454
- displayName: "Cert Manager",
419
+ title: "Cert Manager",
455
420
  description: "A certificate manager for managing TLS certificates.",
456
- primaryIcon: "simple-icons:letsencrypt",
421
+ icon: "simple-icons:letsencrypt",
457
422
  category: "Kubernetes",
458
423
  },
459
424
 
@@ -471,10 +436,8 @@ export const dns01TlsIssuer = defineUnit({
471
436
  * The top-level domains to filter the DNS01 challenge for.
472
437
  *
473
438
  * If not provided, will use all domains passed to the DNS providers.
474
- *
475
- * @schema
476
439
  */
477
- domains: Type.Optional(Type.Array(Type.String())),
440
+ domains: z.string().array().optional(),
478
441
  },
479
442
 
480
443
  inputs: {
@@ -490,9 +453,9 @@ export const dns01TlsIssuer = defineUnit({
490
453
  },
491
454
 
492
455
  meta: {
493
- displayName: "DNS01 Issuer",
456
+ title: "DNS01 Issuer",
494
457
  description: "A TLS issuer for issuing certificate using DNS01 challenge.",
495
- primaryIcon: "mdi:certificate",
458
+ icon: "mdi:certificate",
496
459
  category: "Kubernetes",
497
460
  },
498
461
 
@@ -505,10 +468,10 @@ export const dns01TlsIssuer = defineUnit({
505
468
  export const deploymentEntity = defineEntity({
506
469
  type: "k8s.deployment",
507
470
 
508
- schema: Type.Object({
509
- type: Type.Literal("k8s.deployment"),
510
- ...resourceSchema.properties,
511
- service: Type.Optional(serviceEntity.schema),
471
+ schema: z.object({
472
+ type: z.literal("k8s.deployment"),
473
+ ...resourceSchema.shape,
474
+ service: serviceEntity.schema.optional(),
512
475
  }),
513
476
 
514
477
  meta: {
@@ -519,9 +482,9 @@ export const deploymentEntity = defineEntity({
519
482
  export const statefulSetEntity = defineEntity({
520
483
  type: "k8s.stateful-set",
521
484
 
522
- schema: Type.Object({
523
- type: Type.Literal("k8s.stateful-set"),
524
- ...resourceSchema.properties,
485
+ schema: z.object({
486
+ type: z.literal("k8s.stateful-set"),
487
+ ...resourceSchema.shape,
525
488
  service: serviceEntity.schema,
526
489
  }),
527
490
 
@@ -533,7 +496,7 @@ export const statefulSetEntity = defineEntity({
533
496
  export const exposableWorkloadEntity = defineEntity({
534
497
  type: "k8s.exposable-workload",
535
498
 
536
- schema: Type.Union([deploymentEntity.schema, statefulSetEntity.schema]),
499
+ schema: z.union([deploymentEntity.schema, statefulSetEntity.schema]),
537
500
 
538
501
  meta: {
539
502
  color: "#4CAF50",
@@ -543,9 +506,9 @@ export const exposableWorkloadEntity = defineEntity({
543
506
  export const persistentVolumeClaimEntity = defineEntity({
544
507
  type: "k8s.persistent-volume-claim",
545
508
 
546
- schema: Type.Object({
547
- type: Type.Literal("k8s.persistent-volume-claim"),
548
- ...resourceSchema.properties,
509
+ schema: z.object({
510
+ type: z.literal("k8s.persistent-volume-claim"),
511
+ ...resourceSchema.shape,
549
512
  }),
550
513
 
551
514
  meta: {
@@ -556,8 +519,8 @@ export const persistentVolumeClaimEntity = defineEntity({
556
519
  export const interfaceEntity = defineEntity({
557
520
  type: "k8s.interface",
558
521
 
559
- schema: Type.Object({
560
- name: Type.String(),
522
+ schema: z.object({
523
+ name: z.string(),
561
524
  workload: exposableWorkloadEntity.schema,
562
525
  }),
563
526
 
@@ -580,9 +543,9 @@ export const gatewayApi = defineUnit({
580
543
  },
581
544
 
582
545
  meta: {
583
- displayName: "Gateway API",
546
+ title: "Gateway API",
584
547
  description: "Installs the Gateway API CRDs to the cluster.",
585
- primaryIcon: "devicon:kubernetes",
548
+ icon: "devicon:kubernetes",
586
549
  secondaryIcon: "mdi:api",
587
550
  secondaryIconColor: "#4CAF50",
588
551
  category: "Kubernetes",
@@ -605,7 +568,7 @@ export const cilium = defineUnit({
605
568
  *
606
569
  * By default, is `false`.
607
570
  */
608
- allowForbiddenFqdnResolution: Type.Default(Type.Boolean(), false),
571
+ allowForbiddenFqdnResolution: z.boolean().default(false),
609
572
  },
610
573
 
611
574
  inputs: {
@@ -617,9 +580,9 @@ export const cilium = defineUnit({
617
580
  },
618
581
 
619
582
  meta: {
620
- displayName: "Cilium",
583
+ title: "Cilium",
621
584
  description: "The Cilium CNI deployed on Kubernetes.",
622
- primaryIcon: "simple-icons:cilium",
585
+ icon: "simple-icons:cilium",
623
586
  secondaryIcon: "devicon:kubernetes",
624
587
  category: "Kubernetes",
625
588
  },
@@ -630,24 +593,45 @@ export const cilium = defineUnit({
630
593
  },
631
594
  })
632
595
 
633
- export type CNI = Static<typeof cniSchema>
634
- export type Cluster = Static<typeof clusterEntity.schema>
596
+ export const monitorWorkerResourceGroupSchema = z.object({
597
+ type: z.enum(["deployment", "statefulset", "pod", "service"]),
598
+ namespace: z.string(),
599
+ names: z.string().array().optional(),
600
+ })
601
+
602
+ export const monitorWorkerParamsSchema = z.object({
603
+ /**
604
+ * The ID of the secret containing the kubeconfig of the cluster.
605
+ */
606
+ kubeconfigSecretId: z.string(),
607
+
608
+ /**
609
+ * The resources to monitor in the cluster.
610
+ */
611
+ resourceGroups: monitorWorkerResourceGroupSchema.array(),
612
+ })
613
+
614
+ export type CNI = z.infer<typeof cniSchema>
615
+ export type Cluster = z.infer<typeof clusterEntity.schema>
616
+
617
+ export type Gateway = z.infer<typeof gatewayEntity.schema>
618
+ export type TlsIssuer = z.infer<typeof tlsIssuerEntity.schema>
619
+ export type AccessPoint = z.infer<typeof accessPointEntity.schema>
635
620
 
636
- export type Gateway = Static<typeof gatewayEntity.schema>
637
- export type TlsIssuer = Static<typeof tlsIssuerEntity.schema>
638
- export type AccessPoint = Static<typeof accessPointEntity.schema>
621
+ export type Metadata = z.infer<typeof metadataSchema>
622
+ export type Resource = z.infer<typeof resourceSchema>
639
623
 
640
- export type Metadata = Static<typeof metadataSchema>
641
- export type Resource = Static<typeof resourceSchema>
624
+ export type ServiceType = z.infer<typeof serviceTypeSchema>
625
+ export type Service = z.infer<typeof serviceEntity.schema>
642
626
 
643
- export type ServiceType = Static<typeof serviceTypeSchema>
644
- export type Service = Static<typeof serviceEntity.schema>
627
+ export type Deployment = z.infer<typeof deploymentEntity.schema>
628
+ export type ExposableWorkload = z.infer<typeof exposableWorkloadEntity.schema>
645
629
 
646
- export type Deployment = Static<typeof deploymentEntity.schema>
647
- export type ExposableWorkload = Static<typeof exposableWorkloadEntity.schema>
630
+ export type PersistentVolumeClaim = z.infer<typeof persistentVolumeClaimEntity.schema>
631
+ export type StatefulSet = z.infer<typeof statefulSetEntity.schema>
648
632
 
649
- export type PersistentVolumeClaim = Static<typeof persistentVolumeClaimEntity.schema>
650
- export type StatefulSet = Static<typeof statefulSetEntity.schema>
633
+ export type Interface = z.infer<typeof interfaceEntity.schema>
634
+ export type InternalIpsPolicy = z.infer<typeof internalIpsPolicySchema>
651
635
 
652
- export type Interface = Static<typeof interfaceEntity.schema>
653
- export type InternalIpsPolicy = Static<typeof internalIpsPolicySchema>
636
+ export type MonitorWorkerParams = z.infer<typeof monitorWorkerParamsSchema>
637
+ export type MonitorWorkerResourceGroup = z.infer<typeof monitorWorkerResourceGroupSchema>