@intentius/chant-lexicon-k3d 0.0.1

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 (109) hide show
  1. package/README.md +26 -0
  2. package/dist/codegen/docs.d.ts +7 -0
  3. package/dist/codegen/docs.d.ts.map +1 -0
  4. package/dist/codegen/generate-cli.d.ts +6 -0
  5. package/dist/codegen/generate-cli.d.ts.map +1 -0
  6. package/dist/codegen/generate-lexicon.d.ts +19 -0
  7. package/dist/codegen/generate-lexicon.d.ts.map +1 -0
  8. package/dist/codegen/generate-typescript.d.ts +11 -0
  9. package/dist/codegen/generate-typescript.d.ts.map +1 -0
  10. package/dist/codegen/generate.d.ts +15 -0
  11. package/dist/codegen/generate.d.ts.map +1 -0
  12. package/dist/codegen/naming.d.ts +13 -0
  13. package/dist/codegen/naming.d.ts.map +1 -0
  14. package/dist/codegen/package.d.ts +17 -0
  15. package/dist/codegen/package.d.ts.map +1 -0
  16. package/dist/codegen/parse.d.ts +57 -0
  17. package/dist/codegen/parse.d.ts.map +1 -0
  18. package/dist/describe-resources.d.ts +34 -0
  19. package/dist/describe-resources.d.ts.map +1 -0
  20. package/dist/generated/index.d.ts +22 -0
  21. package/dist/generated/index.d.ts.map +1 -0
  22. package/dist/generated/runtime.d.ts +5 -0
  23. package/dist/generated/runtime.d.ts.map +1 -0
  24. package/dist/index.d.ts +4 -0
  25. package/dist/index.d.ts.map +1 -0
  26. package/dist/integrity.json +9 -0
  27. package/dist/lint/audit-catalog.d.ts +9 -0
  28. package/dist/lint/audit-catalog.d.ts.map +1 -0
  29. package/dist/lint/post-synth/index.d.ts +3 -0
  30. package/dist/lint/post-synth/index.d.ts.map +1 -0
  31. package/dist/lint/post-synth/k3d101.d.ts +19 -0
  32. package/dist/lint/post-synth/k3d101.d.ts.map +1 -0
  33. package/dist/lint/post-synth/k3d102.d.ts +12 -0
  34. package/dist/lint/post-synth/k3d102.d.ts.map +1 -0
  35. package/dist/lint/rules/index.d.ts +5 -0
  36. package/dist/lint/rules/index.d.ts.map +1 -0
  37. package/dist/lint/rules/registry-proxy-password.d.ts +17 -0
  38. package/dist/lint/rules/registry-proxy-password.d.ts.map +1 -0
  39. package/dist/lint/rules/sample.d.ts +8 -0
  40. package/dist/lint/rules/sample.d.ts.map +1 -0
  41. package/dist/lsp/completions.d.ts +7 -0
  42. package/dist/lsp/completions.d.ts.map +1 -0
  43. package/dist/lsp/hover.d.ts +6 -0
  44. package/dist/lsp/hover.d.ts.map +1 -0
  45. package/dist/manifest.json +6 -0
  46. package/dist/meta.json +184 -0
  47. package/dist/op/activities/index.d.ts +17 -0
  48. package/dist/op/activities/index.d.ts.map +1 -0
  49. package/dist/op/activities/k3d.d.ts +93 -0
  50. package/dist/op/activities/k3d.d.ts.map +1 -0
  51. package/dist/package-cli.d.ts +3 -0
  52. package/dist/package-cli.d.ts.map +1 -0
  53. package/dist/plugin.d.ts +8 -0
  54. package/dist/plugin.d.ts.map +1 -0
  55. package/dist/serializer.d.ts +35 -0
  56. package/dist/serializer.d.ts.map +1 -0
  57. package/dist/spec/fetch.d.ts +39 -0
  58. package/dist/spec/fetch.d.ts.map +1 -0
  59. package/dist/testdata/load-fixtures.d.ts +16 -0
  60. package/dist/testdata/load-fixtures.d.ts.map +1 -0
  61. package/dist/types/index.d.ts +189 -0
  62. package/dist/validate-cli.d.ts +3 -0
  63. package/dist/validate-cli.d.ts.map +1 -0
  64. package/dist/validate.d.ts +15 -0
  65. package/dist/validate.d.ts.map +1 -0
  66. package/package.json +58 -0
  67. package/src/codegen/docs.ts +25 -0
  68. package/src/codegen/generate-cli.ts +36 -0
  69. package/src/codegen/generate-lexicon.ts +58 -0
  70. package/src/codegen/generate-typescript.ts +102 -0
  71. package/src/codegen/generate.test.ts +154 -0
  72. package/src/codegen/generate.ts +139 -0
  73. package/src/codegen/naming.ts +56 -0
  74. package/src/codegen/package.ts +27 -0
  75. package/src/codegen/parse.ts +359 -0
  76. package/src/describe-resources.test.ts +142 -0
  77. package/src/describe-resources.ts +144 -0
  78. package/src/generated/.gitkeep +0 -0
  79. package/src/generated/index.d.ts +189 -0
  80. package/src/generated/index.ts +27 -0
  81. package/src/generated/lexicon-k3d.json +184 -0
  82. package/src/generated/runtime.ts +4 -0
  83. package/src/index.ts +8 -0
  84. package/src/lint/audit-catalog.ts +26 -0
  85. package/src/lint/post-synth/index.ts +9 -0
  86. package/src/lint/post-synth/k3d101.ts +87 -0
  87. package/src/lint/post-synth/k3d102.ts +40 -0
  88. package/src/lint/post-synth/post-synth.test.ts +76 -0
  89. package/src/lint/rules/index.ts +7 -0
  90. package/src/lint/rules/registry-proxy-password.test.ts +53 -0
  91. package/src/lint/rules/registry-proxy-password.ts +93 -0
  92. package/src/lsp/completions.test.ts +10 -0
  93. package/src/lsp/completions.ts +21 -0
  94. package/src/lsp/hover.test.ts +10 -0
  95. package/src/lsp/hover.ts +39 -0
  96. package/src/op/activities/index.ts +24 -0
  97. package/src/op/activities/k3d.test.ts +168 -0
  98. package/src/op/activities/k3d.ts +183 -0
  99. package/src/package-cli.ts +41 -0
  100. package/src/plugin.test.ts +17 -0
  101. package/src/plugin.ts +114 -0
  102. package/src/serializer.acceptance.test.ts +94 -0
  103. package/src/serializer.test.ts +189 -0
  104. package/src/serializer.ts +202 -0
  105. package/src/spec/fetch.ts +66 -0
  106. package/src/testdata/k3d-schema-fixture.json +431 -0
  107. package/src/testdata/load-fixtures.ts +27 -0
  108. package/src/validate-cli.ts +5 -0
  109. package/src/validate.ts +28 -0
@@ -0,0 +1,431 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "title": "SimpleConfig",
4
+ "type": "object",
5
+ "required": [
6
+ "apiVersion",
7
+ "kind"
8
+ ],
9
+ "properties": {
10
+ "apiVersion": {
11
+ "type": "string",
12
+ "enum": [
13
+ "k3d.io/v1alpha5"
14
+ ],
15
+ "default": "k3d.io/v1alpha5"
16
+ },
17
+ "kind": {
18
+ "type": "string",
19
+ "enum": [
20
+ "Simple"
21
+ ],
22
+ "default": "Simple"
23
+ },
24
+ "metadata": {
25
+ "type": "object",
26
+ "properties": {
27
+ "name": {
28
+ "description": "Name of the cluster (must be a valid hostname and will be prefixed with 'k3d-'). Example: 'mycluster'.",
29
+ "type": "string",
30
+ "format": "hostname"
31
+ }
32
+ },
33
+ "additionalProperties": false
34
+ },
35
+ "servers": {
36
+ "type": "number",
37
+ "minimum": 1
38
+ },
39
+ "agents": {
40
+ "type": "number",
41
+ "minimum": 0
42
+ },
43
+ "kubeAPI": {
44
+ "type": "object",
45
+ "properties": {
46
+ "host": {
47
+ "type": "string",
48
+ "format": "hostname"
49
+ },
50
+ "hostIP": {
51
+ "type": "string",
52
+ "format": "ipv4",
53
+ "examples": [
54
+ "0.0.0.0",
55
+ "192.168.178.55"
56
+ ]
57
+ },
58
+ "hostPort": {
59
+ "type": "string",
60
+ "examples": [
61
+ "6443"
62
+ ]
63
+ }
64
+ },
65
+ "additionalProperties": false
66
+ },
67
+ "image": {
68
+ "type": "string",
69
+ "examples": [
70
+ "rancher/k3s:latest"
71
+ ]
72
+ },
73
+ "network": {
74
+ "type": "string"
75
+ },
76
+ "subnet": {
77
+ "type": "string",
78
+ "default": "auto",
79
+ "examples": [
80
+ "172.28.0.0/16",
81
+ "192.162.0.0/16"
82
+ ]
83
+ },
84
+ "token": {
85
+ "type": "string"
86
+ },
87
+ "volumes": {
88
+ "type": "array",
89
+ "items": {
90
+ "type": "object",
91
+ "properties": {
92
+ "volume": {
93
+ "type": "string"
94
+ },
95
+ "nodeFilters": {
96
+ "$ref": "#/definitions/nodeFilters"
97
+ }
98
+ },
99
+ "additionalProperties": false
100
+ }
101
+ },
102
+ "ports": {
103
+ "type": "array",
104
+ "items": {
105
+ "type": "object",
106
+ "properties": {
107
+ "port": {
108
+ "type": "string"
109
+ },
110
+ "nodeFilters": {
111
+ "$ref": "#/definitions/nodeFilters"
112
+ }
113
+ },
114
+ "additionalProperties": false
115
+ }
116
+ },
117
+ "files": {
118
+ "type": "array",
119
+ "items": {
120
+ "type": "object",
121
+ "required": ["source", "destination"],
122
+ "properties": {
123
+ "source": {
124
+ "type": "string"
125
+ },
126
+ "destination": {
127
+ "type": "string"
128
+ },
129
+ "description": {
130
+ "type": "string"
131
+ },
132
+ "nodeFilters": {
133
+ "$ref": "#/definitions/nodeFilters"
134
+ }
135
+ },
136
+ "additionalProperties": false
137
+ }
138
+ },
139
+ "options": {
140
+ "type": "object",
141
+ "properties": {
142
+ "k3d": {
143
+ "type": "object",
144
+ "properties": {
145
+ "wait": {
146
+ "type": "boolean",
147
+ "default": true
148
+ },
149
+ "timeout": {
150
+ "examples": [
151
+ "60s",
152
+ "1m",
153
+ "1m30s"
154
+ ]
155
+ },
156
+ "disableLoadbalancer": {
157
+ "type": "boolean",
158
+ "default": false
159
+ },
160
+ "disableImageVolume": {
161
+ "type": "boolean",
162
+ "default": false
163
+ },
164
+ "disableRollback": {
165
+ "type": "boolean",
166
+ "default": false
167
+ },
168
+ "loadbalancer": {
169
+ "type": "object",
170
+ "properties": {
171
+ "configOverrides": {
172
+ "type": "array",
173
+ "examples": [
174
+ "settings.workerConnections=2048",
175
+ "settings.defaultProxyTimeout=900"
176
+ ]
177
+ }
178
+ },
179
+ "additionalProperties": false
180
+ }
181
+ },
182
+ "additionalProperties": false
183
+ },
184
+ "k3s": {
185
+ "type": "object",
186
+ "properties": {
187
+ "extraArgs": {
188
+ "type": "array",
189
+ "items": {
190
+ "type": "object",
191
+ "properties": {
192
+ "arg": {
193
+ "type": "string",
194
+ "examples": [
195
+ "--tls-san=127.0.0.1",
196
+ "--disable=traefik"
197
+ ]
198
+ },
199
+ "nodeFilters": {
200
+ "$ref": "#/definitions/nodeFilters"
201
+ }
202
+ },
203
+ "additionalProperties": false
204
+ }
205
+ },
206
+ "nodeLabels": {
207
+ "type": "array",
208
+ "items": {
209
+ "type": "object",
210
+ "properties": {
211
+ "label": {
212
+ "type": "string"
213
+ },
214
+ "nodeFilters": {
215
+ "$ref": "#/definitions/nodeFilters"
216
+ }
217
+ },
218
+ "additionalProperties": false
219
+ }
220
+ }
221
+ },
222
+ "additionalProperties": false
223
+ },
224
+ "kubeconfig": {
225
+ "type": "object",
226
+ "properties": {
227
+ "updateDefaultKubeconfig": {
228
+ "type": "boolean",
229
+ "default": true
230
+ },
231
+ "switchCurrentContext": {
232
+ "type": "boolean",
233
+ "default": true
234
+ }
235
+ },
236
+ "additionalProperties": false
237
+ },
238
+ "runtime": {
239
+ "type": "object",
240
+ "properties": {
241
+ "gpuRequest": {
242
+ "type": "string"
243
+ },
244
+ "serversMemory": {
245
+ "type": "string"
246
+ },
247
+ "agentsMemory": {
248
+ "type": "string"
249
+ },
250
+ "hostPidMode": {
251
+ "type": "boolean",
252
+ "default": false
253
+ },
254
+ "labels": {
255
+ "type": "array",
256
+ "items": {
257
+ "type": "object",
258
+ "properties": {
259
+ "label": {
260
+ "type": "string"
261
+ },
262
+ "nodeFilters": {
263
+ "$ref": "#/definitions/nodeFilters"
264
+ }
265
+ },
266
+ "additionalProperties": false
267
+ }
268
+ },
269
+ "ulimits": {
270
+ "type": "array",
271
+ "items": {
272
+ "type": "object",
273
+ "properties": {
274
+ "name": {
275
+ "type": "string"
276
+ },
277
+ "soft": {
278
+ "type": "number"
279
+ },
280
+ "hard": {
281
+ "type": "number"
282
+ }
283
+ },
284
+ "additionalProperties": false
285
+ }
286
+ }
287
+ }
288
+ }
289
+ },
290
+ "additionalProperties": false
291
+ },
292
+ "env": {
293
+ "type": "array",
294
+ "items": {
295
+ "type": "object",
296
+ "properties": {
297
+ "envVar": {
298
+ "type": "string"
299
+ },
300
+ "nodeFilters": {
301
+ "$ref": "#/definitions/nodeFilters"
302
+ }
303
+ },
304
+ "additionalProperties": false
305
+ }
306
+ },
307
+ "registries": {
308
+ "type": "object",
309
+ "properties": {
310
+ "create": {
311
+ "type": "object",
312
+ "description": "Create a new container image registry alongside the cluster.",
313
+ "properties": {
314
+ "name": {
315
+ "type": "string",
316
+ "examples": [
317
+ "myregistry",
318
+ "registry.localhost"
319
+ ]
320
+ },
321
+ "host": {
322
+ "type": "string",
323
+ "examples": [
324
+ "0.0.0.0",
325
+ "localhost",
326
+ "127.0.0.1"
327
+ ],
328
+ "default": "0.0.0.0"
329
+ },
330
+ "hostPort": {
331
+ "type": "string",
332
+ "examples": [
333
+ "5000",
334
+ "2345"
335
+ ],
336
+ "default": "random"
337
+ },
338
+ "image": {
339
+ "type": "string",
340
+ "examples": [
341
+ "myregistry/registry:2"
342
+ ],
343
+ "default": "docker.io/library/registry:2"
344
+ },
345
+ "proxy": {
346
+ "type": "object",
347
+ "properties": {
348
+ "remoteURL": {
349
+ "type": "string",
350
+ "examples": [
351
+ "https://registry-1.docker.io"
352
+ ]
353
+ },
354
+ "username": {
355
+ "type": "string"
356
+ },
357
+ "password": {
358
+ "type": "string"
359
+ }
360
+ },
361
+ "additionalProperties": false
362
+ },
363
+ "volumes": {
364
+ "type": "array",
365
+ "items": {
366
+ "type": "string"
367
+ },
368
+ "examples": [
369
+ "/tmp/registry:/var/lib/registry"
370
+ ]
371
+ },
372
+ "enforcePortMatch": {
373
+ "type": "boolean",
374
+ "default": false
375
+ }
376
+ },
377
+ "additionalProperties": false
378
+ },
379
+ "use": {
380
+ "type": "array",
381
+ "description": "Connect another container image registry to the cluster.",
382
+ "items": {
383
+ "type": "string"
384
+ },
385
+ "examples": [
386
+ "otherregistry:5000"
387
+ ]
388
+ },
389
+ "config": {
390
+ "type": "string",
391
+ "description": "Reference a K3s registry configuration file or at it's contents here."
392
+ },
393
+ "additionalProperties": false
394
+ }
395
+ },
396
+ "hostAliases": {
397
+ "type": "array",
398
+ "description": "Additional IP to multiple hostnames mappings",
399
+ "items": {
400
+ "type": "object",
401
+ "properties": {
402
+ "ip": {
403
+ "type": "string"
404
+ },
405
+ "hostnames": {
406
+ "type": "array",
407
+ "items": {
408
+ "type": "string"
409
+ }
410
+ }
411
+ }
412
+ }
413
+ }
414
+ },
415
+ "additionalProperties": false,
416
+ "definitions": {
417
+ "nodeFilters": {
418
+ "type": "array",
419
+ "items": {
420
+ "type": "string"
421
+ },
422
+ "examples": [
423
+ "loadbalancer",
424
+ "server:*",
425
+ "server:0",
426
+ "agent:1",
427
+ "all"
428
+ ]
429
+ }
430
+ }
431
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Test fixture loader for the k3d lexicon.
3
+ *
4
+ * The fixture is a verbatim copy of the pinned upstream schema
5
+ * (see src/spec/fetch.ts for the pin), committed so codegen tests
6
+ * run offline.
7
+ */
8
+
9
+ import { readFileSync } from "fs";
10
+ import { join } from "path";
11
+
12
+ /**
13
+ * Load the pinned SimpleConfig schema fixture for offline testing.
14
+ */
15
+ export function loadSchemaFixture(): Buffer {
16
+ const fixturePath = join(import.meta.dirname, "k3d-schema-fixture.json");
17
+ return Buffer.from(readFileSync(fixturePath));
18
+ }
19
+
20
+ /**
21
+ * Load the schema fixture as a Map compatible with generatePipeline.
22
+ */
23
+ export function loadSchemaFixtureMap(): Map<string, Buffer> {
24
+ const schemas = new Map<string, Buffer>();
25
+ schemas.set("K3d::Cluster", loadSchemaFixture());
26
+ return schemas;
27
+ }
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env tsx
2
+ import { validate } from "./validate";
3
+
4
+ // `validate` takes an optional { basePath }; defaults to the lexicon root.
5
+ await validate();
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Validate generated lexicon-k3d artifacts.
3
+ *
4
+ * Thin wrapper around the core validation framework
5
+ * with k3d-specific configuration.
6
+ */
7
+
8
+ import { dirname } from "path";
9
+ import { fileURLToPath } from "url";
10
+ import { validateLexiconArtifacts, type ValidateResult } from "@intentius/chant/codegen/validate";
11
+
12
+ export type { ValidateCheck, ValidateResult } from "@intentius/chant/codegen/validate";
13
+
14
+ // TODO: Add names of required entities for your lexicon
15
+ const REQUIRED_NAMES: string[] = [];
16
+
17
+ /**
18
+ * Validate the generated lexicon-k3d artifacts.
19
+ */
20
+ export async function validate(opts?: { basePath?: string }): Promise<ValidateResult> {
21
+ const basePath = opts?.basePath ?? dirname(dirname(fileURLToPath(import.meta.url)));
22
+
23
+ return validateLexiconArtifacts({
24
+ lexiconJsonFilename: "lexicon-k3d.json",
25
+ requiredNames: REQUIRED_NAMES,
26
+ basePath,
27
+ });
28
+ }