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,59 @@
1
+ /**
2
+ * Resolves kustomization preservation policy from template defaults and cluster overrides.
3
+ *
4
+ * Resolution order (last wins):
5
+ * 1. Template kustomization preservation policy (defaults to 'stateful')
6
+ * 2. Cluster kustomization override preservation (if specified)
7
+ *
8
+ * @param kustomization - Template kustomization definition
9
+ * @param template_config - Cluster template configuration (may be undefined)
10
+ * @param kustomization_name - Name of the kustomization to resolve
11
+ * @returns Resolved preservation policy
12
+ */
13
+ export function resolve_kustomization_preservation(kustomization, template_config, kustomization_name) {
14
+ // Start with template default
15
+ const template_default = kustomization.preservation ?? {
16
+ mode: 'stateful',
17
+ };
18
+ // Check for cluster override
19
+ if (!template_config?.kustomizations) {
20
+ return template_default;
21
+ }
22
+ const override = template_config.kustomizations[kustomization_name];
23
+ if (override === undefined) {
24
+ return template_default;
25
+ }
26
+ // Merge cluster override with template default
27
+ if (override.preservation) {
28
+ return {
29
+ mode: override.preservation.mode,
30
+ keep_resources: override.preservation.keep_resources ?? template_default.keep_resources,
31
+ };
32
+ }
33
+ return template_default;
34
+ }
35
+ /**
36
+ * Resolves complete kustomization state (preservation only).
37
+ * Template enablement is now determined by whether the template is listed in cluster.yaml.
38
+ *
39
+ * @param kustomization - Template kustomization definition
40
+ * @param template_config - Cluster template configuration (may be undefined)
41
+ * @param kustomization_name - Name of the kustomization to resolve
42
+ * @returns Resolved kustomization state
43
+ */
44
+ export function resolve_kustomization_state(kustomization, template_config, kustomization_name) {
45
+ return {
46
+ preservation: resolve_kustomization_preservation(kustomization, template_config, kustomization_name),
47
+ };
48
+ }
49
+ /**
50
+ * Gets template configuration for a specific template from cluster spec.
51
+ *
52
+ * @param cluster - Cluster configuration
53
+ * @param template_name - Name of the template to find
54
+ * @returns Template configuration or undefined if not found
55
+ */
56
+ export function get_template_config(cluster, template_name) {
57
+ return cluster.spec.templates?.find((t) => t.name === template_name);
58
+ }
59
+ //# sourceMappingURL=kustomization-resolution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kustomization-resolution.js","sourceRoot":"","sources":["../../src/generator/kustomization-resolution.ts"],"names":[],"mappings":"AAeA;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,kCAAkC,CAChD,aAAgC,EAChC,eAA+C,EAC/C,kBAA0B;IAE1B,8BAA8B;IAC9B,MAAM,gBAAgB,GAA2B,aAAa,CAAC,YAAY,IAAI;QAC7E,IAAI,EAAE,UAAU;KACjB,CAAC;IAEF,6BAA6B;IAC7B,IAAI,CAAC,eAAe,EAAE,cAAc,EAAE,CAAC;QACrC,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IAED,MAAM,QAAQ,GAAG,eAAe,CAAC,cAAc,CAAC,kBAAkB,CAAC,CAAC;IACpE,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IAED,+CAA+C;IAC/C,IAAI,QAAQ,CAAC,YAAY,EAAE,CAAC;QAC1B,OAAO;YACL,IAAI,EAAE,QAAQ,CAAC,YAAY,CAAC,IAAI;YAChC,cAAc,EAAE,QAAQ,CAAC,YAAY,CAAC,cAAc,IAAI,gBAAgB,CAAC,cAAc;SACxF,CAAC;IACJ,CAAC;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,2BAA2B,CACzC,aAAgC,EAChC,eAA+C,EAC/C,kBAA0B;IAE1B,OAAO;QACL,YAAY,EAAE,kCAAkC,CAC9C,aAAa,EACb,eAAe,EACf,kBAAkB,CACnB;KACF,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CACjC,OAAoB,EACpB,aAAqB;IAErB,OAAO,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,aAAa,CAAC,CAAC;AACvE,CAAC"}
@@ -0,0 +1,74 @@
1
+ import type { KustomizationType, TemplateType } from '../schema/index.js';
2
+ import type { ResolvedTemplateType } from './types.js';
3
+ /**
4
+ * Gets the set of system namespaces for a given flux namespace.
5
+ *
6
+ * System namespaces are never generated as Namespace resources.
7
+ *
8
+ * @param flux_namespace - The Flux system namespace (defaults to 'flux-system')
9
+ * @returns Set of system namespace names
10
+ */
11
+ export declare function get_system_namespaces(flux_namespace?: string): Set<string>;
12
+ /**
13
+ * System namespaces that should not be generated.
14
+ * Uses the default Flux namespace 'flux-system'.
15
+ *
16
+ * @deprecated Use get_system_namespaces() for dynamic flux namespace support
17
+ */
18
+ export declare const SYSTEM_NAMESPACES: Set<string>;
19
+ /**
20
+ * Namespace resource type.
21
+ */
22
+ export interface NamespaceResourceType {
23
+ apiVersion: 'v1';
24
+ kind: 'Namespace';
25
+ metadata: {
26
+ name: string;
27
+ labels?: Record<string, string>;
28
+ };
29
+ }
30
+ /**
31
+ * Extracts the namespace from a kustomization.
32
+ * Returns undefined if no namespace is configured.
33
+ */
34
+ export declare function get_kustomization_namespace(kustomization: KustomizationType): string | undefined;
35
+ /**
36
+ * Extracts all namespaces from a template.
37
+ */
38
+ export declare function get_template_namespaces(template: TemplateType): string[];
39
+ /**
40
+ * Extracts all namespaces from resolved templates.
41
+ * Only includes templates that are listed in cluster.yaml (enabled = true).
42
+ */
43
+ export declare function collect_namespaces(templates: ResolvedTemplateType[]): string[];
44
+ /**
45
+ * Filters out system namespaces from a list.
46
+ *
47
+ * @param namespaces - List of namespace names to filter
48
+ * @param flux_namespace - The Flux system namespace (defaults to 'flux-system')
49
+ * @returns Filtered list excluding system namespaces
50
+ */
51
+ export declare function filter_system_namespaces(namespaces: string[], flux_namespace?: string): string[];
52
+ /**
53
+ * Checks if a namespace is a system namespace.
54
+ *
55
+ * @param namespace - The namespace to check
56
+ * @param flux_namespace - The Flux system namespace (defaults to 'flux-system')
57
+ * @returns true if the namespace is a system namespace
58
+ */
59
+ export declare function is_system_namespace(namespace: string, flux_namespace?: string): boolean;
60
+ /**
61
+ * Creates a namespace resource.
62
+ */
63
+ export declare function create_namespace_resource(name: string, labels?: Record<string, string>): NamespaceResourceType;
64
+ /**
65
+ * Generates namespace resources for all namespaces in templates.
66
+ * Filters out system namespaces.
67
+ *
68
+ * @param templates - Resolved templates to extract namespaces from
69
+ * @param labels - Optional labels to apply to all namespace resources
70
+ * @param flux_namespace - The Flux system namespace (defaults to 'flux-system')
71
+ * @returns Array of namespace resources
72
+ */
73
+ export declare function generate_namespace_resources(templates: ResolvedTemplateType[], labels?: Record<string, string>, flux_namespace?: string): NamespaceResourceType[];
74
+ //# sourceMappingURL=namespace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"namespace.d.ts","sourceRoot":"","sources":["../../src/generator/namespace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAE1E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD;;;;;;;GA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espace.
3
+ *
4
+ * System namespaces are never generated as Namespace resources.
5
+ *
6
+ * @param flux_namespace - The Flux system namespace (defaults to 'flux-system')
7
+ * @returns Set of system namespace names
8
+ */
9
+ export function get_system_namespaces(flux_namespace = 'flux-system') {
10
+ return new Set(['default', flux_namespace, 'kube-system', 'kube-public', 'kube-node-lease']);
11
+ }
12
+ /**
13
+ * System namespaces that should not be generated.
14
+ * Uses the default Flux namespace 'flux-system'.
15
+ *
16
+ * @deprecated Use get_system_namespaces() for dynamic flux namespace support
17
+ */
18
+ export const SYSTEM_NAMESPACES = get_system_namespaces();
19
+ /**
20
+ * Extracts the namespace from a kustomization.
21
+ * Returns undefined if no namespace is configured.
22
+ */
23
+ export function get_kustomization_namespace(kustomization) {
24
+ return kustomization.namespace?.default;
25
+ }
26
+ /**
27
+ * Extracts all namespaces from a template.
28
+ */
29
+ export function get_template_namespaces(template) {
30
+ const namespaces = new Set();
31
+ for (const kustomization of template.spec.kustomizations) {
32
+ const namespace = get_kustomization_namespace(kustomization);
33
+ if (namespace) {
34
+ namespaces.add(namespace);
35
+ }
36
+ }
37
+ return Array.from(namespaces);
38
+ }
39
+ /**
40
+ * Extracts all namespaces from resolved templates.
41
+ * Only includes templates that are listed in cluster.yaml (enabled = true).
42
+ */
43
+ export function collect_namespaces(templates) {
44
+ const namespaces = new Set();
45
+ for (const resolved of templates) {
46
+ // Only include templates that are listed in cluster.yaml
47
+ if (!resolved.enabled) {
48
+ continue;
49
+ }
50
+ for (const namespace of get_template_namespaces(resolved.template)) {
51
+ namespaces.add(namespace);
52
+ }
53
+ }
54
+ return Array.from(namespaces).sort();
55
+ }
56
+ /**
57
+ * Filters out system namespaces from a list.
58
+ *
59
+ * @param namespaces - List of namespace names to filter
60
+ * @param flux_namespace - The Flux system namespace (defaults to 'flux-system')
61
+ * @returns Filtered list excluding system namespaces
62
+ */
63
+ export function filter_system_namespaces(namespaces, flux_namespace = 'flux-system') {
64
+ return namespaces.filter((ns) => !is_system_namespace(ns, flux_namespace));
65
+ }
66
+ /**
67
+ * Checks if a namespace is a system namespace.
68
+ *
69
+ * @param namespace - The namespace to check
70
+ * @param flux_namespace - The Flux system namespace (defaults to 'flux-system')
71
+ * @returns true if the namespace is a system namespace
72
+ */
73
+ export function is_system_namespace(namespace, flux_namespace = 'flux-system') {
74
+ const system_namespaces = get_system_namespaces(flux_namespace);
75
+ if (system_namespaces.has(namespace)) {
76
+ return true;
77
+ }
78
+ // Also filter kube-* namespaces
79
+ return namespace.startsWith('kube-');
80
+ }
81
+ /**
82
+ * Creates a namespace resource.
83
+ */
84
+ export function create_namespace_resource(name, labels) {
85
+ const metadata = { name };
86
+ if (labels !== undefined) {
87
+ metadata.labels = labels;
88
+ }
89
+ return {
90
+ apiVersion: 'v1',
91
+ kind: 'Namespace',
92
+ metadata,
93
+ };
94
+ }
95
+ /**
96
+ * Generates namespace resources for all namespaces in templates.
97
+ * Filters out system namespaces.
98
+ *
99
+ * @param templates - Resolved templates to extract namespaces from
100
+ * @param labels - Optional labels to apply to all namespace resources
101
+ * @param flux_namespace - The Flux system namespace (defaults to 'flux-system')
102
+ * @returns Array of namespace resources
103
+ */
104
+ export function generate_namespace_resources(templates, labels, flux_namespace = 'flux-system') {
105
+ const namespaces = collect_namespaces(templates);
106
+ const filtered = filter_system_namespaces(namespaces, flux_namespace);
107
+ return filtered.map((name) => create_namespace_resource(name, labels));
108
+ }
109
+ //# sourceMappingURL=namespace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"namespace.js","sourceRoot":"","sources":["../../src/generator/namespace.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CAAC,cAAc,GAAG,aAAa;IAClE,OAAO,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,iBAAiB,CAAC,CAAC,CAAC;AAC/F,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,qBAAqB,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ACH,MAAM,UAAU,mBAAmB,CAAC,SAAiB,EAAE,cAAc,GAAG,aAAa;IACnF,MAAM,iBAAiB,GAAG,qBAAqB,CAAC,cAAc,CAAC,CAAC;IAChE,IAAI,iBAAiB,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;QACrC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,gCAAgC;IAChC,OAAO,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;AACvC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,yBAAyB,CACvC,IAAY,EACZ,MAA+B;IAE/B,MAAM,QAAQ,GAAsC,EAAE,IAAI,EAAE,CAAC;IAC7D,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC;IAC3B,CAAC;IACD,OAAO;QACL,UAAU,EAAE,IAAI;QAChB,IAAI,EAAE,WAAW;QACjB,QAAQ;KACT,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,4BAA4B,CAC1C,SAAiC,EACjC,MAA+B,EAC/B,cAAc,GAAG,aAAa;IAE9B,MAAM,UAAU,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC;IACjD,MAAM,QAAQ,GAAG,wBAAwB,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;IAEtE,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,yBAAyB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;AACzE,CAAC"}
@@ -0,0 +1,56 @@
1
+ import type { KustodianErrorType } from '../core/index.js';
2
+ import { type ResultType } from '../core/index.js';
3
+ import type { FluxKustomizationType, GenerationResultType } from './types.js';
4
+ /**
5
+ * Output format options.
6
+ */
7
+ export type OutputFormatType = 'yaml' | 'json';
8
+ /**
9
+ * Options for writing output.
10
+ */
11
+ export interface WriteOptionsType {
12
+ format?: OutputFormatType;
13
+ create_dirs?: boolean;
14
+ }
15
+ /**
16
+ * Serializes a resource to YAML or JSON.
17
+ */
18
+ export declare function serialize_resource<T>(resource: T, format?: OutputFormatType): string;
19
+ /**
20
+ * Serializes multiple resources to a single YAML document with separators.
21
+ */
22
+ export declare function serialize_resources<T>(resources: T[], format?: OutputFormatType): string;
23
+ /**
24
+ * Ensures a directory exists, creating it if necessary.
25
+ */
26
+ export declare function ensure_directory(dir_path: string): Promise<ResultType<void, KustodianErrorType>>;
27
+ /**
28
+ * Writes content to a file.
29
+ */
30
+ export declare function write_file(file_path: string, content: string, options?: WriteOptionsType): Promise<ResultType<void, KustodianErrorType>>;
31
+ /**
32
+ * Writes a Flux Kustomization resource to a file.
33
+ */
34
+ export declare function write_flux_kustomization(kustomization: FluxKustomizationType, output_dir: string, options?: WriteOptionsType): Promise<ResultType<string, KustodianErrorType>>;
35
+ /**
36
+ * Writes all generated kustomizations to a structured output directory.
37
+ *
38
+ * Output structure:
39
+ * ```
40
+ * {output_dir}/
41
+ * ├── flux-system/
42
+ * │ ├── kustomization.yaml # Root kustomization referencing all templates
43
+ * │ ├── oci-repository.yaml # OCI source (if configured)
44
+ * │ └── gotk-patches.yaml # Controller patches (if flux.controllers configured)
45
+ * └── templates/
46
+ * ├── {template-name}/
47
+ * │ └── {kustomization-name}.yaml
48
+ * └── ...
49
+ * ```
50
+ */
51
+ export declare function write_generation_result(result: GenerationResultType, options?: WriteOptionsType): Promise<ResultType<string[], KustodianErrorType>>;
52
+ /**
53
+ * Gets the file extension for a format.
54
+ */
55
+ export declare function get_extension(format: OutputFormatType): string;
56
+ //# sourceMappingURL=output.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/generator/output.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAU,KAAK,UAAU,EAAoB,MAAM,kBAAkB,CAAC;AAE7E,OAAO,KAAK,EAAE,qBAAqB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,171 @@
1
+ import * as fs from 'node:fs/promises';
2
+ import * as path from 'node:path';
3
+ import YAML from 'yaml';
4
+ import { Errors, failure, success } from '../core/index.js';
5
+ /**
6
+ * Serializes a resource to YAML or JSON.
7
+ */
8
+ export function serialize_resource(resource, format = 'yaml') {
9
+ if (format === 'json') {
10
+ return JSON.stringify(resource, null, 2);
11
+ }
12
+ return YAML.stringify(resource, {
13
+ indent: 2,
14
+ lineWidth: 0,
15
+ singleQuote: false,
16
+ });
17
+ }
18
+ /**
19
+ * Serializes multiple resources to a single YAML document with separators.
20
+ */
21
+ export function serialize_resources(resources, format = 'yaml') {
22
+ if (format === 'json') {
23
+ return JSON.stringify(resources, null, 2);
24
+ }
25
+ return resources.map((r) => serialize_resource(r, format)).join('---\n');
26
+ }
27
+ /**
28
+ * Ensures a directory exists, creating it if necessary.
29
+ */
30
+ export async function ensure_directory(dir_path) {
31
+ try {
32
+ await fs.mkdir(dir_path, { recursive: true });
33
+ return success(undefined);
34
+ }
35
+ catch (error) {
36
+ return failure(Errors.file_write_error(dir_path, error));
37
+ }
38
+ }
39
+ /**
40
+ * Writes content to a file.
41
+ */
42
+ export async function write_file(file_path, content, options = {}) {
43
+ const { create_dirs = true } = options;
44
+ if (create_dirs) {
45
+ const dir = path.dirname(file_path);
46
+ const dir_result = await ensure_directory(dir);
47
+ if (!dir_result.success) {
48
+ return dir_result;
49
+ }
50
+ }
51
+ try {
52
+ await fs.writeFile(file_path, content, 'utf-8');
53
+ return success(undefined);
54
+ }
55
+ catch (error) {
56
+ return failure(Errors.file_write_error(file_path, error));
57
+ }
58
+ }
59
+ /**
60
+ * Writes a Flux Kustomization resource to a file.
61
+ */
62
+ export async function write_flux_kustomization(kustomization, output_dir, options = {}) {
63
+ const format = options.format ?? 'yaml';
64
+ const ext = format === 'json' ? 'json' : 'yaml';
65
+ const file_path = path.join(output_dir, `${kustomization.metadata.name}.${ext}`);
66
+ const content = serialize_resource(kustomization, format);
67
+ const result = await write_file(file_path, content, options);
68
+ if (!result.success) {
69
+ return result;
70
+ }
71
+ return success(file_path);
72
+ }
73
+ /**
74
+ * Writes all generated kustomizations to a structured output directory.
75
+ *
76
+ * Output structure:
77
+ * ```
78
+ * {output_dir}/
79
+ * ├── flux-system/
80
+ * │ ├── kustomization.yaml # Root kustomization referencing all templates
81
+ * │ ├── oci-repository.yaml # OCI source (if configured)
82
+ * │ └── gotk-patches.yaml # Controller patches (if flux.controllers configured)
83
+ * └── templates/
84
+ * ├── {template-name}/
85
+ * │ └── {kustomization-name}.yaml
86
+ * └── ...
87
+ * ```
88
+ */
89
+ export async function write_generation_result(result, options = {}) {
90
+ const format = options.format ?? 'yaml';
91
+ const ext = format === 'json' ? 'json' : 'yaml';
92
+ const written_files = [];
93
+ const flux_system_dir = path.join(result.output_dir, 'flux-system');
94
+ const templates_dir = path.join(result.output_dir, 'templates');
95
+ // Write OCIRepository to flux-system directory if present
96
+ if (result.oci_repository) {
97
+ const oci_path = path.join(flux_system_dir, `oci-repository.${ext}`);
98
+ const oci_content = serialize_resource(result.oci_repository, format);
99
+ const oci_result = await write_file(oci_path, oci_content, options);
100
+ if (!oci_result.success) {
101
+ return oci_result;
102
+ }
103
+ written_files.push(oci_path);
104
+ }
105
+ // Write controller patches to flux-system directory if present
106
+ if (result.controller_patches && result.controller_patches.length > 0) {
107
+ const patches_path = path.join(flux_system_dir, 'gotk-patches.yaml');
108
+ const patches_content = serialize_resource(result.controller_patches, format);
109
+ const patches_result = await write_file(patches_path, patches_content, options);
110
+ if (!patches_result.success) {
111
+ return patches_result;
112
+ }
113
+ written_files.push(patches_path);
114
+ }
115
+ // Write each kustomization to templates/{template-name}/{kustomization-name}.yaml
116
+ for (const generated of result.kustomizations) {
117
+ const template_dir = path.join(templates_dir, generated.template);
118
+ const file_path = path.join(template_dir, `${generated.flux_kustomization.metadata.name}.${ext}`);
119
+ const content = serialize_resource(generated.flux_kustomization, format);
120
+ const file_result = await write_file(file_path, content, options);
121
+ if (!file_result.success) {
122
+ return file_result;
123
+ }
124
+ written_files.push(file_path);
125
+ }
126
+ // Write root kustomization.yaml in flux-system directory
127
+ const kustomization_path = path.join(flux_system_dir, 'kustomization.yaml');
128
+ const resources = [];
129
+ // Add OCI repository reference if present
130
+ if (result.oci_repository) {
131
+ resources.push(`oci-repository.${ext}`);
132
+ }
133
+ // Add references to all template kustomizations with relative paths
134
+ resources.push(...result.kustomizations.map((k) => {
135
+ return `../templates/${k.template}/${k.flux_kustomization.metadata.name}.${ext}`;
136
+ }));
137
+ // Sort resources for deterministic output
138
+ resources.sort();
139
+ // Build kustomization object
140
+ const kustomization_obj = {
141
+ apiVersion: 'kustomize.config.k8s.io/v1beta1',
142
+ kind: 'Kustomization',
143
+ resources,
144
+ };
145
+ // Add patches reference if controller patches are present
146
+ if (result.controller_patches && result.controller_patches.length > 0) {
147
+ kustomization_obj.patches = [
148
+ {
149
+ path: 'gotk-patches.yaml',
150
+ target: {
151
+ kind: 'Deployment',
152
+ name: '(kustomize-controller|helm-controller|source-controller)',
153
+ },
154
+ },
155
+ ];
156
+ }
157
+ const kustomization_content = serialize_resource(kustomization_obj, 'yaml');
158
+ const kustomization_result = await write_file(kustomization_path, kustomization_content, options);
159
+ if (!kustomization_result.success) {
160
+ return kustomization_result;
161
+ }
162
+ written_files.push(kustomization_path);
163
+ return success(written_files);
164
+ }
165
+ /**
166
+ * Gets the file extension for a format.
167
+ */
168
+ export function get_extension(format) {
169
+ return format === 'json' ? 'json' : 'yaml';
170
+ }
171
+ //# sourceMappingURL=output.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/generator/output.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,MAAM,EAAmB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAiB7E;;G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AQ,IAAI,CAAC,CAAC,kBAAkB,CAAC,QAAQ,CAAC,IAAI,IAAI,GAAG,EAAE,CAAC;IACnF,CAAC,CAAC,CACH,CAAC;IAEF,0CAA0C;IAC1C,SAAS,CAAC,IAAI,EAAE,CAAC;IAEjB,6BAA6B;IAC7B,MAAM,iBAAiB,GAKnB;QACF,UAAU,EAAE,iCAAiC;QAC7C,IAAI,EAAE,eAAe;QACrB,SAAS;KACV,CAAC;IAEF,0DAA0D;IAC1D,IAAI,MAAM,CAAC,kBAAkB,IAAI,MAAM,CAAC,kBAAkB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtE,iBAAiB,CAAC,OAAO,GAAG;YAC1B;gBACE,IAAI,EAAE,mBAAmB;gBACzB,MAAM,EAAE;oBACN,IAAI,EAAE,YAAY;oBAClB,IAAI,EAAE,0DAA0D;iBACjE;aACF;SACF,CAAC;IACJ,CAAC;IAED,MAAM,qBAAqB,GAAG,kBAAkB,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;IAE5E,MAAM,oBAAoB,GAAG,MAAM,UAAU,CAAC,kBAAkB,EAAE,qBAAqB,EAAE,OAAO,CAAC,CAAC;IAClG,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE,CAAC;QAClC,OAAO,oBAAoB,CAAC;IAC9B,CAAC;IAED,aAAa,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IAEvC,OAAO,OAAO,CAAC,aAAa,CAAC,CAAC;AAChC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,MAAwB;IACpD,OAAO,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;AAC7C,CAAC"}
@@ -0,0 +1,45 @@
1
+ import type { PreservationPolicyType } from '../schema/index.js';
2
+ /**
3
+ * Resource types that are considered stateful and should be preserved by default.
4
+ *
5
+ * This list defines which Kubernetes resources contain state that should not be
6
+ * accidentally deleted when disabling a kustomization.
7
+ */
8
+ export declare const DEFAULT_STATEFUL_RESOURCES: readonly ["PersistentVolumeClaim", "Secret", "ConfigMap"];
9
+ /**
10
+ * Gets the list of resource types that should be preserved based on preservation policy.
11
+ *
12
+ * @param policy - Preservation policy from kustomization configuration
13
+ * @returns Array of Kubernetes resource kinds to preserve
14
+ */
15
+ export declare function get_preserved_resource_types(policy: PreservationPolicyType): string[];
16
+ /**
17
+ * Generates Flux Kustomization patches to label preserved resources.
18
+ *
19
+ * This function creates patches that add a `kustodian.io/preserve: "true"` label
20
+ * to resources that should be kept when a kustomization is disabled.
21
+ *
22
+ * The label-based approach works as follows:
23
+ * 1. Add labels to resources we want to preserve
24
+ * 2. Configure Flux to not prune resources with the preserve label
25
+ * 3. When kustomization is disabled, non-preserved resources are deleted
26
+ * 4. Preserved resources (PVCs, Secrets, etc.) remain in the cluster
27
+ *
28
+ * @param preserved_types - Resource types to keep (from get_preserved_resource_types)
29
+ * @returns Flux patch objects that add preservation labels
30
+ */
31
+ export declare function generate_preservation_patches(preserved_types: string[]): Array<{
32
+ patch: string;
33
+ target: {
34
+ kind: string;
35
+ };
36
+ }>;
37
+ /**
38
+ * Checks if a resource type should be preserved based on the preservation policy.
39
+ *
40
+ * @param resource_kind - Kubernetes resource kind (e.g., 'Deployment', 'PersistentVolumeClaim')
41
+ * @param policy - Preservation policy
42
+ * @returns true if the resource should be preserved, false if it should be deleted
43
+ */
44
+ export declare function should_preserve_resource(resource_kind: string, policy: PreservationPolicyType): boolean;
45
+ //# sourceMappingURL=preservation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preservation.d.ts","sourceRoot":"","sources":["../../src/generator/preservation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAEjE;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,2DAA4D,CAAC;AAEpG;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,sBAAsB,GAAG,MAAM,EAAE,CAiBrF;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,6BAA6B,CAAC,eAAe,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAC9E,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH,CAAC,CAgBD;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAGT"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Resource types that are considered stateful and should be preserved by default.
3
+ *
4
+ * This list defines which Kubernetes resources contain state that should not be
5
+ * accidentally deleted when disabling a kustomization.
6
+ */
7
+ export const DEFAULT_STATEFUL_RESOURCES = ['PersistentVolumeClaim', 'Secret', 'ConfigMap'];
8
+ /**
9
+ * Gets the list of resource types that should be preserved based on preservation policy.
10
+ *
11
+ * @param policy - Preservation policy from kustomization configuration
12
+ * @returns Array of Kubernetes resource kinds to preserve
13
+ */
14
+ export function get_preserved_resource_types(policy) {
15
+ switch (policy.mode) {
16
+ case 'none':
17
+ return [];
18
+ case 'stateful':
19
+ return [...DEFAULT_STATEFUL_RESOURCES];
20
+ case 'custom':
21
+ return policy.keep_resources ?? [];
22
+ default: {
23
+ // Exhaustiveness check
24
+ const _exhaustive = policy.mode;
25
+ throw new Error(`Unknown preservation mode: ${_exhaustive}`);
26
+ }
27
+ }
28
+ }
29
+ /**
30
+ * Generates Flux Kustomization patches to label preserved resources.
31
+ *
32
+ * This function creates patches that add a `kustodian.io/preserve: "true"` label
33
+ * to resources that should be kept when a kustomization is disabled.
34
+ *
35
+ * The label-based approach works as follows:
36
+ * 1. Add labels to resources we want to preserve
37
+ * 2. Configure Flux to not prune resources with the preserve label
38
+ * 3. When kustomization is disabled, non-preserved resources are deleted
39
+ * 4. Preserved resources (PVCs, Secrets, etc.) remain in the cluster
40
+ *
41
+ * @param preserved_types - Resource types to keep (from get_preserved_resource_types)
42
+ * @returns Flux patch objects that add preservation labels
43
+ */
44
+ export function generate_preservation_patches(preserved_types) {
45
+ if (preserved_types.length === 0) {
46
+ return [];
47
+ }
48
+ return preserved_types.map((kind) => ({
49
+ patch: `apiVersion: v1
50
+ kind: ${kind}
51
+ metadata:
52
+ name: preserved-resource
53
+ labels:
54
+ kustodian.io/preserve: "true"`,
55
+ target: {
56
+ kind,
57
+ },
58
+ }));
59
+ }
60
+ /**
61
+ * Checks if a resource type should be preserved based on the preservation policy.
62
+ *
63
+ * @param resource_kind - Kubernetes resource kind (e.g., 'Deployment', 'PersistentVolumeClaim')
64
+ * @param policy - Preservation policy
65
+ * @returns true if the resource should be preserved, false if it should be deleted
66
+ */
67
+ export function should_preserve_resource(resource_kind, policy) {
68
+ const preserved_types = get_preserved_resource_types(policy);
69
+ return preserved_types.includes(resource_kind);
70
+ }
71
+ //# sourceMappingURL=preservation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preservation.js","sourceRoot":"","sources":["../../src/generator/preservation.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,uBAAuB,EAAE,QAAQ,EAAE,WAAW,CAAU,CAAC;AAEpG;;;;;GAKG;AACH,MAAM,UAAU,4BAA4B,CAAC,MAA8B;IACzE,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,MAAM;YACT,OAAO,EAAE,CAAC;QAEZ,KAAK,UAAU;YACb,OAAO,CAAC,GAAG,0BAA0B,CAAC,CAAC;QAEzC,KAAK,QAAQ;YACX,OAAO,MAAM,CAAC,cAAc,IAAI,EAAE,CAAC;QAErC,OAAO,CAAC,CAAC,CAAC;YACR,uBAAuB;YACvB,MAAM,WAAW,GAAU,MAAM,CAAC,IAAI,CAAC;YACvC,MAAM,IAAI,KAAK,CAAC,8BAA8B,WAAW,EAAE,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,6BAA6B,CAAC,eAAyB;IAMrE,IAAI,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACjC,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,eAAe,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACpC,KAAK,EAAE;QACH,IAAI;;;;kCAIsB;QAC9B,MAAM,EAAE;YACN,IAAI;SACL;KACF,CAAC,CAAC,CAAC;AACN,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,wBAAwB,CACtC,aAAqB,EACrB,MAA8B;IAE9B,MAAM,eAAe,GAAG,4BAA4B,CAAC,MAAM,CAAC,CAAC;IAC7D,OAAO,eAAe,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;AACjD,CAAC"}