@highstate/library 0.20.0 → 0.25.0
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 +4260 -3948
- package/package.json +12 -12
- package/src/abbreviations.ts +2 -0
- package/src/apps/index.ts +1 -0
- package/src/apps/vault.ts +374 -0
- package/src/common/access-point.ts +150 -4
- package/src/common/filter.ts +40 -0
- package/src/common/index.ts +1 -0
- package/src/common/server.ts +131 -1
- package/src/databases/etcd.ts +12 -4
- package/src/databases/index.ts +1 -0
- package/src/databases/minio.ts +19 -0
- package/src/databases/mongodb.ts +12 -4
- package/src/databases/mysql.ts +12 -4
- package/src/databases/postgresql.ts +12 -4
- package/src/databases/rustfs.ts +169 -0
- package/src/dns.ts +3 -3
- package/src/index.ts +3 -0
- package/src/k3s.ts +129 -3
- package/src/k8s/apps/envoy-gateway.ts +50 -0
- package/src/k8s/apps/etcd.ts +1 -1
- package/src/k8s/apps/grafana.ts +1 -1
- package/src/k8s/apps/index.ts +4 -0
- package/src/k8s/apps/mariadb.ts +1 -1
- package/src/k8s/apps/matrix-stack.ts +2 -1
- package/src/k8s/apps/minio.ts +2 -2
- package/src/k8s/apps/mongodb.ts +1 -1
- package/src/k8s/apps/postgresql.ts +1 -1
- package/src/k8s/apps/rustfs.ts +119 -0
- package/src/k8s/apps/shared.ts +16 -1
- package/src/k8s/apps/signoz.ts +32 -0
- package/src/k8s/apps/traefik.ts +5 -5
- package/src/k8s/apps/valkey.ts +1 -1
- package/src/k8s/apps/vault.ts +113 -0
- package/src/k8s/apps/vaultwarden.ts +31 -2
- package/src/k8s/apps/workload.ts +12 -14
- package/src/k8s/cert-manager.ts +44 -2
- package/src/k8s/cilium.ts +3 -16
- package/src/k8s/coredns.ts +62 -0
- package/src/k8s/gateway.ts +25 -0
- package/src/k8s/index.ts +1 -0
- package/src/k8s/scheduling.ts +87 -0
- package/src/k8s/service-args.ts +109 -0
- package/src/k8s/shared.ts +26 -0
- package/src/k8s/workload.ts +21 -0
- package/src/netaminity.ts +950 -0
- package/src/network/address-space.ts +14 -0
- package/src/network/endpoint.ts +12 -1
- package/src/network/index.ts +1 -0
- package/src/network/network.ts +58 -0
- package/src/restic.ts +2 -1
- package/src/ssh.ts +27 -0
- package/src/third-party/gcp.ts +427 -0
- package/src/third-party/index.ts +1 -0
- package/src/third-party/yandex.ts +194 -1
- package/src/tls.ts +135 -6
- package/src/utils.ts +16 -1
- package/src/wireguard.ts +273 -4
- package/LICENSE +0 -21
- package/dist/index.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@highstate/library",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"highstate": {
|
|
6
6
|
"type": "library"
|
|
@@ -23,23 +23,23 @@
|
|
|
23
23
|
"stdlib"
|
|
24
24
|
]
|
|
25
25
|
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "highstate build",
|
|
28
|
+
"typecheck": "tsgo --noEmit --skipLibCheck",
|
|
29
|
+
"biome": "biome check --write --unsafe --error-on-warnings",
|
|
30
|
+
"biome:check": "biome check --error-on-warnings"
|
|
31
|
+
},
|
|
26
32
|
"dependencies": {
|
|
27
|
-
"
|
|
28
|
-
"
|
|
33
|
+
"@highstate/contract": "0.25.0",
|
|
34
|
+
"remeda": "^2.21.0"
|
|
29
35
|
},
|
|
30
36
|
"devDependencies": {
|
|
31
37
|
"@biomejs/biome": "2.2.0",
|
|
38
|
+
"@highstate/cli": "0.25.0",
|
|
32
39
|
"@typescript/native-preview": "^7.0.0-dev.20250920.1",
|
|
33
|
-
"type-fest": "^4.41.0"
|
|
34
|
-
"@highstate/cli": "0.20.0"
|
|
40
|
+
"type-fest": "^4.41.0"
|
|
35
41
|
},
|
|
36
42
|
"repository": {
|
|
37
43
|
"url": "https://github.com/highstate-io/highstate"
|
|
38
|
-
},
|
|
39
|
-
"scripts": {
|
|
40
|
-
"build": "highstate build",
|
|
41
|
-
"typecheck": "tsgo --noEmit --skipLibCheck",
|
|
42
|
-
"biome": "biome check --write --unsafe --error-on-warnings",
|
|
43
|
-
"biome:check": "biome check --error-on-warnings"
|
|
44
44
|
}
|
|
45
|
-
}
|
|
45
|
+
}
|
package/src/abbreviations.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as vault from "./vault"
|
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineEntity,
|
|
3
|
+
defineUnit,
|
|
4
|
+
type EntityInput,
|
|
5
|
+
type EntityValue,
|
|
6
|
+
secretSchema,
|
|
7
|
+
z,
|
|
8
|
+
} from "@highstate/contract"
|
|
9
|
+
import { fileEntity } from "../common"
|
|
10
|
+
import { l7EndpointContainer } from "../network"
|
|
11
|
+
import { privateKeySchema } from "../tls"
|
|
12
|
+
|
|
13
|
+
const vaultColor = "#6F5CFF"
|
|
14
|
+
const vaultIcon = "simple-icons:vault"
|
|
15
|
+
|
|
16
|
+
export const credentialsSchema = z.discriminatedUnion("type", [
|
|
17
|
+
z.object({
|
|
18
|
+
type: z.literal("token"),
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The static token used to authenticate against Vault.
|
|
22
|
+
*/
|
|
23
|
+
token: secretSchema(z.string()),
|
|
24
|
+
}),
|
|
25
|
+
|
|
26
|
+
z.object({
|
|
27
|
+
type: z.literal("approle"),
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The path where the AppRole auth backend is mounted.
|
|
31
|
+
*/
|
|
32
|
+
authPath: z.string(),
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The role ID used to authenticate against Vault.
|
|
36
|
+
*/
|
|
37
|
+
roleId: z.string(),
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The secret ID used to authenticate against Vault.
|
|
41
|
+
*/
|
|
42
|
+
secretId: secretSchema(z.string()),
|
|
43
|
+
}),
|
|
44
|
+
])
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Represents a connection to a Vault instance, including the endpoints and credentials.
|
|
48
|
+
*/
|
|
49
|
+
export const connectionEntity = defineEntity({
|
|
50
|
+
type: "vault.connection.v1",
|
|
51
|
+
|
|
52
|
+
extends: { l7EndpointContainer },
|
|
53
|
+
|
|
54
|
+
includes: {
|
|
55
|
+
/**
|
|
56
|
+
* The CA certificate file used to verify the server if any.
|
|
57
|
+
*/
|
|
58
|
+
ca: {
|
|
59
|
+
entity: fileEntity,
|
|
60
|
+
required: false,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
schema: z.object({
|
|
65
|
+
/**
|
|
66
|
+
* The credentials for authenticating to the Vault instance.
|
|
67
|
+
*/
|
|
68
|
+
credentials: credentialsSchema,
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* The Vault Enterprise namespace to operate in.
|
|
72
|
+
*/
|
|
73
|
+
namespace: z.string().optional(),
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* The TLS server name used to verify the Vault server certificate.
|
|
77
|
+
*/
|
|
78
|
+
tlsServerName: z.string().optional(),
|
|
79
|
+
}),
|
|
80
|
+
|
|
81
|
+
meta: {
|
|
82
|
+
color: vaultColor,
|
|
83
|
+
title: "Vault Connection",
|
|
84
|
+
icon: vaultIcon,
|
|
85
|
+
iconColor: vaultColor,
|
|
86
|
+
},
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
export const pkiCaEntity = defineEntity({
|
|
90
|
+
type: "vault.pki.ca.v1",
|
|
91
|
+
|
|
92
|
+
includes: {
|
|
93
|
+
/**
|
|
94
|
+
* The Vault connection authorized to manage this PKI CA.
|
|
95
|
+
*/
|
|
96
|
+
connection: {
|
|
97
|
+
entity: connectionEntity,
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* The root CA certificate in PEM format.
|
|
102
|
+
*/
|
|
103
|
+
ca: {
|
|
104
|
+
entity: fileEntity,
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
|
|
108
|
+
schema: z.object({
|
|
109
|
+
/**
|
|
110
|
+
* The mount path of the root PKI backend.
|
|
111
|
+
*/
|
|
112
|
+
path: z.string(),
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* The mount path of the intermediate PKI backend used by issuers.
|
|
116
|
+
*/
|
|
117
|
+
intermediatePath: z.string(),
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* The common name of the root CA certificate.
|
|
121
|
+
*/
|
|
122
|
+
commonName: z.string(),
|
|
123
|
+
}),
|
|
124
|
+
|
|
125
|
+
meta: {
|
|
126
|
+
color: vaultColor,
|
|
127
|
+
title: "Vault PKI CA",
|
|
128
|
+
icon: vaultIcon,
|
|
129
|
+
iconColor: vaultColor,
|
|
130
|
+
},
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
export const pkiIssuerEntity = defineEntity({
|
|
134
|
+
type: "vault.pki.issuer.v1",
|
|
135
|
+
|
|
136
|
+
includes: {
|
|
137
|
+
/**
|
|
138
|
+
* The Vault connection authorized to issue certificates through this PKI issuer.
|
|
139
|
+
*/
|
|
140
|
+
connection: {
|
|
141
|
+
entity: connectionEntity,
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
|
|
145
|
+
schema: z.object({
|
|
146
|
+
/**
|
|
147
|
+
* The mount path of the shared intermediate PKI backend.
|
|
148
|
+
*/
|
|
149
|
+
path: z.string(),
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* The PKI role name used to issue leaf certificates.
|
|
153
|
+
*/
|
|
154
|
+
roleName: z.string(),
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* The DNS zones for which this issuer can issue certificates.
|
|
158
|
+
*/
|
|
159
|
+
dnsNames: z.string().array(),
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* The common names for which this issuer can issue certificates.
|
|
163
|
+
*/
|
|
164
|
+
commonNames: z.string().array(),
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Whether the Vault role allows issuing certificates for exact allowed domains.
|
|
168
|
+
*/
|
|
169
|
+
allowBareDomains: z.boolean(),
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Whether the Vault role allows issuing certificates for subdomains of allowed domains.
|
|
173
|
+
*/
|
|
174
|
+
allowSubdomains: z.boolean(),
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Whether the Vault role allows issuing wildcard certificates.
|
|
178
|
+
*/
|
|
179
|
+
allowWildcardCertificates: z.boolean(),
|
|
180
|
+
}),
|
|
181
|
+
|
|
182
|
+
meta: {
|
|
183
|
+
color: vaultColor,
|
|
184
|
+
title: "Vault PKI Issuer",
|
|
185
|
+
icon: vaultIcon,
|
|
186
|
+
iconColor: vaultColor,
|
|
187
|
+
},
|
|
188
|
+
})
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Creates a root PKI CA in Vault.
|
|
192
|
+
*/
|
|
193
|
+
export const pkiCa = defineUnit({
|
|
194
|
+
type: "vault.pki.ca.v1",
|
|
195
|
+
|
|
196
|
+
args: {
|
|
197
|
+
/**
|
|
198
|
+
* The mount path of the root PKI backend.
|
|
199
|
+
*
|
|
200
|
+
* If not provided, it will be set to `pki/<unit name>`.
|
|
201
|
+
*/
|
|
202
|
+
path: z.string().optional(),
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* The common name of the root CA certificate.
|
|
206
|
+
*
|
|
207
|
+
* If not provided, it will be set to `<unit name> Root CA`.
|
|
208
|
+
*/
|
|
209
|
+
commonName: z.string().optional(),
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* The TTL of the generated root CA certificate.
|
|
213
|
+
*/
|
|
214
|
+
ttl: z.string().default("87600h"),
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* The private key configuration for the root CA certificate.
|
|
218
|
+
*/
|
|
219
|
+
privateKey: privateKeySchema,
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* The default lease TTL of the root PKI backend in seconds.
|
|
223
|
+
*/
|
|
224
|
+
defaultLeaseTtlSeconds: z.number().int().positive().default(3600),
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* The maximum lease TTL of the root PKI backend in seconds.
|
|
228
|
+
*/
|
|
229
|
+
maxLeaseTtlSeconds: z.number().int().positive().default(315360000),
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* The intermediate PKI backend and CA certificate configuration.
|
|
233
|
+
*/
|
|
234
|
+
intermediate: z
|
|
235
|
+
.object({
|
|
236
|
+
/**
|
|
237
|
+
* The mount path of the intermediate PKI backend used by issuers.
|
|
238
|
+
*
|
|
239
|
+
* If not provided, it will be set to `<root path>-intermediate`.
|
|
240
|
+
*/
|
|
241
|
+
path: z.string().optional(),
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* The common name of the intermediate CA certificate.
|
|
245
|
+
*
|
|
246
|
+
* If not provided, it will be set to `<unit name> Intermediate CA`.
|
|
247
|
+
*/
|
|
248
|
+
commonName: z.string().optional(),
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* The TTL of the generated intermediate CA certificate.
|
|
252
|
+
*/
|
|
253
|
+
ttl: z.string().default("43800h"),
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* The private key configuration for the intermediate CA certificate.
|
|
257
|
+
*/
|
|
258
|
+
privateKey: privateKeySchema,
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* The default lease TTL of the intermediate PKI backend in seconds.
|
|
262
|
+
*/
|
|
263
|
+
defaultLeaseTtlSeconds: z.number().int().positive().default(3600),
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* The maximum lease TTL of the intermediate PKI backend in seconds.
|
|
267
|
+
*/
|
|
268
|
+
maxLeaseTtlSeconds: z.number().int().positive().default(157680000),
|
|
269
|
+
})
|
|
270
|
+
.default({
|
|
271
|
+
ttl: "43800h",
|
|
272
|
+
privateKey: {
|
|
273
|
+
algorithm: "RSA",
|
|
274
|
+
size: 4096,
|
|
275
|
+
},
|
|
276
|
+
defaultLeaseTtlSeconds: 3600,
|
|
277
|
+
maxLeaseTtlSeconds: 157680000,
|
|
278
|
+
}),
|
|
279
|
+
},
|
|
280
|
+
|
|
281
|
+
inputs: {
|
|
282
|
+
/**
|
|
283
|
+
* The Vault connection used to configure the root PKI CA.
|
|
284
|
+
*/
|
|
285
|
+
connection: connectionEntity,
|
|
286
|
+
},
|
|
287
|
+
|
|
288
|
+
outputs: {
|
|
289
|
+
ca: pkiCaEntity,
|
|
290
|
+
},
|
|
291
|
+
|
|
292
|
+
meta: {
|
|
293
|
+
title: "Vault PKI CA",
|
|
294
|
+
icon: "simple-icons:vault",
|
|
295
|
+
category: "Security",
|
|
296
|
+
},
|
|
297
|
+
|
|
298
|
+
source: {
|
|
299
|
+
package: "@highstate/vault",
|
|
300
|
+
path: "units/pki-ca",
|
|
301
|
+
},
|
|
302
|
+
})
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Creates a PKI issuer role in Vault.
|
|
306
|
+
*/
|
|
307
|
+
export const pkiIssuer = defineUnit({
|
|
308
|
+
type: "vault.pki.issuer.v1",
|
|
309
|
+
|
|
310
|
+
args: {
|
|
311
|
+
/**
|
|
312
|
+
* The PKI role name used to issue leaf certificates.
|
|
313
|
+
*
|
|
314
|
+
* If not provided, it will be set to the unit name.
|
|
315
|
+
*/
|
|
316
|
+
roleName: z.string().optional(),
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* The DNS zones for which this issuer can issue certificates.
|
|
320
|
+
*/
|
|
321
|
+
dnsNames: z.string().array(),
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* The common names for which this issuer can issue certificates.
|
|
325
|
+
*/
|
|
326
|
+
commonNames: z.string().array().default([]),
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Whether the Vault role allows issuing certificates for exact allowed domains.
|
|
330
|
+
*/
|
|
331
|
+
allowBareDomains: z.boolean().default(true),
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Whether the Vault role allows issuing certificates for subdomains of allowed domains.
|
|
335
|
+
*/
|
|
336
|
+
allowSubdomains: z.boolean().default(true),
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Whether the Vault role allows issuing wildcard certificates.
|
|
340
|
+
*/
|
|
341
|
+
allowWildcardCertificates: z.boolean().default(true),
|
|
342
|
+
},
|
|
343
|
+
|
|
344
|
+
inputs: {
|
|
345
|
+
/**
|
|
346
|
+
* The Vault PKI CA used to create and sign the intermediate issuer.
|
|
347
|
+
*/
|
|
348
|
+
ca: pkiCaEntity,
|
|
349
|
+
},
|
|
350
|
+
|
|
351
|
+
outputs: {
|
|
352
|
+
issuer: pkiIssuerEntity,
|
|
353
|
+
},
|
|
354
|
+
|
|
355
|
+
meta: {
|
|
356
|
+
title: "Vault PKI Issuer",
|
|
357
|
+
icon: "simple-icons:vault",
|
|
358
|
+
category: "Security",
|
|
359
|
+
},
|
|
360
|
+
|
|
361
|
+
source: {
|
|
362
|
+
package: "@highstate/vault",
|
|
363
|
+
path: "units/pki-issuer",
|
|
364
|
+
},
|
|
365
|
+
})
|
|
366
|
+
|
|
367
|
+
export type Connection = EntityValue<typeof connectionEntity>
|
|
368
|
+
export type ConnectionInput = EntityInput<typeof connectionEntity>
|
|
369
|
+
|
|
370
|
+
export type PkiCa = EntityValue<typeof pkiCaEntity>
|
|
371
|
+
export type PkiCaInput = EntityInput<typeof pkiCaEntity>
|
|
372
|
+
|
|
373
|
+
export type PkiIssuer = EntityValue<typeof pkiIssuerEntity>
|
|
374
|
+
export type PkiIssuerInput = EntityInput<typeof pkiIssuerEntity>
|
|
@@ -8,6 +8,56 @@ import {
|
|
|
8
8
|
import * as dns from "../dns"
|
|
9
9
|
import { implementationReferenceSchema } from "../impl-ref"
|
|
10
10
|
import { l3EndpointEntity } from "../network"
|
|
11
|
+
import { booleanPatchSchema } from "../utils"
|
|
12
|
+
import { fileEntity } from "./files"
|
|
13
|
+
|
|
14
|
+
const gatewayClientAuthSchema = z.object({
|
|
15
|
+
/**
|
|
16
|
+
* The PEM-encoded CA certificates used to validate client certificates.
|
|
17
|
+
*/
|
|
18
|
+
ca: z.string().array(),
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The DNS SAN patterns to validate on client certificates.
|
|
22
|
+
*/
|
|
23
|
+
dnsNames: z.string().array().default([]),
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
const gatewayPatchArgs = {
|
|
27
|
+
/**
|
|
28
|
+
* The public L3 endpoints to set on the gateway.
|
|
29
|
+
*
|
|
30
|
+
* If not specified, the existing endpoints will be kept.
|
|
31
|
+
*/
|
|
32
|
+
endpoints: z.string().array().default([]),
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The DNS SAN patterns to validate on client certificates.
|
|
36
|
+
*/
|
|
37
|
+
clientAuthDnsNames: z.string().array().default([]),
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const gatewayPatchInputs = {
|
|
41
|
+
/**
|
|
42
|
+
* The public L3 endpoints to set on the gateway.
|
|
43
|
+
*
|
|
44
|
+
* These endpoints take precedence over the endpoints argument.
|
|
45
|
+
*/
|
|
46
|
+
endpoints: {
|
|
47
|
+
entity: l3EndpointEntity,
|
|
48
|
+
required: false,
|
|
49
|
+
multiple: true,
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The CA certificate files used to validate client certificates.
|
|
54
|
+
*/
|
|
55
|
+
clientAuthCa: {
|
|
56
|
+
entity: fileEntity,
|
|
57
|
+
required: false,
|
|
58
|
+
multiple: true,
|
|
59
|
+
},
|
|
60
|
+
} as const
|
|
11
61
|
|
|
12
62
|
export const gatewayEntity = defineEntity({
|
|
13
63
|
type: "common.gateway.v1",
|
|
@@ -24,6 +74,11 @@ export const gatewayEntity = defineEntity({
|
|
|
24
74
|
* If not provided, should be automatically detected by the implementation.
|
|
25
75
|
*/
|
|
26
76
|
endpoints: l3EndpointEntity.schema.array().default([]),
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* The default client certificate validation configuration for routes using this gateway.
|
|
80
|
+
*/
|
|
81
|
+
clientAuth: gatewayClientAuthSchema.optional(),
|
|
27
82
|
}),
|
|
28
83
|
|
|
29
84
|
meta: {
|
|
@@ -60,22 +115,30 @@ export const tlsIssuerEntity = defineEntity({
|
|
|
60
115
|
export const accessPointEntity = defineEntity({
|
|
61
116
|
type: "common.access-point.v1",
|
|
62
117
|
|
|
63
|
-
|
|
118
|
+
includes: {
|
|
64
119
|
/**
|
|
65
120
|
* The gateway of the access point.
|
|
66
121
|
*/
|
|
67
|
-
gateway: gatewayEntity
|
|
122
|
+
gateway: gatewayEntity,
|
|
68
123
|
|
|
69
124
|
/**
|
|
70
125
|
* The TLS issuers used to manage TLS certificates for the access point.
|
|
71
126
|
*/
|
|
72
|
-
tlsIssuers:
|
|
127
|
+
tlsIssuers: {
|
|
128
|
+
entity: tlsIssuerEntity,
|
|
129
|
+
multiple: true,
|
|
130
|
+
},
|
|
73
131
|
|
|
74
132
|
/**
|
|
75
133
|
* The DNS providers used to manage the DNS records for the access point.
|
|
76
134
|
*/
|
|
77
|
-
dnsProviders:
|
|
135
|
+
dnsProviders: {
|
|
136
|
+
entity: dns.providerEntity,
|
|
137
|
+
multiple: true,
|
|
138
|
+
},
|
|
139
|
+
},
|
|
78
140
|
|
|
141
|
+
schema: z.object({
|
|
79
142
|
/**
|
|
80
143
|
* Whether the DNS records created for the access point should be proxied.
|
|
81
144
|
*/
|
|
@@ -140,6 +203,89 @@ export const accessPoint = defineUnit({
|
|
|
140
203
|
},
|
|
141
204
|
})
|
|
142
205
|
|
|
206
|
+
/**
|
|
207
|
+
* Patches some properties of the gateway and outputs the updated gateway.
|
|
208
|
+
*/
|
|
209
|
+
export const gatewayPatch = defineUnit({
|
|
210
|
+
type: "common.gateway-patch.v1",
|
|
211
|
+
|
|
212
|
+
args: gatewayPatchArgs,
|
|
213
|
+
|
|
214
|
+
inputs: {
|
|
215
|
+
gateway: gatewayEntity,
|
|
216
|
+
...gatewayPatchInputs,
|
|
217
|
+
},
|
|
218
|
+
|
|
219
|
+
outputs: {
|
|
220
|
+
gateway: gatewayEntity,
|
|
221
|
+
},
|
|
222
|
+
|
|
223
|
+
meta: {
|
|
224
|
+
title: "Gateway Patch",
|
|
225
|
+
icon: "mdi:router-network",
|
|
226
|
+
secondaryIcon: "fluent:patch-20-filled",
|
|
227
|
+
category: "Kubernetes",
|
|
228
|
+
},
|
|
229
|
+
|
|
230
|
+
source: {
|
|
231
|
+
package: "@highstate/common",
|
|
232
|
+
path: "units/gateway-patch",
|
|
233
|
+
},
|
|
234
|
+
})
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Patches some properties of the access point and outputs the updated access point.
|
|
238
|
+
*/
|
|
239
|
+
export const accessPointPatch = defineUnit({
|
|
240
|
+
type: "common.access-point-patch.v1",
|
|
241
|
+
|
|
242
|
+
args: {
|
|
243
|
+
...gatewayPatchArgs,
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Whether the DNS records created for the access point should be proxied.
|
|
247
|
+
*
|
|
248
|
+
* If not specified, the existing value will be kept.
|
|
249
|
+
*/
|
|
250
|
+
proxied: booleanPatchSchema,
|
|
251
|
+
},
|
|
252
|
+
|
|
253
|
+
inputs: {
|
|
254
|
+
accessPoint: accessPointEntity,
|
|
255
|
+
gateway: {
|
|
256
|
+
entity: gatewayEntity,
|
|
257
|
+
required: false,
|
|
258
|
+
},
|
|
259
|
+
tlsIssuers: {
|
|
260
|
+
entity: tlsIssuerEntity,
|
|
261
|
+
required: false,
|
|
262
|
+
multiple: true,
|
|
263
|
+
},
|
|
264
|
+
dnsProviders: {
|
|
265
|
+
entity: dns.providerEntity,
|
|
266
|
+
required: false,
|
|
267
|
+
multiple: true,
|
|
268
|
+
},
|
|
269
|
+
...gatewayPatchInputs,
|
|
270
|
+
},
|
|
271
|
+
|
|
272
|
+
outputs: {
|
|
273
|
+
accessPoint: accessPointEntity,
|
|
274
|
+
},
|
|
275
|
+
|
|
276
|
+
meta: {
|
|
277
|
+
title: "Access Point Patch",
|
|
278
|
+
icon: "mdi:access-point",
|
|
279
|
+
secondaryIcon: "fluent:patch-20-filled",
|
|
280
|
+
category: "Kubernetes",
|
|
281
|
+
},
|
|
282
|
+
|
|
283
|
+
source: {
|
|
284
|
+
package: "@highstate/common",
|
|
285
|
+
path: "units/access-point-patch",
|
|
286
|
+
},
|
|
287
|
+
})
|
|
288
|
+
|
|
143
289
|
export type Gateway = EntityValue<typeof gatewayEntity>
|
|
144
290
|
export type AccessPoint = EntityValue<typeof accessPointEntity>
|
|
145
291
|
export type TlsIssuer = EntityValue<typeof tlsIssuerEntity>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { defineUnit, objectEntity, z } from "@highstate/contract"
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A unit that filters entities based on a specified expression.
|
|
5
|
+
*/
|
|
6
|
+
export const filter = defineUnit({
|
|
7
|
+
type: "common.filter.v1",
|
|
8
|
+
|
|
9
|
+
args: {
|
|
10
|
+
/**
|
|
11
|
+
* The expression used to filter entities.
|
|
12
|
+
*/
|
|
13
|
+
expression: z.string(),
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
inputs: {
|
|
17
|
+
entities: {
|
|
18
|
+
entity: objectEntity,
|
|
19
|
+
multiple: true,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
outputs: {
|
|
24
|
+
entities: {
|
|
25
|
+
fromInput: "entities",
|
|
26
|
+
multiple: true,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
meta: {
|
|
31
|
+
title: "Entity Filter",
|
|
32
|
+
category: "common",
|
|
33
|
+
icon: "mdi:filter-variant",
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
source: {
|
|
37
|
+
package: "@highstate/common",
|
|
38
|
+
path: "filter",
|
|
39
|
+
},
|
|
40
|
+
})
|
package/src/common/index.ts
CHANGED