@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.
- package/dist/highstate.library.msgpack +0 -0
- package/dist/index.js +3467 -3083
- package/dist/index.js.map +1 -1
- package/package.json +5 -4
- package/src/common/access-point.ts +105 -0
- package/src/{files.ts → common/files.ts} +10 -8
- package/src/common/index.ts +3 -0
- package/src/{common.ts → common/server.ts} +69 -38
- package/src/databases/index.ts +4 -0
- package/src/databases/mariadb.ts +37 -0
- package/src/databases/mongodb.ts +37 -0
- package/src/databases/postgresql.ts +37 -0
- package/src/databases/shared.ts +61 -0
- package/src/distributions/ubuntu.ts +6 -4
- package/src/dns.ts +110 -12
- package/src/git.ts +7 -3
- package/src/impl-ref.ts +26 -0
- package/src/index.ts +14 -15
- package/src/k3s.ts +7 -5
- package/src/k8s/apps/code-server.ts +48 -0
- package/src/k8s/apps/gitea.ts +25 -0
- package/src/k8s/apps/grocy.ts +39 -0
- package/src/k8s/apps/hubble.ts +30 -0
- package/src/{apps → k8s/apps}/index.ts +16 -13
- package/src/k8s/apps/kubernetes-dashboard.ts +28 -0
- package/src/k8s/apps/mariadb.ts +83 -0
- package/src/k8s/apps/maybe.ts +39 -0
- package/src/k8s/apps/mongodb.ts +84 -0
- package/src/k8s/apps/postgresql.ts +86 -0
- package/src/k8s/apps/shared.ts +149 -0
- package/src/{apps → k8s/apps}/syncthing.ts +27 -9
- package/src/k8s/apps/traefik.ts +40 -0
- package/src/k8s/apps/vaultwarden.ts +31 -0
- package/src/k8s/apps/workload.ts +214 -0
- package/src/k8s/apps/zitadel.ts +26 -0
- package/src/k8s/cert-manager.ts +80 -0
- package/src/k8s/cilium.ts +64 -0
- package/src/k8s/gateway.ts +70 -0
- package/src/k8s/index.ts +9 -0
- package/src/{obfuscators → k8s/obfuscators}/phantun.ts +10 -6
- package/src/{obfuscators → k8s/obfuscators}/shared.ts +11 -5
- package/src/k8s/resources.ts +111 -0
- package/src/k8s/service.ts +65 -0
- package/src/{k8s.ts → k8s/shared.ts} +35 -329
- package/src/k8s/workload.ts +77 -0
- package/src/network.ts +208 -22
- package/src/nixos.ts +23 -8
- package/src/proxmox.ts +62 -75
- package/src/restic.ts +15 -6
- package/src/sops.ts +16 -5
- package/src/ssh.ts +107 -9
- package/src/talos.ts +6 -4
- package/src/third-party/cloudflare.ts +59 -0
- package/src/third-party/index.ts +3 -0
- package/src/{mullvad.ts → third-party/mullvad.ts} +6 -4
- package/src/third-party/timeweb.ts +99 -0
- package/src/utils.ts +24 -3
- package/src/wireguard.ts +171 -48
- package/src/apps/code-server.ts +0 -34
- package/src/apps/deployment.ts +0 -60
- package/src/apps/dns.ts +0 -107
- package/src/apps/gitea.ts +0 -18
- package/src/apps/grocy.ts +0 -20
- package/src/apps/hubble.ts +0 -20
- package/src/apps/kubernetes-dashboard.ts +0 -19
- package/src/apps/mariadb.ts +0 -81
- package/src/apps/maybe.ts +0 -25
- package/src/apps/mongodb.ts +0 -81
- package/src/apps/network.ts +0 -55
- package/src/apps/postgresql.ts +0 -81
- package/src/apps/shared.ts +0 -289
- package/src/apps/test.ts +0 -19
- package/src/apps/traefik.ts +0 -36
- package/src/apps/vaultwarden.ts +0 -23
- package/src/apps/zitadel.ts +0 -21
- package/src/cloudflare.ts +0 -26
- package/src/timeweb.ts +0 -75
- package/src/{obfuscators → k8s/obfuscators}/index.ts +1 -1
@@ -1,8 +1,10 @@
|
|
1
1
|
import { $args, defineEntity, defineUnit, z } from "@highstate/contract"
|
2
|
-
import
|
3
|
-
import
|
4
|
-
import {
|
5
|
-
import {
|
2
|
+
import { serverEntity } from "../common"
|
3
|
+
import * as dns from "../dns"
|
4
|
+
import { implementationReferenceSchema } from "../impl-ref"
|
5
|
+
import { l3EndpointEntity, l4EndpointEntity } from "../network"
|
6
|
+
import { arrayPatchModeSchema } from "../utils"
|
7
|
+
import { scopedResourceSchema } from "./resources"
|
6
8
|
|
7
9
|
export const fallbackKubeApiAccessSchema = z.object({
|
8
10
|
serverIp: z.string(),
|
@@ -22,7 +24,6 @@ export const tunDevicePolicySchema = z.union([
|
|
22
24
|
|
23
25
|
export const externalServiceTypeSchema = z.enum(["NodePort", "LoadBalancer"])
|
24
26
|
export const scheduleOnMastersPolicySchema = z.enum(["always", "when-no-workers", "never"])
|
25
|
-
export const cniSchema = z.enum(["cilium", "other"])
|
26
27
|
|
27
28
|
export const clusterQuirksSchema = z.object({
|
28
29
|
/**
|
@@ -53,23 +54,30 @@ export const clusterInfoProperties = {
|
|
53
54
|
/**
|
54
55
|
* The unique identifier of the cluster.
|
55
56
|
*
|
56
|
-
* Should be defined as a
|
57
|
+
* Should be defined as a `uid` of the `kube-system` namespace which is always present in the cluster.
|
57
58
|
*/
|
58
59
|
id: z.string(),
|
59
60
|
|
61
|
+
/**
|
62
|
+
* The ID of the connection to the cluster.
|
63
|
+
*
|
64
|
+
* If not explicitly set, should be the same as the cluster ID.
|
65
|
+
*
|
66
|
+
* When reducing cluster access, the `uid` of the service account should be used instead.
|
67
|
+
*/
|
68
|
+
connectionId: z.string(),
|
69
|
+
|
60
70
|
/**
|
61
71
|
* The name of the cluster.
|
62
72
|
*/
|
63
73
|
name: z.string(),
|
64
74
|
|
65
75
|
/**
|
66
|
-
* The
|
76
|
+
* The optional reference to the network policy implementation.
|
67
77
|
*
|
68
|
-
*
|
69
|
-
* - `cilium`
|
70
|
-
* - `other`
|
78
|
+
* If not provided, the native Kubernetes NetworkPolicy implementation will be used.
|
71
79
|
*/
|
72
|
-
|
80
|
+
networkPolicyImplRef: implementationReferenceSchema.optional(),
|
73
81
|
|
74
82
|
/**
|
75
83
|
* The endpoints of the cluster nodes.
|
@@ -105,36 +113,8 @@ export const clusterInfoProperties = {
|
|
105
113
|
metadata: z.record(z.string(), z.unknown()).optional(),
|
106
114
|
} as const
|
107
115
|
|
108
|
-
export const serviceTypeSchema = z.enum(["NodePort", "LoadBalancer", "ClusterIP"])
|
109
|
-
|
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(),
|
115
|
-
})
|
116
|
-
|
117
|
-
export const resourceSchema = z.object({
|
118
|
-
clusterId: z.string(),
|
119
|
-
metadata: metadataSchema,
|
120
|
-
})
|
121
|
-
|
122
|
-
export const serviceEntity = defineEntity({
|
123
|
-
type: "k8s.service",
|
124
|
-
|
125
|
-
schema: z.object({
|
126
|
-
type: z.literal("k8s.service"),
|
127
|
-
...resourceSchema.shape,
|
128
|
-
endpoints: l4EndpointEntity.schema.array(),
|
129
|
-
}),
|
130
|
-
|
131
|
-
meta: {
|
132
|
-
color: "#2196F3",
|
133
|
-
},
|
134
|
-
})
|
135
|
-
|
136
116
|
export const clusterEntity = defineEntity({
|
137
|
-
type: "k8s.cluster",
|
117
|
+
type: "k8s.cluster.v1",
|
138
118
|
|
139
119
|
schema: z.object({
|
140
120
|
...clusterInfoProperties,
|
@@ -183,8 +163,11 @@ export const clusterOutputs = {
|
|
183
163
|
},
|
184
164
|
} as const
|
185
165
|
|
166
|
+
/**
|
167
|
+
* The existing Kubernetes cluster created outside of the Highstate.
|
168
|
+
*/
|
186
169
|
export const existingCluster = defineUnit({
|
187
|
-
type: "k8s.existing-cluster",
|
170
|
+
type: "k8s.existing-cluster.v1",
|
188
171
|
|
189
172
|
args: {
|
190
173
|
/**
|
@@ -222,7 +205,6 @@ export const existingCluster = defineUnit({
|
|
222
205
|
|
223
206
|
meta: {
|
224
207
|
title: "Existing Cluster",
|
225
|
-
description: "An existing Kubernetes cluster.",
|
226
208
|
icon: "devicon:kubernetes",
|
227
209
|
category: "Kubernetes",
|
228
210
|
},
|
@@ -233,8 +215,11 @@ export const existingCluster = defineUnit({
|
|
233
215
|
},
|
234
216
|
})
|
235
217
|
|
218
|
+
/**
|
219
|
+
* Patches some properties of the cluster and outputs the updated cluster.
|
220
|
+
*/
|
236
221
|
export const clusterPatch = defineUnit({
|
237
|
-
type: "k8s.cluster-patch",
|
222
|
+
type: "k8s.cluster-patch.v1",
|
238
223
|
|
239
224
|
args: {
|
240
225
|
/**
|
@@ -290,7 +275,6 @@ export const clusterPatch = defineUnit({
|
|
290
275
|
|
291
276
|
meta: {
|
292
277
|
title: "Cluster Patch",
|
293
|
-
description: "Patches some properties of the cluster.",
|
294
278
|
icon: "devicon:kubernetes",
|
295
279
|
secondaryIcon: "fluent:patch-20-filled",
|
296
280
|
category: "Kubernetes",
|
@@ -302,8 +286,11 @@ export const clusterPatch = defineUnit({
|
|
302
286
|
},
|
303
287
|
})
|
304
288
|
|
289
|
+
/**
|
290
|
+
* Creates a set of DNS records for the cluster and updates the endpoints.
|
291
|
+
*/
|
305
292
|
export const clusterDns = defineUnit({
|
306
|
-
type: "k8s.cluster-dns",
|
293
|
+
type: "k8s.cluster-dns.v1",
|
307
294
|
|
308
295
|
args: {
|
309
296
|
...dns.createArgs(),
|
@@ -319,7 +306,6 @@ export const clusterDns = defineUnit({
|
|
319
306
|
|
320
307
|
meta: {
|
321
308
|
title: "Cluster DNS",
|
322
|
-
description: "Creates DNS records for the cluster and updates endpoints.",
|
323
309
|
icon: "devicon:kubernetes",
|
324
310
|
secondaryIcon: "mdi:dns",
|
325
311
|
category: "Kubernetes",
|
@@ -331,268 +317,6 @@ export const clusterDns = defineUnit({
|
|
331
317
|
},
|
332
318
|
})
|
333
319
|
|
334
|
-
export const gatewayEntity = defineEntity({
|
335
|
-
type: "k8s.gateway",
|
336
|
-
|
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(),
|
343
|
-
}),
|
344
|
-
|
345
|
-
meta: {
|
346
|
-
color: "#4CAF50",
|
347
|
-
},
|
348
|
-
})
|
349
|
-
|
350
|
-
export const tlsIssuerEntity = defineEntity({
|
351
|
-
type: "k8s.tls-issuer",
|
352
|
-
|
353
|
-
schema: z.object({
|
354
|
-
clusterId: z.string(),
|
355
|
-
clusterIssuerName: z.string(),
|
356
|
-
}),
|
357
|
-
|
358
|
-
meta: {
|
359
|
-
color: "#f06292",
|
360
|
-
},
|
361
|
-
})
|
362
|
-
|
363
|
-
export const accessPointEntity = defineEntity({
|
364
|
-
type: "k8s.access-point",
|
365
|
-
|
366
|
-
schema: z.object({
|
367
|
-
clusterId: z.string(),
|
368
|
-
gateway: gatewayEntity.schema,
|
369
|
-
tlsIssuer: tlsIssuerEntity.schema,
|
370
|
-
dnsProviders: dns.providerEntity.schema.array(),
|
371
|
-
}),
|
372
|
-
|
373
|
-
meta: {
|
374
|
-
color: "#F57F17",
|
375
|
-
},
|
376
|
-
})
|
377
|
-
|
378
|
-
export const accessPoint = defineUnit({
|
379
|
-
type: "k8s.access-point",
|
380
|
-
|
381
|
-
inputs: {
|
382
|
-
gateway: gatewayEntity,
|
383
|
-
tlsIssuer: tlsIssuerEntity,
|
384
|
-
dnsProviders: {
|
385
|
-
entity: dns.providerEntity,
|
386
|
-
multiple: true,
|
387
|
-
},
|
388
|
-
},
|
389
|
-
|
390
|
-
outputs: {
|
391
|
-
accessPoint: accessPointEntity,
|
392
|
-
},
|
393
|
-
|
394
|
-
meta: {
|
395
|
-
title: "Access Point",
|
396
|
-
description: "An access point which can be used to connect to services.",
|
397
|
-
icon: "mdi:access-point",
|
398
|
-
category: "Kubernetes",
|
399
|
-
},
|
400
|
-
|
401
|
-
source: {
|
402
|
-
package: "@highstate/k8s",
|
403
|
-
path: "units/access-point",
|
404
|
-
},
|
405
|
-
})
|
406
|
-
|
407
|
-
export const certManager = defineUnit({
|
408
|
-
type: "k8s.cert-manager",
|
409
|
-
|
410
|
-
inputs: {
|
411
|
-
k8sCluster: clusterEntity,
|
412
|
-
},
|
413
|
-
|
414
|
-
outputs: {
|
415
|
-
k8sCluster: clusterEntity,
|
416
|
-
},
|
417
|
-
|
418
|
-
meta: {
|
419
|
-
title: "Cert Manager",
|
420
|
-
description: "A certificate manager for managing TLS certificates.",
|
421
|
-
icon: "simple-icons:letsencrypt",
|
422
|
-
category: "Kubernetes",
|
423
|
-
},
|
424
|
-
|
425
|
-
source: {
|
426
|
-
package: "@highstate/k8s",
|
427
|
-
path: "units/cert-manager",
|
428
|
-
},
|
429
|
-
})
|
430
|
-
|
431
|
-
export const dns01TlsIssuer = defineUnit({
|
432
|
-
type: "k8s.dns01-issuer",
|
433
|
-
|
434
|
-
args: {
|
435
|
-
/**
|
436
|
-
* The top-level domains to filter the DNS01 challenge for.
|
437
|
-
*
|
438
|
-
* If not provided, will use all domains passed to the DNS providers.
|
439
|
-
*/
|
440
|
-
domains: z.string().array().optional(),
|
441
|
-
},
|
442
|
-
|
443
|
-
inputs: {
|
444
|
-
k8sCluster: clusterEntity,
|
445
|
-
dnsProviders: {
|
446
|
-
entity: dns.providerEntity,
|
447
|
-
multiple: true,
|
448
|
-
},
|
449
|
-
},
|
450
|
-
|
451
|
-
outputs: {
|
452
|
-
tlsIssuer: tlsIssuerEntity,
|
453
|
-
},
|
454
|
-
|
455
|
-
meta: {
|
456
|
-
title: "DNS01 Issuer",
|
457
|
-
description: "A TLS issuer for issuing certificate using DNS01 challenge.",
|
458
|
-
icon: "mdi:certificate",
|
459
|
-
category: "Kubernetes",
|
460
|
-
},
|
461
|
-
|
462
|
-
source: {
|
463
|
-
package: "@highstate/k8s",
|
464
|
-
path: "units/dns01-issuer",
|
465
|
-
},
|
466
|
-
})
|
467
|
-
|
468
|
-
export const deploymentEntity = defineEntity({
|
469
|
-
type: "k8s.deployment",
|
470
|
-
|
471
|
-
schema: z.object({
|
472
|
-
type: z.literal("k8s.deployment"),
|
473
|
-
...resourceSchema.shape,
|
474
|
-
service: serviceEntity.schema.optional(),
|
475
|
-
}),
|
476
|
-
|
477
|
-
meta: {
|
478
|
-
color: "#4CAF50",
|
479
|
-
},
|
480
|
-
})
|
481
|
-
|
482
|
-
export const statefulSetEntity = defineEntity({
|
483
|
-
type: "k8s.stateful-set",
|
484
|
-
|
485
|
-
schema: z.object({
|
486
|
-
type: z.literal("k8s.stateful-set"),
|
487
|
-
...resourceSchema.shape,
|
488
|
-
service: serviceEntity.schema,
|
489
|
-
}),
|
490
|
-
|
491
|
-
meta: {
|
492
|
-
color: "#FFC107",
|
493
|
-
},
|
494
|
-
})
|
495
|
-
|
496
|
-
export const exposableWorkloadEntity = defineEntity({
|
497
|
-
type: "k8s.exposable-workload",
|
498
|
-
|
499
|
-
schema: z.union([deploymentEntity.schema, statefulSetEntity.schema]),
|
500
|
-
|
501
|
-
meta: {
|
502
|
-
color: "#4CAF50",
|
503
|
-
},
|
504
|
-
})
|
505
|
-
|
506
|
-
export const persistentVolumeClaimEntity = defineEntity({
|
507
|
-
type: "k8s.persistent-volume-claim",
|
508
|
-
|
509
|
-
schema: z.object({
|
510
|
-
type: z.literal("k8s.persistent-volume-claim"),
|
511
|
-
...resourceSchema.shape,
|
512
|
-
}),
|
513
|
-
|
514
|
-
meta: {
|
515
|
-
color: "#FFC107",
|
516
|
-
},
|
517
|
-
})
|
518
|
-
|
519
|
-
export const interfaceEntity = defineEntity({
|
520
|
-
type: "k8s.interface",
|
521
|
-
|
522
|
-
schema: z.object({
|
523
|
-
name: z.string(),
|
524
|
-
workload: exposableWorkloadEntity.schema,
|
525
|
-
}),
|
526
|
-
|
527
|
-
meta: {
|
528
|
-
color: "#2196F3",
|
529
|
-
description:
|
530
|
-
"The interface in a network space of pod kernel which can accept or transmit packets.",
|
531
|
-
},
|
532
|
-
})
|
533
|
-
|
534
|
-
export const gatewayApi = defineUnit({
|
535
|
-
type: "k8s.gateway-api",
|
536
|
-
|
537
|
-
inputs: {
|
538
|
-
k8sCluster: clusterEntity,
|
539
|
-
},
|
540
|
-
|
541
|
-
outputs: {
|
542
|
-
k8sCluster: clusterEntity,
|
543
|
-
},
|
544
|
-
|
545
|
-
meta: {
|
546
|
-
title: "Gateway API",
|
547
|
-
description: "Installs the Gateway API CRDs to the cluster.",
|
548
|
-
icon: "devicon:kubernetes",
|
549
|
-
secondaryIcon: "mdi:api",
|
550
|
-
secondaryIconColor: "#4CAF50",
|
551
|
-
category: "Kubernetes",
|
552
|
-
},
|
553
|
-
|
554
|
-
source: {
|
555
|
-
package: "@highstate/k8s",
|
556
|
-
path: "units/gateway-api",
|
557
|
-
},
|
558
|
-
})
|
559
|
-
|
560
|
-
export const cilium = defineUnit({
|
561
|
-
type: "k8s.cilium",
|
562
|
-
|
563
|
-
args: {
|
564
|
-
/**
|
565
|
-
* If set to `true`, the generated network policy will allow
|
566
|
-
* all DNS queries to be resolved, even if they are
|
567
|
-
* for forbidden (non-allowed) FQDNs.
|
568
|
-
*
|
569
|
-
* By default, is `false`.
|
570
|
-
*/
|
571
|
-
allowForbiddenFqdnResolution: z.boolean().default(false),
|
572
|
-
},
|
573
|
-
|
574
|
-
inputs: {
|
575
|
-
k8sCluster: clusterEntity,
|
576
|
-
},
|
577
|
-
|
578
|
-
outputs: {
|
579
|
-
k8sCluster: clusterEntity,
|
580
|
-
},
|
581
|
-
|
582
|
-
meta: {
|
583
|
-
title: "Cilium",
|
584
|
-
description: "The Cilium CNI deployed on Kubernetes.",
|
585
|
-
icon: "simple-icons:cilium",
|
586
|
-
secondaryIcon: "devicon:kubernetes",
|
587
|
-
category: "Kubernetes",
|
588
|
-
},
|
589
|
-
|
590
|
-
source: {
|
591
|
-
package: "@highstate/cilium",
|
592
|
-
path: "unit",
|
593
|
-
},
|
594
|
-
})
|
595
|
-
|
596
320
|
export const monitorWorkerResourceGroupSchema = z.object({
|
597
321
|
type: z.enum(["deployment", "statefulset", "pod", "service"]),
|
598
322
|
namespace: z.string(),
|
@@ -601,36 +325,18 @@ export const monitorWorkerResourceGroupSchema = z.object({
|
|
601
325
|
|
602
326
|
export const monitorWorkerParamsSchema = z.object({
|
603
327
|
/**
|
604
|
-
* The
|
328
|
+
* The content of the kubeconfig to use for monitoring.
|
605
329
|
*/
|
606
|
-
|
330
|
+
kubeconfig: z.string(),
|
607
331
|
|
608
332
|
/**
|
609
333
|
* The resources to monitor in the cluster.
|
610
334
|
*/
|
611
|
-
|
335
|
+
resources: scopedResourceSchema.array(),
|
612
336
|
})
|
613
337
|
|
614
|
-
export type CNI = z.infer<typeof cniSchema>
|
615
338
|
export type Cluster = z.infer<typeof clusterEntity.schema>
|
616
339
|
|
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>
|
620
|
-
|
621
|
-
export type Metadata = z.infer<typeof metadataSchema>
|
622
|
-
export type Resource = z.infer<typeof resourceSchema>
|
623
|
-
|
624
|
-
export type ServiceType = z.infer<typeof serviceTypeSchema>
|
625
|
-
export type Service = z.infer<typeof serviceEntity.schema>
|
626
|
-
|
627
|
-
export type Deployment = z.infer<typeof deploymentEntity.schema>
|
628
|
-
export type ExposableWorkload = z.infer<typeof exposableWorkloadEntity.schema>
|
629
|
-
|
630
|
-
export type PersistentVolumeClaim = z.infer<typeof persistentVolumeClaimEntity.schema>
|
631
|
-
export type StatefulSet = z.infer<typeof statefulSetEntity.schema>
|
632
|
-
|
633
|
-
export type Interface = z.infer<typeof interfaceEntity.schema>
|
634
340
|
export type InternalIpsPolicy = z.infer<typeof internalIpsPolicySchema>
|
635
341
|
|
636
342
|
export type MonitorWorkerParams = z.infer<typeof monitorWorkerParamsSchema>
|
@@ -0,0 +1,77 @@
|
|
1
|
+
import { defineEntity, z } from "@highstate/contract"
|
2
|
+
import { scopedResourceSchema } from "./resources"
|
3
|
+
import { serviceEntity } from "./service"
|
4
|
+
|
5
|
+
/**
|
6
|
+
* The entity which represents a Kubernetes deployment managed by Highstate.
|
7
|
+
*
|
8
|
+
* Also includes a service associated with the deployment.
|
9
|
+
*/
|
10
|
+
export const deploymentEntity = defineEntity({
|
11
|
+
type: "k8s.deployment.v1",
|
12
|
+
|
13
|
+
schema: z.object({
|
14
|
+
...scopedResourceSchema.shape,
|
15
|
+
type: z.literal("deployment"),
|
16
|
+
service: serviceEntity.schema.optional(),
|
17
|
+
}),
|
18
|
+
|
19
|
+
meta: {
|
20
|
+
color: "#4CAF50",
|
21
|
+
},
|
22
|
+
})
|
23
|
+
|
24
|
+
/**
|
25
|
+
* The entity which represents a Kubernetes stateful set managed by Highstate.
|
26
|
+
*
|
27
|
+
* Also includes a service associated with the stateful set.
|
28
|
+
*/
|
29
|
+
export const statefulSetEntity = defineEntity({
|
30
|
+
type: "k8s.stateful-set.v1",
|
31
|
+
|
32
|
+
schema: z.object({
|
33
|
+
...scopedResourceSchema.shape,
|
34
|
+
type: z.literal("stateful-set"),
|
35
|
+
service: serviceEntity.schema,
|
36
|
+
}),
|
37
|
+
|
38
|
+
meta: {
|
39
|
+
color: "#FFC107",
|
40
|
+
},
|
41
|
+
})
|
42
|
+
|
43
|
+
/**
|
44
|
+
* The entity which represents a Kubernetes workload exposed via a service.
|
45
|
+
*
|
46
|
+
* It can be either a deployment or a stateful set.
|
47
|
+
*/
|
48
|
+
export const exposableWorkloadEntity = defineEntity({
|
49
|
+
type: "k8s.exposable-workload.v1",
|
50
|
+
|
51
|
+
schema: z.union([deploymentEntity.schema, statefulSetEntity.schema]),
|
52
|
+
|
53
|
+
meta: {
|
54
|
+
color: "#4CAF50",
|
55
|
+
},
|
56
|
+
})
|
57
|
+
|
58
|
+
/**
|
59
|
+
* The network interface in a network namespace of the pod which can accept and transmit network traffic.
|
60
|
+
*/
|
61
|
+
export const networkInterfaceEntity = defineEntity({
|
62
|
+
type: "k8s.network-interface.v1",
|
63
|
+
|
64
|
+
schema: z.object({
|
65
|
+
name: z.string(),
|
66
|
+
workload: exposableWorkloadEntity.schema,
|
67
|
+
}),
|
68
|
+
|
69
|
+
meta: {
|
70
|
+
color: "#2196F3",
|
71
|
+
},
|
72
|
+
})
|
73
|
+
|
74
|
+
export type Deployment = z.infer<typeof deploymentEntity.schema>
|
75
|
+
export type StatefulSet = z.infer<typeof statefulSetEntity.schema>
|
76
|
+
export type ExposableWorkload = z.infer<typeof exposableWorkloadEntity.schema>
|
77
|
+
export type NetworkInterface = z.infer<typeof networkInterfaceEntity.schema>
|