kustodian 1.0.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.
Files changed (351) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +346 -0
  3. package/dist/cli/bin.d.ts +3 -0
  4. package/dist/cli/bin.d.ts.map +1 -0
  5. package/dist/cli/bin.js +67 -0
  6. package/dist/cli/bin.js.map +1 -0
  7. package/dist/cli/command.d.ts +57 -0
  8. package/dist/cli/command.d.ts.map +1 -0
  9. package/dist/cli/command.js +26 -0
  10. package/dist/cli/command.js.map +1 -0
  11. package/dist/cli/commands/apply.d.ts +8 -0
  12. package/dist/cli/commands/apply.d.ts.map +1 -0
  13. package/dist/cli/commands/apply.js +802 -0
  14. package/dist/cli/commands/apply.js.map +1 -0
  15. package/dist/cli/commands/init.d.ts +5 -0
  16. package/dist/cli/commands/init.d.ts.map +1 -0
  17. package/dist/cli/commands/init.js +403 -0
  18. package/dist/cli/commands/init.js.map +1 -0
  19. package/dist/cli/commands/sources.d.ts +5 -0
  20. package/dist/cli/commands/sources.d.ts.map +1 -0
  21. package/dist/cli/commands/sources.js +377 -0
  22. package/dist/cli/commands/sources.js.map +1 -0
  23. package/dist/cli/commands/update.d.ts +5 -0
  24. package/dist/cli/commands/update.d.ts.map +1 -0
  25. package/dist/cli/commands/update.js +314 -0
  26. package/dist/cli/commands/update.js.map +1 -0
  27. package/dist/cli/commands/validate.d.ts +5 -0
  28. package/dist/cli/commands/validate.d.ts.map +1 -0
  29. package/dist/cli/commands/validate.js +126 -0
  30. package/dist/cli/commands/validate.js.map +1 -0
  31. package/dist/cli/container.d.ts +48 -0
  32. package/dist/cli/container.d.ts.map +1 -0
  33. package/dist/cli/container.js +49 -0
  34. package/dist/cli/container.js.map +1 -0
  35. package/dist/cli/index.d.ts +8 -0
  36. package/dist/cli/index.d.ts.map +1 -0
  37. package/dist/cli/index.js +9 -0
  38. package/dist/cli/index.js.map +1 -0
  39. package/dist/cli/middleware.d.ts +118 -0
  40. package/dist/cli/middleware.d.ts.map +1 -0
  41. package/dist/cli/middleware.js +280 -0
  42. package/dist/cli/middleware.js.map +1 -0
  43. package/dist/cli/runner.d.ts +34 -0
  44. package/dist/cli/runner.d.ts.map +1 -0
  45. package/dist/cli/runner.js +156 -0
  46. package/dist/cli/runner.js.map +1 -0
  47. package/dist/cli/utils/defaults.d.ts +23 -0
  48. package/dist/cli/utils/defaults.d.ts.map +1 -0
  49. package/dist/cli/utils/defaults.js +43 -0
  50. package/dist/cli/utils/defaults.js.map +1 -0
  51. package/dist/core/error.d.ts +117 -0
  52. package/dist/core/error.d.ts.map +1 -0
  53. package/dist/core/error.js +210 -0
  54. package/dist/core/error.js.map +1 -0
  55. package/dist/core/index.d.ts +6 -0
  56. package/dist/core/index.d.ts.map +1 -0
  57. package/dist/core/index.js +6 -0
  58. package/dist/core/index.js.map +1 -0
  59. package/dist/core/logger.d.ts +31 -0
  60. package/dist/core/logger.d.ts.map +1 -0
  61. package/dist/core/logger.js +78 -0
  62. package/dist/core/logger.js.map +1 -0
  63. package/dist/core/path.d.ts +57 -0
  64. package/dist/core/path.d.ts.map +1 -0
  65. package/dist/core/path.js +154 -0
  66. package/dist/core/path.js.map +1 -0
  67. package/dist/core/result.d.ts +80 -0
  68. package/dist/core/result.d.ts.map +1 -0
  69. package/dist/core/result.js +150 -0
  70. package/dist/core/result.js.map +1 -0
  71. package/dist/core/types.d.ts +80 -0
  72. package/dist/core/types.d.ts.map +1 -0
  73. package/dist/core/types.js +5 -0
  74. package/dist/core/types.js.map +1 -0
  75. package/dist/generator/external-substitutions.d.ts +21 -0
  76. package/dist/generator/external-substitutions.d.ts.map +1 -0
  77. package/dist/generator/external-substitutions.js +49 -0
  78. package/dist/generator/external-substitutions.js.map +1 -0
  79. package/dist/generator/flux.d.ts +61 -0
  80. package/dist/generator/flux.d.ts.map +1 -0
  81. package/dist/generator/flux.js +294 -0
  82. package/dist/generator/flux.js.map +1 -0
  83. package/dist/generator/generator.d.ts +77 -0
  84. package/dist/generator/generator.d.ts.map +1 -0
  85. package/dist/generator/generator.js +183 -0
  86. package/dist/generator/generator.js.map +1 -0
  87. package/dist/generator/index.d.ts +9 -0
  88. package/dist/generator/index.d.ts.map +1 -0
  89. package/dist/generator/index.js +9 -0
  90. package/dist/generator/index.js.map +1 -0
  91. package/dist/generator/kustomization-resolution.d.ts +40 -0
  92. package/dist/generator/kustomization-resolution.d.ts.map +1 -0
  93. package/dist/generator/kustomization-resolution.js +59 -0
  94. package/dist/generator/kustomization-resolution.js.map +1 -0
  95. package/dist/generator/namespace.d.ts +74 -0
  96. package/dist/generator/namespace.d.ts.map +1 -0
  97. package/dist/generator/namespace.js +109 -0
  98. package/dist/generator/namespace.js.map +1 -0
  99. package/dist/generator/output.d.ts +56 -0
  100. package/dist/generator/output.d.ts.map +1 -0
  101. package/dist/generator/output.js +171 -0
  102. package/dist/generator/output.js.map +1 -0
  103. package/dist/generator/preservation.d.ts +45 -0
  104. package/dist/generator/preservation.d.ts.map +1 -0
  105. package/dist/generator/preservation.js +71 -0
  106. package/dist/generator/preservation.js.map +1 -0
  107. package/dist/generator/substitution.d.ts +79 -0
  108. package/dist/generator/substitution.d.ts.map +1 -0
  109. package/dist/generator/substitution.js +210 -0
  110. package/dist/generator/substitution.js.map +1 -0
  111. package/dist/generator/types.d.ts +162 -0
  112. package/dist/generator/types.d.ts.map +1 -0
  113. package/dist/generator/types.js +2 -0
  114. package/dist/generator/types.js.map +1 -0
  115. package/dist/generator/validation/cycle-detection.d.ts +25 -0
  116. package/dist/generator/validation/cycle-detection.d.ts.map +1 -0
  117. package/dist/generator/validation/cycle-detection.js +101 -0
  118. package/dist/generator/validation/cycle-detection.js.map +1 -0
  119. package/dist/generator/validation/enablement.d.ts +24 -0
  120. package/dist/generator/validation/enablement.d.ts.map +1 -0
  121. package/dist/generator/validation/enablement.js +69 -0
  122. package/dist/generator/validation/enablement.js.map +1 -0
  123. package/dist/generator/validation/graph.d.ts +29 -0
  124. package/dist/generator/validation/graph.d.ts.map +1 -0
  125. package/dist/generator/validation/graph.js +106 -0
  126. package/dist/generator/validation/graph.js.map +1 -0
  127. package/dist/generator/validation/index.d.ts +38 -0
  128. package/dist/generator/validation/index.d.ts.map +1 -0
  129. package/dist/generator/validation/index.js +64 -0
  130. package/dist/generator/validation/index.js.map +1 -0
  131. package/dist/generator/validation/reference.d.ts +45 -0
  132. package/dist/generator/validation/reference.d.ts.map +1 -0
  133. package/dist/generator/validation/reference.js +143 -0
  134. package/dist/generator/validation/reference.js.map +1 -0
  135. package/dist/generator/validation/requirements.d.ts +25 -0
  136. package/dist/generator/validation/requirements.d.ts.map +1 -0
  137. package/dist/generator/validation/requirements.js +64 -0
  138. package/dist/generator/validation/requirements.js.map +1 -0
  139. package/dist/generator/validation/types.d.ts +116 -0
  140. package/dist/generator/validation/types.d.ts.map +1 -0
  141. package/dist/generator/validation/types.js +13 -0
  142. package/dist/generator/validation/types.js.map +1 -0
  143. package/dist/k8s/exec.d.ts +20 -0
  144. package/dist/k8s/exec.d.ts.map +1 -0
  145. package/dist/k8s/exec.js +47 -0
  146. package/dist/k8s/exec.js.map +1 -0
  147. package/dist/k8s/flux.d.ts +57 -0
  148. package/dist/k8s/flux.d.ts.map +1 -0
  149. package/dist/k8s/flux.js +202 -0
  150. package/dist/k8s/flux.js.map +1 -0
  151. package/dist/k8s/index.d.ts +6 -0
  152. package/dist/k8s/index.d.ts.map +1 -0
  153. package/dist/k8s/index.js +6 -0
  154. package/dist/k8s/index.js.map +1 -0
  155. package/dist/k8s/kubeconfig.d.ts +45 -0
  156. package/dist/k8s/kubeconfig.d.ts.map +1 -0
  157. package/dist/k8s/kubeconfig.js +152 -0
  158. package/dist/k8s/kubeconfig.js.map +1 -0
  159. package/dist/k8s/kubectl.d.ts +68 -0
  160. package/dist/k8s/kubectl.d.ts.map +1 -0
  161. package/dist/k8s/kubectl.js +187 -0
  162. package/dist/k8s/kubectl.js.map +1 -0
  163. package/dist/k8s/types.d.ts +65 -0
  164. package/dist/k8s/types.d.ts.map +1 -0
  165. package/dist/k8s/types.js +2 -0
  166. package/dist/k8s/types.js.map +1 -0
  167. package/dist/loader/file.d.ts +39 -0
  168. package/dist/loader/file.d.ts.map +1 -0
  169. package/dist/loader/file.js +121 -0
  170. package/dist/loader/file.js.map +1 -0
  171. package/dist/loader/index.d.ts +5 -0
  172. package/dist/loader/index.d.ts.map +1 -0
  173. package/dist/loader/index.js +5 -0
  174. package/dist/loader/index.js.map +1 -0
  175. package/dist/loader/profile.d.ts +23 -0
  176. package/dist/loader/profile.d.ts.map +1 -0
  177. package/dist/loader/profile.js +84 -0
  178. package/dist/loader/profile.js.map +1 -0
  179. package/dist/loader/project.d.ts +76 -0
  180. package/dist/loader/project.d.ts.map +1 -0
  181. package/dist/loader/project.js +279 -0
  182. package/dist/loader/project.js.map +1 -0
  183. package/dist/loader/yaml.d.ts +15 -0
  184. package/dist/loader/yaml.d.ts.map +1 -0
  185. package/dist/loader/yaml.js +44 -0
  186. package/dist/loader/yaml.js.map +1 -0
  187. package/dist/nodes/index.d.ts +5 -0
  188. package/dist/nodes/index.d.ts.map +1 -0
  189. package/dist/nodes/index.js +5 -0
  190. package/dist/nodes/index.js.map +1 -0
  191. package/dist/nodes/kubectl-labeler.d.ts +7 -0
  192. package/dist/nodes/kubectl-labeler.d.ts.map +1 -0
  193. package/dist/nodes/kubectl-labeler.js +89 -0
  194. package/dist/nodes/kubectl-labeler.js.map +1 -0
  195. package/dist/nodes/labeler.d.ts +74 -0
  196. package/dist/nodes/labeler.d.ts.map +1 -0
  197. package/dist/nodes/labeler.js +118 -0
  198. package/dist/nodes/labeler.js.map +1 -0
  199. package/dist/nodes/profile.d.ts +58 -0
  200. package/dist/nodes/profile.d.ts.map +1 -0
  201. package/dist/nodes/profile.js +128 -0
  202. package/dist/nodes/profile.js.map +1 -0
  203. package/dist/nodes/types.d.ts +84 -0
  204. package/dist/nodes/types.d.ts.map +1 -0
  205. package/dist/nodes/types.js +77 -0
  206. package/dist/nodes/types.js.map +1 -0
  207. package/dist/plugins/generators.d.ts +49 -0
  208. package/dist/plugins/generators.d.ts.map +1 -0
  209. package/dist/plugins/generators.js +7 -0
  210. package/dist/plugins/generators.js.map +1 -0
  211. package/dist/plugins/hooks.d.ts +120 -0
  212. package/dist/plugins/hooks.d.ts.map +1 -0
  213. package/dist/plugins/hooks.js +41 -0
  214. package/dist/plugins/hooks.js.map +1 -0
  215. package/dist/plugins/index.d.ts +8 -0
  216. package/dist/plugins/index.d.ts.map +1 -0
  217. package/dist/plugins/index.js +15 -0
  218. package/dist/plugins/index.js.map +1 -0
  219. package/dist/plugins/loader.d.ts +40 -0
  220. package/dist/plugins/loader.d.ts.map +1 -0
  221. package/dist/plugins/loader.js +236 -0
  222. package/dist/plugins/loader.js.map +1 -0
  223. package/dist/plugins/object-types.d.ts +71 -0
  224. package/dist/plugins/object-types.d.ts.map +1 -0
  225. package/dist/plugins/object-types.js +65 -0
  226. package/dist/plugins/object-types.js.map +1 -0
  227. package/dist/plugins/registry.d.ts +87 -0
  228. package/dist/plugins/registry.d.ts.map +1 -0
  229. package/dist/plugins/registry.js +158 -0
  230. package/dist/plugins/registry.js.map +1 -0
  231. package/dist/plugins/substitution-providers.d.ts +48 -0
  232. package/dist/plugins/substitution-providers.d.ts.map +1 -0
  233. package/dist/plugins/substitution-providers.js +2 -0
  234. package/dist/plugins/substitution-providers.js.map +1 -0
  235. package/dist/plugins/types.d.ts +288 -0
  236. package/dist/plugins/types.d.ts.map +1 -0
  237. package/dist/plugins/types.js +25 -0
  238. package/dist/plugins/types.js.map +1 -0
  239. package/dist/registry/auth.d.ts +14 -0
  240. package/dist/registry/auth.d.ts.map +1 -0
  241. package/dist/registry/auth.js +40 -0
  242. package/dist/registry/auth.js.map +1 -0
  243. package/dist/registry/client.d.ts +24 -0
  244. package/dist/registry/client.d.ts.map +1 -0
  245. package/dist/registry/client.js +85 -0
  246. package/dist/registry/client.js.map +1 -0
  247. package/dist/registry/dockerhub.d.ts +6 -0
  248. package/dist/registry/dockerhub.d.ts.map +1 -0
  249. package/dist/registry/dockerhub.js +91 -0
  250. package/dist/registry/dockerhub.js.map +1 -0
  251. package/dist/registry/ghcr.d.ts +6 -0
  252. package/dist/registry/ghcr.d.ts.map +1 -0
  253. package/dist/registry/ghcr.js +95 -0
  254. package/dist/registry/ghcr.js.map +1 -0
  255. package/dist/registry/helm.d.ts +11 -0
  256. package/dist/registry/helm.d.ts.map +1 -0
  257. package/dist/registry/helm.js +124 -0
  258. package/dist/registry/helm.js.map +1 -0
  259. package/dist/registry/index.d.ts +8 -0
  260. package/dist/registry/index.d.ts.map +1 -0
  261. package/dist/registry/index.js +12 -0
  262. package/dist/registry/index.js.map +1 -0
  263. package/dist/registry/types.d.ts +55 -0
  264. package/dist/registry/types.d.ts.map +1 -0
  265. package/dist/registry/types.js +2 -0
  266. package/dist/registry/types.js.map +1 -0
  267. package/dist/registry/version.d.ts +22 -0
  268. package/dist/registry/version.d.ts.map +1 -0
  269. package/dist/registry/version.js +62 -0
  270. package/dist/registry/version.js.map +1 -0
  271. package/dist/schema/cluster.d.ts +2890 -0
  272. package/dist/schema/cluster.d.ts.map +1 -0
  273. package/dist/schema/cluster.js +231 -0
  274. package/dist/schema/cluster.js.map +1 -0
  275. package/dist/schema/common.d.ts +1059 -0
  276. package/dist/schema/common.d.ts.map +1 -0
  277. package/dist/schema/common.js +340 -0
  278. package/dist/schema/common.js.map +1 -0
  279. package/dist/schema/index.d.ts +8 -0
  280. package/dist/schema/index.d.ts.map +1 -0
  281. package/dist/schema/index.js +8 -0
  282. package/dist/schema/index.js.map +1 -0
  283. package/dist/schema/node-list.d.ts +361 -0
  284. package/dist/schema/node-list.d.ts.map +1 -0
  285. package/dist/schema/node-list.js +104 -0
  286. package/dist/schema/node-list.js.map +1 -0
  287. package/dist/schema/profile.d.ts +166 -0
  288. package/dist/schema/profile.d.ts.map +1 -0
  289. package/dist/schema/profile.js +61 -0
  290. package/dist/schema/profile.js.map +1 -0
  291. package/dist/schema/project.d.ts +168 -0
  292. package/dist/schema/project.d.ts.map +1 -0
  293. package/dist/schema/project.js +40 -0
  294. package/dist/schema/project.js.map +1 -0
  295. package/dist/schema/sources.d.ts +338 -0
  296. package/dist/schema/sources.d.ts.map +1 -0
  297. package/dist/schema/sources.js +111 -0
  298. package/dist/schema/sources.js.map +1 -0
  299. package/dist/schema/template.d.ts +2711 -0
  300. package/dist/schema/template.d.ts.map +1 -0
  301. package/dist/schema/template.js +97 -0
  302. package/dist/schema/template.js.map +1 -0
  303. package/dist/sources/cache/index.d.ts +9 -0
  304. package/dist/sources/cache/index.d.ts.map +1 -0
  305. package/dist/sources/cache/index.js +278 -0
  306. package/dist/sources/cache/index.js.map +1 -0
  307. package/dist/sources/cache/metadata.d.ts +36 -0
  308. package/dist/sources/cache/metadata.d.ts.map +1 -0
  309. package/dist/sources/cache/metadata.js +21 -0
  310. package/dist/sources/cache/metadata.js.map +1 -0
  311. package/dist/sources/cache/ttl.d.ts +20 -0
  312. package/dist/sources/cache/ttl.d.ts.map +1 -0
  313. package/dist/sources/cache/ttl.js +53 -0
  314. package/dist/sources/cache/ttl.js.map +1 -0
  315. package/dist/sources/fetchers/git.d.ts +6 -0
  316. package/dist/sources/fetchers/git.d.ts.map +1 -0
  317. package/dist/sources/fetchers/git.js +165 -0
  318. package/dist/sources/fetchers/git.js.map +1 -0
  319. package/dist/sources/fetchers/http.d.ts +6 -0
  320. package/dist/sources/fetchers/http.d.ts.map +1 -0
  321. package/dist/sources/fetchers/http.js +159 -0
  322. package/dist/sources/fetchers/http.js.map +1 -0
  323. package/dist/sources/fetchers/index.d.ts +11 -0
  324. package/dist/sources/fetchers/index.d.ts.map +1 -0
  325. package/dist/sources/fetchers/index.js +24 -0
  326. package/dist/sources/fetchers/index.js.map +1 -0
  327. package/dist/sources/fetchers/oci.d.ts +6 -0
  328. package/dist/sources/fetchers/oci.d.ts.map +1 -0
  329. package/dist/sources/fetchers/oci.js +156 -0
  330. package/dist/sources/fetchers/oci.js.map +1 -0
  331. package/dist/sources/fetchers/types.d.ts +25 -0
  332. package/dist/sources/fetchers/types.d.ts.map +1 -0
  333. package/dist/sources/fetchers/types.js +2 -0
  334. package/dist/sources/fetchers/types.js.map +1 -0
  335. package/dist/sources/index.d.ts +6 -0
  336. package/dist/sources/index.d.ts.map +1 -0
  337. package/dist/sources/index.js +10 -0
  338. package/dist/sources/index.js.map +1 -0
  339. package/dist/sources/loader.d.ts +34 -0
  340. package/dist/sources/loader.d.ts.map +1 -0
  341. package/dist/sources/loader.js +89 -0
  342. package/dist/sources/loader.js.map +1 -0
  343. package/dist/sources/resolver.d.ts +17 -0
  344. package/dist/sources/resolver.d.ts.map +1 -0
  345. package/dist/sources/resolver.js +125 -0
  346. package/dist/sources/resolver.js.map +1 -0
  347. package/dist/sources/types.d.ts +151 -0
  348. package/dist/sources/types.d.ts.map +1 -0
  349. package/dist/sources/types.js +2 -0
  350. package/dist/sources/types.js.map +1 -0
  351. package/package.json +101 -0
@@ -0,0 +1,69 @@
1
+ import { get_template_config } from '../kustomization-resolution.js';
2
+ import { create_node_id } from './reference.js';
3
+ /**
4
+ * Validates that all kustomization dependencies are satisfied by templates listed in cluster.yaml.
5
+ *
6
+ * Templates are only deployed if they are explicitly listed in cluster.yaml.
7
+ * This validates that all dependency references point to kustomizations from listed templates.
8
+ *
9
+ * @param cluster - Cluster configuration
10
+ * @param templates - Array of templates
11
+ * @returns Array of validation errors (empty if valid)
12
+ */
13
+ export function validate_enablement_dependencies(cluster, templates) {
14
+ const errors = [];
15
+ // Build a set of kustomization IDs that will be deployed
16
+ const deployed_kustomizations = new Set();
17
+ for (const template of templates) {
18
+ const template_config = get_template_config(cluster, template.metadata.name);
19
+ // Template is only deployed if listed in cluster.yaml
20
+ if (!template_config) {
21
+ continue;
22
+ }
23
+ // All kustomizations in a listed template are deployed
24
+ for (const kustomization of template.spec.kustomizations) {
25
+ const node_id = create_node_id(template.metadata.name, kustomization.name);
26
+ deployed_kustomizations.add(node_id);
27
+ }
28
+ }
29
+ // Check each deployed kustomization's dependencies
30
+ for (const template of templates) {
31
+ const template_config = get_template_config(cluster, template.metadata.name);
32
+ // Skip templates not listed in cluster.yaml
33
+ if (!template_config) {
34
+ continue;
35
+ }
36
+ for (const kustomization of template.spec.kustomizations) {
37
+ const node_id = create_node_id(template.metadata.name, kustomization.name);
38
+ // Check dependencies
39
+ for (const dep of kustomization.depends_on ?? []) {
40
+ // Skip raw dependencies - they're external to kustodian
41
+ if (typeof dep !== 'string') {
42
+ continue;
43
+ }
44
+ // Parse dependency to get target node ID
45
+ const dep_parts = dep.split('/');
46
+ let target_node_id;
47
+ if (dep_parts.length === 2) {
48
+ // Cross-template reference: template/kustomization
49
+ target_node_id = dep;
50
+ }
51
+ else {
52
+ // Within-template reference: kustomization
53
+ target_node_id = create_node_id(template.metadata.name, dep);
54
+ }
55
+ // Check if the dependency is deployed
56
+ if (!deployed_kustomizations.has(target_node_id)) {
57
+ errors.push({
58
+ type: 'missing_dependency',
59
+ source: node_id,
60
+ target: target_node_id,
61
+ message: `Kustomization '${node_id}' depends on '${target_node_id}' which is not deployed. Add the template to cluster.yaml.`,
62
+ });
63
+ }
64
+ }
65
+ }
66
+ }
67
+ return errors;
68
+ }
69
+ //# sourceMappingURL=enablement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enablement.js","sourceRoot":"","sources":["../../../src/generator/validation/enablement.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAchD;;;;;;;;;GASG;AACH,MAAM,UAAU,gCAAgC,CAC9C,OAAoB,EACpB,SAAyB;IAEzB,MAAM,MAAM,GAAiC,EAAE,CAAC;IAEhD,yDAAyD;IACzD,MAAM,uBAAuB,GAAG,IAAI,GAAG,EAAU,CAAC;IAElD,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,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;gBACvB,CAAC;qBAAM,CAAC;oBACN,2CAA2C;oBAC3C,cAAc,GAAG,cAAc,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;gBAC/D,CAAC;gBAED,sCAAsC;gBACtC,IAAI,CAAC,uBAAuB,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,CAAC;oBACjD,MAAM,CAAC,IAAI,CAAC;wBACV,IAAI,EAAE,oBAAoB;wBAC1B,MAAM,EAAE,OAAO;wBACf,MAAM,EAAE,cAAc;wBACtB,OAAO,EAAE,kBAAkB,OAAO,iBAAiB,cAAc,4DAA4D;qBAC9H,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,29 @@
1
+ import type { TemplateType } from '../../schema/index.js';
2
+ import type { BuildGraphResultType, GraphNodeType } from './types.js';
3
+ /**
4
+ * Builds a dependency graph from templates.
5
+ *
6
+ * Uses a two-pass algorithm:
7
+ * 1. First pass: Create nodes for all kustomizations
8
+ * 2. Second pass: Resolve dependencies and validate references
9
+ *
10
+ * @param templates - Array of templates to build graph from
11
+ * @returns Graph nodes and any errors encountered during building
12
+ */
13
+ export declare function build_dependency_graph(templates: TemplateType[]): BuildGraphResultType;
14
+ /**
15
+ * Gets all nodes from the graph as an array.
16
+ *
17
+ * @param nodes - Map of graph nodes
18
+ * @returns Array of all nodes
19
+ */
20
+ export declare function get_all_nodes(nodes: Map<string, GraphNodeType>): GraphNodeType[];
21
+ /**
22
+ * Gets a node by its ID.
23
+ *
24
+ * @param nodes - Map of graph nodes
25
+ * @param id - Node ID to look up
26
+ * @returns The node or undefined if not found
27
+ */
28
+ export declare function get_node(nodes: Map<string, GraphNodeType>, id: string): GraphNodeType | undefined;
29
+ //# sourceMappingURL=graph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../../src/generator/validation/graph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAQ1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAA4B,MAAM,YAAY,CAAC;AAEhG;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,YAAY,EAAE,GAAG,oBAAoB,CAwFtF;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,GAAG,aAAa,EAAE,CAEhF;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAEjG"}
@@ -0,0 +1,106 @@
1
+ import { create_node_id, is_parse_error, parse_dependency_ref, resolve_dependency_ref, } from './reference.js';
2
+ /**
3
+ * Builds a dependency graph from templates.
4
+ *
5
+ * Uses a two-pass algorithm:
6
+ * 1. First pass: Create nodes for all kustomizations
7
+ * 2. Second pass: Resolve dependencies and validate references
8
+ *
9
+ * @param templates - Array of templates to build graph from
10
+ * @returns Graph nodes and any errors encountered during building
11
+ */
12
+ export function build_dependency_graph(templates) {
13
+ const nodes = new Map();
14
+ const errors = [];
15
+ // First pass: Create all nodes
16
+ for (const template of templates) {
17
+ const template_name = template.metadata.name;
18
+ for (const kustomization of template.spec.kustomizations) {
19
+ const node_id = create_node_id(template_name, kustomization.name);
20
+ nodes.set(node_id, {
21
+ id: node_id,
22
+ template: template_name,
23
+ kustomization: kustomization.name,
24
+ dependencies: [],
25
+ });
26
+ }
27
+ }
28
+ // Second pass: Resolve dependencies
29
+ for (const template of templates) {
30
+ const template_name = template.metadata.name;
31
+ for (const kustomization of template.spec.kustomizations) {
32
+ const node_id = create_node_id(template_name, kustomization.name);
33
+ const resolved_dependencies = [];
34
+ for (const dep of kustomization.depends_on ?? []) {
35
+ // Parse the dependency reference
36
+ const parse_result = parse_dependency_ref(dep);
37
+ if (is_parse_error(parse_result)) {
38
+ // Add source to the error
39
+ errors.push({
40
+ ...parse_result,
41
+ source: node_id,
42
+ });
43
+ continue;
44
+ }
45
+ // Resolve to full node ID
46
+ const target_id = resolve_dependency_ref(parse_result, template_name);
47
+ // Skip raw dependencies - they're external and don't participate in graph validation
48
+ if (target_id === null) {
49
+ continue;
50
+ }
51
+ // Check for self-reference
52
+ if (target_id === node_id) {
53
+ errors.push({
54
+ type: 'self_reference',
55
+ node: node_id,
56
+ message: `Kustomization '${node_id}' cannot depend on itself`,
57
+ });
58
+ continue;
59
+ }
60
+ // Check if target exists
61
+ if (!nodes.has(target_id)) {
62
+ errors.push({
63
+ type: 'missing_reference',
64
+ source: node_id,
65
+ target: target_id,
66
+ message: `Kustomization '${node_id}' depends on '${target_id}' which does not exist`,
67
+ });
68
+ continue;
69
+ }
70
+ resolved_dependencies.push(target_id);
71
+ }
72
+ // Update node with resolved dependencies
73
+ // We need to create a new node since GraphNodeType has readonly properties
74
+ if (resolved_dependencies.length > 0) {
75
+ const existing_node = nodes.get(node_id);
76
+ if (existing_node) {
77
+ nodes.set(node_id, {
78
+ ...existing_node,
79
+ dependencies: resolved_dependencies,
80
+ });
81
+ }
82
+ }
83
+ }
84
+ }
85
+ return { nodes, errors };
86
+ }
87
+ /**
88
+ * Gets all nodes from the graph as an array.
89
+ *
90
+ * @param nodes - Map of graph nodes
91
+ * @returns Array of all nodes
92
+ */
93
+ export function get_all_nodes(nodes) {
94
+ return Array.from(nodes.values());
95
+ }
96
+ /**
97
+ * Gets a node by its ID.
98
+ *
99
+ * @param nodes - Map of graph nodes
100
+ * @param id - Node ID to look up
101
+ * @returns The node or undefined if not found
102
+ */
103
+ export function get_node(nodes, id) {
104
+ return nodes.get(id);
105
+ }
106
+ //# sourceMappingURL=graph.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph.js","sourceRoot":"","sources":["../../../src/generator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C;IACH,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AAC3B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,KAAiC;IAC7D,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;AACpC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAiC,EAAE,EAAU;IACpE,OAAO,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AACvB,CAAC"}
@@ -0,0 +1,38 @@
1
+ import type { KustodianErrorType } from '../../core/index.js';
2
+ import { type ResultType } from '../../core/index.js';
3
+ import type { ClusterType, TemplateType } from '../../schema/index.js';
4
+ import type { GraphValidationResultType } from './types.js';
5
+ export { detect_cycles, has_cycles } from './cycle-detection.js';
6
+ export type { MissingDependencyErrorType } from './enablement.js';
7
+ export { validate_enablement_dependencies } from './enablement.js';
8
+ export { build_dependency_graph, get_all_nodes, get_node } from './graph.js';
9
+ export { create_node_id, is_parse_error, parse_dependency_ref, parse_node_id, resolve_dependency_ref, } from './reference.js';
10
+ export type { RequirementValidationErrorType, RequirementValidationResultType, } from './requirements.js';
11
+ export { validate_template_requirements } from './requirements.js';
12
+ export type { BuildGraphResultType, CycleDetectionResultType, CycleErrorType, DependencyRefType, GraphNodeType, GraphValidationErrorType, GraphValidationResultType, InvalidReferenceErrorType, MissingReferenceErrorType, SelfReferenceErrorType, } from './types.js';
13
+ /**
14
+ * Validates the dependency graph for a set of templates.
15
+ *
16
+ * Performs the following validations:
17
+ * 1. Reference validation: Ensures all `depends_on` references point to existing kustomizations
18
+ * 2. Self-reference detection: Detects kustomizations that depend on themselves
19
+ * 3. Cycle detection: Detects circular dependencies using DFS
20
+ * 4. Topological sorting: Computes deployment order if the graph is valid
21
+ *
22
+ * @param templates - Array of templates to validate
23
+ * @returns Detailed validation result including errors and deployment order
24
+ */
25
+ export declare function validate_dependency_graph(templates: TemplateType[]): GraphValidationResultType;
26
+ /**
27
+ * Validates the dependency graph and returns a Result type.
28
+ *
29
+ * This is the main integration point for the generator pipeline.
30
+ * Returns a success with the topological order, or a failure with
31
+ * detailed error information.
32
+ *
33
+ * @param cluster - Cluster configuration
34
+ * @param templates - Array of templates to validate
35
+ * @returns Result with topological order on success, or error on failure
36
+ */
37
+ export declare function validate_dependencies(cluster: ClusterType, templates: TemplateType[]): ResultType<string[], KustodianErrorType>;
38
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/generator/validation/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,KAAK,UAAU,EAAoB,MAAM,qBAAqB,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAKvE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAE5D,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACjE,YAAY,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,gCAAgC,EAAE,MAAM,iBAAiB,CAAC;AAGnE,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC7E,OAAO,EACL,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,aAAa,EACb,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,8BAA8B,EAC9B,+BAA+B,GAChC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,8BAA8B,EAAE,MAAM,mBAAmB,CAAC;AAEnE,YAAY,EACV,oBAAoB,EACpB,wBAAwB,EACxB,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,wBAAwB,EACxB,yBAAyB,EACzB,yBAAyB,EACzB,yBAAyB,EACzB,sBAAsB,GACvB,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;GAWG;AACH,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,YAAY,EAAE,GAAG,yBAAyB,CAoB9F;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,YAAY,EAAE,GACxB,UAAU,CAAC,MAAM,EAAE,EAAE,kBAAkB,CAAC,CAgB1C"}
@@ -0,0 +1,64 @@
1
+ import { failure, success } from '../../core/index.js';
2
+ import { detect_cycles } from './cycle-detection.js';
3
+ import { validate_enablement_dependencies } from './enablement.js';
4
+ import { build_dependency_graph } from './graph.js';
5
+ export { detect_cycles, has_cycles } from './cycle-detection.js';
6
+ export { validate_enablement_dependencies } from './enablement.js';
7
+ // Re-export functions
8
+ export { build_dependency_graph, get_all_nodes, get_node } from './graph.js';
9
+ export { create_node_id, is_parse_error, parse_dependency_ref, parse_node_id, resolve_dependency_ref, } from './reference.js';
10
+ export { validate_template_requirements } from './requirements.js';
11
+ /**
12
+ * Validates the dependency graph for a set of templates.
13
+ *
14
+ * Performs the following validations:
15
+ * 1. Reference validation: Ensures all `depends_on` references point to existing kustomizations
16
+ * 2. Self-reference detection: Detects kustomizations that depend on themselves
17
+ * 3. Cycle detection: Detects circular dependencies using DFS
18
+ * 4. Topological sorting: Computes deployment order if the graph is valid
19
+ *
20
+ * @param templates - Array of templates to validate
21
+ * @returns Detailed validation result including errors and deployment order
22
+ */
23
+ export function validate_dependency_graph(templates) {
24
+ // Build the dependency graph (validates references)
25
+ const { nodes, errors } = build_dependency_graph(templates);
26
+ // Detect cycles in the graph
27
+ const { cycles, topological_order } = detect_cycles(nodes);
28
+ // Combine all errors
29
+ const all_errors = [...errors, ...cycles];
30
+ const result = {
31
+ valid: all_errors.length === 0,
32
+ errors: all_errors,
33
+ };
34
+ if (topological_order !== null) {
35
+ return { ...result, topological_order };
36
+ }
37
+ return result;
38
+ }
39
+ /**
40
+ * Validates the dependency graph and returns a Result type.
41
+ *
42
+ * This is the main integration point for the generator pipeline.
43
+ * Returns a success with the topological order, or a failure with
44
+ * detailed error information.
45
+ *
46
+ * @param cluster - Cluster configuration
47
+ * @param templates - Array of templates to validate
48
+ * @returns Result with topological order on success, or error on failure
49
+ */
50
+ export function validate_dependencies(cluster, templates) {
51
+ const result = validate_dependency_graph(templates);
52
+ const enablement_errors = validate_enablement_dependencies(cluster, templates);
53
+ // Combine all errors
54
+ const all_errors = [...result.errors, ...enablement_errors];
55
+ if (all_errors.length > 0) {
56
+ const error_messages = all_errors.map((e) => e.message);
57
+ return failure({
58
+ code: 'DEPENDENCY_VALIDATION_ERROR',
59
+ message: `Dependency validation failed:\n${error_messages.map((m) => ` - ${m}`).join('\n')}`,
60
+ });
61
+ }
62
+ return success(result.topological_order ?? []);
63
+ }
64
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/generator/validation/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAmB,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAGxE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,gCAAgC,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAGpD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEjE,OAAO,EAAE,gCAAgC,EAAE,MAAM,iBAAiB,CAAC;AAEnE,sBAAsB;AACtB,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC7E,OAAO,EACL,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,aAAa,EACb,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AAKxB,OAAO,EAAE,8BAA8B,EAAE,MAAM,mBA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,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;SAC9F,CAAC,CAAC;IACL,CAAC;IAED,OAAO,OAAO,CAAC,MAAM,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC;AACjD,CAAC"}
@@ -0,0 +1,45 @@
1
+ import type { DependencyRefType as SchemaDependencyRefType } from '../../schema/index.js';
2
+ import type { DependencyRefType, InvalidReferenceErrorType } from './types.js';
3
+ /**
4
+ * Parses a dependency reference from the schema.
5
+ *
6
+ * Supports three formats:
7
+ * - Within-template: `kustomization-name` (e.g., `operator`)
8
+ * - Cross-template: `template-name/kustomization-name` (e.g., `001-secrets/doppler`)
9
+ * - Raw external: `{ raw: { name: 'legacy-infrastructure', namespace: 'gitops-system' } }`
10
+ *
11
+ * @param ref - The dependency reference from schema (string or raw object)
12
+ * @returns Parsed dependency reference or error
13
+ */
14
+ export declare function parse_dependency_ref(ref: SchemaDependencyRefType): DependencyRefType | InvalidReferenceErrorType;
15
+ /**
16
+ * Type guard to check if parse result is an error.
17
+ */
18
+ export declare function is_parse_error(result: DependencyRefType | InvalidReferenceErrorType): result is InvalidReferenceErrorType;
19
+ /**
20
+ * Resolves a dependency reference to a full node ID.
21
+ *
22
+ * @param ref - Parsed dependency reference
23
+ * @param current_template - The template containing the reference
24
+ * @returns Full node ID in format `template/kustomization` for string refs, or null for raw refs
25
+ */
26
+ export declare function resolve_dependency_ref(ref: DependencyRefType, current_template: string): string | null;
27
+ /**
28
+ * Creates a node ID from template and kustomization names.
29
+ *
30
+ * @param template - Template name
31
+ * @param kustomization - Kustomization name
32
+ * @returns Node ID in format `template/kustomization`
33
+ */
34
+ export declare function create_node_id(template: string, kustomization: string): string;
35
+ /**
36
+ * Parses a node ID into its components.
37
+ *
38
+ * @param node_id - Node ID in format `template/kustomization`
39
+ * @returns Object with template and kustomization names
40
+ */
41
+ export declare function parse_node_id(node_id: string): {
42
+ template: string;
43
+ kustomization: string;
44
+ };
45
+ //# sourceMappingURL=reference.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reference.d.ts","sourceRoot":"","sources":["../../../src/generator/validation/reference.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,IAAI,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAC1F,OAAO,KAAK,EACV,iBAAiB,EACjB,yBAAyB,EAG1B,MAAM,YAAY,CAAC;AAWpB;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,uBAAuB,GAC3B,iBAAiB,GAAG,yBAAyB,CAW/C;AAgFD;;GAEG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,iBAAiB,GAAG,yBAAyB,GACpD,MAAM,IAAI,yBAAyB,CAErC;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,iBAAiB,EACtB,gBAAgB,EAAE,MAAM,GACvB,MAAM,GAAG,IAAI,CASf;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,CAE9E;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,CAS1F"}
@@ -0,0 +1,143 @@
1
+ /**
2
+ * Checks if a dependency reference is a raw object reference.
3
+ */
4
+ function is_raw_object(ref) {
5
+ return typeof ref === 'object' && 'raw' in ref;
6
+ }
7
+ /**
8
+ * Parses a dependency reference from the schema.
9
+ *
10
+ * Supports three formats:
11
+ * - Within-template: `kustomization-name` (e.g., `operator`)
12
+ * - Cross-template: `template-name/kustomization-name` (e.g., `001-secrets/doppler`)
13
+ * - Raw external: `{ raw: { name: 'legacy-infrastructure', namespace: 'gitops-system' } }`
14
+ *
15
+ * @param ref - The dependency reference from schema (string or raw object)
16
+ * @returns Parsed dependency reference or error
17
+ */
18
+ export function parse_dependency_ref(ref) {
19
+ // Handle raw object references
20
+ if (is_raw_object(ref)) {
21
+ return {
22
+ name: ref.raw.name,
23
+ namespace: ref.raw.namespace,
24
+ };
25
+ }
26
+ // Handle string references
27
+ return parse_string_dependency_ref(ref);
28
+ }
29
+ /**
30
+ * Parses a dependency reference string.
31
+ *
32
+ * Supports two formats:
33
+ * - Within-template: `kustomization-name` (e.g., `operator`)
34
+ * - Cross-template: `template-name/kustomization-name` (e.g., `001-secrets/doppler`)
35
+ *
36
+ * @param ref - The raw dependency reference string
37
+ * @returns Parsed dependency reference or error
38
+ */
39
+ function parse_string_dependency_ref(ref) {
40
+ const trimmed = ref.trim();
41
+ if (trimmed.length === 0) {
42
+ return {
43
+ type: 'invalid_reference',
44
+ source: '',
45
+ reference: ref,
46
+ message: 'Empty dependency reference',
47
+ };
48
+ }
49
+ const parts = trimmed.split('/');
50
+ if (parts.length === 1) {
51
+ // Within-template reference: `kustomization-name`
52
+ const kustomization = parts[0];
53
+ if (kustomization === undefined) {
54
+ return {
55
+ type: 'invalid_reference',
56
+ source: '',
57
+ reference: ref,
58
+ message: `Invalid dependency reference: '${ref}'`,
59
+ };
60
+ }
61
+ return {
62
+ kustomization,
63
+ raw: ref,
64
+ };
65
+ }
66
+ if (parts.length === 2) {
67
+ // Cross-template reference: `template-name/kustomization-name`
68
+ const template = parts[0];
69
+ const kustomization = parts[1];
70
+ if (template === undefined ||
71
+ kustomization === undefined ||
72
+ template.length === 0 ||
73
+ kustomization.length === 0) {
74
+ return {
75
+ type: 'invalid_reference',
76
+ source: '',
77
+ reference: ref,
78
+ message: `Invalid dependency reference format: '${ref}' - both template and kustomization names must be non-empty`,
79
+ };
80
+ }
81
+ return {
82
+ template,
83
+ kustomization,
84
+ raw: ref,
85
+ };
86
+ }
87
+ // More than one slash is invalid
88
+ return {
89
+ type: 'invalid_reference',
90
+ source: '',
91
+ reference: ref,
92
+ message: `Invalid dependency reference format: '${ref}' - expected 'kustomization' or 'template/kustomization'`,
93
+ };
94
+ }
95
+ /**
96
+ * Type guard to check if parse result is an error.
97
+ */
98
+ export function is_parse_error(result) {
99
+ return 'type' in result && result.type === 'invalid_reference';
100
+ }
101
+ /**
102
+ * Resolves a dependency reference to a full node ID.
103
+ *
104
+ * @param ref - Parsed dependency reference
105
+ * @param current_template - The template containing the reference
106
+ * @returns Full node ID in format `template/kustomization` for string refs, or null for raw refs
107
+ */
108
+ export function resolve_dependency_ref(ref, current_template) {
109
+ // Raw dependencies don't resolve to node IDs - they're external
110
+ if ('name' in ref && 'namespace' in ref) {
111
+ return null;
112
+ }
113
+ // String-based dependency references
114
+ const template = ref.template ?? current_template;
115
+ return `${template}/${ref.kustomization}`;
116
+ }
117
+ /**
118
+ * Creates a node ID from template and kustomization names.
119
+ *
120
+ * @param template - Template name
121
+ * @param kustomization - Kustomization name
122
+ * @returns Node ID in format `template/kustomization`
123
+ */
124
+ export function create_node_id(template, kustomization) {
125
+ return `${template}/${kustomization}`;
126
+ }
127
+ /**
128
+ * Parses a node ID into its components.
129
+ *
130
+ * @param node_id - Node ID in format `template/kustomization`
131
+ * @returns Object with template and kustomization names
132
+ */
133
+ export function parse_node_id(node_id) {
134
+ const slash_index = node_id.indexOf('/');
135
+ if (slash_index === -1) {
136
+ return { template: '', kustomization: node_id };
137
+ }
138
+ return {
139
+ template: node_id.slice(0, slash_index),
140
+ kustomization: node_id.slice(slash_index + 1),
141
+ };
142
+ }
143
+ //# sourceMappingURL=reference.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reference.js","sourceRoot":"","sources":["../../../src/generator/validation/reference.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,SAAS,aAAa,CACpB,GAA4B;IAE5B,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,KAAK,IAAI,GAAG,CAAC;AACjD,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,oBAAoB,CAClC,GAA4B;IAE5B,+BAA+B;IAC/B,IAAI,aAAa,CAAC,GAAG,CAAC,EAA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AE,EAAE,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC;IAClD,CAAC;IACD,OAAO;QACL,QAAQ,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC;QACvC,aAAa,EAAE,OAAO,CAAC,KAAK,CAAC,WAAW,GAAG,CAAC,CAAC;KAC9C,CAAC;AACJ,CAAC"}
@@ -0,0 +1,25 @@
1
+ import type { NodeSchemaType, TemplateRequirementType, TemplateType } from '../../schema/index.js';
2
+ /**
3
+ * Validation error for a template requirement.
4
+ */
5
+ export interface RequirementValidationErrorType {
6
+ template: string;
7
+ requirement: TemplateRequirementType;
8
+ message: string;
9
+ }
10
+ /**
11
+ * Result of validating template requirements against cluster nodes.
12
+ */
13
+ export interface RequirementValidationResultType {
14
+ valid: boolean;
15
+ errors: RequirementValidationErrorType[];
16
+ }
17
+ /**
18
+ * Validates all template requirements against cluster nodes.
19
+ *
20
+ * @param templates - Templates to validate (only enabled ones should be passed)
21
+ * @param nodes - Cluster nodes to validate against
22
+ * @returns Validation result with any requirement errors
23
+ */
24
+ export declare function validate_template_requirements(templates: TemplateType[], nodes: NodeSchemaType[]): RequirementValidationResultType;
25
+ //# sourceMappingURL=requirements.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requirements.d.ts","sourceRoot":"","sources":["../../../src/generator/validation/requirements.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAEnG;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,uBAAuB,CAAC;IACrC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,+BAA+B;IAC9C,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,8BAA8B,EAAE,CAAC;CAC1C;AAoED;;;;;;GAMG;AACH,wBAAgB,8BAA8B,CAC5C,SAAS,EAAE,YAAY,EAAE,EACzB,KAAK,EAAE,cAAc,EAAE,GACtB,+BAA+B,CAYjC"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Checks if a node label matches the requirement.
3
+ */
4
+ function node_matches_label_requirement(node, key, value) {
5
+ if (!node.labels) {
6
+ return false;
7
+ }
8
+ const label_value = node.labels[key];
9
+ // Label must exist
10
+ if (label_value === undefined) {
11
+ return false;
12
+ }
13
+ // If no specific value required, just presence is enough
14
+ if (value === undefined) {
15
+ return true;
16
+ }
17
+ // Check if label value matches
18
+ // Node labels can be string, boolean, or number, so convert both to strings for comparison
19
+ return String(label_value) === value;
20
+ }
21
+ /**
22
+ * Validates node label requirements for a template against cluster nodes.
23
+ */
24
+ function validate_node_label_requirements(template, nodes) {
25
+ const errors = [];
26
+ if (!template.spec.requirements) {
27
+ return errors;
28
+ }
29
+ for (const requirement of template.spec.requirements) {
30
+ if (requirement.type !== 'nodeLabel') {
31
+ continue;
32
+ }
33
+ const matching_nodes = nodes.filter((node) => node_matches_label_requirement(node, requirement.key, requirement.value));
34
+ if (matching_nodes.length < requirement.atLeast) {
35
+ const value_part = requirement.value !== undefined ? `=${requirement.value}` : '';
36
+ const message = `Template requires at least ${requirement.atLeast} node(s) with label '${requirement.key}${value_part}', but found ${matching_nodes.length}`;
37
+ errors.push({
38
+ template: template.metadata.name,
39
+ requirement,
40
+ message,
41
+ });
42
+ }
43
+ }
44
+ return errors;
45
+ }
46
+ /**
47
+ * Validates all template requirements against cluster nodes.
48
+ *
49
+ * @param templates - Templates to validate (only enabled ones should be passed)
50
+ * @param nodes - Cluster nodes to validate against
51
+ * @returns Validation result with any requirement errors
52
+ */
53
+ export function validate_template_requirements(templates, nodes) {
54
+ const all_errors = [];
55
+ for (const template of templates) {
56
+ const errors = validate_node_label_requirements(template, nodes);
57
+ all_errors.push(...errors);
58
+ }
59
+ return {
60
+ valid: all_errors.length === 0,
61
+ errors: all_errors,
62
+ };
63
+ }
64
+ //# sourceMappingURL=requirements.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requirements.js","sourceRoot":"","sources":["../../../src/generator/validation/requirements.ts"],"names":[],"mappings":"AAmBA;;GAEG;AACH,SAAS,8BAA8B,CACrC,IAAoB,EACpB,GAAW,EACX,KAAc;IAEd,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACjB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAErC,mBAAmB;IACnB,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,yDAAyD;IACzD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,+BAA+B;IAC/B,2FAA2F;IAC3F,OAAO,MAAM,CAAC,WAAW,CAAC,KAAK,KAAK,CAAC;AACvC,CAAC;AAED;;GAEG;AACH,SAAS,gCAAgC,CACvC,QAAsB,EACtB,KAAuB;IAEvB,MAAM,MAAM,GAAqC,EAAE,CAAC;IAEpD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;QAChC,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,KAAK,MAAM,WAAW,IAAI,QAAQ,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;QACrD,IAAI,WAAW,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;YACrC,SAAS;QACX,CAAC;QAED,MAAM,cAAc,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAC3C,8BAA8B,CAAC,IAAI,EAAE,WAAW,CAAC,GAAG,EAAE,WAAW,CAAC,KAAK,CAAC,CACzE,CAAC;QAEF,IAAI,cAAc,CAAC,MAAM,GAAG,WAAW,CAAC,OAAO,EAAE,CAAC;YAChD,MAAM,UAAU,GAAG,WAAW,CAAC,KAAK,KAAK,SAA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