@highstate/library 0.7.2 → 0.7.3
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.manifest.json +5 -0
- package/dist/index.js +2111 -0
- package/dist/index.js.map +1 -0
- package/package.json +9 -11
- package/src/apps/code-server.ts +51 -0
- package/src/apps/deployment.ts +82 -0
- package/src/apps/gitea.ts +31 -0
- package/src/apps/grocy.ts +33 -0
- package/src/apps/index.ts +13 -0
- package/src/apps/kubernetes-dashboard.ts +28 -0
- package/src/apps/mariadb.ts +95 -0
- package/src/apps/maybe.ts +39 -0
- package/src/apps/mongodb.ts +96 -0
- package/src/apps/postgresql.ts +95 -0
- package/src/apps/syncthing.ts +50 -0
- package/src/apps/traefik.ts +32 -0
- package/src/apps/vaultwarden.ts +33 -0
- package/src/apps/zitadel.ts +31 -0
- package/src/cloudflare.ts +25 -0
- package/src/common.ts +70 -0
- package/src/dns.ts +45 -0
- package/src/index.ts +13 -0
- package/src/k3s.ts +28 -0
- package/src/k8s.ts +353 -0
- package/src/mullvad.ts +46 -0
- package/src/proxmox.ts +188 -0
- package/src/restic.ts +51 -0
- package/src/ssh.ts +60 -0
- package/src/talos.ts +116 -0
- package/src/wireguard.ts +588 -0
- package/src/xt-wgobfs.ts +49 -0
- package/dist/index.d.ts +0 -2937
- package/dist/index.mjs +0 -1725
package/src/talos.ts
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
import { defineEntity, defineUnit, Type } from "@highstate/contract"
|
2
|
+
import { serverEntity } from "./common"
|
3
|
+
import { clusterEntity as k8sClusterEntity } from "./k8s"
|
4
|
+
|
5
|
+
export const clusterEntity = defineEntity({
|
6
|
+
type: "talos.cluster",
|
7
|
+
|
8
|
+
schema: Type.Object({
|
9
|
+
clientConfiguration: Type.String(),
|
10
|
+
machineSecrets: Type.String(),
|
11
|
+
}),
|
12
|
+
|
13
|
+
meta: {
|
14
|
+
color: "#2d2d2d",
|
15
|
+
},
|
16
|
+
})
|
17
|
+
|
18
|
+
export const cniSchema = Type.StringEnum(["none", "cilium", "flannel"])
|
19
|
+
export const csiSchema = Type.StringEnum(["none", "local-path-provisioner"])
|
20
|
+
|
21
|
+
export const cluster = defineUnit({
|
22
|
+
type: "talos.cluster",
|
23
|
+
|
24
|
+
args: {
|
25
|
+
/**
|
26
|
+
* Allow scheduling workloads on the master nodes.
|
27
|
+
*
|
28
|
+
* By default, "true" if no worker nodes are provided.
|
29
|
+
*/
|
30
|
+
scheduleOnMasters: Type.Boolean(),
|
31
|
+
|
32
|
+
/**
|
33
|
+
* The endpoint of the cluster.
|
34
|
+
*
|
35
|
+
* By default, the first master node's endpoint is used.
|
36
|
+
*/
|
37
|
+
endpoint: Type.Optional(Type.String()),
|
38
|
+
|
39
|
+
/**
|
40
|
+
* The name of the cluster.
|
41
|
+
*
|
42
|
+
* By default, the name of the instance is used.
|
43
|
+
*/
|
44
|
+
clusterName: Type.Optional(Type.String()),
|
45
|
+
|
46
|
+
/**
|
47
|
+
* The CNI plugin to use.
|
48
|
+
*
|
49
|
+
* The following options are available:
|
50
|
+
* - "cilium" (default)
|
51
|
+
* - "flannel" (built-in in Talos)
|
52
|
+
* - "none" (disable CNI, must be installed manually)
|
53
|
+
*
|
54
|
+
* The "cilium" CNI plugin is recommended to cover advanced network policies like FQDNs.
|
55
|
+
*/
|
56
|
+
cni: { ...cniSchema, default: "cilium" },
|
57
|
+
|
58
|
+
/**
|
59
|
+
* The CSI plugin to use.
|
60
|
+
*
|
61
|
+
* The following options are available:
|
62
|
+
* - "local-path-provisioner" (default)
|
63
|
+
* - "none" (disable CSI, must be installed manually if needed)
|
64
|
+
*/
|
65
|
+
csi: { ...csiSchema, default: "local-path-provisioner" },
|
66
|
+
|
67
|
+
/**
|
68
|
+
* The shared configuration patch.
|
69
|
+
* It will be applied to all nodes.
|
70
|
+
*/
|
71
|
+
sharedConfigPatch: Type.Optional(Type.Record(Type.String(), Type.Any())),
|
72
|
+
|
73
|
+
/**
|
74
|
+
* The master configuration patch.
|
75
|
+
* It will be applied to all master nodes.
|
76
|
+
*/
|
77
|
+
masterConfigPatch: Type.Optional(Type.Record(Type.String(), Type.Any())),
|
78
|
+
|
79
|
+
/**
|
80
|
+
* The worker configuration patch.
|
81
|
+
* It will be applied to all worker nodes.
|
82
|
+
*/
|
83
|
+
workerConfigPatch: Type.Optional(Type.Record(Type.String(), Type.Any())),
|
84
|
+
},
|
85
|
+
|
86
|
+
inputs: {
|
87
|
+
masters: {
|
88
|
+
entity: serverEntity,
|
89
|
+
multiple: true,
|
90
|
+
},
|
91
|
+
workers: {
|
92
|
+
entity: serverEntity,
|
93
|
+
multiple: true,
|
94
|
+
required: false,
|
95
|
+
},
|
96
|
+
},
|
97
|
+
|
98
|
+
outputs: {
|
99
|
+
k8sCluster: k8sClusterEntity,
|
100
|
+
talosCluster: clusterEntity,
|
101
|
+
},
|
102
|
+
|
103
|
+
meta: {
|
104
|
+
displayName: "Talos Cluster",
|
105
|
+
description: "A Kubernetes cluster managed by Talos.",
|
106
|
+
category: "Talos",
|
107
|
+
color: "#2d2d2d",
|
108
|
+
primaryIcon: "simple-icons:talos",
|
109
|
+
secondaryIcon: "devicon:kubernetes",
|
110
|
+
},
|
111
|
+
|
112
|
+
source: {
|
113
|
+
package: "@highstate/talos",
|
114
|
+
path: "cluster",
|
115
|
+
},
|
116
|
+
})
|
package/src/wireguard.ts
ADDED
@@ -0,0 +1,588 @@
|
|
1
|
+
import { defineEntity, defineUnit, Type, type Static } from "@highstate/contract"
|
2
|
+
import {
|
3
|
+
clusterEntity,
|
4
|
+
deploymentEntity,
|
5
|
+
interfaceEntity,
|
6
|
+
serviceEntity,
|
7
|
+
serviceTypeSchema,
|
8
|
+
statefulSetEntity,
|
9
|
+
} from "./k8s"
|
10
|
+
import { providerEntity } from "./dns"
|
11
|
+
|
12
|
+
export const backendSchema = Type.StringEnum(["wireguard", "amneziawg"])
|
13
|
+
export const presharedKeyModeSchema = Type.StringEnum(["none", "global", "secure"])
|
14
|
+
|
15
|
+
export type Backend = Static<typeof backendSchema>
|
16
|
+
export type PresharedKeyMode = Static<typeof presharedKeyModeSchema>
|
17
|
+
|
18
|
+
export const networkEntity = defineEntity({
|
19
|
+
type: "wireguard.network",
|
20
|
+
|
21
|
+
schema: Type.Object({
|
22
|
+
backend: Type.Optional(backendSchema),
|
23
|
+
presharedKeyMode: presharedKeyModeSchema,
|
24
|
+
globalPresharedKey: Type.Optional(Type.String()),
|
25
|
+
ipv6: Type.Optional(Type.Boolean()),
|
26
|
+
}),
|
27
|
+
})
|
28
|
+
|
29
|
+
export const identityEntity = defineEntity({
|
30
|
+
type: "wireguard.identity",
|
31
|
+
|
32
|
+
schema: Type.Object({
|
33
|
+
name: Type.String(),
|
34
|
+
network: Type.Optional(networkEntity.schema),
|
35
|
+
address: Type.Optional(Type.String()),
|
36
|
+
privateKey: Type.String(),
|
37
|
+
presharedKeyPart: Type.Optional(Type.String()),
|
38
|
+
k8sServices: Type.Array(serviceEntity.schema),
|
39
|
+
exitNode: Type.Boolean(),
|
40
|
+
listenPort: Type.Optional(Type.Number()),
|
41
|
+
externalIp: Type.Optional(Type.String()),
|
42
|
+
endpoint: Type.Optional(Type.String()),
|
43
|
+
fqdn: Type.Optional(Type.String()),
|
44
|
+
}),
|
45
|
+
|
46
|
+
meta: {
|
47
|
+
color: "#F44336",
|
48
|
+
},
|
49
|
+
})
|
50
|
+
|
51
|
+
export const peerEntity = defineEntity({
|
52
|
+
type: "wireguard.peer",
|
53
|
+
|
54
|
+
schema: Type.Object({
|
55
|
+
name: Type.String(),
|
56
|
+
network: Type.Optional(networkEntity.schema),
|
57
|
+
publicKey: Type.String(),
|
58
|
+
address: Type.Optional(Type.String()),
|
59
|
+
allowedIps: Type.Array(Type.String()),
|
60
|
+
endpoint: Type.Optional(Type.String()),
|
61
|
+
presharedKeyPart: Type.Optional(Type.String()),
|
62
|
+
excludedIps: Type.Optional(Type.Array(Type.String())),
|
63
|
+
dns: Type.Optional(Type.Array(Type.String())),
|
64
|
+
}),
|
65
|
+
|
66
|
+
meta: {
|
67
|
+
color: "#673AB7",
|
68
|
+
},
|
69
|
+
})
|
70
|
+
|
71
|
+
export const k8sNodeEntity = defineEntity({
|
72
|
+
type: "wireguard.node",
|
73
|
+
|
74
|
+
schema: Type.Object({
|
75
|
+
network: Type.String(),
|
76
|
+
address: Type.String(),
|
77
|
+
endpoint: Type.Optional(Type.String()),
|
78
|
+
peers: Type.Array(Type.String()),
|
79
|
+
}),
|
80
|
+
})
|
81
|
+
|
82
|
+
export type Network = Static<typeof networkEntity.schema>
|
83
|
+
export type Identity = Static<typeof identityEntity.schema>
|
84
|
+
export type Peer = Static<typeof peerEntity.schema>
|
85
|
+
|
86
|
+
/**
|
87
|
+
* The network hols the shared configuration for the WireGuard identities, peers and nodes.
|
88
|
+
*/
|
89
|
+
export const network = defineUnit({
|
90
|
+
type: "wireguard.network",
|
91
|
+
|
92
|
+
args: {
|
93
|
+
/**
|
94
|
+
* The backend to use for the WireGuard network.
|
95
|
+
*
|
96
|
+
* Possible values are:
|
97
|
+
* 1. `wireguard` - The default backend.
|
98
|
+
* 2. `amneziawg` - The censorship-resistant fork of WireGuard.
|
99
|
+
*
|
100
|
+
* By default, the `wireguard` backend is used.
|
101
|
+
*
|
102
|
+
* @schema
|
103
|
+
*/
|
104
|
+
backend: backendSchema,
|
105
|
+
|
106
|
+
/**
|
107
|
+
* The option which defines how to handle pre-shared keys between peers.
|
108
|
+
*
|
109
|
+
* 1. `none` - No pre-shared keys will be used.
|
110
|
+
* 2. `global` - A single pre-shared key will be used for all peer pairs in the network.
|
111
|
+
* 3. `secure` - Each peer pair will have its own pre-shared key.
|
112
|
+
* In this case, each identity generates `presharedKeyPart` and the actual pre-shared key
|
113
|
+
* for each peer pair will be computed as `xor(peer1.presharedKeyPart, peer2.presharedKeyPart)`.
|
114
|
+
*
|
115
|
+
* If the whole network is managed by the HighState, the `secure` mode is recommended.
|
116
|
+
*
|
117
|
+
* By default, the `none` mode is used.
|
118
|
+
*
|
119
|
+
* @schema
|
120
|
+
*/
|
121
|
+
presharedKeyMode: Type.Optional(presharedKeyModeSchema),
|
122
|
+
|
123
|
+
/**
|
124
|
+
* The option to enable IPv6 support in the network.
|
125
|
+
*
|
126
|
+
* By default, IPv6 support is disabled.
|
127
|
+
*
|
128
|
+
* @schema
|
129
|
+
*/
|
130
|
+
ipv6: Type.Optional(Type.Boolean()),
|
131
|
+
},
|
132
|
+
|
133
|
+
secrets: {
|
134
|
+
/**
|
135
|
+
* The global pre-shared key to use for all peer pairs in the network.
|
136
|
+
*
|
137
|
+
* Will be used only if `presharedKeyMode` is set to `global`.
|
138
|
+
* Will be generated automatically if not provided.
|
139
|
+
*
|
140
|
+
* @schema
|
141
|
+
*/
|
142
|
+
globalPresharedKey: Type.Optional(Type.String()),
|
143
|
+
},
|
144
|
+
|
145
|
+
outputs: {
|
146
|
+
network: networkEntity,
|
147
|
+
},
|
148
|
+
|
149
|
+
meta: {
|
150
|
+
description: "The WireGuard network with some shared configuration.",
|
151
|
+
primaryIcon: "simple-icons:wireguard",
|
152
|
+
primaryIconColor: "#88171a",
|
153
|
+
secondaryIcon: "mdi:local-area-network-connect",
|
154
|
+
},
|
155
|
+
|
156
|
+
source: {
|
157
|
+
package: "@highstate/wireguard",
|
158
|
+
path: "network",
|
159
|
+
},
|
160
|
+
})
|
161
|
+
|
162
|
+
const sharedPeerArgs = {
|
163
|
+
/**
|
164
|
+
* The name of the WireGuard peer.
|
165
|
+
*
|
166
|
+
* If not provided, the peer will be named after the unit.
|
167
|
+
*
|
168
|
+
* @schema
|
169
|
+
*/
|
170
|
+
peerName: Type.Optional(Type.String()),
|
171
|
+
|
172
|
+
/**
|
173
|
+
* The address of the WireGuard interface.
|
174
|
+
*
|
175
|
+
* The address may be any IPv4 or IPv6 address. CIDR notation is also supported.
|
176
|
+
*
|
177
|
+
* @schema
|
178
|
+
*/
|
179
|
+
address: Type.Optional(Type.String()),
|
180
|
+
|
181
|
+
/**
|
182
|
+
* The list of allowed IPs for the peer.
|
183
|
+
*
|
184
|
+
* @schema
|
185
|
+
*/
|
186
|
+
allowedIps: Type.Optional(Type.Array(Type.String())),
|
187
|
+
|
188
|
+
/**
|
189
|
+
* The convenience option to set `allowedIps` to `0.0.0.0/0, ::/0`.
|
190
|
+
*
|
191
|
+
* Will be merged with the `allowedIps` if provided.
|
192
|
+
*
|
193
|
+
* @schema
|
194
|
+
*/
|
195
|
+
exitNode: Type.Optional(Type.Boolean()),
|
196
|
+
|
197
|
+
/**
|
198
|
+
* The list of IP ranges to exclude from the tunnel.
|
199
|
+
*
|
200
|
+
* Implementation notes:
|
201
|
+
*
|
202
|
+
* - This list will not be used to generate the allowed IPs for the peer.
|
203
|
+
* - Instead, the node will setup extra direct routes to these IPs via default gateway.
|
204
|
+
* - This allows to use `0.0.0.0/0, ::/0` in the `allowedIps` (and corresponding fwmark magic) and still have some IPs excluded from the tunnel.
|
205
|
+
*
|
206
|
+
* @schema
|
207
|
+
*/
|
208
|
+
excludedIps: Type.Optional(Type.Array(Type.String())),
|
209
|
+
|
210
|
+
/**
|
211
|
+
* The convenience option to exclude private IPs from the tunnel.
|
212
|
+
*
|
213
|
+
* For IPv4, the private IPs are:
|
214
|
+
*
|
215
|
+
* - `10.0.0.0/8`
|
216
|
+
* - `172.16.0.0/12`
|
217
|
+
* - `192.168.0.0/16`
|
218
|
+
*
|
219
|
+
* For IPv6, the private IPs are:
|
220
|
+
*
|
221
|
+
* - `fc00::/7`
|
222
|
+
* - `fe80::/10`
|
223
|
+
*
|
224
|
+
* Will be merged with `excludedIps` if provided.
|
225
|
+
*
|
226
|
+
* @schema
|
227
|
+
*/
|
228
|
+
excludePrivateIps: Type.Optional(Type.Boolean()),
|
229
|
+
|
230
|
+
/**
|
231
|
+
* The endpoint of the WireGuard peer.
|
232
|
+
*
|
233
|
+
* @schema
|
234
|
+
*/
|
235
|
+
endpoint: Type.Optional(Type.String()),
|
236
|
+
|
237
|
+
/**
|
238
|
+
* The DNS servers that should be used by the interface connected to the WireGuard peer.
|
239
|
+
*
|
240
|
+
* If multiple peers define DNS servers, the node will merge them into a single list (but this is discouraged).
|
241
|
+
*
|
242
|
+
* @schema
|
243
|
+
*/
|
244
|
+
dns: Type.Optional(Type.Array(Type.String())),
|
245
|
+
|
246
|
+
/**
|
247
|
+
* The convenience option to include the DNS servers to the allowed IPs.
|
248
|
+
*
|
249
|
+
* By default, is `true`.
|
250
|
+
*
|
251
|
+
* @schema
|
252
|
+
*/
|
253
|
+
includeDns: Type.Optional(Type.Boolean({ default: true })),
|
254
|
+
}
|
255
|
+
|
256
|
+
const sharedInterfaceArgs = {
|
257
|
+
/**
|
258
|
+
* The port to listen on.
|
259
|
+
*
|
260
|
+
* Will override the `listenPort` of the identity if provided.
|
261
|
+
*
|
262
|
+
* @schema
|
263
|
+
*/
|
264
|
+
listenPort: Type.Optional(Type.Number()),
|
265
|
+
|
266
|
+
/**
|
267
|
+
* The DNS servers that should be used by the interface connected to the WireGuard node.
|
268
|
+
*
|
269
|
+
* Will be merged with the DNS servers of the peers.
|
270
|
+
*
|
271
|
+
* @schema
|
272
|
+
*/
|
273
|
+
dns: Type.Optional(Type.Array(Type.String())),
|
274
|
+
}
|
275
|
+
|
276
|
+
export const peer = defineUnit({
|
277
|
+
type: "wireguard.peer",
|
278
|
+
|
279
|
+
args: {
|
280
|
+
...sharedPeerArgs,
|
281
|
+
|
282
|
+
/**
|
283
|
+
* The public key of the WireGuard peer.
|
284
|
+
*
|
285
|
+
* @schema
|
286
|
+
*/
|
287
|
+
publicKey: Type.String(),
|
288
|
+
},
|
289
|
+
|
290
|
+
inputs: {
|
291
|
+
/**
|
292
|
+
* The network to use for the WireGuard peer.
|
293
|
+
*
|
294
|
+
* If not provided, the peer will use default network configuration.
|
295
|
+
*
|
296
|
+
* @schema
|
297
|
+
*/
|
298
|
+
network: {
|
299
|
+
entity: networkEntity,
|
300
|
+
required: false,
|
301
|
+
},
|
302
|
+
},
|
303
|
+
|
304
|
+
outputs: {
|
305
|
+
peer: peerEntity,
|
306
|
+
},
|
307
|
+
|
308
|
+
meta: {
|
309
|
+
description: "The WireGuard peer with the public key.",
|
310
|
+
primaryIcon: "simple-icons:wireguard",
|
311
|
+
primaryIconColor: "#88171a",
|
312
|
+
secondaryIcon: "mdi:badge-account-horizontal",
|
313
|
+
},
|
314
|
+
|
315
|
+
source: {
|
316
|
+
package: "@highstate/wireguard",
|
317
|
+
path: "peer",
|
318
|
+
},
|
319
|
+
})
|
320
|
+
|
321
|
+
export const identity = defineUnit({
|
322
|
+
type: "wireguard.identity",
|
323
|
+
|
324
|
+
args: {
|
325
|
+
...sharedPeerArgs,
|
326
|
+
|
327
|
+
/**
|
328
|
+
* The port to listen on.
|
329
|
+
*
|
330
|
+
* Used by the implementation of the identity and to calculate the endpoint of the peer.
|
331
|
+
*
|
332
|
+
* @schema
|
333
|
+
*/
|
334
|
+
listenPort: Type.Optional(Type.Number()),
|
335
|
+
|
336
|
+
/**
|
337
|
+
* The external IP address of the WireGuard identity.
|
338
|
+
*
|
339
|
+
* Used by the implementation of the identity and to calculate the endpoint of the peer.
|
340
|
+
*
|
341
|
+
* @schema
|
342
|
+
*/
|
343
|
+
externalIp: Type.Optional(Type.String()),
|
344
|
+
|
345
|
+
/**
|
346
|
+
* The endpoint of the WireGuard peer.
|
347
|
+
*
|
348
|
+
* By default, the endpoint is calculated as `externalIp:listenPort`.
|
349
|
+
*
|
350
|
+
* If overridden, does not affect node which implements the identity, but is used in the peer configuration of other nodes.
|
351
|
+
*
|
352
|
+
* @schema
|
353
|
+
*/
|
354
|
+
endpoint: Type.Optional(Type.String()),
|
355
|
+
|
356
|
+
/**
|
357
|
+
* The FQDN of the WireGuard identity.
|
358
|
+
* Will be used as endpoint for the peer.
|
359
|
+
*
|
360
|
+
* If `dnsProvider` is provided and `externalIp` is available, the FQDN will be registered automatically.
|
361
|
+
*
|
362
|
+
* @schema
|
363
|
+
*/
|
364
|
+
fqdn: Type.Optional(Type.String()),
|
365
|
+
},
|
366
|
+
|
367
|
+
secrets: {
|
368
|
+
/**
|
369
|
+
* The private key of the WireGuard identity.
|
370
|
+
*
|
371
|
+
* If not provided, the key will be generated automatically.
|
372
|
+
*
|
373
|
+
* @schema
|
374
|
+
*/
|
375
|
+
privateKey: Type.Optional(Type.String()),
|
376
|
+
|
377
|
+
/**
|
378
|
+
* The part of the pre-shared of the WireGuard identity.
|
379
|
+
*
|
380
|
+
* Will be generated automatically if not provided.
|
381
|
+
*
|
382
|
+
* @schema
|
383
|
+
*/
|
384
|
+
presharedKeyPart: Type.Optional(Type.String()),
|
385
|
+
},
|
386
|
+
|
387
|
+
inputs: {
|
388
|
+
/**
|
389
|
+
* The network to use for the WireGuard identity.
|
390
|
+
*
|
391
|
+
* If not provided, the identity will use default network configuration.
|
392
|
+
*
|
393
|
+
* @schema
|
394
|
+
*/
|
395
|
+
network: {
|
396
|
+
entity: networkEntity,
|
397
|
+
required: false,
|
398
|
+
},
|
399
|
+
|
400
|
+
/**
|
401
|
+
* The list of Kubernetes services to expose the WireGuard identity.
|
402
|
+
*
|
403
|
+
* Their IP addresses will be added to the `allowedIps` of the identity and passed to the node to set up network policies.
|
404
|
+
*
|
405
|
+
* @schema
|
406
|
+
*/
|
407
|
+
k8sServices: {
|
408
|
+
entity: serviceEntity,
|
409
|
+
multiple: true,
|
410
|
+
required: false,
|
411
|
+
},
|
412
|
+
|
413
|
+
dnsProvider: {
|
414
|
+
entity: providerEntity,
|
415
|
+
required: false,
|
416
|
+
},
|
417
|
+
},
|
418
|
+
|
419
|
+
outputs: {
|
420
|
+
identity: identityEntity,
|
421
|
+
peer: peerEntity,
|
422
|
+
},
|
423
|
+
|
424
|
+
meta: {
|
425
|
+
description: "The WireGuard identity with the public key.",
|
426
|
+
primaryIcon: "simple-icons:wireguard",
|
427
|
+
primaryIconColor: "#88171a",
|
428
|
+
secondaryIcon: "mdi:account",
|
429
|
+
},
|
430
|
+
|
431
|
+
source: {
|
432
|
+
package: "@highstate/wireguard",
|
433
|
+
path: "identity",
|
434
|
+
},
|
435
|
+
})
|
436
|
+
|
437
|
+
export const node = defineUnit({
|
438
|
+
type: "wireguard.node",
|
439
|
+
|
440
|
+
args: {
|
441
|
+
appName: Type.Optional(Type.String()),
|
442
|
+
serviceType: Type.Optional(serviceTypeSchema),
|
443
|
+
|
444
|
+
...sharedInterfaceArgs,
|
445
|
+
|
446
|
+
/**
|
447
|
+
* The external IP address of the WireGuard node.
|
448
|
+
*
|
449
|
+
* Will override the `externalIp` of the identity if provided.
|
450
|
+
*
|
451
|
+
* @schema
|
452
|
+
*/
|
453
|
+
externalIp: Type.Optional(Type.String()),
|
454
|
+
|
455
|
+
/**
|
456
|
+
* The extra specification of the container which runs the WireGuard node.
|
457
|
+
*
|
458
|
+
* Will override any overlapping fields.
|
459
|
+
*
|
460
|
+
* @schema
|
461
|
+
*/
|
462
|
+
containerSpec: Type.Optional(Type.Record(Type.String(), Type.Any())),
|
463
|
+
},
|
464
|
+
|
465
|
+
inputs: {
|
466
|
+
identity: identityEntity,
|
467
|
+
k8sCluster: clusterEntity,
|
468
|
+
|
469
|
+
deployment: {
|
470
|
+
entity: deploymentEntity,
|
471
|
+
required: false,
|
472
|
+
},
|
473
|
+
|
474
|
+
statefulSet: {
|
475
|
+
entity: statefulSetEntity,
|
476
|
+
required: false,
|
477
|
+
},
|
478
|
+
|
479
|
+
interface: {
|
480
|
+
entity: interfaceEntity,
|
481
|
+
required: false,
|
482
|
+
},
|
483
|
+
|
484
|
+
peers: {
|
485
|
+
entity: peerEntity,
|
486
|
+
multiple: true,
|
487
|
+
required: false,
|
488
|
+
},
|
489
|
+
},
|
490
|
+
|
491
|
+
outputs: {
|
492
|
+
deployment: {
|
493
|
+
entity: deploymentEntity,
|
494
|
+
required: false,
|
495
|
+
},
|
496
|
+
|
497
|
+
interface: {
|
498
|
+
entity: interfaceEntity,
|
499
|
+
required: false,
|
500
|
+
},
|
501
|
+
|
502
|
+
service: {
|
503
|
+
entity: serviceEntity,
|
504
|
+
required: false,
|
505
|
+
},
|
506
|
+
},
|
507
|
+
|
508
|
+
meta: {
|
509
|
+
description: "The WireGuard node running on the Kubernetes.",
|
510
|
+
primaryIcon: "simple-icons:wireguard",
|
511
|
+
primaryIconColor: "#88171a",
|
512
|
+
secondaryIcon: "mdi:server",
|
513
|
+
},
|
514
|
+
|
515
|
+
source: {
|
516
|
+
package: "@highstate/wireguard",
|
517
|
+
path: "node",
|
518
|
+
},
|
519
|
+
})
|
520
|
+
|
521
|
+
export const config = defineUnit({
|
522
|
+
type: "wireguard.config",
|
523
|
+
|
524
|
+
args: {
|
525
|
+
...sharedInterfaceArgs,
|
526
|
+
|
527
|
+
/**
|
528
|
+
* The name of the "default" interface where non-tunneled traffic should go.
|
529
|
+
*
|
530
|
+
* If not provided, the config will not respect `excludedIps`.
|
531
|
+
*
|
532
|
+
* @schema
|
533
|
+
*/
|
534
|
+
defaultInterface: Type.Optional(Type.String()),
|
535
|
+
},
|
536
|
+
|
537
|
+
inputs: {
|
538
|
+
identity: identityEntity,
|
539
|
+
peers: {
|
540
|
+
entity: peerEntity,
|
541
|
+
multiple: true,
|
542
|
+
required: false,
|
543
|
+
},
|
544
|
+
},
|
545
|
+
|
546
|
+
meta: {
|
547
|
+
displayName: "WireGuard Config",
|
548
|
+
description: "Just the WireGuard configuration for the identity and peers.",
|
549
|
+
primaryIcon: "simple-icons:wireguard",
|
550
|
+
primaryIconColor: "#88171a",
|
551
|
+
secondaryIcon: "mdi:settings",
|
552
|
+
},
|
553
|
+
|
554
|
+
source: {
|
555
|
+
package: "@highstate/wireguard",
|
556
|
+
path: "config",
|
557
|
+
},
|
558
|
+
})
|
559
|
+
|
560
|
+
export const configBundle = defineUnit({
|
561
|
+
type: "wireguard.config-bundle",
|
562
|
+
|
563
|
+
inputs: {
|
564
|
+
identity: identityEntity,
|
565
|
+
peers: {
|
566
|
+
entity: peerEntity,
|
567
|
+
multiple: true,
|
568
|
+
},
|
569
|
+
sharedPeers: {
|
570
|
+
entity: peerEntity,
|
571
|
+
multiple: true,
|
572
|
+
required: false,
|
573
|
+
},
|
574
|
+
},
|
575
|
+
|
576
|
+
meta: {
|
577
|
+
displayName: "WireGuard Config Bundle",
|
578
|
+
description: "The WireGuard configuration bundle for the identity and peers.",
|
579
|
+
primaryIcon: "simple-icons:wireguard",
|
580
|
+
primaryIconColor: "#88171a",
|
581
|
+
secondaryIcon: "mdi:folder-settings-variant",
|
582
|
+
},
|
583
|
+
|
584
|
+
source: {
|
585
|
+
package: "@highstate/wireguard",
|
586
|
+
path: "config-bundle",
|
587
|
+
},
|
588
|
+
})
|