k8ts 0.13.2 → 0.14.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 (585) hide show
  1. package/dist/common-world.d.ts +3 -8
  2. package/dist/common-world.d.ts.map +1 -1
  3. package/dist/common-world.js +6 -9
  4. package/dist/common-world.js.map +1 -1
  5. package/dist/env/env.d.ts +7 -7
  6. package/dist/env/env.d.ts.map +1 -1
  7. package/dist/env/env.js +21 -23
  8. package/dist/env/env.js.map +1 -1
  9. package/dist/env/error.d.ts +5 -0
  10. package/dist/env/error.d.ts.map +1 -0
  11. package/dist/env/error.js +12 -0
  12. package/dist/env/error.js.map +1 -0
  13. package/dist/env/index.d.ts +1 -1
  14. package/dist/env/index.d.ts.map +1 -1
  15. package/dist/env/types.d.ts +5 -5
  16. package/dist/env/types.d.ts.map +1 -1
  17. package/dist/gvks/apps.d.ts +29 -0
  18. package/dist/gvks/apps.d.ts.map +1 -0
  19. package/dist/gvks/apps.js.map +1 -0
  20. package/dist/gvks/batch.d.ts +17 -0
  21. package/dist/gvks/batch.d.ts.map +1 -0
  22. package/dist/gvks/batch.js.map +1 -0
  23. package/dist/gvks/default.d.ts +73 -0
  24. package/dist/gvks/default.d.ts.map +1 -0
  25. package/dist/gvks/default.js.map +1 -0
  26. package/dist/gvks/gateway.d.ts +29 -0
  27. package/dist/gvks/gateway.d.ts.map +1 -0
  28. package/dist/gvks/gateway.js.map +1 -0
  29. package/dist/gvks/index.d.ts.map +1 -0
  30. package/dist/gvks/index.js.map +1 -0
  31. package/dist/gvks/metrics.d.ts +17 -0
  32. package/dist/gvks/metrics.d.ts.map +1 -0
  33. package/dist/gvks/metrics.js.map +1 -0
  34. package/dist/gvks/networking.d.ts +13 -0
  35. package/dist/gvks/networking.d.ts.map +1 -0
  36. package/dist/gvks/networking.js.map +1 -0
  37. package/dist/gvks/rbac.d.ts +25 -0
  38. package/dist/gvks/rbac.d.ts.map +1 -0
  39. package/dist/gvks/rbac.js.map +1 -0
  40. package/dist/gvks/storage.d.ts +17 -0
  41. package/dist/gvks/storage.d.ts.map +1 -0
  42. package/dist/gvks/storage.js.map +1 -0
  43. package/dist/index.d.ts +2 -2
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +2 -2
  46. package/dist/index.js.map +1 -1
  47. package/dist/kinds.d.ts +2 -0
  48. package/dist/kinds.d.ts.map +1 -0
  49. package/dist/kinds.js +18 -0
  50. package/dist/kinds.js.map +1 -0
  51. package/dist/origins/file/file.d.ts +13 -14
  52. package/dist/origins/file/file.d.ts.map +1 -1
  53. package/dist/origins/file/file.js +14 -17
  54. package/dist/origins/file/file.js.map +1 -1
  55. package/dist/origins/file/index.d.ts +0 -1
  56. package/dist/origins/file/index.d.ts.map +1 -1
  57. package/dist/origins/file/index.js +0 -1
  58. package/dist/origins/file/index.js.map +1 -1
  59. package/dist/origins/file/section.d.ts +11 -11
  60. package/dist/origins/file/section.d.ts.map +1 -1
  61. package/dist/origins/file/section.js +15 -13
  62. package/dist/origins/file/section.js.map +1 -1
  63. package/dist/origins/world.d.ts +6 -5
  64. package/dist/origins/world.d.ts.map +1 -1
  65. package/dist/origins/world.js +9 -5
  66. package/dist/origins/world.js.map +1 -1
  67. package/dist/resources/annotations.d.ts +2 -0
  68. package/dist/resources/annotations.d.ts.map +1 -0
  69. package/dist/resources/{persistent/block-mode.js → annotations.js} +1 -1
  70. package/dist/resources/annotations.js.map +1 -0
  71. package/dist/resources/config/configmap.d.ts +7 -7
  72. package/dist/resources/config/configmap.d.ts.map +1 -1
  73. package/dist/resources/config/configmap.js +7 -6
  74. package/dist/resources/config/configmap.js.map +1 -1
  75. package/dist/resources/config/index.d.ts +0 -1
  76. package/dist/resources/config/index.d.ts.map +1 -1
  77. package/dist/resources/config/index.js +0 -1
  78. package/dist/resources/config/index.js.map +1 -1
  79. package/dist/resources/config/resolver.d.ts +2 -2
  80. package/dist/resources/config/resolver.d.ts.map +1 -1
  81. package/dist/resources/config/resolver.js +4 -3
  82. package/dist/resources/config/resolver.js.map +1 -1
  83. package/dist/resources/config/secret.d.ts +7 -14
  84. package/dist/resources/config/secret.d.ts.map +1 -1
  85. package/dist/resources/config/secret.js +6 -4
  86. package/dist/resources/config/secret.js.map +1 -1
  87. package/dist/resources/errors.d.ts +7 -0
  88. package/dist/resources/errors.d.ts.map +1 -0
  89. package/dist/resources/errors.js +12 -0
  90. package/dist/resources/errors.js.map +1 -0
  91. package/dist/resources/hostpath.d.ts +1 -1
  92. package/dist/resources/hostpath.d.ts.map +1 -1
  93. package/dist/resources/index.d.ts +2 -5
  94. package/dist/resources/index.d.ts.map +1 -1
  95. package/dist/resources/index.js +2 -5
  96. package/dist/resources/index.js.map +1 -1
  97. package/dist/resources/namespace/namespace.d.ts +7 -9
  98. package/dist/resources/namespace/namespace.d.ts.map +1 -1
  99. package/dist/resources/namespace/namespace.js +7 -4
  100. package/dist/resources/namespace/namespace.js.map +1 -1
  101. package/dist/resources/network/http-route/http-route.d.ts +19 -0
  102. package/dist/resources/network/http-route/http-route.d.ts.map +1 -0
  103. package/dist/resources/network/http-route/http-route.js +51 -0
  104. package/dist/resources/network/http-route/http-route.js.map +1 -0
  105. package/dist/resources/network/http-route/index.d.ts.map +1 -0
  106. package/dist/resources/network/http-route/index.js.map +1 -0
  107. package/dist/resources/network/index.d.ts +3 -0
  108. package/dist/resources/network/index.d.ts.map +1 -0
  109. package/dist/resources/network/index.js +19 -0
  110. package/dist/resources/network/index.js.map +1 -0
  111. package/dist/resources/network/service/index.d.ts.map +1 -0
  112. package/dist/resources/network/service/index.js.map +1 -0
  113. package/dist/resources/network/service/service-port.d.ts +12 -0
  114. package/dist/resources/network/service/service-port.d.ts.map +1 -0
  115. package/dist/resources/{service → network/service}/service-port.js +5 -5
  116. package/dist/resources/network/service/service-port.js.map +1 -0
  117. package/dist/resources/network/service/service.d.ts +46 -0
  118. package/dist/resources/network/service/service.d.ts.map +1 -0
  119. package/dist/resources/{service → network/service}/service.js +34 -22
  120. package/dist/resources/network/service/service.js.map +1 -0
  121. package/dist/resources/network/service/utils.d.ts +5 -0
  122. package/dist/resources/network/service/utils.d.ts.map +1 -0
  123. package/dist/resources/network/service/utils.js +22 -0
  124. package/dist/resources/network/service/utils.js.map +1 -0
  125. package/dist/resources/persistent/access-mode.d.ts +4 -7
  126. package/dist/resources/persistent/access-mode.d.ts.map +1 -1
  127. package/dist/resources/persistent/access-mode.js +20 -24
  128. package/dist/resources/persistent/access-mode.js.map +1 -1
  129. package/dist/resources/persistent/claim/pvc.d.ts +17 -20
  130. package/dist/resources/persistent/claim/pvc.d.ts.map +1 -1
  131. package/dist/resources/persistent/claim/pvc.js +22 -28
  132. package/dist/resources/persistent/claim/pvc.js.map +1 -1
  133. package/dist/resources/persistent/index.d.ts +1 -1
  134. package/dist/resources/persistent/index.d.ts.map +1 -1
  135. package/dist/resources/persistent/index.js +1 -1
  136. package/dist/resources/persistent/index.js.map +1 -1
  137. package/dist/resources/persistent/volume/parse-backend.d.ts +1 -1
  138. package/dist/resources/persistent/volume/parse-backend.js +3 -3
  139. package/dist/resources/persistent/volume/parse-backend.js.map +1 -1
  140. package/dist/resources/persistent/volume/pv.d.ts +23 -25
  141. package/dist/resources/persistent/volume/pv.d.ts.map +1 -1
  142. package/dist/resources/persistent/volume/pv.js +23 -29
  143. package/dist/resources/persistent/volume/pv.js.map +1 -1
  144. package/dist/resources/persistent/volume-mode.d.ts +2 -0
  145. package/dist/resources/persistent/volume-mode.d.ts.map +1 -0
  146. package/dist/resources/persistent/volume-mode.js +3 -0
  147. package/dist/resources/persistent/volume-mode.js.map +1 -0
  148. package/dist/resources/rbac/cluster-role-binding.d.ts +12 -12
  149. package/dist/resources/rbac/cluster-role-binding.d.ts.map +1 -1
  150. package/dist/resources/rbac/cluster-role-binding.js +12 -10
  151. package/dist/resources/rbac/cluster-role-binding.js.map +1 -1
  152. package/dist/resources/rbac/cluster-role.d.ts +6 -23
  153. package/dist/resources/rbac/cluster-role.d.ts.map +1 -1
  154. package/dist/resources/rbac/cluster-role.js +9 -18
  155. package/dist/resources/rbac/cluster-role.js.map +1 -1
  156. package/dist/resources/rbac/role-props.d.ts +20 -0
  157. package/dist/resources/rbac/role-props.d.ts.map +1 -0
  158. package/dist/resources/rbac/role-props.js +17 -0
  159. package/dist/resources/rbac/role-props.js.map +1 -0
  160. package/dist/resources/rbac/service-account.d.ts +8 -8
  161. package/dist/resources/rbac/service-account.d.ts.map +1 -1
  162. package/dist/resources/rbac/service-account.js +8 -6
  163. package/dist/resources/rbac/service-account.js.map +1 -1
  164. package/dist/resources/workload/cronjob/index.d.ts +21 -0
  165. package/dist/resources/workload/cronjob/index.d.ts.map +1 -0
  166. package/dist/resources/workload/cronjob/index.js +98 -0
  167. package/dist/resources/workload/cronjob/index.js.map +1 -0
  168. package/dist/resources/workload/daemonset/daemonset.d.ts +16 -0
  169. package/dist/resources/workload/daemonset/daemonset.d.ts.map +1 -0
  170. package/dist/resources/workload/daemonset/daemonset.js +117 -0
  171. package/dist/resources/workload/daemonset/daemonset.js.map +1 -0
  172. package/dist/resources/workload/daemonset/index.d.ts +2 -0
  173. package/dist/resources/workload/daemonset/index.d.ts.map +1 -0
  174. package/dist/resources/workload/daemonset/index.js +18 -0
  175. package/dist/resources/workload/daemonset/index.js.map +1 -0
  176. package/dist/resources/workload/daemonset/props.d.ts +15 -0
  177. package/dist/resources/workload/daemonset/props.d.ts.map +1 -0
  178. package/dist/resources/{pod/container/mounts.js → workload/daemonset/props.js} +1 -1
  179. package/dist/resources/workload/daemonset/props.js.map +1 -0
  180. package/dist/resources/workload/deployment/deployment.d.ts +16 -0
  181. package/dist/resources/workload/deployment/deployment.d.ts.map +1 -0
  182. package/dist/resources/{deployment → workload/deployment}/deployment.js +39 -34
  183. package/dist/resources/workload/deployment/deployment.js.map +1 -0
  184. package/dist/resources/workload/deployment/index.d.ts.map +1 -0
  185. package/dist/resources/workload/deployment/index.js.map +1 -0
  186. package/dist/resources/workload/deployment/props.d.ts +17 -0
  187. package/dist/resources/workload/deployment/props.d.ts.map +1 -0
  188. package/dist/{_type/prefix$.js → resources/workload/deployment/props.js} +1 -1
  189. package/dist/resources/workload/deployment/props.js.map +1 -0
  190. package/dist/resources/workload/index.d.ts +7 -0
  191. package/dist/resources/workload/index.d.ts.map +1 -0
  192. package/dist/resources/{pod → workload}/index.js +6 -3
  193. package/dist/resources/workload/index.js.map +1 -0
  194. package/dist/resources/workload/pod/container/container.d.ts +47 -0
  195. package/dist/resources/workload/pod/container/container.d.ts.map +1 -0
  196. package/dist/resources/{pod → workload/pod}/container/container.js +46 -38
  197. package/dist/resources/workload/pod/container/container.js.map +1 -0
  198. package/dist/resources/workload/pod/container/index.d.ts +3 -0
  199. package/dist/resources/workload/pod/container/index.d.ts.map +1 -0
  200. package/dist/resources/{pod → workload/pod}/container/index.js +1 -0
  201. package/dist/resources/workload/pod/container/index.js.map +1 -0
  202. package/dist/resources/workload/pod/container/mounts/device.d.ts +17 -0
  203. package/dist/resources/workload/pod/container/mounts/device.d.ts.map +1 -0
  204. package/dist/resources/workload/pod/container/mounts/device.js +29 -0
  205. package/dist/resources/workload/pod/container/mounts/device.js.map +1 -0
  206. package/dist/resources/workload/pod/container/mounts/volume.d.ts +21 -0
  207. package/dist/resources/workload/pod/container/mounts/volume.d.ts.map +1 -0
  208. package/dist/resources/{pod → workload/pod}/container/mounts/volume.js +9 -7
  209. package/dist/resources/workload/pod/container/mounts/volume.js.map +1 -0
  210. package/dist/resources/workload/pod/container/ref.d.ts +6 -0
  211. package/dist/resources/workload/pod/container/ref.d.ts.map +1 -0
  212. package/dist/{runner/exporter/meta.js → resources/workload/pod/container/ref.js} +1 -1
  213. package/dist/resources/workload/pod/container/ref.js.map +1 -0
  214. package/dist/resources/workload/pod/container/scope.d.ts +25 -0
  215. package/dist/resources/workload/pod/container/scope.d.ts.map +1 -0
  216. package/dist/resources/workload/pod/container/scope.js +50 -0
  217. package/dist/resources/workload/pod/container/scope.js.map +1 -0
  218. package/dist/resources/workload/pod/container/utils.d.ts +5 -0
  219. package/dist/resources/workload/pod/container/utils.d.ts.map +1 -0
  220. package/dist/resources/workload/pod/container/utils.js +18 -0
  221. package/dist/resources/workload/pod/container/utils.js.map +1 -0
  222. package/dist/resources/workload/pod/pod.d.ts +27 -0
  223. package/dist/resources/workload/pod/pod.d.ts.map +1 -0
  224. package/dist/resources/workload/pod/pod.js +78 -0
  225. package/dist/resources/workload/pod/pod.js.map +1 -0
  226. package/dist/resources/workload/pod/volume/devices.d.ts +24 -0
  227. package/dist/resources/workload/pod/volume/devices.d.ts.map +1 -0
  228. package/dist/resources/{pod → workload/pod}/volume/devices.js +11 -9
  229. package/dist/resources/workload/pod/volume/devices.js.map +1 -0
  230. package/dist/resources/workload/pod/volume/index.d.ts +3 -0
  231. package/dist/resources/workload/pod/volume/index.d.ts.map +1 -0
  232. package/dist/resources/workload/pod/volume/index.js +8 -0
  233. package/dist/resources/workload/pod/volume/index.js.map +1 -0
  234. package/dist/resources/workload/pod/volume/volumes.d.ts +74 -0
  235. package/dist/resources/workload/pod/volume/volumes.d.ts.map +1 -0
  236. package/dist/resources/workload/pod/volume/volumes.js +111 -0
  237. package/dist/resources/workload/pod/volume/volumes.js.map +1 -0
  238. package/dist/resources/workload/statefulset/index.d.ts +2 -0
  239. package/dist/resources/workload/statefulset/index.d.ts.map +1 -0
  240. package/dist/resources/workload/statefulset/index.js +18 -0
  241. package/dist/resources/workload/statefulset/index.js.map +1 -0
  242. package/dist/resources/workload/statefulset/props.d.ts +24 -0
  243. package/dist/resources/workload/statefulset/props.d.ts.map +1 -0
  244. package/dist/{runner/proverbs.js → resources/workload/statefulset/props.js} +1 -1
  245. package/dist/resources/workload/statefulset/props.js.map +1 -0
  246. package/dist/resources/workload/statefulset/scope.d.ts +13 -0
  247. package/dist/resources/workload/statefulset/scope.d.ts.map +1 -0
  248. package/dist/resources/workload/statefulset/scope.js +26 -0
  249. package/dist/resources/workload/statefulset/scope.js.map +1 -0
  250. package/dist/resources/workload/statefulset/statefulset.d.ts +22 -0
  251. package/dist/resources/workload/statefulset/statefulset.d.ts.map +1 -0
  252. package/dist/resources/workload/statefulset/statefulset.js +110 -0
  253. package/dist/resources/workload/statefulset/statefulset.js.map +1 -0
  254. package/dist/resources/workload/util.d.ts +4 -0
  255. package/dist/resources/workload/util.d.ts.map +1 -0
  256. package/dist/resources/workload/util.js +10 -0
  257. package/dist/resources/workload/util.js.map +1 -0
  258. package/dist/resources/workload/workload-ref.d.ts +5 -0
  259. package/dist/resources/workload/workload-ref.d.ts.map +1 -0
  260. package/dist/resources/workload/workload-ref.js +3 -0
  261. package/dist/resources/workload/workload-ref.js.map +1 -0
  262. package/dist/runner/{exporter → engine}/assembler.d.ts +15 -14
  263. package/dist/runner/engine/assembler.d.ts.map +1 -0
  264. package/dist/runner/{exporter → engine}/assembler.js +63 -40
  265. package/dist/runner/engine/assembler.js.map +1 -0
  266. package/dist/runner/engine/index.d.ts +3 -0
  267. package/dist/runner/engine/index.d.ts.map +1 -0
  268. package/dist/runner/{exporter → engine}/index.js +1 -1
  269. package/dist/runner/engine/index.js.map +1 -0
  270. package/dist/runner/engine/loader.d.ts +19 -0
  271. package/dist/runner/engine/loader.d.ts.map +1 -0
  272. package/dist/runner/{exporter → engine}/loader.js +18 -19
  273. package/dist/runner/engine/loader.js.map +1 -0
  274. package/dist/runner/{exporter → engine}/manifester.d.ts +8 -8
  275. package/dist/runner/engine/manifester.d.ts.map +1 -0
  276. package/dist/runner/{exporter → engine}/manifester.js +4 -25
  277. package/dist/runner/engine/manifester.js.map +1 -0
  278. package/dist/runner/{exporter → engine}/saver.d.ts +5 -4
  279. package/dist/runner/engine/saver.d.ts.map +1 -0
  280. package/dist/runner/{exporter → engine}/saver.js +5 -10
  281. package/dist/runner/engine/saver.js.map +1 -0
  282. package/dist/runner/engine/serializer.d.ts +20 -0
  283. package/dist/runner/engine/serializer.d.ts.map +1 -0
  284. package/dist/runner/{exporter → engine}/serializer.js +8 -17
  285. package/dist/runner/engine/serializer.js.map +1 -0
  286. package/dist/runner/{exporter → engine}/stage.d.ts +2 -2
  287. package/dist/runner/engine/stage.d.ts.map +1 -0
  288. package/dist/runner/{exporter → engine}/stage.js +10 -10
  289. package/dist/runner/engine/stage.js.map +1 -0
  290. package/dist/runner/error.d.ts +7 -0
  291. package/dist/runner/error.d.ts.map +1 -0
  292. package/dist/runner/error.js +12 -0
  293. package/dist/runner/error.js.map +1 -0
  294. package/dist/runner/index.d.ts +1 -1
  295. package/dist/runner/index.d.ts.map +1 -1
  296. package/dist/runner/index.js +3 -15
  297. package/dist/runner/index.js.map +1 -1
  298. package/dist/runner/runner.d.ts +8 -6
  299. package/dist/runner/runner.d.ts.map +1 -1
  300. package/dist/runner/runner.js +27 -22
  301. package/dist/runner/runner.js.map +1 -1
  302. package/dist/runner/viz/progress-shower.d.ts +11 -0
  303. package/dist/runner/viz/progress-shower.d.ts.map +1 -0
  304. package/dist/runner/viz/progress-shower.js +63 -0
  305. package/dist/runner/viz/progress-shower.js.map +1 -0
  306. package/dist/runner/{summarizer.d.ts → viz/summarizer.d.ts} +5 -5
  307. package/dist/runner/viz/summarizer.d.ts.map +1 -0
  308. package/dist/runner/{summarizer.js → viz/summarizer.js} +9 -10
  309. package/dist/runner/viz/summarizer.js.map +1 -0
  310. package/dist/util/merge.d.ts +2 -0
  311. package/dist/util/merge.d.ts.map +1 -0
  312. package/dist/util/merge.js +3 -0
  313. package/dist/util/merge.js.map +1 -0
  314. package/package.json +12 -12
  315. package/src/common-world.ts +10 -11
  316. package/src/env/env.ts +33 -35
  317. package/src/env/error.ts +7 -0
  318. package/src/env/index.ts +1 -1
  319. package/src/env/types.ts +5 -5
  320. package/src/index.ts +2 -2
  321. package/src/kinds.ts +1 -0
  322. package/src/origins/file/file.ts +25 -33
  323. package/src/origins/file/index.ts +0 -1
  324. package/src/origins/file/section.ts +17 -16
  325. package/src/origins/world.ts +19 -13
  326. package/src/resources/config/configmap.ts +14 -13
  327. package/src/resources/config/index.ts +0 -1
  328. package/src/resources/config/resolver.ts +8 -5
  329. package/src/resources/config/secret.ts +11 -7
  330. package/src/resources/errors.ts +7 -0
  331. package/src/resources/hostpath.ts +1 -1
  332. package/src/resources/index.ts +2 -5
  333. package/src/resources/namespace/namespace.ts +11 -8
  334. package/src/resources/network/http-route/http-route.ts +62 -0
  335. package/src/resources/network/index.ts +2 -0
  336. package/src/resources/network/service/service-port.ts +17 -0
  337. package/src/resources/network/service/service.ts +135 -0
  338. package/src/resources/network/service/utils.ts +20 -0
  339. package/src/resources/persistent/access-mode.ts +20 -24
  340. package/src/resources/persistent/claim/pvc.ts +41 -43
  341. package/src/resources/persistent/index.ts +1 -1
  342. package/src/resources/persistent/volume/parse-backend.ts +3 -3
  343. package/src/resources/persistent/volume/pv.ts +55 -51
  344. package/src/resources/persistent/volume-mode.ts +1 -0
  345. package/src/resources/rbac/cluster-role-binding.ts +19 -17
  346. package/src/resources/rbac/cluster-role.ts +13 -62
  347. package/src/resources/rbac/role-props.ts +26 -0
  348. package/src/resources/rbac/service-account.ts +14 -12
  349. package/src/resources/workload/cronjob/index.ts +74 -0
  350. package/src/resources/workload/daemonset/daemonset.ts +82 -0
  351. package/src/resources/workload/daemonset/index.ts +1 -0
  352. package/src/resources/workload/daemonset/props.ts +19 -0
  353. package/src/resources/workload/deployment/deployment.ts +79 -0
  354. package/src/resources/workload/deployment/props.ts +19 -0
  355. package/src/resources/workload/index.ts +6 -0
  356. package/src/resources/workload/pod/container/container.ts +227 -0
  357. package/src/resources/{pod → workload/pod}/container/index.ts +1 -0
  358. package/src/resources/workload/pod/container/mounts/device.ts +41 -0
  359. package/src/resources/workload/pod/container/mounts/volume.ts +46 -0
  360. package/src/resources/workload/pod/container/ref.ts +6 -0
  361. package/src/resources/workload/pod/container/scope.ts +83 -0
  362. package/src/resources/workload/pod/container/utils.ts +16 -0
  363. package/src/resources/workload/pod/pod.ts +96 -0
  364. package/src/resources/workload/pod/volume/devices.ts +56 -0
  365. package/src/resources/workload/pod/volume/index.ts +2 -0
  366. package/src/resources/workload/pod/volume/volumes.ts +203 -0
  367. package/src/resources/workload/statefulset/index.ts +1 -0
  368. package/src/resources/workload/statefulset/props.ts +34 -0
  369. package/src/resources/workload/statefulset/scope.ts +25 -0
  370. package/src/resources/workload/statefulset/statefulset.ts +137 -0
  371. package/src/resources/workload/util.ts +8 -0
  372. package/src/resources/workload/workload-ref.ts +5 -0
  373. package/src/runner/{exporter → engine}/assembler.ts +83 -54
  374. package/src/runner/engine/index.ts +2 -0
  375. package/src/runner/{exporter → engine}/loader.ts +32 -29
  376. package/src/runner/{exporter → engine}/manifester.ts +20 -32
  377. package/src/runner/{exporter → engine}/saver.ts +8 -9
  378. package/src/runner/{exporter → engine}/serializer.ts +21 -20
  379. package/src/runner/{exporter → engine}/stage.ts +5 -5
  380. package/src/runner/error.ts +7 -0
  381. package/src/runner/index.ts +1 -1
  382. package/src/runner/runner.ts +44 -29
  383. package/src/runner/{exporter → viz}/progress-shower.ts +21 -21
  384. package/src/runner/{summarizer.ts → viz/summarizer.ts} +21 -21
  385. package/dist/_type/prefix$.d.ts +0 -4
  386. package/dist/_type/prefix$.d.ts.map +0 -1
  387. package/dist/_type/prefix$.js.map +0 -1
  388. package/dist/kinds/apps.d.ts +0 -29
  389. package/dist/kinds/apps.d.ts.map +0 -1
  390. package/dist/kinds/apps.js.map +0 -1
  391. package/dist/kinds/batch.d.ts +0 -17
  392. package/dist/kinds/batch.d.ts.map +0 -1
  393. package/dist/kinds/batch.js.map +0 -1
  394. package/dist/kinds/default.d.ts +0 -73
  395. package/dist/kinds/default.d.ts.map +0 -1
  396. package/dist/kinds/default.js.map +0 -1
  397. package/dist/kinds/gateway.d.ts +0 -29
  398. package/dist/kinds/gateway.d.ts.map +0 -1
  399. package/dist/kinds/gateway.js.map +0 -1
  400. package/dist/kinds/index.d.ts.map +0 -1
  401. package/dist/kinds/index.js.map +0 -1
  402. package/dist/kinds/metrics.d.ts +0 -17
  403. package/dist/kinds/metrics.d.ts.map +0 -1
  404. package/dist/kinds/metrics.js.map +0 -1
  405. package/dist/kinds/networking.d.ts +0 -13
  406. package/dist/kinds/networking.d.ts.map +0 -1
  407. package/dist/kinds/networking.js.map +0 -1
  408. package/dist/kinds/rbac.d.ts +0 -25
  409. package/dist/kinds/rbac.d.ts.map +0 -1
  410. package/dist/kinds/rbac.js.map +0 -1
  411. package/dist/kinds/storage.d.ts +0 -17
  412. package/dist/kinds/storage.d.ts.map +0 -1
  413. package/dist/kinds/storage.js.map +0 -1
  414. package/dist/origins/file/modifier.d.ts +0 -10
  415. package/dist/origins/file/modifier.d.ts.map +0 -1
  416. package/dist/origins/file/modifier.js +0 -21
  417. package/dist/origins/file/modifier.js.map +0 -1
  418. package/dist/resources/config/config-keys-of.d.ts +0 -2
  419. package/dist/resources/config/config-keys-of.d.ts.map +0 -1
  420. package/dist/resources/config/config-keys-of.js +0 -3
  421. package/dist/resources/config/config-keys-of.js.map +0 -1
  422. package/dist/resources/config/key-ref.d.ts +0 -7
  423. package/dist/resources/config/key-ref.d.ts.map +0 -1
  424. package/dist/resources/config/key-ref.js +0 -13
  425. package/dist/resources/config/key-ref.js.map +0 -1
  426. package/dist/resources/cronjob/index.d.ts +0 -20
  427. package/dist/resources/cronjob/index.d.ts.map +0 -1
  428. package/dist/resources/cronjob/index.js +0 -37
  429. package/dist/resources/cronjob/index.js.map +0 -1
  430. package/dist/resources/deployment/deployment.d.ts +0 -30
  431. package/dist/resources/deployment/deployment.d.ts.map +0 -1
  432. package/dist/resources/deployment/deployment.js.map +0 -1
  433. package/dist/resources/deployment/index.d.ts.map +0 -1
  434. package/dist/resources/deployment/index.js.map +0 -1
  435. package/dist/resources/http-route/http-route.d.ts +0 -21
  436. package/dist/resources/http-route/http-route.d.ts.map +0 -1
  437. package/dist/resources/http-route/http-route.js +0 -45
  438. package/dist/resources/http-route/http-route.js.map +0 -1
  439. package/dist/resources/http-route/index.d.ts.map +0 -1
  440. package/dist/resources/http-route/index.js.map +0 -1
  441. package/dist/resources/persistent/block-mode.d.ts +0 -2
  442. package/dist/resources/persistent/block-mode.d.ts.map +0 -1
  443. package/dist/resources/persistent/block-mode.js.map +0 -1
  444. package/dist/resources/pod/container/container.d.ts +0 -47
  445. package/dist/resources/pod/container/container.d.ts.map +0 -1
  446. package/dist/resources/pod/container/container.js.map +0 -1
  447. package/dist/resources/pod/container/index.d.ts +0 -2
  448. package/dist/resources/pod/container/index.d.ts.map +0 -1
  449. package/dist/resources/pod/container/index.js.map +0 -1
  450. package/dist/resources/pod/container/mounts/device.d.ts +0 -17
  451. package/dist/resources/pod/container/mounts/device.d.ts.map +0 -1
  452. package/dist/resources/pod/container/mounts/device.js +0 -27
  453. package/dist/resources/pod/container/mounts/device.js.map +0 -1
  454. package/dist/resources/pod/container/mounts/volume.d.ts +0 -21
  455. package/dist/resources/pod/container/mounts/volume.d.ts.map +0 -1
  456. package/dist/resources/pod/container/mounts/volume.js.map +0 -1
  457. package/dist/resources/pod/container/mounts.d.ts +0 -3
  458. package/dist/resources/pod/container/mounts.d.ts.map +0 -1
  459. package/dist/resources/pod/container/mounts.js.map +0 -1
  460. package/dist/resources/pod/index.d.ts +0 -4
  461. package/dist/resources/pod/index.d.ts.map +0 -1
  462. package/dist/resources/pod/index.js.map +0 -1
  463. package/dist/resources/pod/pod-template.d.ts +0 -54
  464. package/dist/resources/pod/pod-template.d.ts.map +0 -1
  465. package/dist/resources/pod/pod-template.js +0 -119
  466. package/dist/resources/pod/pod-template.js.map +0 -1
  467. package/dist/resources/pod/volume/devices.d.ts +0 -24
  468. package/dist/resources/pod/volume/devices.d.ts.map +0 -1
  469. package/dist/resources/pod/volume/devices.js.map +0 -1
  470. package/dist/resources/pod/volume/index.d.ts +0 -3
  471. package/dist/resources/pod/volume/index.d.ts.map +0 -1
  472. package/dist/resources/pod/volume/index.js +0 -8
  473. package/dist/resources/pod/volume/index.js.map +0 -1
  474. package/dist/resources/pod/volume/volumes.d.ts +0 -66
  475. package/dist/resources/pod/volume/volumes.d.ts.map +0 -1
  476. package/dist/resources/pod/volume/volumes.js +0 -97
  477. package/dist/resources/pod/volume/volumes.js.map +0 -1
  478. package/dist/resources/service/index.d.ts.map +0 -1
  479. package/dist/resources/service/index.js.map +0 -1
  480. package/dist/resources/service/service-port.d.ts +0 -12
  481. package/dist/resources/service/service-port.d.ts.map +0 -1
  482. package/dist/resources/service/service-port.js.map +0 -1
  483. package/dist/resources/service/service.d.ts +0 -39
  484. package/dist/resources/service/service.d.ts.map +0 -1
  485. package/dist/resources/service/service.js.map +0 -1
  486. package/dist/resources/utils/adapters.d.ts +0 -7
  487. package/dist/resources/utils/adapters.d.ts.map +0 -1
  488. package/dist/resources/utils/adapters.js +0 -32
  489. package/dist/resources/utils/adapters.js.map +0 -1
  490. package/dist/runner/exporter/assembler.d.ts.map +0 -1
  491. package/dist/runner/exporter/assembler.js.map +0 -1
  492. package/dist/runner/exporter/index.d.ts +0 -3
  493. package/dist/runner/exporter/index.d.ts.map +0 -1
  494. package/dist/runner/exporter/index.js.map +0 -1
  495. package/dist/runner/exporter/loader.d.ts +0 -18
  496. package/dist/runner/exporter/loader.d.ts.map +0 -1
  497. package/dist/runner/exporter/loader.js.map +0 -1
  498. package/dist/runner/exporter/manifester.d.ts.map +0 -1
  499. package/dist/runner/exporter/manifester.js.map +0 -1
  500. package/dist/runner/exporter/meta.d.ts +0 -2
  501. package/dist/runner/exporter/meta.d.ts.map +0 -1
  502. package/dist/runner/exporter/meta.js.map +0 -1
  503. package/dist/runner/exporter/progress-shower.d.ts +0 -11
  504. package/dist/runner/exporter/progress-shower.d.ts.map +0 -1
  505. package/dist/runner/exporter/progress-shower.js +0 -69
  506. package/dist/runner/exporter/progress-shower.js.map +0 -1
  507. package/dist/runner/exporter/saver.d.ts.map +0 -1
  508. package/dist/runner/exporter/saver.js.map +0 -1
  509. package/dist/runner/exporter/serializer.d.ts +0 -19
  510. package/dist/runner/exporter/serializer.d.ts.map +0 -1
  511. package/dist/runner/exporter/serializer.js.map +0 -1
  512. package/dist/runner/exporter/stage.d.ts.map +0 -1
  513. package/dist/runner/exporter/stage.js.map +0 -1
  514. package/dist/runner/exporter/validator.d.ts +0 -16
  515. package/dist/runner/exporter/validator.d.ts.map +0 -1
  516. package/dist/runner/exporter/validator.js +0 -12
  517. package/dist/runner/exporter/validator.js.map +0 -1
  518. package/dist/runner/paths.d.ts +0 -2
  519. package/dist/runner/paths.d.ts.map +0 -1
  520. package/dist/runner/paths.js +0 -5
  521. package/dist/runner/paths.js.map +0 -1
  522. package/dist/runner/proverbs.d.ts +0 -2
  523. package/dist/runner/proverbs.d.ts.map +0 -1
  524. package/dist/runner/proverbs.js.map +0 -1
  525. package/dist/runner/silly/proverbs.d.ts +0 -7
  526. package/dist/runner/silly/proverbs.d.ts.map +0 -1
  527. package/dist/runner/silly/proverbs.js +0 -21
  528. package/dist/runner/silly/proverbs.js.map +0 -1
  529. package/dist/runner/summarizer.d.ts.map +0 -1
  530. package/dist/runner/summarizer.js.map +0 -1
  531. package/proverbs.txt +0 -20
  532. package/src/_type/prefix$.ts +0 -3
  533. package/src/origins/file/modifier.ts +0 -21
  534. package/src/resources/config/key-ref.ts +0 -8
  535. package/src/resources/cronjob/index.ts +0 -50
  536. package/src/resources/deployment/deployment.ts +0 -95
  537. package/src/resources/http-route/http-route.ts +0 -60
  538. package/src/resources/persistent/block-mode.ts +0 -1
  539. package/src/resources/pod/container/container.ts +0 -215
  540. package/src/resources/pod/container/mounts/device.ts +0 -33
  541. package/src/resources/pod/container/mounts/volume.ts +0 -38
  542. package/src/resources/pod/container/mounts.ts +0 -2
  543. package/src/resources/pod/index.ts +0 -3
  544. package/src/resources/pod/pod-template.ts +0 -166
  545. package/src/resources/pod/volume/devices.ts +0 -55
  546. package/src/resources/pod/volume/index.ts +0 -2
  547. package/src/resources/pod/volume/volumes.ts +0 -170
  548. package/src/resources/service/service-port.ts +0 -17
  549. package/src/resources/service/service.ts +0 -101
  550. package/src/resources/utils/adapters.ts +0 -29
  551. package/src/runner/exporter/index.ts +0 -2
  552. package/src/runner/exporter/validator.ts +0 -13
  553. package/src/runner/paths.ts +0 -1
  554. package/src/runner/proverbs.ts +0 -0
  555. package/src/runner/silly/proverbs.ts +0 -14
  556. /package/dist/{kinds → gvks}/apps.js +0 -0
  557. /package/dist/{kinds → gvks}/batch.js +0 -0
  558. /package/dist/{kinds → gvks}/default.js +0 -0
  559. /package/dist/{kinds → gvks}/gateway.js +0 -0
  560. /package/dist/{kinds → gvks}/index.d.ts +0 -0
  561. /package/dist/{kinds → gvks}/index.js +0 -0
  562. /package/dist/{kinds → gvks}/metrics.js +0 -0
  563. /package/dist/{kinds → gvks}/networking.js +0 -0
  564. /package/dist/{kinds → gvks}/rbac.js +0 -0
  565. /package/dist/{kinds → gvks}/storage.js +0 -0
  566. /package/dist/resources/{http-route → network/http-route}/index.d.ts +0 -0
  567. /package/dist/resources/{http-route → network/http-route}/index.js +0 -0
  568. /package/dist/resources/{service → network/service}/index.d.ts +0 -0
  569. /package/dist/resources/{service → network/service}/index.js +0 -0
  570. /package/dist/resources/{deployment → workload/deployment}/index.d.ts +0 -0
  571. /package/dist/resources/{deployment → workload/deployment}/index.js +0 -0
  572. /package/src/{kinds → gvks}/apps.ts +0 -0
  573. /package/src/{kinds → gvks}/batch.ts +0 -0
  574. /package/src/{kinds → gvks}/default.ts +0 -0
  575. /package/src/{kinds → gvks}/gateway.ts +0 -0
  576. /package/src/{kinds → gvks}/index.ts +0 -0
  577. /package/src/{kinds → gvks}/metrics.ts +0 -0
  578. /package/src/{kinds → gvks}/networking.ts +0 -0
  579. /package/src/{kinds → gvks}/rbac.ts +0 -0
  580. /package/src/{kinds → gvks}/storage.ts +0 -0
  581. /package/src/resources/{config/config-keys-of.ts → annotations.ts} +0 -0
  582. /package/src/resources/{http-route → network/http-route}/index.ts +0 -0
  583. /package/src/resources/{service → network/service}/index.ts +0 -0
  584. /package/src/resources/{deployment → workload/deployment}/index.ts +0 -0
  585. /package/src/{runner/exporter/meta.ts → util/merge.ts} +0 -0
@@ -1,19 +1,22 @@
1
- import { Rsc_Top } from "@k8ts/instruments"
2
- import { v1 } from "../../kinds/default"
3
- export interface Namespace_Props {}
1
+ import { K8sResource, type Resource_Props_Top } from "@k8ts/instruments"
2
+ import { K8S } from "@k8ts/sample-interfaces"
3
+ import { merge } from "lodash"
4
+ import { v1 } from "../../gvks/default"
5
+ export interface NamespaceProps extends Resource_Props_Top<K8S.NamespaceSpec> {}
4
6
 
5
- export class Namespace<Name extends string = string> extends Rsc_Top<Name, Namespace_Props> {
6
- constructor(name: Name, props: Namespace_Props = {}) {
7
+ export class Namespace<Name extends string = string> extends K8sResource<Name, NamespaceProps> {
8
+ constructor(name: Name, props: NamespaceProps = {}) {
7
9
  super(name, props)
8
10
  }
9
- declare name: Name
10
11
  get kind() {
11
12
  return v1.Namespace._
12
13
  }
13
14
 
14
- protected body() {
15
+ protected __body__(): K8S.KubeNamespaceProps {
16
+ const spec = {} satisfies K8S.NamespaceSpec
17
+ const spec2 = merge(spec, this.props.$$manifest)
15
18
  return {
16
- spec: {}
19
+ spec: spec2
17
20
  }
18
21
  }
19
22
  }
@@ -0,0 +1,62 @@
1
+ import { K8sResource, type ResourceRef, type Resource_Props_Top } from "@k8ts/instruments"
2
+ import { K8S } from "@k8ts/sample-interfaces"
3
+ import { merge } from "lodash"
4
+ import { gateway } from "../../../gvks/gateway"
5
+ import type { Service_PortRef } from "../service/service-port"
6
+
7
+ export interface HttpRoute_Props<Ports extends string>
8
+ extends Resource_Props_Top<K8S.HttpRouteSpec> {
9
+ $gateway: ResourceRef<gateway.v1.Gateway._>
10
+ $hostname: string
11
+ $backend: Service_PortRef<Ports>
12
+ }
13
+
14
+ export class HttpRoute<Name extends string, Ports extends string> extends K8sResource<
15
+ Name,
16
+ HttpRoute_Props<Ports>
17
+ > {
18
+ get kind() {
19
+ return gateway.v1.HttpRoute._
20
+ }
21
+
22
+ private _getBackendRef() {
23
+ const backendRef: K8S.HttpRouteSpecRulesBackendRefs = {
24
+ kind: "Service",
25
+ namespace: this.props.$backend.service.ident.namespace,
26
+ name: this.props.$backend.service.ident.name,
27
+ port: this.props.$backend.number()
28
+ }
29
+ return backendRef
30
+ }
31
+
32
+ protected __body__(): K8S.HttpRouteProps {
33
+ const self = this
34
+ const backendRef = this._getBackendRef()
35
+ const spec = {
36
+ parentRefs: [
37
+ {
38
+ kind: "Gateway",
39
+ name: self.props.$gateway.ident.name,
40
+ namespace: self.props.$gateway.ident.namespace
41
+ }
42
+ ],
43
+ hostnames: [self.props.$hostname],
44
+ rules: [
45
+ {
46
+ backendRefs: [backendRef]
47
+ }
48
+ ]
49
+ } satisfies K8S.HttpRouteSpec
50
+ const spec2 = merge(spec, self.props.$$manifest)
51
+ return {
52
+ spec: spec2
53
+ }
54
+ }
55
+
56
+ protected __needs__() {
57
+ return {
58
+ gateway: this.props.$gateway,
59
+ service: this.props.$backend.service
60
+ }
61
+ }
62
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./http-route"
2
+ export * from "./service"
@@ -0,0 +1,17 @@
1
+ import { Service, type Service_Ref } from "./service"
2
+
3
+ export interface Service_PortRef_Props<Port extends string> {
4
+ service: Service_Ref<Port>
5
+ name: Port
6
+ }
7
+
8
+ export class Service_PortRef<Port extends string> {
9
+ constructor(readonly props: Service_PortRef_Props<Port>) {}
10
+ get service() {
11
+ return this.props.service
12
+ }
13
+
14
+ number() {
15
+ return this.props.service.cast(Service).ports.get(this.props.name).frontend
16
+ }
17
+ }
@@ -0,0 +1,135 @@
1
+ import {
2
+ K8sResource,
3
+ ResourceRef,
4
+ type Ip4_Input_String,
5
+ type PortMap,
6
+ type PortMapping_Input,
7
+ type Resource_Props_Top
8
+ } from "@k8ts/instruments"
9
+ import { K8S } from "@k8ts/sample-interfaces"
10
+ import { seq } from "doddle"
11
+ import { merge } from "lodash"
12
+ import { v1 } from "../../../gvks/index"
13
+ import { K8tsResourceError } from "../../errors"
14
+ import type { Workload_Ref } from "../../workload/workload-ref"
15
+ import { Service_PortRef } from "./service-port"
16
+ import { toServicePorts } from "./utils"
17
+
18
+ /** Short for ClusterIp with ClusterIp: None */
19
+ export interface Service_Frontend_Headless {
20
+ type: "Headless"
21
+ }
22
+ export interface Sevice_Frontend_ClusterIp {
23
+ type: "ClusterIP"
24
+ clusterIp?: Ip4_Input_String | "None"
25
+ }
26
+
27
+ export interface Service_Frontend_LoadBalancer {
28
+ type: "LoadBalancer"
29
+ loadBalancerIP?: Ip4_Input_String
30
+ loadBalancerSourceRanges?: string[]
31
+ loadBalancerClass?: string
32
+ allocateLoadBalancerNodePorts?: boolean
33
+ clusterIp?: Ip4_Input_String
34
+ }
35
+ export type Service_Frontend =
36
+ | Sevice_Frontend_ClusterIp
37
+ | Service_Frontend_LoadBalancer
38
+ | Service_Frontend_Headless
39
+ export interface Service_Props<DeployPorts extends string, ExposedPorts extends DeployPorts>
40
+ extends Resource_Props_Top<K8S.ServiceSpec> {
41
+ $ports: PortMapping_Input<ExposedPorts>
42
+ $backend: Workload_Ref<DeployPorts>
43
+ $frontend: Service_Frontend
44
+ }
45
+ export interface Service_Ref<PortsExposed extends string> extends ResourceRef<v1.Service._> {
46
+ ports: PortMap<PortsExposed>
47
+ }
48
+
49
+ export class Service<
50
+ Name extends string = string,
51
+ PortsExposed extends string = string
52
+ > extends K8sResource<Name, Service_Props<string, PortsExposed>> {
53
+ __PORTS__!: PortsExposed
54
+ get kind() {
55
+ return v1.Service._
56
+ }
57
+
58
+ private get _backend() {
59
+ return this.props.$backend
60
+ }
61
+ get ports() {
62
+ const srcPorts = this._backend.ports
63
+ const knownPorts = seq(Object.entries(this.props.$ports))
64
+ .filter(([, v]) => v !== undefined)
65
+ .map(([k]) => k)
66
+ .toArray()
67
+ .pull() as PortsExposed[]
68
+ const svcPorts = srcPorts.pick(...knownPorts).map(this.props.$ports as any)
69
+ return svcPorts
70
+ }
71
+
72
+ protected override __needs__() {
73
+ return {
74
+ backend: this._backend
75
+ }
76
+ }
77
+
78
+ portRef(name: PortsExposed) {
79
+ return new Service_PortRef({
80
+ service: this,
81
+ name: name
82
+ })
83
+ }
84
+
85
+ get hostname() {
86
+ return `${this.ident.name}.${this.ident.namespace}.svc.cluster.local`
87
+ }
88
+
89
+ private _getProtoPort(port: PortsExposed, protocol: "http" | "https") {
90
+ const portNumber = this.props.$ports[port]
91
+ if (portNumber === 80 && protocol === "http") {
92
+ return ""
93
+ }
94
+ if (portNumber === 443 && protocol === "https") {
95
+ return ""
96
+ }
97
+ if (portNumber === undefined) {
98
+ throw new K8tsResourceError(`Port ${port} is not defined in service ${this.ident.name}`)
99
+ }
100
+ return `:${portNumber}`
101
+ }
102
+
103
+ private _frontend() {
104
+ if (this.props.$frontend.type === "Headless") {
105
+ return {
106
+ type: "ClusterIP",
107
+ clusterIp: "None"
108
+ } satisfies K8S.ServiceSpec
109
+ }
110
+ return this.props.$frontend satisfies K8S.ServiceSpec
111
+ }
112
+
113
+ protected __body__(): K8S.KubeServiceProps {
114
+ const self = this
115
+ const svcPorts = self.ports
116
+ const spec = {
117
+ ...self._frontend(),
118
+
119
+ ports: toServicePorts(svcPorts),
120
+ selector: {
121
+ app: self.props.$backend.ident.name
122
+ }
123
+ } satisfies K8S.ServiceSpec
124
+ const spec2 = merge(spec, self.props.$$manifest)
125
+ const body = {
126
+ spec: spec2
127
+ }
128
+
129
+ return body
130
+ }
131
+
132
+ address(protocol: "http" | "https", port: PortsExposed) {
133
+ return `${protocol}://${this.hostname}${this._getProtoPort(port, protocol)}`
134
+ }
135
+ }
@@ -0,0 +1,20 @@
1
+ import type { PortMap, PortMap_Item } from "@k8ts/instruments"
2
+ import { K8S } from "@k8ts/sample-interfaces"
3
+ import { seq } from "doddle"
4
+
5
+ export function toServicePort(entry: PortMap_Item): K8S.ServicePort {
6
+ return {
7
+ port: entry.frontend,
8
+ targetPort: K8S.IntOrString.fromString(entry.name),
9
+ protocol: entry.protocol,
10
+ name: entry.name
11
+ }
12
+ }
13
+
14
+ export function toServicePorts(ports: PortMap<any>) {
15
+ return seq
16
+ .fromObject(ports.values)
17
+ .map(([, entry]) => toServicePort(entry))
18
+ .toArray()
19
+ .pull()
20
+ }
@@ -1,29 +1,25 @@
1
- export type Access = Access.Pv_AccessMode_Inputs
1
+ export type PvAccessMode_Explicit = "ReadWriteOnce" | "ReadOnlyMany" | "ReadWriteMany"
2
+ export type PvAccessMode = PvAccessMode_Explicit | "RWX" | "ROX" | "RWO"
3
+ export type PvAccessMode_Many = PvAccessMode | PvAccessMode[]
2
4
 
3
- export namespace Access {
4
- export type Pv_AccessMode = "ReadWriteOnce" | "ReadOnlyMany" | "ReadWriteMany"
5
- export type Pv_AccessMode_Input = Pv_AccessMode | "RWX" | "ROX" | "RWO"
6
- export type Pv_AccessMode_Inputs = Pv_AccessMode_Input | Pv_AccessMode_Input[]
7
-
8
- function parseOne(mode: Pv_AccessMode_Input): Pv_AccessMode {
9
- switch (mode) {
10
- case "RWX":
11
- case "ReadWriteMany":
12
- return "ReadWriteMany"
13
- case "ROX":
14
- case "ReadOnlyMany":
15
- return "ReadOnlyMany"
16
- case "RWO":
17
- case "ReadWriteOnce":
18
- return "ReadWriteOnce"
19
- }
5
+ function parseOne(mode: PvAccessMode): PvAccessMode_Explicit {
6
+ switch (mode) {
7
+ case "RWX":
8
+ case "ReadWriteMany":
9
+ return "ReadWriteMany"
10
+ case "ROX":
11
+ case "ReadOnlyMany":
12
+ return "ReadOnlyMany"
13
+ case "RWO":
14
+ case "ReadWriteOnce":
15
+ return "ReadWriteOnce"
20
16
  }
17
+ }
21
18
 
22
- export function pv_parseAccessMode(modes: Pv_AccessMode_Inputs): Pv_AccessMode[] {
23
- if (Array.isArray(modes)) {
24
- return modes.map(parseOne)
25
- } else {
26
- return [parseOne(modes)]
27
- }
19
+ export function parsePvAccessMode(modes: PvAccessMode_Many): PvAccessMode_Explicit[] {
20
+ if (Array.isArray(modes)) {
21
+ return modes.map(parseOne)
22
+ } else {
23
+ return [parseOne(modes)]
28
24
  }
29
25
  }
@@ -1,31 +1,34 @@
1
- import { ResourcesSpec, Rsc_Top, Unit, type Rsc_Ref } from "@k8ts/instruments"
2
- import { CDK } from "@k8ts/sample-interfaces"
3
- import { Prefix$ } from "../../../_type/prefix$"
4
- import { MakeError } from "../../../error"
5
- import { v1 } from "../../../kinds/default"
6
- import { storage } from "../../../kinds/storage"
7
- import { Access } from "../access-mode"
8
- import type { Pv_VolumeMode } from "../block-mode"
9
- import type { Pv, Pv_Ref } from "../volume"
1
+ import {
2
+ K8sResource,
3
+ Reqs,
4
+ Units,
5
+ type ResourceRef,
6
+ type Resource_Props_Top
7
+ } from "@k8ts/instruments"
8
+ import { K8S } from "@k8ts/sample-interfaces"
9
+ import { merge } from "lodash"
10
+ import { v1 } from "../../../gvks/default"
11
+ import { storage } from "../../../gvks/storage"
12
+ import { parsePvAccessMode, type PvAccessMode_Many } from "../access-mode"
13
+ import type { Pv_Ref } from "../volume"
14
+ import type { PvVolumeMode } from "../volume-mode"
10
15
 
11
- const StorageClassKind = storage.v1.StorageClass._
12
-
13
- const pvc_ResourcesSpec = ResourcesSpec.make({
14
- storage: Unit.Data
16
+ const pvcReqs = new Reqs({
17
+ storage: Units.Data
15
18
  })
16
- type Pvc_Resources = Prefix$<(typeof pvc_ResourcesSpec)["__INPUT__"]>
17
- export interface Pvc_Props<Mode extends Pv_VolumeMode> extends Pvc_Resources {
18
- $accessModes: Access
19
+ export interface Pvc_Props<Mode extends PvVolumeMode>
20
+ extends Resource_Props_Top<K8S.KubePersistentVolumeClaimProps> {
21
+ $accessModes: PvAccessMode_Many
19
22
  $mode?: Mode
20
- $storageClass?: Rsc_Ref<typeof StorageClassKind>
21
- $bind?: Pv_Ref<Mode>
23
+ $storageClass?: ResourceRef<storage.v1.StorageClass._>
24
+ $volume?: Pv_Ref<Mode>
25
+ $resources: typeof pvcReqs.__INPUT__
22
26
  }
23
27
 
24
- export class Pvc<Mode extends Pv_VolumeMode, Name extends string = string> extends Rsc_Top<
28
+ export class Pvc<Mode extends PvVolumeMode, Name extends string = string> extends K8sResource<
25
29
  Name,
26
30
  Pvc_Props<Mode>
27
31
  > {
28
- declare name: Name
29
32
  get kind() {
30
33
  return v1.PersistentVolumeClaim._
31
34
  }
@@ -33,34 +36,29 @@ export class Pvc<Mode extends Pv_VolumeMode, Name extends string = string> exten
33
36
  protected __needs__() {
34
37
  const self = this
35
38
  return {
36
- bind: self.bound,
39
+ bind: self.props.$volume,
37
40
  storageClass: self.props.$storageClass
38
41
  }
39
42
  }
40
- protected body(): CDK.KubePersistentVolumeClaimProps {
43
+ protected __body__(): K8S.KubePersistentVolumeClaimProps {
41
44
  const self = this
42
- const { $storage, $accessModes, $mode, $storageClass, $bind } = self.props
43
- const nAccessModes = Access.pv_parseAccessMode($accessModes)
44
- if (!$bind && !$storageClass) {
45
- throw new MakeError(
46
- `While manifesting ${self.node.format("source")}, PVC that doesn't have a $bind must have a $storageClass.`
47
- )
48
- }
45
+ const { $resources, $accessModes, $mode, $storageClass, $volume } = self.props
46
+ const nAccessModes = parsePvAccessMode($accessModes)
47
+
48
+ const spec = {
49
+ accessModes: nAccessModes,
50
+ volumeName: self.props.$volume?.ident.name,
51
+ volumeMode: $mode,
52
+ resources: pvcReqs
53
+ .parse({
54
+ storage: $resources.storage
55
+ })
56
+ .toObject(),
57
+ storageClassName: self.props.$storageClass?.ident.name ?? "standard"
58
+ } satisfies K8S.PersistentVolumeClaimSpec
59
+ const spec2 = merge(spec, self.props.$$manifest)
49
60
  return {
50
- spec: {
51
- accessModes: nAccessModes,
52
- volumeName: self.props.$bind?.name,
53
- volumeMode: $mode,
54
- resources: pvc_ResourcesSpec
55
- .parse({
56
- storage: $storage
57
- })
58
- .toObject(),
59
- storageClassName: self.props.$storageClass?.name ?? "standard"
60
- }
61
+ spec: spec2
61
62
  }
62
63
  }
63
- get bound() {
64
- return this.props.$bind as Pv<Mode> | undefined
65
- }
66
64
  }
@@ -1,4 +1,4 @@
1
1
  export * from "./access-mode"
2
- export * from "./block-mode"
3
2
  export * from "./claim"
4
3
  export * from "./volume"
4
+ export * from "./volume-mode"
@@ -1,4 +1,4 @@
1
- import { MakeError } from "../../../error"
1
+ import { K8tsResourceError } from "../../errors"
2
2
  import type { Pv_Backend } from "./pv"
3
3
  export function parseBackend(backend?: Pv_Backend) {
4
4
  switch (backend?.kind) {
@@ -9,7 +9,7 @@ export function parseBackend(backend?: Pv_Backend) {
9
9
  return {
10
10
  hostPath: {
11
11
  path: backend.path,
12
- type: backend.hostpathType
12
+ type: backend.type
13
13
  }
14
14
  }
15
15
  case "Local":
@@ -26,7 +26,7 @@ export function parseBackend(backend?: Pv_Backend) {
26
26
  }
27
27
  }
28
28
  default:
29
- throw new MakeError(`Unknown backend kind!`, {
29
+ throw new K8tsResourceError(`Unknown backend kind!`, {
30
30
  backend
31
31
  })
32
32
  }
@@ -1,50 +1,59 @@
1
- import { Rsc_Ref, Rsc_Top, type Unit } from "@k8ts/instruments"
2
- import { CDK } from "@k8ts/sample-interfaces"
3
- import { MakeError } from "../../../error"
4
- import { v1 } from "../../../kinds/default"
5
- import { storage } from "../../../kinds/storage"
6
- import type { HostPathType } from "../../hostpath"
7
- import { Access } from "../access-mode"
8
- import type { Pv_VolumeMode } from "../block-mode"
1
+ import {
2
+ K8sResource,
3
+ ResourceRef,
4
+ toCdkQuantityRecord,
5
+ Units,
6
+ type Resource_Props_Top
7
+ } from "@k8ts/instruments"
8
+ import { K8S } from "@k8ts/sample-interfaces"
9
+ import { merge } from "lodash"
10
+ import { v1 } from "../../../gvks/default"
11
+ import { storage } from "../../../gvks/storage"
12
+ import { K8tsResourceError } from "../../errors"
13
+ import type { HostPath_Type } from "../../hostpath"
14
+ import { parsePvAccessMode, type PvAccessMode_Many } from "../access-mode"
15
+ import type { PvVolumeMode } from "../volume-mode"
9
16
  import { parseBackend } from "./parse-backend"
10
17
 
11
18
  const StorageClassKind = storage.v1.StorageClass._
12
19
 
13
20
  export interface Pv_Backend_HostPath {
14
21
  kind: "HostPath"
15
- hostpathType: HostPathType
22
+ type: HostPath_Type
16
23
  path: string
17
24
  }
18
25
  export interface Pv_Backend_Local {
19
26
  kind: "Local"
20
27
  path: string
21
28
  }
22
- export interface Pv_Backend_Nfs {
29
+ export interface Pv_Backend_NFS {
23
30
  kind: "NFS"
24
31
  server: string
25
32
  path: string
26
33
  }
27
34
 
28
- export type Pv_Backend = Pv_Backend_HostPath | Pv_Backend_Local | Pv_Backend_Nfs
29
- export interface Pv_Props_K8ts<Mode extends Pv_VolumeMode = Pv_VolumeMode> {
30
- $accessModes: Access
31
- $storageClass?: Rsc_Ref<storage.v1.StorageClass._>
35
+ export type Pv_Backend = Pv_Backend_HostPath | Pv_Backend_Local | Pv_Backend_NFS
36
+ export interface Pv_Props<Mode extends PvVolumeMode = PvVolumeMode>
37
+ extends Resource_Props_Top<K8S.PersistentVolumeSpec> {
38
+ $accessModes: PvAccessMode_Many
39
+ $storageClass?: ResourceRef<storage.v1.StorageClass._>
32
40
  $mode?: Mode
33
- reclaimPolicy?: Reclaim
34
- $capacity: Unit.Data
41
+ $reclaimPolicy?: Pv_ReclaimMode
42
+ $capacity: {
43
+ storage: Units.Data
44
+ }
35
45
  $backend?: Pv_Backend
36
- mountOptions?: string[]
37
- nodeAffinity?: CDK.VolumeNodeAffinity
38
- }
39
- export type Reclaim = "Retain" | "Delete" | "Recycle"
40
- export type Pv_Ref<Mode extends Pv_VolumeMode = Pv_VolumeMode> = Rsc_Ref<v1.PersistentVolume._> & {
41
- __MODE__: Mode
42
46
  }
47
+ export type Pv_ReclaimMode = "Retain" | "Delete" | "Recycle"
48
+ export type Pv_Ref<Mode extends PvVolumeMode = PvVolumeMode> =
49
+ ResourceRef<v1.PersistentVolume._> & {
50
+ __MODE__: Mode
51
+ }
43
52
 
44
53
  export class Pv<
45
- Mode extends Pv_VolumeMode = "Filesystem",
54
+ Mode extends PvVolumeMode = "Filesystem",
46
55
  Name extends string = string
47
- > extends Rsc_Top<Name, Pv_Props_K8ts<Mode>> {
56
+ > extends K8sResource<Name, Pv_Props<Mode>> {
48
57
  __MODE__!: Mode
49
58
  get kind() {
50
59
  return v1.PersistentVolume._
@@ -55,41 +64,36 @@ export class Pv<
55
64
  storageClass: this.props.$storageClass
56
65
  }
57
66
  }
58
- protected body() {
67
+ protected __body__(): K8S.KubePersistentVolumeProps {
59
68
  const self = this
60
- const pvProps = self.props
61
- const accessModes = Access.pv_parseAccessMode(pvProps.$accessModes)
62
- if (self.props.$backend?.kind === "Local") {
63
- if (!pvProps.nodeAffinity) {
64
- throw new MakeError(
65
- `While manifesting ${self.node.format("source")}, PV with Local backend must have nodeAffinity.`
66
- )
67
- }
68
- }
69
+ const accessModes = parsePvAccessMode(self.props.$accessModes)
70
+ // Make sure it parses correctly
71
+ Units.Data.parse(self.props.$capacity.storage)
72
+
69
73
  if (!self.props.$backend && !self.props.$storageClass) {
70
- throw new MakeError(
71
- `While manifesting ${self.node.format("source")}, PV that doesn't have a $backend must have a $storageClass.`
74
+ throw new K8tsResourceError(
75
+ `While manifesting ${self.__vertex__.format("source")}, PV that doesn't have a $backend must have a $storageClass.`
72
76
  )
73
77
  }
74
- let base: CDK.PersistentVolumeSpec = {
78
+ let spec: K8S.PersistentVolumeSpec = {
75
79
  accessModes,
76
- storageClassName: pvProps.$storageClass?.name ?? "standard",
77
- capacity: pvProps.$capacity
78
- ? {
79
- storage: CDK.Quantity.fromString(pvProps.$capacity)
80
- }
81
- : undefined,
82
- volumeMode: pvProps.$mode ?? "Filesystem",
83
- mountOptions: pvProps.mountOptions,
84
- persistentVolumeReclaimPolicy: pvProps.reclaimPolicy ?? "Retain",
85
- nodeAffinity: pvProps.nodeAffinity
80
+ storageClassName: self.props.$storageClass?.ident.name ?? "standard",
81
+ capacity: toCdkQuantityRecord(self.props.$capacity),
82
+ volumeMode: self.props.$mode ?? "Filesystem",
83
+ persistentVolumeReclaimPolicy: self.props.$reclaimPolicy ?? "Retain"
84
+ }
85
+ spec = {
86
+ ...spec,
87
+ ...parseBackend(self.props.$backend)
86
88
  }
87
- base = {
88
- ...base,
89
- ...parseBackend(pvProps.$backend)
89
+ spec = merge(spec, self.props.$$manifest)
90
+ if (!spec.nodeAffinity) {
91
+ throw new K8tsResourceError(
92
+ `While manifesting ${self.__vertex__.format("source")}, PV with Local backend must have nodeAffinity.`
93
+ )
90
94
  }
91
95
  return {
92
- spec: base
96
+ spec
93
97
  }
94
98
  }
95
99
  }
@@ -0,0 +1 @@
1
+ export type PvVolumeMode = "Block" | "Filesystem"
@@ -1,15 +1,16 @@
1
- import { Rsc_Top } from "@k8ts/instruments"
2
- import { CDK } from "@k8ts/sample-interfaces"
3
- import { rbac } from "../../kinds/rbac"
4
- import type { ClusterRole } from "./cluster-role"
5
- import type { ServiceAccount } from "./service-account"
1
+ import { K8sResource, type Resource_Props_Top, type ResourceRef } from "@k8ts/instruments"
2
+ import { K8S } from "@k8ts/sample-interfaces"
3
+ import { merge } from "lodash"
4
+ import type { v1 } from "../../gvks"
5
+ import { rbac } from "../../gvks/rbac"
6
6
 
7
- export interface ClusterRoleBoding_Props {
8
- $role: ClusterRole
9
- $subjects: ServiceAccount[]
7
+ export interface ClusterRoleBoding_Props
8
+ extends Resource_Props_Top<K8S.KubeClusterRoleBindingProps> {
9
+ $role: ResourceRef<rbac.v1.ClusterRole._>
10
+ $subjects: ResourceRef<v1.ServiceAccount._>[]
10
11
  }
11
12
 
12
- export class ClusterRoleBinding<Name extends string = string> extends Rsc_Top<
13
+ export class ClusterRoleBinding<Name extends string = string> extends K8sResource<
13
14
  Name,
14
15
  ClusterRoleBoding_Props
15
16
  > {
@@ -23,18 +24,19 @@ export class ClusterRoleBinding<Name extends string = string> extends Rsc_Top<
23
24
  subjects: this.props.$subjects
24
25
  }
25
26
  }
26
- protected body(): CDK.KubeClusterRoleBindingProps {
27
- return {
27
+ protected __body__(): K8S.KubeClusterRoleBindingProps {
28
+ const body = {
28
29
  roleRef: {
29
- apiGroup: this.props.$role.kind.parent!.parent!.text,
30
- kind: this.props.$role.kind.name,
31
- name: this.props.$role.name
30
+ apiGroup: this.props.$role.kind.parent!.parent!.url,
31
+ kind: this.props.$role.kind.value,
32
+ name: this.props.$role.ident.name
32
33
  },
33
34
  subjects: this.props.$subjects.map(sa => ({
34
- kind: sa.kind.name,
35
- name: sa.name,
36
- namespace: sa.namespace!
35
+ kind: sa.kind.value,
36
+ name: sa.ident.name,
37
+ namespace: sa.ident.namespace!
37
38
  }))
38
39
  }
40
+ return merge(body, this.props.$$manifest)
39
41
  }
40
42
  }