@highstate/library 0.19.1 → 0.20.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 +2314 -1141
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/abbreviations.ts +3 -0
- package/src/common/access-point.ts +19 -4
- package/src/common/files.ts +24 -17
- package/src/common/server.ts +19 -6
- package/src/databases/etcd.ts +141 -39
- package/src/databases/index.ts +8 -7
- package/src/databases/influxdb3.ts +103 -0
- package/src/databases/minio.ts +157 -0
- package/src/databases/mongodb.ts +122 -41
- package/src/databases/mysql.ts +172 -0
- package/src/databases/postgresql.ts +133 -40
- package/src/databases/redis.ts +118 -44
- package/src/databases/s3.ts +48 -127
- package/src/dns.ts +11 -7
- package/src/index.ts +1 -1
- package/src/k3s.ts +7 -0
- package/src/k8s/apps/etcd.ts +3 -3
- package/src/k8s/apps/gitea.ts +1 -1
- package/src/k8s/apps/grafana.ts +48 -0
- package/src/k8s/apps/index.ts +4 -2
- package/src/k8s/apps/mariadb.ts +7 -38
- package/src/k8s/apps/matrix-stack.ts +62 -0
- package/src/k8s/apps/minio.ts +38 -45
- package/src/k8s/apps/mongodb.ts +6 -38
- package/src/k8s/apps/portal.ts +27 -0
- package/src/k8s/apps/postgresql.ts +7 -41
- package/src/k8s/apps/refluxdb.ts +49 -0
- package/src/k8s/apps/remnawave.ts +15 -2
- package/src/k8s/apps/shared.ts +16 -15
- package/src/k8s/apps/traefik.ts +5 -0
- package/src/k8s/apps/valkey.ts +5 -5
- package/src/k8s/apps/vaultwarden.ts +2 -6
- package/src/k8s/apps/workload.ts +14 -11
- package/src/k8s/cert-manager.ts +22 -0
- package/src/k8s/cilium.ts +17 -2
- package/src/k8s/resources.ts +41 -9
- package/src/k8s/service.ts +6 -2
- package/src/k8s/shared.ts +49 -18
- package/src/k8s/workload.ts +59 -43
- package/src/network/address-space.ts +16 -7
- package/src/network/address.ts +13 -2
- package/src/network/endpoint-container.ts +235 -0
- package/src/network/endpoint-schema.ts +8 -0
- package/src/network/endpoint.ts +20 -39
- package/src/network/index.ts +1 -1
- package/src/network/subnet.ts +4 -2
- package/src/proxmox.ts +24 -7
- package/src/restic.ts +8 -2
- package/src/ssh.ts +52 -30
- package/src/talos.ts +8 -2
- package/src/third-party/cloudflare.ts +4 -4
- package/src/third-party/timeweb.ts +17 -3
- package/src/third-party/yandex.ts +198 -88
- package/src/tls.ts +22 -0
- package/src/utils.ts +16 -1
- package/src/wireguard.ts +346 -120
- package/src/databases/mariadb.ts +0 -91
- package/src/databases/shared.ts +0 -67
- package/src/k8s/apps/kubernetes-dashboard.ts +0 -28
- package/src/k8s/apps/maybe.ts +0 -39
- package/src/network/dynamic-endpoint.ts +0 -43
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
defineEntity,
|
|
3
|
+
defineUnit,
|
|
4
|
+
type EntityInput,
|
|
5
|
+
type EntityValue,
|
|
6
|
+
z,
|
|
7
|
+
} from "@highstate/contract"
|
|
3
8
|
import { subnetEntity } from "./subnet"
|
|
4
9
|
|
|
5
|
-
export type AddressSpace =
|
|
10
|
+
export type AddressSpace = EntityValue<typeof addressSpaceEntity>
|
|
6
11
|
export type AddressSpaceInput = EntityInput<typeof addressSpaceEntity>
|
|
7
12
|
|
|
8
13
|
/**
|
|
@@ -18,6 +23,7 @@ export const addressSpaceEntity = defineEntity({
|
|
|
18
23
|
subnets: {
|
|
19
24
|
entity: subnetEntity,
|
|
20
25
|
multiple: true,
|
|
26
|
+
required: false,
|
|
21
27
|
},
|
|
22
28
|
},
|
|
23
29
|
|
|
@@ -25,6 +31,9 @@ export const addressSpaceEntity = defineEntity({
|
|
|
25
31
|
|
|
26
32
|
meta: {
|
|
27
33
|
color: "#3F51B5",
|
|
34
|
+
title: "Address Space",
|
|
35
|
+
icon: "mdi:network",
|
|
36
|
+
iconColor: "#3F51B5",
|
|
28
37
|
},
|
|
29
38
|
})
|
|
30
39
|
|
|
@@ -57,19 +66,19 @@ export const addressSpace = defineUnit({
|
|
|
57
66
|
|
|
58
67
|
inputs: {
|
|
59
68
|
/**
|
|
60
|
-
* The
|
|
69
|
+
* The subnets to include in the address space.
|
|
61
70
|
*/
|
|
62
71
|
included: {
|
|
63
|
-
entity:
|
|
72
|
+
entity: subnetEntity,
|
|
64
73
|
multiple: true,
|
|
65
74
|
required: false,
|
|
66
75
|
},
|
|
67
76
|
|
|
68
77
|
/**
|
|
69
|
-
* The
|
|
78
|
+
* The subnets to exclude from the `included` list.
|
|
70
79
|
*/
|
|
71
80
|
excluded: {
|
|
72
|
-
entity:
|
|
81
|
+
entity: subnetEntity,
|
|
73
82
|
multiple: true,
|
|
74
83
|
required: false,
|
|
75
84
|
},
|
package/src/network/address.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineEntity, type EntityInput, z } from "@highstate/contract"
|
|
1
|
+
import { defineEntity, type EntityInput, type EntityValue, z } from "@highstate/contract"
|
|
2
2
|
import { addressTypeSchema, subnetEntity } from "./subnet"
|
|
3
3
|
|
|
4
|
-
export type Address =
|
|
4
|
+
export type Address = EntityValue<typeof addressEntity>
|
|
5
5
|
export type AddressInput = EntityInput<typeof addressEntity>
|
|
6
6
|
|
|
7
7
|
export const addressEntity = defineEntity({
|
|
@@ -12,6 +12,12 @@ export const addressEntity = defineEntity({
|
|
|
12
12
|
* The subnet to which the address belongs.
|
|
13
13
|
*/
|
|
14
14
|
subnet: subnetEntity,
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The subnet containing the single address.
|
|
18
|
+
* Can be used to provide address entity where subnet entity is expected.
|
|
19
|
+
*/
|
|
20
|
+
asSubnet: subnetEntity,
|
|
15
21
|
},
|
|
16
22
|
|
|
17
23
|
schema: z.object({
|
|
@@ -31,4 +37,9 @@ export const addressEntity = defineEntity({
|
|
|
31
37
|
*/
|
|
32
38
|
value: z.string(),
|
|
33
39
|
}),
|
|
40
|
+
|
|
41
|
+
meta: {
|
|
42
|
+
title: "Address",
|
|
43
|
+
icon: "mdi:ip",
|
|
44
|
+
},
|
|
34
45
|
})
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import {
|
|
2
|
+
$args,
|
|
3
|
+
defineEntity,
|
|
4
|
+
defineUnit,
|
|
5
|
+
type EntityInput,
|
|
6
|
+
type EntityValue,
|
|
7
|
+
z,
|
|
8
|
+
} from "@highstate/contract"
|
|
9
|
+
import { pick } from "remeda"
|
|
10
|
+
import { addressEntity } from "./address"
|
|
11
|
+
import {
|
|
12
|
+
l3EndpointEntity,
|
|
13
|
+
l4EndpointEntity,
|
|
14
|
+
l7EndpointEntity,
|
|
15
|
+
optionalNetworkArgs,
|
|
16
|
+
} from "./endpoint"
|
|
17
|
+
|
|
18
|
+
export const l3EndpointContainer = defineEntity({
|
|
19
|
+
type: "network.l3-endpoint-container.v1",
|
|
20
|
+
|
|
21
|
+
includes: {
|
|
22
|
+
endpoints: {
|
|
23
|
+
entity: l3EndpointEntity,
|
|
24
|
+
multiple: true,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
schema: z.unknown(),
|
|
29
|
+
|
|
30
|
+
meta: {
|
|
31
|
+
color: "#4CAF50",
|
|
32
|
+
title: "L3 Endpoint Container",
|
|
33
|
+
icon: "mdi:network-outline",
|
|
34
|
+
iconColor: "#4CAF50",
|
|
35
|
+
},
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
export const l4EndpointContainer = defineEntity({
|
|
39
|
+
type: "network.l4-endpoint-container.v1",
|
|
40
|
+
|
|
41
|
+
includes: {
|
|
42
|
+
endpoints: {
|
|
43
|
+
entity: l4EndpointEntity,
|
|
44
|
+
multiple: true,
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
schema: z.unknown(),
|
|
49
|
+
|
|
50
|
+
meta: {
|
|
51
|
+
color: "#2196F3",
|
|
52
|
+
title: "L4 Endpoint Container",
|
|
53
|
+
icon: "mdi:network-outline",
|
|
54
|
+
iconColor: "#2196F3",
|
|
55
|
+
},
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
export const l7EndpointContainer = defineEntity({
|
|
59
|
+
type: "network.l7-endpoint-container.v1",
|
|
60
|
+
|
|
61
|
+
includes: {
|
|
62
|
+
endpoints: {
|
|
63
|
+
entity: l7EndpointEntity,
|
|
64
|
+
multiple: true,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
schema: z.unknown(),
|
|
69
|
+
|
|
70
|
+
meta: {
|
|
71
|
+
color: "#FF9800",
|
|
72
|
+
title: "L7 Endpoint Container",
|
|
73
|
+
icon: "mdi:network-outline",
|
|
74
|
+
iconColor: "#FF9800",
|
|
75
|
+
},
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
const endpointReplacerArgs = $args({
|
|
79
|
+
/**
|
|
80
|
+
* The strings to parse as endpoints and add to the replacement list.
|
|
81
|
+
*/
|
|
82
|
+
endpoints: z.string().array().default([]),
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Whether to add current endpoints of the entity to the replacement list.
|
|
86
|
+
*
|
|
87
|
+
* Defaults to `true`.
|
|
88
|
+
*/
|
|
89
|
+
includeCurrent: z.boolean().default(true),
|
|
90
|
+
|
|
91
|
+
...pick(optionalNetworkArgs, ["endpointFilter"]),
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Replaces the L3 endpoints in the entity.
|
|
96
|
+
*/
|
|
97
|
+
export const l3EndpointReplacer = defineUnit({
|
|
98
|
+
type: "network.l3-endpoint-replacer.v1",
|
|
99
|
+
|
|
100
|
+
args: endpointReplacerArgs,
|
|
101
|
+
|
|
102
|
+
inputs: {
|
|
103
|
+
/**
|
|
104
|
+
* The entity containing the "endpoints" inclusion to replace.
|
|
105
|
+
*/
|
|
106
|
+
entity: l3EndpointContainer,
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* The endpoints to add to the replacement list.
|
|
110
|
+
*/
|
|
111
|
+
endpoints: {
|
|
112
|
+
entity: l3EndpointEntity,
|
|
113
|
+
multiple: true,
|
|
114
|
+
required: false,
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* The IP addresses to parse as endpoints and add to the replacement list.
|
|
119
|
+
*/
|
|
120
|
+
addresses: {
|
|
121
|
+
entity: addressEntity,
|
|
122
|
+
multiple: true,
|
|
123
|
+
required: false,
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
|
|
127
|
+
outputs: {
|
|
128
|
+
entity: { fromInput: "entity" },
|
|
129
|
+
},
|
|
130
|
+
|
|
131
|
+
meta: {
|
|
132
|
+
title: "L3 Endpoint Replacer",
|
|
133
|
+
icon: "mdi:network-outline",
|
|
134
|
+
iconColor: "#FF9800",
|
|
135
|
+
secondaryIcon: "mdi:swap-horizontal-bold",
|
|
136
|
+
category: "Network",
|
|
137
|
+
},
|
|
138
|
+
|
|
139
|
+
source: {
|
|
140
|
+
package: "@highstate/common",
|
|
141
|
+
path: "units/network/l3-endpoint-replacer",
|
|
142
|
+
},
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Replaces the L4 endpoints in the entity.
|
|
147
|
+
*/
|
|
148
|
+
export const l4EndpointReplacer = defineUnit({
|
|
149
|
+
type: "network.l4-endpoint-replacer.v1",
|
|
150
|
+
|
|
151
|
+
args: endpointReplacerArgs,
|
|
152
|
+
|
|
153
|
+
inputs: {
|
|
154
|
+
/**
|
|
155
|
+
* The entity containing the "endpoints" inclusion to replace.
|
|
156
|
+
*/
|
|
157
|
+
entity: l4EndpointContainer,
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* The endpoints to add to the replacement list.
|
|
161
|
+
*/
|
|
162
|
+
endpoints: {
|
|
163
|
+
entity: l4EndpointEntity,
|
|
164
|
+
multiple: true,
|
|
165
|
+
required: false,
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
|
|
169
|
+
outputs: {
|
|
170
|
+
entity: { fromInput: "entity" },
|
|
171
|
+
},
|
|
172
|
+
|
|
173
|
+
meta: {
|
|
174
|
+
title: "L4 Endpoint Replacer",
|
|
175
|
+
icon: "mdi:network-outline",
|
|
176
|
+
iconColor: "#FF9800",
|
|
177
|
+
secondaryIcon: "mdi:swap-horizontal-bold",
|
|
178
|
+
category: "Network",
|
|
179
|
+
},
|
|
180
|
+
|
|
181
|
+
source: {
|
|
182
|
+
package: "@highstate/common",
|
|
183
|
+
path: "units/network/l4-endpoint-replacer",
|
|
184
|
+
},
|
|
185
|
+
})
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Replaces the L7 endpoints in the entity.
|
|
189
|
+
*/
|
|
190
|
+
export const l7EndpointReplacer = defineUnit({
|
|
191
|
+
type: "network.l7-endpoint-replacer.v1",
|
|
192
|
+
|
|
193
|
+
args: endpointReplacerArgs,
|
|
194
|
+
|
|
195
|
+
inputs: {
|
|
196
|
+
/**
|
|
197
|
+
* The entity containing the "endpoints" inclusion to replace.
|
|
198
|
+
*/
|
|
199
|
+
entity: l7EndpointContainer,
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* The endpoints to add to the replacement list.
|
|
203
|
+
*/
|
|
204
|
+
endpoints: {
|
|
205
|
+
entity: l7EndpointEntity,
|
|
206
|
+
multiple: true,
|
|
207
|
+
required: false,
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
|
|
211
|
+
outputs: {
|
|
212
|
+
entity: { fromInput: "entity" },
|
|
213
|
+
},
|
|
214
|
+
|
|
215
|
+
meta: {
|
|
216
|
+
title: "L7 Endpoint Replacer",
|
|
217
|
+
icon: "mdi:network-outline",
|
|
218
|
+
iconColor: "#FF9800",
|
|
219
|
+
secondaryIcon: "mdi:swap-horizontal-bold",
|
|
220
|
+
category: "Network",
|
|
221
|
+
},
|
|
222
|
+
|
|
223
|
+
source: {
|
|
224
|
+
package: "@highstate/common",
|
|
225
|
+
path: "units/network/l7-endpoint-replacer",
|
|
226
|
+
},
|
|
227
|
+
})
|
|
228
|
+
|
|
229
|
+
export type L3EndpointContainer = EntityValue<typeof l3EndpointContainer>
|
|
230
|
+
export type L4EndpointContainer = EntityValue<typeof l4EndpointContainer>
|
|
231
|
+
export type L7EndpointContainer = EntityValue<typeof l7EndpointContainer>
|
|
232
|
+
|
|
233
|
+
export type L3EndpointContainerInput = EntityInput<typeof l3EndpointContainer>
|
|
234
|
+
export type L4EndpointContainerInput = EntityInput<typeof l4EndpointContainer>
|
|
235
|
+
export type L7EndpointContainerInput = EntityInput<typeof l7EndpointContainer>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "@highstate/contract"
|
|
2
|
+
import { implementationReferenceSchema } from "../impl-ref"
|
|
2
3
|
import { metadataSchema } from "../utils"
|
|
3
4
|
import { addressEntity } from "./address"
|
|
4
5
|
|
|
@@ -33,6 +34,13 @@ function createEndpointSchema<TLevel extends number, TShape extends z.core.$ZodS
|
|
|
33
34
|
}),
|
|
34
35
|
),
|
|
35
36
|
|
|
37
|
+
/**
|
|
38
|
+
* The implementation reference that will be used to resolve the endpoint at runtime.
|
|
39
|
+
*
|
|
40
|
+
* Used primarily to expose endpoints from private networks to the Pulumi program.
|
|
41
|
+
*/
|
|
42
|
+
implRef: implementationReferenceSchema.optional(),
|
|
43
|
+
|
|
36
44
|
...shape,
|
|
37
45
|
}),
|
|
38
46
|
z.union([
|
package/src/network/endpoint.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import type { Simplify } from "type-fest"
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
$args,
|
|
4
|
+
defineEntity,
|
|
5
|
+
defineUnit,
|
|
6
|
+
type EntityInput,
|
|
7
|
+
type EntityValue,
|
|
8
|
+
z,
|
|
9
|
+
} from "@highstate/contract"
|
|
3
10
|
import { mapValues, pick } from "remeda"
|
|
4
11
|
import { metadataSchema } from "../utils"
|
|
5
12
|
import { addressEntity } from "./address"
|
|
6
|
-
import {
|
|
7
|
-
dynamicL3EndpointEntity,
|
|
8
|
-
dynamicL4EndpointEntity,
|
|
9
|
-
dynamicL7EndpointEntity,
|
|
10
|
-
} from "./dynamic-endpoint"
|
|
11
13
|
import {
|
|
12
14
|
l3EndpointSchema,
|
|
13
15
|
l4EndpointSchema,
|
|
@@ -46,22 +48,15 @@ export const l3EndpointEntity = defineEntity({
|
|
|
46
48
|
entity: addressEntity,
|
|
47
49
|
required: false,
|
|
48
50
|
},
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* The dynamic endpoint which statically resolves to this endpoint.
|
|
52
|
-
*
|
|
53
|
-
* Allows to use any static endpoint as a dynamic without extra units.
|
|
54
|
-
*/
|
|
55
|
-
dynamic: {
|
|
56
|
-
entity: dynamicL3EndpointEntity,
|
|
57
|
-
required: false,
|
|
58
|
-
},
|
|
59
51
|
},
|
|
60
52
|
|
|
61
53
|
schema: l3EndpointSchema,
|
|
62
54
|
|
|
63
55
|
meta: {
|
|
64
56
|
color: "#4CAF50",
|
|
57
|
+
title: "L3 Endpoint",
|
|
58
|
+
icon: "mdi:network-outline",
|
|
59
|
+
iconColor: "#4CAF50",
|
|
65
60
|
},
|
|
66
61
|
})
|
|
67
62
|
|
|
@@ -84,20 +79,13 @@ export const l4EndpointEntity = defineEntity({
|
|
|
84
79
|
type: "network.l4-endpoint.v1",
|
|
85
80
|
|
|
86
81
|
extends: { l3EndpointEntity },
|
|
87
|
-
|
|
88
|
-
includes: {
|
|
89
|
-
/**
|
|
90
|
-
* The dynamic endpoint which statically resolves to this endpoint.
|
|
91
|
-
*
|
|
92
|
-
* Allows to use any static endpoint as a dynamic without extra units.
|
|
93
|
-
*/
|
|
94
|
-
dynamic: dynamicL4EndpointEntity,
|
|
95
|
-
},
|
|
96
|
-
|
|
97
82
|
schema: l4EndpointSchema,
|
|
98
83
|
|
|
99
84
|
meta: {
|
|
100
85
|
color: "#2196F3",
|
|
86
|
+
title: "L4 Endpoint",
|
|
87
|
+
icon: "mdi:network-outline",
|
|
88
|
+
iconColor: "#2196F3",
|
|
101
89
|
},
|
|
102
90
|
})
|
|
103
91
|
|
|
@@ -110,20 +98,13 @@ export const l7EndpointEntity = defineEntity({
|
|
|
110
98
|
type: "network.l7-endpoint.v1",
|
|
111
99
|
|
|
112
100
|
extends: { l4EndpointEntity },
|
|
113
|
-
|
|
114
|
-
includes: {
|
|
115
|
-
/**
|
|
116
|
-
* The dynamic endpoint which statically resolves to this endpoint.
|
|
117
|
-
*
|
|
118
|
-
* Allows to use any static endpoint as a dynamic without extra units.
|
|
119
|
-
*/
|
|
120
|
-
dynamic: dynamicL7EndpointEntity,
|
|
121
|
-
},
|
|
122
|
-
|
|
123
101
|
schema: l7EndpointSchema,
|
|
124
102
|
|
|
125
103
|
meta: {
|
|
126
104
|
color: "#FF9800",
|
|
105
|
+
title: "L7 Endpoint",
|
|
106
|
+
icon: "mdi:network-outline",
|
|
107
|
+
iconColor: "#FF9800",
|
|
127
108
|
},
|
|
128
109
|
})
|
|
129
110
|
|
|
@@ -331,13 +312,13 @@ export const endpointFilter = defineUnit({
|
|
|
331
312
|
},
|
|
332
313
|
})
|
|
333
314
|
|
|
334
|
-
export type L3Endpoint = Simplify<
|
|
315
|
+
export type L3Endpoint = Simplify<EntityValue<typeof l3EndpointEntity>>
|
|
335
316
|
export type L3EndpointInput = EntityInput<typeof l3EndpointEntity>
|
|
336
|
-
export type L4Endpoint = Simplify<
|
|
317
|
+
export type L4Endpoint = Simplify<EntityValue<typeof l4EndpointEntity>>
|
|
337
318
|
export type L4EndpointInput = EntityInput<typeof l4EndpointEntity>
|
|
338
319
|
export type L4Protocol = z.infer<typeof l4ProtocolSchema>
|
|
339
320
|
export type L4PortInfo = z.infer<typeof l4PortInfoSchema>
|
|
340
|
-
export type L7Endpoint = Simplify<
|
|
321
|
+
export type L7Endpoint = Simplify<EntityValue<typeof l7EndpointEntity>>
|
|
341
322
|
export type L7EndpointInput = EntityInput<typeof l7EndpointEntity>
|
|
342
323
|
export type L7AppInfo = z.infer<typeof l7AppInfoSchema>
|
|
343
324
|
|
package/src/network/index.ts
CHANGED
package/src/network/subnet.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineEntity, type EntityInput, z } from "@highstate/contract"
|
|
1
|
+
import { defineEntity, type EntityInput, type EntityValue, z } from "@highstate/contract"
|
|
2
2
|
|
|
3
|
-
export type Subnet =
|
|
3
|
+
export type Subnet = EntityValue<typeof subnetEntity>
|
|
4
4
|
export type SubnetInput = EntityInput<typeof subnetEntity>
|
|
5
5
|
export type AddressType = z.infer<typeof addressTypeSchema>
|
|
6
6
|
|
|
@@ -27,6 +27,8 @@ export const subnetEntity = defineEntity({
|
|
|
27
27
|
}),
|
|
28
28
|
|
|
29
29
|
meta: {
|
|
30
|
+
title: "Subnet",
|
|
31
|
+
icon: "ri:network-line",
|
|
30
32
|
color: "#3F51B5",
|
|
31
33
|
},
|
|
32
34
|
})
|
package/src/proxmox.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
defineEntity,
|
|
3
|
+
defineUnit,
|
|
4
|
+
type EntityInput,
|
|
5
|
+
type EntityValue,
|
|
6
|
+
secretSchema,
|
|
7
|
+
z,
|
|
8
|
+
} from "@highstate/contract"
|
|
2
9
|
import {
|
|
3
10
|
checksumSchema,
|
|
4
11
|
fileEntity,
|
|
@@ -13,6 +20,18 @@ import * as ssh from "./ssh"
|
|
|
13
20
|
export const clusterEntity = defineEntity({
|
|
14
21
|
type: "proxmox.cluster.v1",
|
|
15
22
|
|
|
23
|
+
includes: {
|
|
24
|
+
/**
|
|
25
|
+
* The SSH configuration for the Proxmox nodes.
|
|
26
|
+
*
|
|
27
|
+
* If not specified, it will be assumed that the nodes are not accessible via SSH.
|
|
28
|
+
*/
|
|
29
|
+
ssh: {
|
|
30
|
+
entity: ssh.connectionEntity,
|
|
31
|
+
required: false,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
|
|
16
35
|
schema: z.object({
|
|
17
36
|
endpoint: l7EndpointEntity.schema,
|
|
18
37
|
insecure: z.boolean().optional(),
|
|
@@ -21,10 +40,8 @@ export const clusterEntity = defineEntity({
|
|
|
21
40
|
defaultNodeName: z.string(),
|
|
22
41
|
defaultDatastoreId: z.string(),
|
|
23
42
|
|
|
24
|
-
password: z.string().optional(),
|
|
25
|
-
apiToken: z.string().optional(),
|
|
26
|
-
|
|
27
|
-
ssh: ssh.connectionSchema.optional(),
|
|
43
|
+
password: secretSchema(z.string()).optional(),
|
|
44
|
+
apiToken: secretSchema(z.string()).optional(),
|
|
28
45
|
}),
|
|
29
46
|
|
|
30
47
|
meta: {
|
|
@@ -430,8 +447,8 @@ export const virtualMachine = defineUnit({
|
|
|
430
447
|
},
|
|
431
448
|
})
|
|
432
449
|
|
|
433
|
-
export type Cluster =
|
|
434
|
-
export type Image =
|
|
450
|
+
export type Cluster = EntityValue<typeof clusterEntity>
|
|
451
|
+
export type Image = EntityValue<typeof imageEntity>
|
|
435
452
|
|
|
436
453
|
export type ClusterInput = EntityInput<typeof clusterEntity>
|
|
437
454
|
export type ImageInput = EntityInput<typeof imageEntity>
|
package/src/restic.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
defineEntity,
|
|
3
|
+
defineUnit,
|
|
4
|
+
type EntityInput,
|
|
5
|
+
type EntityValue,
|
|
6
|
+
z,
|
|
7
|
+
} from "@highstate/contract"
|
|
2
8
|
import { l3EndpointEntity, l4EndpointEntity } from "./network"
|
|
3
9
|
|
|
4
10
|
export const repositoryEntity = defineEntity({
|
|
@@ -82,5 +88,5 @@ export const repository = defineUnit({
|
|
|
82
88
|
},
|
|
83
89
|
})
|
|
84
90
|
|
|
85
|
-
export type Repository =
|
|
91
|
+
export type Repository = EntityValue<typeof repositoryEntity>
|
|
86
92
|
export type RepositoryInput = EntityInput<typeof repositoryEntity>
|
package/src/ssh.ts
CHANGED
|
@@ -4,9 +4,10 @@ import {
|
|
|
4
4
|
defineEntity,
|
|
5
5
|
defineUnit,
|
|
6
6
|
type EntityInput,
|
|
7
|
+
type EntityValue,
|
|
8
|
+
secretSchema,
|
|
7
9
|
z,
|
|
8
10
|
} from "@highstate/contract"
|
|
9
|
-
import { fileEntity } from "./common/files"
|
|
10
11
|
import { l4EndpointEntity, portSchema } from "./network"
|
|
11
12
|
|
|
12
13
|
export const keyTypeSchema = z.enum(["ed25519"])
|
|
@@ -50,44 +51,66 @@ export const keyPairEntity = defineEntity({
|
|
|
50
51
|
/**
|
|
51
52
|
* The private key in PEM format.
|
|
52
53
|
*/
|
|
53
|
-
privateKey: z.string(),
|
|
54
|
+
privateKey: secretSchema(z.string()),
|
|
54
55
|
}),
|
|
55
56
|
|
|
56
57
|
meta: {
|
|
57
58
|
color: "#2b5797",
|
|
59
|
+
title: "SSH Key Pair",
|
|
60
|
+
icon: "charm:key",
|
|
61
|
+
iconColor: "#ffffff",
|
|
62
|
+
secondaryIcon: "mdi:lock",
|
|
63
|
+
secondaryIconColor: "#ffffff",
|
|
58
64
|
},
|
|
59
65
|
})
|
|
60
66
|
|
|
61
67
|
/**
|
|
62
|
-
* The schema for the SSH connection
|
|
63
|
-
*
|
|
64
|
-
* Contains enough information to connect to an SSH server.
|
|
68
|
+
* The schema for the SSH connection credentials.
|
|
65
69
|
*/
|
|
66
|
-
export const
|
|
67
|
-
|
|
68
|
-
* The list of L4 endpoints which can be used to connect to the SSH server.
|
|
69
|
-
*/
|
|
70
|
-
endpoints: l4EndpointEntity.schema.array(),
|
|
70
|
+
export const connectionEntity = defineEntity({
|
|
71
|
+
type: "ssh.connection.v1",
|
|
71
72
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
includes: {
|
|
74
|
+
/**
|
|
75
|
+
* The endpoints to connect to.
|
|
76
|
+
*/
|
|
77
|
+
endpoints: {
|
|
78
|
+
entity: l4EndpointEntity,
|
|
79
|
+
multiple: true,
|
|
80
|
+
},
|
|
76
81
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
82
|
+
/**
|
|
83
|
+
* The SSH key pair to use for authentication.
|
|
84
|
+
*/
|
|
85
|
+
keyPair: {
|
|
86
|
+
entity: keyPairEntity,
|
|
87
|
+
required: false,
|
|
88
|
+
},
|
|
89
|
+
},
|
|
81
90
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
91
|
+
schema: z.object({
|
|
92
|
+
/**
|
|
93
|
+
* The host key of the SSH server which will be used to verify the server's identity.
|
|
94
|
+
*/
|
|
95
|
+
hostKey: z.string(),
|
|
86
96
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
97
|
+
/**
|
|
98
|
+
* The user to connect as.
|
|
99
|
+
*/
|
|
100
|
+
user: z.string(),
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* The password to use for authentication.
|
|
104
|
+
*/
|
|
105
|
+
password: secretSchema(z.string()).optional(),
|
|
106
|
+
}),
|
|
107
|
+
|
|
108
|
+
meta: {
|
|
109
|
+
color: "#2b5797",
|
|
110
|
+
title: "SSH Connection",
|
|
111
|
+
icon: "mdi:terminal",
|
|
112
|
+
iconColor: "#2b5797",
|
|
113
|
+
},
|
|
91
114
|
})
|
|
92
115
|
|
|
93
116
|
export const argsSchema = z.object({
|
|
@@ -196,7 +219,6 @@ export const keyPair = defineUnit({
|
|
|
196
219
|
|
|
197
220
|
outputs: {
|
|
198
221
|
keyPair: keyPairEntity,
|
|
199
|
-
publicKeyFile: fileEntity,
|
|
200
222
|
},
|
|
201
223
|
|
|
202
224
|
meta: {
|
|
@@ -216,9 +238,9 @@ export const keyPair = defineUnit({
|
|
|
216
238
|
|
|
217
239
|
export type Args = z.infer<typeof argsSchema>
|
|
218
240
|
export type KeyType = z.infer<typeof keyTypeSchema>
|
|
219
|
-
export type PublicKey =
|
|
220
|
-
export type KeyPair =
|
|
221
|
-
export type Connection =
|
|
241
|
+
export type PublicKey = EntityValue<typeof publicKeyEntity>
|
|
242
|
+
export type KeyPair = EntityValue<typeof keyPairEntity>
|
|
243
|
+
export type Connection = EntityValue<typeof connectionEntity>
|
|
222
244
|
|
|
223
245
|
export type PublicKeyInput = EntityInput<typeof publicKeyEntity>
|
|
224
246
|
export type KeyPairInput = EntityInput<typeof keyPairEntity>
|
package/src/talos.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
defineEntity,
|
|
3
|
+
defineUnit,
|
|
4
|
+
type EntityInput,
|
|
5
|
+
type EntityValue,
|
|
6
|
+
z,
|
|
7
|
+
} from "@highstate/contract"
|
|
2
8
|
import { clusterInputs, clusterOutputs, scheduleOnMastersPolicyArgs } from "./k8s/shared"
|
|
3
9
|
|
|
4
10
|
export const clusterEntity = defineEntity({
|
|
@@ -103,5 +109,5 @@ export const cluster = defineUnit({
|
|
|
103
109
|
},
|
|
104
110
|
})
|
|
105
111
|
|
|
106
|
-
export type Cluster =
|
|
112
|
+
export type Cluster = EntityValue<typeof clusterEntity>
|
|
107
113
|
export type ClusterInput = EntityInput<typeof clusterEntity>
|