@intentius/chant-lexicon-k8s 0.124.98 → 0.124.100

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 (941) hide show
  1. package/dist/actions/apps.d.ts +0 -1
  2. package/dist/actions/batch.d.ts +0 -1
  3. package/dist/actions/core.d.ts +0 -1
  4. package/dist/actions/index.d.ts +0 -1
  5. package/dist/actions/networking.d.ts +0 -1
  6. package/dist/actions/rbac.d.ts +0 -1
  7. package/dist/api/classify.d.ts +0 -1
  8. package/dist/api/connect.d.ts +0 -1
  9. package/dist/api/fake-cluster.d.ts +0 -1
  10. package/dist/api/operation-surface.d.ts +0 -1
  11. package/dist/api/owner-chain.d.ts +0 -1
  12. package/dist/api/sweep-types.d.ts +0 -1
  13. package/dist/application-paths.d.ts +0 -1
  14. package/dist/application-set.d.ts +0 -1
  15. package/dist/behaviour-kinds.d.ts +0 -1
  16. package/dist/cluster-secret.d.ts +0 -1
  17. package/dist/codegen/docs-cli.d.ts +0 -1
  18. package/dist/codegen/docs.d.ts +0 -1
  19. package/dist/codegen/generate-cli.d.ts +0 -1
  20. package/dist/codegen/generate-lexicon.d.ts +7 -1
  21. package/dist/codegen/generate-lexicon.js +2 -0
  22. package/dist/codegen/generate-list-map-keys.d.ts +0 -1
  23. package/dist/codegen/generate-operations.d.ts +0 -1
  24. package/dist/codegen/generate-typescript.d.ts +0 -1
  25. package/dist/codegen/generate.d.ts +0 -1
  26. package/dist/codegen/naming.d.ts +0 -1
  27. package/dist/codegen/package.d.ts +0 -1
  28. package/dist/codegen/patches.d.ts +0 -1
  29. package/dist/codegen/typecheck.d.ts +0 -1
  30. package/dist/codegen/versions.d.ts +0 -1
  31. package/dist/components/argo-app.d.ts +0 -1
  32. package/dist/components/builders.d.ts +0 -1
  33. package/dist/components/capability-plugin.d.ts +0 -1
  34. package/dist/components/flux-reconcile.d.ts +0 -1
  35. package/dist/components/index.d.ts +0 -1
  36. package/dist/components/kubectl-apply.d.ts +0 -1
  37. package/dist/components/kustomize-apply.d.ts +0 -1
  38. package/dist/composites/adot-collector.d.ts +0 -1
  39. package/dist/composites/agic-ingress.d.ts +0 -1
  40. package/dist/composites/aks-external-dns-agent.d.ts +0 -1
  41. package/dist/composites/alb-ingress.d.ts +0 -1
  42. package/dist/composites/argo-app.d.ts +0 -1
  43. package/dist/composites/autoscaled-service.d.ts +0 -1
  44. package/dist/composites/azure-disk-storage-class.d.ts +0 -1
  45. package/dist/composites/azure-file-storage-class.d.ts +0 -1
  46. package/dist/composites/azure-monitor-collector.d.ts +0 -1
  47. package/dist/composites/batch-job.d.ts +0 -1
  48. package/dist/composites/catalog.d.ts +0 -1
  49. package/dist/composites/cockroachdb-cluster.d.ts +0 -1
  50. package/dist/composites/cockroachdb-region-stack.d.ts +0 -1
  51. package/dist/composites/config-connector-context.d.ts +0 -1
  52. package/dist/composites/configured-app.d.ts +0 -1
  53. package/dist/composites/cron-schedule.d.ts +0 -1
  54. package/dist/composites/cron-workload.d.ts +0 -1
  55. package/dist/composites/ebs-storage-class.d.ts +0 -1
  56. package/dist/composites/efs-storage-class.d.ts +0 -1
  57. package/dist/composites/external-dns-agent.d.ts +0 -1
  58. package/dist/composites/filestore-storage-class.d.ts +0 -1
  59. package/dist/composites/fluent-bit-agent.d.ts +0 -1
  60. package/dist/composites/flux-app.d.ts +0 -1
  61. package/dist/composites/gce-ingress.d.ts +0 -1
  62. package/dist/composites/gce-pd-storage-class.d.ts +0 -1
  63. package/dist/composites/gke-external-dns-agent.d.ts +0 -1
  64. package/dist/composites/gke-fluent-bit-agent.d.ts +0 -1
  65. package/dist/composites/gke-gateway.d.ts +0 -1
  66. package/dist/composites/gke-otel-collector.d.ts +0 -1
  67. package/dist/composites/index.d.ts +0 -1
  68. package/dist/composites/inference-service.d.ts +0 -1
  69. package/dist/composites/irsa-service-account.d.ts +0 -1
  70. package/dist/composites/member-defaults.d.ts +0 -1
  71. package/dist/composites/metrics-server.d.ts +0 -1
  72. package/dist/composites/model.d.ts +0 -1
  73. package/dist/composites/monitored-service.d.ts +0 -1
  74. package/dist/composites/namespace-env.d.ts +0 -1
  75. package/dist/composites/network-isolated-app.d.ts +0 -1
  76. package/dist/composites/node-agent.d.ts +0 -1
  77. package/dist/composites/operator-stack.d.ts +0 -1
  78. package/dist/composites/otel-collector-agent.d.ts +0 -1
  79. package/dist/composites/otel-collector-gateway.d.ts +0 -1
  80. package/dist/composites/otel-collector-node.d.ts +0 -1
  81. package/dist/composites/otel-collector-rbac.d.ts +0 -1
  82. package/dist/composites/otel-collector-shape.d.ts +0 -1
  83. package/dist/composites/otel-collector.d.ts +0 -1
  84. package/dist/composites/otel-operator-collector.d.ts +0 -1
  85. package/dist/composites/ray-cluster.d.ts +0 -1
  86. package/dist/composites/ray-job.d.ts +0 -1
  87. package/dist/composites/ray-service.d.ts +0 -1
  88. package/dist/composites/secure-ingress.d.ts +0 -1
  89. package/dist/composites/security-context.d.ts +0 -1
  90. package/dist/composites/sidecar-app.d.ts +0 -1
  91. package/dist/composites/stateful-app.d.ts +0 -1
  92. package/dist/composites/vllm-serving-runtime.d.ts +0 -1
  93. package/dist/composites/web-app.d.ts +0 -1
  94. package/dist/composites/worker-pool.d.ts +0 -1
  95. package/dist/composites/workload-identity-sa.d.ts +0 -1
  96. package/dist/composites/workload-identity-service-account.d.ts +0 -1
  97. package/dist/config-schema.d.ts +0 -1
  98. package/dist/config.d.ts +0 -1
  99. package/dist/coverage.d.ts +0 -1
  100. package/dist/crd/crd-sources.d.ts +0 -1
  101. package/dist/crd/loader.d.ts +0 -1
  102. package/dist/crd/oci-chart.d.ts +0 -1
  103. package/dist/crd/parser.d.ts +0 -1
  104. package/dist/crd/parser.js +3 -0
  105. package/dist/crd/project-codegen.d.ts +0 -1
  106. package/dist/crd/types.d.ts +0 -1
  107. package/dist/deep-observe-hooks.d.ts +0 -1
  108. package/dist/deep-observe.d.ts +0 -1
  109. package/dist/default-labels.d.ts +0 -1
  110. package/dist/describe-resources.d.ts +0 -1
  111. package/dist/describe-stack-status.d.ts +0 -1
  112. package/dist/detect.d.ts +0 -1
  113. package/dist/effect-receipt-row.d.ts +0 -1
  114. package/dist/export-resources.d.ts +0 -1
  115. package/dist/generated/index.d.ts +0 -1
  116. package/{src → dist}/generated/lexicon-k8s.json +1984 -155
  117. package/dist/generated/runtime.d.ts +0 -1
  118. package/dist/group-namespace.d.ts +0 -1
  119. package/dist/helm-references.d.ts +0 -1
  120. package/dist/import/directory.d.ts +7 -0
  121. package/dist/import/directory.js +103 -0
  122. package/dist/import/embedded.d.ts +3 -1
  123. package/dist/import/embedded.js +34 -0
  124. package/dist/import/generator.d.ts +2 -3
  125. package/dist/import/generator.js +6 -2
  126. package/dist/import/live-export.d.ts +0 -1
  127. package/dist/import/parser.d.ts +0 -1
  128. package/dist/import/parser.js +34 -7
  129. package/dist/import/testdata/embedded/fixtures.d.ts +0 -1
  130. package/dist/import/typed-classes.d.ts +21 -2
  131. package/dist/import/typed-classes.js +41 -3
  132. package/dist/include/entity.d.ts +0 -1
  133. package/dist/include/resolve.d.ts +0 -1
  134. package/dist/index-identity.d.ts +0 -1
  135. package/dist/index-import.d.ts +0 -1
  136. package/dist/index.d.ts +0 -1
  137. package/dist/integrity.json +5 -3
  138. package/dist/kube/apply.d.ts +0 -1
  139. package/dist/kube/connect.d.ts +0 -1
  140. package/dist/kube/delete.d.ts +0 -1
  141. package/dist/kube/describe.d.ts +0 -1
  142. package/dist/kube/events.d.ts +0 -1
  143. package/dist/kube/flags.d.ts +0 -1
  144. package/dist/kube/get.d.ts +0 -1
  145. package/dist/kube/group.d.ts +0 -1
  146. package/dist/kube/logs.d.ts +0 -1
  147. package/dist/kube/project.d.ts +0 -1
  148. package/dist/kube/render.d.ts +0 -1
  149. package/dist/kube/source.d.ts +0 -1
  150. package/dist/kube/target.d.ts +0 -1
  151. package/dist/kube/testing.d.ts +0 -1
  152. package/dist/kube/top.d.ts +0 -1
  153. package/dist/kube/verdict.d.ts +0 -1
  154. package/dist/kube/wait.d.ts +0 -1
  155. package/dist/kustomize/render.d.ts +0 -1
  156. package/dist/kustomize/rendered-entity.d.ts +0 -1
  157. package/dist/kustomize/root.d.ts +0 -1
  158. package/dist/lint/audit-catalog.d.ts +0 -1
  159. package/dist/lint/audit-catalog.js +1 -0
  160. package/dist/lint/audit-lineage.d.ts +0 -1
  161. package/dist/lint/post-synth/argo-helpers.d.ts +0 -1
  162. package/dist/lint/post-synth/argo002.d.ts +0 -1
  163. package/dist/lint/post-synth/argo003.d.ts +0 -1
  164. package/dist/lint/post-synth/argo005.d.ts +0 -1
  165. package/dist/lint/post-synth/crd-schema-helpers.d.ts +0 -1
  166. package/dist/lint/post-synth/flux002.d.ts +0 -1
  167. package/dist/lint/post-synth/flux003.d.ts +0 -1
  168. package/dist/lint/post-synth/index.d.ts +0 -1
  169. package/dist/lint/post-synth/index.js +2 -0
  170. package/dist/lint/post-synth/k8s-helpers.d.ts +0 -1
  171. package/dist/lint/post-synth/monitoring-selection-helpers.d.ts +0 -1
  172. package/dist/lint/post-synth/otel-placement-helpers.d.ts +0 -1
  173. package/dist/lint/post-synth/sops-helpers.d.ts +0 -1
  174. package/dist/lint/post-synth/top-level-fields-helpers.d.ts +16 -0
  175. package/dist/lint/post-synth/top-level-fields-helpers.js +45 -0
  176. package/dist/lint/post-synth/wk8005.d.ts +0 -1
  177. package/dist/lint/post-synth/wk8006.d.ts +0 -1
  178. package/dist/lint/post-synth/wk8041.d.ts +0 -1
  179. package/dist/lint/post-synth/wk8042.d.ts +0 -1
  180. package/dist/lint/post-synth/wk8101.d.ts +0 -1
  181. package/dist/lint/post-synth/wk8102.d.ts +0 -1
  182. package/dist/lint/post-synth/wk8103.d.ts +0 -1
  183. package/dist/lint/post-synth/wk8104.d.ts +0 -1
  184. package/dist/lint/post-synth/wk8105.d.ts +0 -1
  185. package/dist/lint/post-synth/wk8201.d.ts +0 -1
  186. package/dist/lint/post-synth/wk8202.d.ts +0 -1
  187. package/dist/lint/post-synth/wk8203.d.ts +0 -1
  188. package/dist/lint/post-synth/wk8204.d.ts +0 -1
  189. package/dist/lint/post-synth/wk8205.d.ts +0 -1
  190. package/dist/lint/post-synth/wk8207.d.ts +0 -1
  191. package/dist/lint/post-synth/wk8208.d.ts +0 -1
  192. package/dist/lint/post-synth/wk8209.d.ts +0 -1
  193. package/dist/lint/post-synth/wk8301.d.ts +0 -1
  194. package/dist/lint/post-synth/wk8302.d.ts +0 -1
  195. package/dist/lint/post-synth/wk8303.d.ts +0 -1
  196. package/dist/lint/post-synth/wk8304.d.ts +0 -1
  197. package/dist/lint/post-synth/wk8305.d.ts +0 -1
  198. package/dist/lint/post-synth/wk8306.d.ts +0 -1
  199. package/dist/lint/post-synth/wk8401.d.ts +0 -1
  200. package/dist/lint/post-synth/wk8402.d.ts +0 -1
  201. package/dist/lint/post-synth/wk8403.d.ts +0 -1
  202. package/dist/lint/post-synth/wk8404.d.ts +0 -1
  203. package/dist/lint/post-synth/wk8405.d.ts +0 -1
  204. package/dist/lint/post-synth/wk8406.d.ts +0 -1
  205. package/dist/lint/post-synth/wk8407.d.ts +0 -1
  206. package/dist/lint/post-synth/wk8501.d.ts +0 -1
  207. package/dist/lint/post-synth/wk8502.d.ts +0 -1
  208. package/dist/lint/post-synth/wk8503.d.ts +0 -1
  209. package/dist/lint/post-synth/wk8504.d.ts +0 -1
  210. package/dist/lint/post-synth/wk8505.d.ts +0 -1
  211. package/dist/lint/post-synth/wk8506.d.ts +14 -0
  212. package/dist/lint/post-synth/wk8506.js +38 -0
  213. package/dist/lint/post-synth/wk8601.d.ts +0 -1
  214. package/dist/lint/post-synth/wk8602.d.ts +0 -1
  215. package/dist/lint/post-synth/wk8603.d.ts +0 -1
  216. package/dist/lint/post-synth/wk8604.d.ts +0 -1
  217. package/dist/lint/post-synth/wk8605.d.ts +0 -1
  218. package/dist/lint/post-synth/wk8606.d.ts +0 -1
  219. package/dist/lint/post-synth/wk8701.d.ts +0 -1
  220. package/dist/lint/post-synth/wk8702.d.ts +0 -1
  221. package/dist/lint/post-synth/wk8703.d.ts +0 -1
  222. package/dist/lint/post-synth/wk8704.d.ts +0 -1
  223. package/dist/lint/post-synth/wk8705.d.ts +0 -1
  224. package/dist/lint/rules/argo-appset-single-project.d.ts +0 -1
  225. package/dist/lint/rules/argo-ast.d.ts +0 -1
  226. package/dist/lint/rules/argo-automated-prune.d.ts +0 -1
  227. package/dist/lint/rules/flux-source-ref-pin.d.ts +0 -1
  228. package/dist/lint/rules/hardcoded-namespace.d.ts +0 -1
  229. package/dist/lint/rules/latest-image-tag.d.ts +0 -1
  230. package/dist/lint/rules/missing-resource-limits.d.ts +0 -1
  231. package/dist/listed-types.d.ts +0 -1
  232. package/dist/lsp/completions.d.ts +0 -1
  233. package/dist/lsp/hover.d.ts +0 -1
  234. package/dist/manifest-entity.d.ts +0 -1
  235. package/dist/manifest-files.d.ts +16 -0
  236. package/dist/manifest-files.js +24 -0
  237. package/dist/manifest.json +1 -1
  238. package/dist/meta.json +1984 -155
  239. package/dist/micro-time.d.ts +0 -1
  240. package/dist/okf/index.md +1 -0
  241. package/dist/okf/rules/WK8506.md +11 -0
  242. package/dist/op/activities/apply-diff.d.ts +0 -1
  243. package/dist/op/activities/argo.d.ts +0 -1
  244. package/dist/op/activities/ensure-secret.d.ts +0 -1
  245. package/dist/op/activities/index.d.ts +0 -1
  246. package/dist/op/activities/kubectl.d.ts +0 -1
  247. package/dist/op/activities/wait-for-ready.d.ts +0 -1
  248. package/dist/op/builders.d.ts +0 -1
  249. package/dist/package-cli.d.ts +0 -1
  250. package/dist/patch/json-patch.d.ts +0 -1
  251. package/dist/patch/rendered-patch.d.ts +0 -1
  252. package/dist/plugin.d.ts +0 -1
  253. package/dist/plugin.js +2 -0
  254. package/dist/project-kinds.d.ts +0 -1
  255. package/dist/receipt-store.d.ts +0 -1
  256. package/dist/reference-catalog.d.ts +0 -1
  257. package/dist/rules/top-level-fields-helpers.ts +54 -0
  258. package/dist/rules/wk8506.ts +43 -0
  259. package/dist/secret-labels.d.ts +0 -1
  260. package/dist/secret-store.d.ts +0 -1
  261. package/dist/serializer.d.ts +0 -1
  262. package/dist/sops/encrypted-secret-file.d.ts +0 -1
  263. package/dist/sops/entity.d.ts +0 -1
  264. package/dist/spec/fetch.d.ts +0 -1
  265. package/dist/spec/parse.d.ts +6 -1
  266. package/dist/spec/parse.js +1 -0
  267. package/dist/subscribe-changes.d.ts +0 -1
  268. package/dist/teardown.d.ts +0 -1
  269. package/dist/telemetry-release.d.ts +0 -1
  270. package/dist/top-level-fields.d.ts +24 -0
  271. package/dist/top-level-fields.js +35 -0
  272. package/dist/validate-cli.d.ts +0 -1
  273. package/dist/validate.d.ts +0 -1
  274. package/dist/variables.d.ts +0 -1
  275. package/dist/whoami.d.ts +0 -1
  276. package/dist/workspace-member.d.ts +0 -1
  277. package/dist/workspace-member.js +1 -9
  278. package/package.json +12 -13
  279. package/dist/actions/apps.d.ts.map +0 -1
  280. package/dist/actions/batch.d.ts.map +0 -1
  281. package/dist/actions/core.d.ts.map +0 -1
  282. package/dist/actions/index.d.ts.map +0 -1
  283. package/dist/actions/networking.d.ts.map +0 -1
  284. package/dist/actions/rbac.d.ts.map +0 -1
  285. package/dist/api/classify.d.ts.map +0 -1
  286. package/dist/api/connect.d.ts.map +0 -1
  287. package/dist/api/fake-cluster.d.ts.map +0 -1
  288. package/dist/api/operation-surface.d.ts.map +0 -1
  289. package/dist/api/owner-chain.d.ts.map +0 -1
  290. package/dist/api/sweep-types.d.ts.map +0 -1
  291. package/dist/application-paths.d.ts.map +0 -1
  292. package/dist/application-set.d.ts.map +0 -1
  293. package/dist/behaviour-kinds.d.ts.map +0 -1
  294. package/dist/cluster-secret.d.ts.map +0 -1
  295. package/dist/codegen/docs-cli.d.ts.map +0 -1
  296. package/dist/codegen/docs.d.ts.map +0 -1
  297. package/dist/codegen/generate-cli.d.ts.map +0 -1
  298. package/dist/codegen/generate-lexicon.d.ts.map +0 -1
  299. package/dist/codegen/generate-list-map-keys.d.ts.map +0 -1
  300. package/dist/codegen/generate-operations.d.ts.map +0 -1
  301. package/dist/codegen/generate-typescript.d.ts.map +0 -1
  302. package/dist/codegen/generate.d.ts.map +0 -1
  303. package/dist/codegen/naming.d.ts.map +0 -1
  304. package/dist/codegen/package.d.ts.map +0 -1
  305. package/dist/codegen/patches.d.ts.map +0 -1
  306. package/dist/codegen/typecheck.d.ts.map +0 -1
  307. package/dist/codegen/versions.d.ts.map +0 -1
  308. package/dist/components/argo-app.d.ts.map +0 -1
  309. package/dist/components/builders.d.ts.map +0 -1
  310. package/dist/components/capability-plugin.d.ts.map +0 -1
  311. package/dist/components/flux-reconcile.d.ts.map +0 -1
  312. package/dist/components/index.d.ts.map +0 -1
  313. package/dist/components/kubectl-apply.d.ts.map +0 -1
  314. package/dist/components/kustomize-apply.d.ts.map +0 -1
  315. package/dist/composites/adot-collector.d.ts.map +0 -1
  316. package/dist/composites/agic-ingress.d.ts.map +0 -1
  317. package/dist/composites/aks-external-dns-agent.d.ts.map +0 -1
  318. package/dist/composites/alb-ingress.d.ts.map +0 -1
  319. package/dist/composites/argo-app.d.ts.map +0 -1
  320. package/dist/composites/autoscaled-service.d.ts.map +0 -1
  321. package/dist/composites/azure-disk-storage-class.d.ts.map +0 -1
  322. package/dist/composites/azure-file-storage-class.d.ts.map +0 -1
  323. package/dist/composites/azure-monitor-collector.d.ts.map +0 -1
  324. package/dist/composites/batch-job.d.ts.map +0 -1
  325. package/dist/composites/catalog.d.ts.map +0 -1
  326. package/dist/composites/cockroachdb-cluster.d.ts.map +0 -1
  327. package/dist/composites/cockroachdb-region-stack.d.ts.map +0 -1
  328. package/dist/composites/config-connector-context.d.ts.map +0 -1
  329. package/dist/composites/configured-app.d.ts.map +0 -1
  330. package/dist/composites/cron-schedule.d.ts.map +0 -1
  331. package/dist/composites/cron-workload.d.ts.map +0 -1
  332. package/dist/composites/ebs-storage-class.d.ts.map +0 -1
  333. package/dist/composites/efs-storage-class.d.ts.map +0 -1
  334. package/dist/composites/external-dns-agent.d.ts.map +0 -1
  335. package/dist/composites/filestore-storage-class.d.ts.map +0 -1
  336. package/dist/composites/fluent-bit-agent.d.ts.map +0 -1
  337. package/dist/composites/flux-app.d.ts.map +0 -1
  338. package/dist/composites/gce-ingress.d.ts.map +0 -1
  339. package/dist/composites/gce-pd-storage-class.d.ts.map +0 -1
  340. package/dist/composites/gke-external-dns-agent.d.ts.map +0 -1
  341. package/dist/composites/gke-fluent-bit-agent.d.ts.map +0 -1
  342. package/dist/composites/gke-gateway.d.ts.map +0 -1
  343. package/dist/composites/gke-otel-collector.d.ts.map +0 -1
  344. package/dist/composites/index.d.ts.map +0 -1
  345. package/dist/composites/inference-service.d.ts.map +0 -1
  346. package/dist/composites/irsa-service-account.d.ts.map +0 -1
  347. package/dist/composites/member-defaults.d.ts.map +0 -1
  348. package/dist/composites/metrics-server.d.ts.map +0 -1
  349. package/dist/composites/model.d.ts.map +0 -1
  350. package/dist/composites/monitored-service.d.ts.map +0 -1
  351. package/dist/composites/namespace-env.d.ts.map +0 -1
  352. package/dist/composites/network-isolated-app.d.ts.map +0 -1
  353. package/dist/composites/node-agent.d.ts.map +0 -1
  354. package/dist/composites/operator-stack.d.ts.map +0 -1
  355. package/dist/composites/otel-collector-agent.d.ts.map +0 -1
  356. package/dist/composites/otel-collector-gateway.d.ts.map +0 -1
  357. package/dist/composites/otel-collector-node.d.ts.map +0 -1
  358. package/dist/composites/otel-collector-rbac.d.ts.map +0 -1
  359. package/dist/composites/otel-collector-shape.d.ts.map +0 -1
  360. package/dist/composites/otel-collector.d.ts.map +0 -1
  361. package/dist/composites/otel-operator-collector.d.ts.map +0 -1
  362. package/dist/composites/ray-cluster.d.ts.map +0 -1
  363. package/dist/composites/ray-job.d.ts.map +0 -1
  364. package/dist/composites/ray-service.d.ts.map +0 -1
  365. package/dist/composites/secure-ingress.d.ts.map +0 -1
  366. package/dist/composites/security-context.d.ts.map +0 -1
  367. package/dist/composites/sidecar-app.d.ts.map +0 -1
  368. package/dist/composites/stateful-app.d.ts.map +0 -1
  369. package/dist/composites/vllm-serving-runtime.d.ts.map +0 -1
  370. package/dist/composites/web-app.d.ts.map +0 -1
  371. package/dist/composites/worker-pool.d.ts.map +0 -1
  372. package/dist/composites/workload-identity-sa.d.ts.map +0 -1
  373. package/dist/composites/workload-identity-service-account.d.ts.map +0 -1
  374. package/dist/config-schema.d.ts.map +0 -1
  375. package/dist/config.d.ts.map +0 -1
  376. package/dist/coverage.d.ts.map +0 -1
  377. package/dist/crd/crd-sources.d.ts.map +0 -1
  378. package/dist/crd/loader.d.ts.map +0 -1
  379. package/dist/crd/oci-chart.d.ts.map +0 -1
  380. package/dist/crd/parser.d.ts.map +0 -1
  381. package/dist/crd/project-codegen.d.ts.map +0 -1
  382. package/dist/crd/types.d.ts.map +0 -1
  383. package/dist/deep-observe-hooks.d.ts.map +0 -1
  384. package/dist/deep-observe.d.ts.map +0 -1
  385. package/dist/default-labels.d.ts.map +0 -1
  386. package/dist/describe-resources.d.ts.map +0 -1
  387. package/dist/describe-stack-status.d.ts.map +0 -1
  388. package/dist/detect.d.ts.map +0 -1
  389. package/dist/effect-receipt-row.d.ts.map +0 -1
  390. package/dist/export-resources.d.ts.map +0 -1
  391. package/dist/generated/index.d.ts.map +0 -1
  392. package/dist/generated/runtime.d.ts.map +0 -1
  393. package/dist/group-namespace.d.ts.map +0 -1
  394. package/dist/helm-references.d.ts.map +0 -1
  395. package/dist/import/embedded.d.ts.map +0 -1
  396. package/dist/import/generator.d.ts.map +0 -1
  397. package/dist/import/live-export.d.ts.map +0 -1
  398. package/dist/import/parser.d.ts.map +0 -1
  399. package/dist/import/testdata/embedded/fixtures.d.ts.map +0 -1
  400. package/dist/import/typed-classes.d.ts.map +0 -1
  401. package/dist/include/entity.d.ts.map +0 -1
  402. package/dist/include/resolve.d.ts.map +0 -1
  403. package/dist/index-identity.d.ts.map +0 -1
  404. package/dist/index-import.d.ts.map +0 -1
  405. package/dist/index.d.ts.map +0 -1
  406. package/dist/kube/apply.d.ts.map +0 -1
  407. package/dist/kube/connect.d.ts.map +0 -1
  408. package/dist/kube/delete.d.ts.map +0 -1
  409. package/dist/kube/describe.d.ts.map +0 -1
  410. package/dist/kube/events.d.ts.map +0 -1
  411. package/dist/kube/flags.d.ts.map +0 -1
  412. package/dist/kube/get.d.ts.map +0 -1
  413. package/dist/kube/group.d.ts.map +0 -1
  414. package/dist/kube/logs.d.ts.map +0 -1
  415. package/dist/kube/project.d.ts.map +0 -1
  416. package/dist/kube/render.d.ts.map +0 -1
  417. package/dist/kube/source.d.ts.map +0 -1
  418. package/dist/kube/target.d.ts.map +0 -1
  419. package/dist/kube/testing.d.ts.map +0 -1
  420. package/dist/kube/top.d.ts.map +0 -1
  421. package/dist/kube/verdict.d.ts.map +0 -1
  422. package/dist/kube/wait.d.ts.map +0 -1
  423. package/dist/kustomize/render.d.ts.map +0 -1
  424. package/dist/kustomize/rendered-entity.d.ts.map +0 -1
  425. package/dist/kustomize/root.d.ts.map +0 -1
  426. package/dist/lint/audit-catalog.d.ts.map +0 -1
  427. package/dist/lint/audit-lineage.d.ts.map +0 -1
  428. package/dist/lint/post-synth/argo-helpers.d.ts.map +0 -1
  429. package/dist/lint/post-synth/argo002.d.ts.map +0 -1
  430. package/dist/lint/post-synth/argo003.d.ts.map +0 -1
  431. package/dist/lint/post-synth/argo005.d.ts.map +0 -1
  432. package/dist/lint/post-synth/crd-schema-helpers.d.ts.map +0 -1
  433. package/dist/lint/post-synth/flux002.d.ts.map +0 -1
  434. package/dist/lint/post-synth/flux003.d.ts.map +0 -1
  435. package/dist/lint/post-synth/index.d.ts.map +0 -1
  436. package/dist/lint/post-synth/k8s-helpers.d.ts.map +0 -1
  437. package/dist/lint/post-synth/monitoring-selection-helpers.d.ts.map +0 -1
  438. package/dist/lint/post-synth/otel-placement-helpers.d.ts.map +0 -1
  439. package/dist/lint/post-synth/sops-helpers.d.ts.map +0 -1
  440. package/dist/lint/post-synth/wk8005.d.ts.map +0 -1
  441. package/dist/lint/post-synth/wk8006.d.ts.map +0 -1
  442. package/dist/lint/post-synth/wk8041.d.ts.map +0 -1
  443. package/dist/lint/post-synth/wk8042.d.ts.map +0 -1
  444. package/dist/lint/post-synth/wk8101.d.ts.map +0 -1
  445. package/dist/lint/post-synth/wk8102.d.ts.map +0 -1
  446. package/dist/lint/post-synth/wk8103.d.ts.map +0 -1
  447. package/dist/lint/post-synth/wk8104.d.ts.map +0 -1
  448. package/dist/lint/post-synth/wk8105.d.ts.map +0 -1
  449. package/dist/lint/post-synth/wk8201.d.ts.map +0 -1
  450. package/dist/lint/post-synth/wk8202.d.ts.map +0 -1
  451. package/dist/lint/post-synth/wk8203.d.ts.map +0 -1
  452. package/dist/lint/post-synth/wk8204.d.ts.map +0 -1
  453. package/dist/lint/post-synth/wk8205.d.ts.map +0 -1
  454. package/dist/lint/post-synth/wk8207.d.ts.map +0 -1
  455. package/dist/lint/post-synth/wk8208.d.ts.map +0 -1
  456. package/dist/lint/post-synth/wk8209.d.ts.map +0 -1
  457. package/dist/lint/post-synth/wk8301.d.ts.map +0 -1
  458. package/dist/lint/post-synth/wk8302.d.ts.map +0 -1
  459. package/dist/lint/post-synth/wk8303.d.ts.map +0 -1
  460. package/dist/lint/post-synth/wk8304.d.ts.map +0 -1
  461. package/dist/lint/post-synth/wk8305.d.ts.map +0 -1
  462. package/dist/lint/post-synth/wk8306.d.ts.map +0 -1
  463. package/dist/lint/post-synth/wk8401.d.ts.map +0 -1
  464. package/dist/lint/post-synth/wk8402.d.ts.map +0 -1
  465. package/dist/lint/post-synth/wk8403.d.ts.map +0 -1
  466. package/dist/lint/post-synth/wk8404.d.ts.map +0 -1
  467. package/dist/lint/post-synth/wk8405.d.ts.map +0 -1
  468. package/dist/lint/post-synth/wk8406.d.ts.map +0 -1
  469. package/dist/lint/post-synth/wk8407.d.ts.map +0 -1
  470. package/dist/lint/post-synth/wk8501.d.ts.map +0 -1
  471. package/dist/lint/post-synth/wk8502.d.ts.map +0 -1
  472. package/dist/lint/post-synth/wk8503.d.ts.map +0 -1
  473. package/dist/lint/post-synth/wk8504.d.ts.map +0 -1
  474. package/dist/lint/post-synth/wk8505.d.ts.map +0 -1
  475. package/dist/lint/post-synth/wk8601.d.ts.map +0 -1
  476. package/dist/lint/post-synth/wk8602.d.ts.map +0 -1
  477. package/dist/lint/post-synth/wk8603.d.ts.map +0 -1
  478. package/dist/lint/post-synth/wk8604.d.ts.map +0 -1
  479. package/dist/lint/post-synth/wk8605.d.ts.map +0 -1
  480. package/dist/lint/post-synth/wk8606.d.ts.map +0 -1
  481. package/dist/lint/post-synth/wk8701.d.ts.map +0 -1
  482. package/dist/lint/post-synth/wk8702.d.ts.map +0 -1
  483. package/dist/lint/post-synth/wk8703.d.ts.map +0 -1
  484. package/dist/lint/post-synth/wk8704.d.ts.map +0 -1
  485. package/dist/lint/post-synth/wk8705.d.ts.map +0 -1
  486. package/dist/lint/rules/argo-appset-single-project.d.ts.map +0 -1
  487. package/dist/lint/rules/argo-ast.d.ts.map +0 -1
  488. package/dist/lint/rules/argo-automated-prune.d.ts.map +0 -1
  489. package/dist/lint/rules/flux-source-ref-pin.d.ts.map +0 -1
  490. package/dist/lint/rules/hardcoded-namespace.d.ts.map +0 -1
  491. package/dist/lint/rules/latest-image-tag.d.ts.map +0 -1
  492. package/dist/lint/rules/missing-resource-limits.d.ts.map +0 -1
  493. package/dist/listed-types.d.ts.map +0 -1
  494. package/dist/lsp/completions.d.ts.map +0 -1
  495. package/dist/lsp/hover.d.ts.map +0 -1
  496. package/dist/manifest-entity.d.ts.map +0 -1
  497. package/dist/micro-time.d.ts.map +0 -1
  498. package/dist/op/activities/apply-diff.d.ts.map +0 -1
  499. package/dist/op/activities/argo.d.ts.map +0 -1
  500. package/dist/op/activities/ensure-secret.d.ts.map +0 -1
  501. package/dist/op/activities/index.d.ts.map +0 -1
  502. package/dist/op/activities/kubectl.d.ts.map +0 -1
  503. package/dist/op/activities/wait-for-ready.d.ts.map +0 -1
  504. package/dist/op/builders.d.ts.map +0 -1
  505. package/dist/package-cli.d.ts.map +0 -1
  506. package/dist/patch/json-patch.d.ts.map +0 -1
  507. package/dist/patch/rendered-patch.d.ts.map +0 -1
  508. package/dist/plugin.d.ts.map +0 -1
  509. package/dist/project-kinds.d.ts.map +0 -1
  510. package/dist/receipt-store.d.ts.map +0 -1
  511. package/dist/reference-catalog.d.ts.map +0 -1
  512. package/dist/secret-labels.d.ts.map +0 -1
  513. package/dist/secret-store.d.ts.map +0 -1
  514. package/dist/serializer.d.ts.map +0 -1
  515. package/dist/sops/encrypted-secret-file.d.ts.map +0 -1
  516. package/dist/sops/entity.d.ts.map +0 -1
  517. package/dist/spec/fetch.d.ts.map +0 -1
  518. package/dist/spec/parse.d.ts.map +0 -1
  519. package/dist/subscribe-changes.d.ts.map +0 -1
  520. package/dist/teardown.d.ts.map +0 -1
  521. package/dist/telemetry-release.d.ts.map +0 -1
  522. package/dist/validate-cli.d.ts.map +0 -1
  523. package/dist/validate.d.ts.map +0 -1
  524. package/dist/variables.d.ts.map +0 -1
  525. package/dist/whoami.d.ts.map +0 -1
  526. package/dist/workspace-member.d.ts.map +0 -1
  527. package/src/actions/actions.test.ts +0 -83
  528. package/src/actions/apps.ts +0 -23
  529. package/src/actions/batch.ts +0 -9
  530. package/src/actions/core.ts +0 -62
  531. package/src/actions/index.ts +0 -50
  532. package/src/actions/networking.ts +0 -15
  533. package/src/actions/rbac.ts +0 -13
  534. package/src/api/classify.test.ts +0 -170
  535. package/src/api/classify.ts +0 -154
  536. package/src/api/connect.ts +0 -104
  537. package/src/api/fake-cluster.ts +0 -231
  538. package/src/api/operation-surface.test.ts +0 -116
  539. package/src/api/operation-surface.ts +0 -130
  540. package/src/api/owner-chain.test.ts +0 -171
  541. package/src/api/owner-chain.ts +0 -144
  542. package/src/api/sweep-types.ts +0 -35
  543. package/src/application-paths.ts +0 -96
  544. package/src/application-set.test.ts +0 -130
  545. package/src/application-set.ts +0 -336
  546. package/src/behaviour-kinds.ts +0 -88
  547. package/src/cluster-secret.test.ts +0 -117
  548. package/src/cluster-secret.ts +0 -76
  549. package/src/codegen/declarations.test.ts +0 -118
  550. package/src/codegen/docs-cli.ts +0 -3
  551. package/src/codegen/docs.ts +0 -156
  552. package/src/codegen/generate-cli.ts +0 -41
  553. package/src/codegen/generate-crd-sources.test.ts +0 -49
  554. package/src/codegen/generate-lexicon.ts +0 -105
  555. package/src/codegen/generate-list-map-keys.test.ts +0 -112
  556. package/src/codegen/generate-list-map-keys.ts +0 -99
  557. package/src/codegen/generate-operations.ts +0 -56
  558. package/src/codegen/generate-typescript.ts +0 -162
  559. package/src/codegen/generate.ts +0 -231
  560. package/src/codegen/naming.test.ts +0 -63
  561. package/src/codegen/naming.ts +0 -201
  562. package/src/codegen/package.ts +0 -53
  563. package/src/codegen/patches.ts +0 -108
  564. package/src/codegen/snapshot.test.ts +0 -115
  565. package/src/codegen/typecheck.test.ts +0 -24
  566. package/src/codegen/typecheck.ts +0 -4
  567. package/src/codegen/versions.ts +0 -50
  568. package/src/components/argo-app.test.ts +0 -137
  569. package/src/components/argo-app.ts +0 -163
  570. package/src/components/builders.ts +0 -30
  571. package/src/components/capability-plugin.test.ts +0 -20
  572. package/src/components/capability-plugin.ts +0 -44
  573. package/src/components/flux-reconcile.test.ts +0 -145
  574. package/src/components/flux-reconcile.ts +0 -159
  575. package/src/components/index.ts +0 -44
  576. package/src/components/kubectl-apply-plan.k3d.e2e.test.ts +0 -127
  577. package/src/components/kubectl-apply.test.ts +0 -465
  578. package/src/components/kubectl-apply.ts +0 -570
  579. package/src/components/kustomize-apply.test.ts +0 -98
  580. package/src/components/kustomize-apply.ts +0 -110
  581. package/src/composites/__snapshots__/gke-otel-collector.snapshot.test.ts.snap +0 -335
  582. package/src/composites/adot-collector.ts +0 -258
  583. package/src/composites/agic-ingress.ts +0 -157
  584. package/src/composites/aks-external-dns-agent.ts +0 -211
  585. package/src/composites/alb-ingress.ts +0 -161
  586. package/src/composites/argo-app.ts +0 -381
  587. package/src/composites/autoscaled-service.ts +0 -293
  588. package/src/composites/azure-disk-storage-class.ts +0 -91
  589. package/src/composites/azure-file-storage-class.ts +0 -86
  590. package/src/composites/azure-monitor-collector.ts +0 -245
  591. package/src/composites/batch-job.ts +0 -230
  592. package/src/composites/catalog.test.ts +0 -39
  593. package/src/composites/catalog.ts +0 -4115
  594. package/src/composites/cockroachdb-cluster.ts +0 -528
  595. package/src/composites/cockroachdb-region-stack.ts +0 -553
  596. package/src/composites/composites.test.ts +0 -4291
  597. package/src/composites/config-connector-context.ts +0 -69
  598. package/src/composites/configured-app.ts +0 -231
  599. package/src/composites/cron-schedule.ts +0 -47
  600. package/src/composites/cron-workload.ts +0 -182
  601. package/src/composites/ebs-storage-class.ts +0 -105
  602. package/src/composites/efs-storage-class.ts +0 -86
  603. package/src/composites/external-dns-agent.ts +0 -181
  604. package/src/composites/filestore-storage-class.ts +0 -88
  605. package/src/composites/fluent-bit-agent.ts +0 -227
  606. package/src/composites/flux-app.ts +0 -298
  607. package/src/composites/gce-ingress.ts +0 -152
  608. package/src/composites/gce-pd-storage-class.ts +0 -94
  609. package/src/composites/gke-external-dns-agent.ts +0 -189
  610. package/src/composites/gke-fluent-bit-agent.ts +0 -232
  611. package/src/composites/gke-gateway.ts +0 -150
  612. package/src/composites/gke-otel-collector.snapshot.test.ts +0 -53
  613. package/src/composites/gke-otel-collector.ts +0 -156
  614. package/src/composites/index.ts +0 -133
  615. package/src/composites/inference-service.ts +0 -141
  616. package/src/composites/irsa-service-account.ts +0 -123
  617. package/src/composites/member-defaults.test.ts +0 -63
  618. package/src/composites/member-defaults.ts +0 -29
  619. package/src/composites/metrics-server.ts +0 -240
  620. package/src/composites/model.ts +0 -151
  621. package/src/composites/monitored-service.ts +0 -252
  622. package/src/composites/namespace-env.ts +0 -173
  623. package/src/composites/network-isolated-app.ts +0 -208
  624. package/src/composites/node-agent.ts +0 -242
  625. package/src/composites/operator-stack.ts +0 -387
  626. package/src/composites/otel-collector-agent.ts +0 -230
  627. package/src/composites/otel-collector-gateway.test.ts +0 -380
  628. package/src/composites/otel-collector-gateway.ts +0 -404
  629. package/src/composites/otel-collector-node.test.ts +0 -193
  630. package/src/composites/otel-collector-node.ts +0 -211
  631. package/src/composites/otel-collector-rbac.test.ts +0 -125
  632. package/src/composites/otel-collector-rbac.ts +0 -146
  633. package/src/composites/otel-collector-shape.ts +0 -163
  634. package/src/composites/otel-collector.ts +0 -209
  635. package/src/composites/otel-operator-collector.test.ts +0 -267
  636. package/src/composites/otel-operator-collector.ts +0 -221
  637. package/src/composites/ray-cluster.ts +0 -591
  638. package/src/composites/ray-job.ts +0 -236
  639. package/src/composites/ray-service.ts +0 -272
  640. package/src/composites/secure-ingress.ts +0 -160
  641. package/src/composites/security-context.ts +0 -10
  642. package/src/composites/sidecar-app.ts +0 -213
  643. package/src/composites/stateful-app.ts +0 -196
  644. package/src/composites/vllm-serving-runtime.test.ts +0 -167
  645. package/src/composites/vllm-serving-runtime.ts +0 -197
  646. package/src/composites/web-app.ts +0 -254
  647. package/src/composites/worker-pool.ts +0 -279
  648. package/src/composites/workload-identity-sa.ts +0 -127
  649. package/src/composites/workload-identity-service-account.ts +0 -123
  650. package/src/config-augmentation.test.ts +0 -100
  651. package/src/config-schema.ts +0 -113
  652. package/src/config.ts +0 -235
  653. package/src/coverage.test.ts +0 -27
  654. package/src/coverage.ts +0 -35
  655. package/src/crd/clickhouse-operators.test.ts +0 -105
  656. package/src/crd/cnpg.test.ts +0 -191
  657. package/src/crd/crd-sources.ts +0 -688
  658. package/src/crd/infisical.test.ts +0 -100
  659. package/src/crd/loader.test.ts +0 -90
  660. package/src/crd/loader.ts +0 -214
  661. package/src/crd/oci-chart.test.ts +0 -149
  662. package/src/crd/oci-chart.ts +0 -178
  663. package/src/crd/parser.test.ts +0 -585
  664. package/src/crd/parser.ts +0 -437
  665. package/src/crd/project-codegen.e2e.test.ts +0 -239
  666. package/src/crd/project-codegen.ts +0 -327
  667. package/src/crd/traefik.test.ts +0 -108
  668. package/src/crd/types.ts +0 -92
  669. package/src/deep-observe-hooks.ts +0 -361
  670. package/src/deep-observe.test.ts +0 -1160
  671. package/src/deep-observe.ts +0 -290
  672. package/src/default-labels.test.ts +0 -111
  673. package/src/default-labels.ts +0 -122
  674. package/src/describe-resources.test.ts +0 -1873
  675. package/src/describe-resources.ts +0 -839
  676. package/src/describe-stack-status.test.ts +0 -169
  677. package/src/describe-stack-status.ts +0 -143
  678. package/src/detect.ts +0 -9
  679. package/src/effect-receipt-row.test.ts +0 -285
  680. package/src/effect-receipt-row.ts +0 -268
  681. package/src/export-resources-io.test.ts +0 -97
  682. package/src/export-resources.ts +0 -72
  683. package/src/generated/index.d.ts +0 -8909
  684. package/src/generated/index.ts +0 -1153
  685. package/src/generated/runtime.ts +0 -4
  686. package/src/group-namespace.test.ts +0 -99
  687. package/src/group-namespace.ts +0 -103
  688. package/src/helm-references.test.ts +0 -149
  689. package/src/helm-references.ts +0 -425
  690. package/src/import/embedded-live.test.ts +0 -180
  691. package/src/import/embedded-roundtrip.test.ts +0 -298
  692. package/src/import/embedded-types.e2e.test.ts +0 -45
  693. package/src/import/embedded.test.ts +0 -189
  694. package/src/import/embedded.ts +0 -208
  695. package/src/import/generator.test.ts +0 -197
  696. package/src/import/generator.ts +0 -348
  697. package/src/import/live-export.test.ts +0 -114
  698. package/src/import/live-export.ts +0 -97
  699. package/src/import/operator-alerting-roundtrip.test.ts +0 -158
  700. package/src/import/operator-collector-roundtrip.test.ts +0 -105
  701. package/src/import/parser.test.ts +0 -233
  702. package/src/import/parser.ts +0 -263
  703. package/src/import/roundtrip-build.test.ts +0 -224
  704. package/src/import/roundtrip.test.ts +0 -86
  705. package/src/import/testdata/embedded/README.md +0 -14
  706. package/src/import/testdata/embedded/agent-observability.yaml +0 -2905
  707. package/src/import/testdata/embedded/alertmanager-configmap.yaml +0 -91
  708. package/src/import/testdata/embedded/fixtures.ts +0 -71
  709. package/src/import/testdata/embedded/grafana-dashboard-configmap.yaml +0 -364
  710. package/src/import/testdata/embedded/grafana-operator-dashboard.yaml +0 -363
  711. package/src/import/testdata/embedded/grafana-v2-dashboard-configmap.yaml +0 -851
  712. package/src/import/testdata/embedded/node-exporter-prometheusrule.yaml +0 -425
  713. package/src/import/testdata/embedded/otel-collector-daemonset.yaml +0 -225
  714. package/src/import/typed-classes.ts +0 -168
  715. package/src/include/entity.ts +0 -119
  716. package/src/include/include.test.ts +0 -345
  717. package/src/include/resolve.ts +0 -204
  718. package/src/index-identity.ts +0 -119
  719. package/src/index-import.test.ts +0 -244
  720. package/src/index-import.ts +0 -181
  721. package/src/index.ts +0 -172
  722. package/src/kube/apply.test.ts +0 -105
  723. package/src/kube/apply.ts +0 -106
  724. package/src/kube/connect.ts +0 -55
  725. package/src/kube/delete.test.ts +0 -123
  726. package/src/kube/delete.ts +0 -174
  727. package/src/kube/describe.test.ts +0 -106
  728. package/src/kube/describe.ts +0 -195
  729. package/src/kube/events.test.ts +0 -115
  730. package/src/kube/events.ts +0 -160
  731. package/src/kube/flags.test.ts +0 -65
  732. package/src/kube/flags.ts +0 -114
  733. package/src/kube/get.test.ts +0 -195
  734. package/src/kube/get.ts +0 -190
  735. package/src/kube/group.test.ts +0 -33
  736. package/src/kube/group.ts +0 -125
  737. package/src/kube/logs.test.ts +0 -126
  738. package/src/kube/logs.ts +0 -96
  739. package/src/kube/project.test.ts +0 -57
  740. package/src/kube/project.ts +0 -106
  741. package/src/kube/render.test.ts +0 -142
  742. package/src/kube/render.ts +0 -252
  743. package/src/kube/source.test.ts +0 -138
  744. package/src/kube/source.ts +0 -139
  745. package/src/kube/target.test.ts +0 -67
  746. package/src/kube/target.ts +0 -89
  747. package/src/kube/testing.ts +0 -42
  748. package/src/kube/top.test.ts +0 -149
  749. package/src/kube/top.ts +0 -120
  750. package/src/kube/verdict.test.ts +0 -48
  751. package/src/kube/verdict.ts +0 -77
  752. package/src/kube/wait.test.ts +0 -125
  753. package/src/kube/wait.ts +0 -160
  754. package/src/kustomize/helm.test.ts +0 -183
  755. package/src/kustomize/render.ts +0 -232
  756. package/src/kustomize/rendered-entity.ts +0 -82
  757. package/src/kustomize/root.test.ts +0 -309
  758. package/src/kustomize/root.ts +0 -100
  759. package/src/kustomize/search.test.ts +0 -101
  760. package/src/lifecycle-integration.test.ts +0 -325
  761. package/src/lint/audit-catalog.ts +0 -63
  762. package/src/lint/audit-lineage.ts +0 -127
  763. package/src/lint/post-synth/argo-helpers.ts +0 -54
  764. package/src/lint/post-synth/argo002.ts +0 -48
  765. package/src/lint/post-synth/argo003.ts +0 -81
  766. package/src/lint/post-synth/argo005.ts +0 -85
  767. package/src/lint/post-synth/audit-identity.test.ts +0 -65
  768. package/src/lint/post-synth/crd-schema-helpers.ts +0 -235
  769. package/src/lint/post-synth/flux002.ts +0 -78
  770. package/src/lint/post-synth/flux003.ts +0 -76
  771. package/src/lint/post-synth/index.ts +0 -107
  772. package/src/lint/post-synth/k8s-helpers.test.ts +0 -236
  773. package/src/lint/post-synth/k8s-helpers.ts +0 -296
  774. package/src/lint/post-synth/monitoring-selection-helpers.ts +0 -185
  775. package/src/lint/post-synth/monitoring-selection.test.ts +0 -316
  776. package/src/lint/post-synth/otel-placement-helpers.ts +0 -333
  777. package/src/lint/post-synth/otel-placement.test.ts +0 -450
  778. package/src/lint/post-synth/post-synth.test.ts +0 -2942
  779. package/src/lint/post-synth/sops-helpers.ts +0 -76
  780. package/src/lint/post-synth/wk8005.ts +0 -107
  781. package/src/lint/post-synth/wk8006.ts +0 -65
  782. package/src/lint/post-synth/wk8041.ts +0 -69
  783. package/src/lint/post-synth/wk8042.ts +0 -43
  784. package/src/lint/post-synth/wk8101.ts +0 -60
  785. package/src/lint/post-synth/wk8102.ts +0 -41
  786. package/src/lint/post-synth/wk8103.ts +0 -41
  787. package/src/lint/post-synth/wk8104.ts +0 -65
  788. package/src/lint/post-synth/wk8105.ts +0 -41
  789. package/src/lint/post-synth/wk8201.ts +0 -51
  790. package/src/lint/post-synth/wk8202.ts +0 -42
  791. package/src/lint/post-synth/wk8203.ts +0 -42
  792. package/src/lint/post-synth/wk8204.ts +0 -84
  793. package/src/lint/post-synth/wk8205.ts +0 -52
  794. package/src/lint/post-synth/wk8207.ts +0 -40
  795. package/src/lint/post-synth/wk8208.ts +0 -40
  796. package/src/lint/post-synth/wk8209.ts +0 -40
  797. package/src/lint/post-synth/wk8301.ts +0 -55
  798. package/src/lint/post-synth/wk8302.ts +0 -41
  799. package/src/lint/post-synth/wk8303.ts +0 -93
  800. package/src/lint/post-synth/wk8304.ts +0 -65
  801. package/src/lint/post-synth/wk8305.ts +0 -112
  802. package/src/lint/post-synth/wk8306.ts +0 -46
  803. package/src/lint/post-synth/wk8401.ts +0 -93
  804. package/src/lint/post-synth/wk8402.ts +0 -38
  805. package/src/lint/post-synth/wk8403.ts +0 -55
  806. package/src/lint/post-synth/wk8404.ts +0 -50
  807. package/src/lint/post-synth/wk8405.ts +0 -85
  808. package/src/lint/post-synth/wk8406.ts +0 -56
  809. package/src/lint/post-synth/wk8407.ts +0 -66
  810. package/src/lint/post-synth/wk8501.ts +0 -40
  811. package/src/lint/post-synth/wk8502.ts +0 -39
  812. package/src/lint/post-synth/wk8503.ts +0 -220
  813. package/src/lint/post-synth/wk8504.ts +0 -51
  814. package/src/lint/post-synth/wk8505.ts +0 -65
  815. package/src/lint/post-synth/wk8601.ts +0 -44
  816. package/src/lint/post-synth/wk8602.ts +0 -133
  817. package/src/lint/post-synth/wk8603.ts +0 -66
  818. package/src/lint/post-synth/wk8604.ts +0 -36
  819. package/src/lint/post-synth/wk8605.test.ts +0 -153
  820. package/src/lint/post-synth/wk8605.ts +0 -133
  821. package/src/lint/post-synth/wk8606.ts +0 -27
  822. package/src/lint/post-synth/wk8701.ts +0 -37
  823. package/src/lint/post-synth/wk8702.ts +0 -43
  824. package/src/lint/post-synth/wk8703.ts +0 -37
  825. package/src/lint/post-synth/wk8704.ts +0 -134
  826. package/src/lint/post-synth/wk8705.ts +0 -45
  827. package/src/lint/rules/argo-appset-single-project.ts +0 -66
  828. package/src/lint/rules/argo-ast.ts +0 -121
  829. package/src/lint/rules/argo-automated-prune.ts +0 -75
  830. package/src/lint/rules/flux-source-ref-pin.ts +0 -52
  831. package/src/lint/rules/hardcoded-namespace.ts +0 -71
  832. package/src/lint/rules/latest-image-tag.ts +0 -121
  833. package/src/lint/rules/missing-resource-limits.ts +0 -111
  834. package/src/lint/rules/rules.test.ts +0 -421
  835. package/src/list-map-key-table.test.ts +0 -83
  836. package/src/list-map-order-key.test.ts +0 -119
  837. package/src/listed-types.test.ts +0 -76
  838. package/src/listed-types.ts +0 -70
  839. package/src/lsp/completions.test.ts +0 -64
  840. package/src/lsp/completions.ts +0 -21
  841. package/src/lsp/hover.test.ts +0 -69
  842. package/src/lsp/hover.ts +0 -69
  843. package/src/manifest-entity.test.ts +0 -78
  844. package/src/manifest-entity.ts +0 -82
  845. package/src/micro-time.test.ts +0 -48
  846. package/src/micro-time.ts +0 -51
  847. package/src/op/activities/apply-diff.ts +0 -87
  848. package/src/op/activities/argo.test.ts +0 -79
  849. package/src/op/activities/argo.ts +0 -163
  850. package/src/op/activities/ensure-secret.ts +0 -71
  851. package/src/op/activities/index.ts +0 -79
  852. package/src/op/activities/kubectl-plan.test.ts +0 -224
  853. package/src/op/activities/kubectl.test.ts +0 -662
  854. package/src/op/activities/kubectl.ts +0 -723
  855. package/src/op/activities/wait-for-ready.test.ts +0 -260
  856. package/src/op/activities/wait-for-ready.ts +0 -371
  857. package/src/op/builders.test.ts +0 -82
  858. package/src/op/builders.ts +0 -95
  859. package/src/package-cli.ts +0 -28
  860. package/src/patch/json-patch.test.ts +0 -91
  861. package/src/patch/json-patch.ts +0 -189
  862. package/src/patch/rendered-patch.test.ts +0 -143
  863. package/src/patch/rendered-patch.ts +0 -180
  864. package/src/plugin.test.ts +0 -273
  865. package/src/plugin.ts +0 -827
  866. package/src/project-kinds.ts +0 -75
  867. package/src/prometheus-rule-groups.test.ts +0 -135
  868. package/src/receipt-store.test.ts +0 -380
  869. package/src/receipt-store.ts +0 -290
  870. package/src/reference-catalog.test.ts +0 -251
  871. package/src/reference-catalog.ts +0 -438
  872. package/src/secret-labels.ts +0 -36
  873. package/src/secret-store.test.ts +0 -184
  874. package/src/secret-store.ts +0 -165
  875. package/src/serializer-ownership.test.ts +0 -44
  876. package/src/serializer-telemetry.test.ts +0 -146
  877. package/src/serializer.test.ts +0 -640
  878. package/src/serializer.ts +0 -655
  879. package/src/skills/chant-k8s-aks.md +0 -146
  880. package/src/skills/chant-k8s-argo.md +0 -190
  881. package/src/skills/chant-k8s-deployment-strategies.md +0 -183
  882. package/src/skills/chant-k8s-eks.md +0 -171
  883. package/src/skills/chant-k8s-flux.md +0 -162
  884. package/src/skills/chant-k8s-gke.md +0 -246
  885. package/src/skills/chant-k8s-patterns.md +0 -245
  886. package/src/skills/chant-k8s-ray.md +0 -252
  887. package/src/skills/chant-k8s-security.md +0 -237
  888. package/src/skills/chant-k8s.md +0 -307
  889. package/src/sops/encrypted-secret-file.test.ts +0 -333
  890. package/src/sops/encrypted-secret-file.ts +0 -264
  891. package/src/sops/entity.ts +0 -53
  892. package/src/spec/fetch.test.ts +0 -24
  893. package/src/spec/fetch.ts +0 -68
  894. package/src/spec/parse.test.ts +0 -262
  895. package/src/spec/parse.ts +0 -864
  896. package/src/subscribe-changes.test.ts +0 -368
  897. package/src/subscribe-changes.ts +0 -210
  898. package/src/teardown.test.ts +0 -240
  899. package/src/teardown.ts +0 -239
  900. package/src/telemetry-build.test.ts +0 -79
  901. package/src/telemetry-release.ts +0 -93
  902. package/src/testdata/helm-chart-missing/kustomization.yaml +0 -8
  903. package/src/testdata/helm-chart-root/charts/webchart/Chart.yaml +0 -3
  904. package/src/testdata/helm-chart-root/charts/webchart/templates/configmap.yaml +0 -6
  905. package/src/testdata/helm-chart-root/charts/webchart/values.yaml +0 -1
  906. package/src/testdata/helm-chart-root/kustomization.yaml +0 -9
  907. package/src/testdata/helm-chart-root/values.yaml +0 -1
  908. package/src/testdata/include/bundle.yaml +0 -45
  909. package/src/testdata/indexed/listing.json +0 -67
  910. package/src/testdata/kustomize-root/base/deployment.yaml +0 -17
  911. package/src/testdata/kustomize-root/base/kustomization.yaml +0 -3
  912. package/src/testdata/kustomize-root/base/service.yaml +0 -9
  913. package/src/testdata/kustomize-root/overlays/prod/kustomization.yaml +0 -6
  914. package/src/testdata/manifests/configmap.yaml +0 -7
  915. package/src/testdata/manifests/deployment.yaml +0 -22
  916. package/src/testdata/manifests/full-app.yaml +0 -61
  917. package/src/testdata/manifests/secret.yaml +0 -7
  918. package/src/testdata/manifests/service.yaml +0 -15
  919. package/src/testdata/sops/db-credentials.sops.yaml +0 -23
  920. package/src/testdata/workspace-members/argo/guestbook.yaml +0 -28
  921. package/src/testdata/workspace-members/argo/namespace.yaml +0 -4
  922. package/src/testdata/workspace-members/argo-clusters/clusters.yaml +0 -34
  923. package/src/testdata/workspace-members/argo-set/all.yaml +0 -43
  924. package/src/testdata/workspace-members/flux/apps.yaml +0 -12
  925. package/src/testdata/workspace-members/flux/kustomization.yaml +0 -4
  926. package/src/testdata/workspace-members/plain/deploy.yaml +0 -27
  927. package/src/testdata/workspace-members/plain/es.yaml +0 -15
  928. package/src/testdata/workspace-members/templated/block.yaml +0 -6
  929. package/src/testdata/workspace-members/templated/chart-cm.yaml +0 -4
  930. package/src/testdata/workspace-members/templated/cm.yaml +0 -6
  931. package/src/validate-cli.ts +0 -21
  932. package/src/validate.test.ts +0 -29
  933. package/src/validate.ts +0 -53
  934. package/src/variables.ts +0 -36
  935. package/src/whoami.test.ts +0 -203
  936. package/src/whoami.ts +0 -122
  937. package/src/workspace-kinds.test.ts +0 -43
  938. package/src/workspace-member.test.ts +0 -220
  939. package/src/workspace-member.ts +0 -269
  940. /package/{src → dist}/generated/list-map-keys.json +0 -0
  941. /package/{src → dist}/generated/operations.json +0 -0
@@ -1,2942 +0,0 @@
1
- import { execFileSync } from "node:child_process";
2
- import { mkdirSync, mkdtempSync } from "node:fs";
3
- import { tmpdir } from "node:os";
4
- import { describe, test, expect } from "vitest";
5
- import type { PostSynthContext } from "@intentius/chant/lint/post-synth";
6
-
7
- // Import all checks
8
- import { wk8005 } from "./wk8005";
9
- import { wk8006 } from "./wk8006";
10
- import { wk8041 } from "./wk8041";
11
- import { wk8042 } from "./wk8042";
12
- import { wk8101 } from "./wk8101";
13
- import { wk8102 } from "./wk8102";
14
- import { wk8103 } from "./wk8103";
15
- import { wk8104 } from "./wk8104";
16
- import { wk8105 } from "./wk8105";
17
- import { wk8201 } from "./wk8201";
18
- import { wk8202 } from "./wk8202";
19
- import { wk8203 } from "./wk8203";
20
- import { wk8204 } from "./wk8204";
21
- import { wk8205 } from "./wk8205";
22
- import { wk8207 } from "./wk8207";
23
- import { wk8208 } from "./wk8208";
24
- import { wk8209 } from "./wk8209";
25
- import { wk8301 } from "./wk8301";
26
- import { wk8302 } from "./wk8302";
27
- import { wk8303 } from "./wk8303";
28
- import { wk8304 } from "./wk8304";
29
- import { wk8305 } from "./wk8305";
30
- import { wk8306 } from "./wk8306";
31
- import { wk8401 } from "./wk8401";
32
- import { wk8402 } from "./wk8402";
33
- import { wk8403 } from "./wk8403";
34
- import { wk8404 } from "./wk8404";
35
- import { wk8405 } from "./wk8405";
36
- import { wk8406 } from "./wk8406";
37
- import { wk8407 } from "./wk8407";
38
- import { argo002 } from "./argo002";
39
- import { argo003 } from "./argo003";
40
- import { argo005 } from "./argo005";
41
- import { flux002 } from "./flux002";
42
- import { flux003 } from "./flux003";
43
- import { wk8501 } from "./wk8501";
44
- import { wk8502 } from "./wk8502";
45
- import { wk8503 } from "./wk8503";
46
- import { wk8504 } from "./wk8504";
47
- import { wk8505 } from "./wk8505";
48
- import { declareSecret, type SecretDeclarationInput } from "@intentius/chant/secret-provenance";
49
- import type { Declarable } from "@intentius/chant/declarable";
50
- import type { SerializerResult } from "@intentius/chant/serializer";
51
- import { readFileSync } from "node:fs";
52
- import { dirname, join } from "node:path";
53
- import { fileURLToPath } from "node:url";
54
- import { getCrdSchemaRegistry, setCrdSchemaRegistry, validateSpec } from "./crd-schema-helpers";
55
-
56
- function makeCtx(yaml: string): PostSynthContext {
57
- return {
58
- outputs: new Map([["k8s", yaml]]),
59
- entities: new Map(),
60
- buildResult: {
61
- outputs: new Map([["k8s", yaml]]),
62
- entities: new Map(),
63
- warnings: [],
64
- errors: [],
65
- sourceFileCount: 1,
66
- },
67
- };
68
- }
69
-
70
- /** Join several manifests (objects) into a multi-document YAML string. */
71
- function manifestsCtx(...objs: unknown[]): PostSynthContext {
72
- return makeCtx(objs.map((o) => JSON.stringify(o)).join("\n---\n"));
73
- }
74
-
75
- // ── WK8005: Secrets in env ──────────────────────────────────────────
76
- // Note: tests with nested container properties (env, resources, securityContext,
77
- // ports, probes) use JSON format, written when core's parseYAML was a line
78
- // parser that misread them. It is js-yaml now (#3006), so YAML works too.
79
-
80
- describe("WK8005: Hardcoded secrets in env", () => {
81
- test("flags hardcoded password in env", () => {
82
- const ctx = makeCtx(JSON.stringify({
83
- apiVersion: "apps/v1",
84
- kind: "Deployment",
85
- metadata: { name: "app" },
86
- spec: {
87
- template: {
88
- spec: {
89
- containers: [
90
- { name: "app", image: "app:1.0", env: [{ name: "DB_PASSWORD", value: "secret123" }] },
91
- ],
92
- },
93
- },
94
- },
95
- }));
96
- const diags = wk8005.check(ctx);
97
- expect(diags.length).toBeGreaterThanOrEqual(1);
98
- expect(diags[0].checkId).toBe("WK8005");
99
- });
100
-
101
- test("passes when env uses secretKeyRef", () => {
102
- const ctx = makeCtx(JSON.stringify({
103
- apiVersion: "apps/v1",
104
- kind: "Deployment",
105
- metadata: { name: "app" },
106
- spec: {
107
- template: {
108
- spec: {
109
- containers: [
110
- { name: "app", image: "app:1.0", env: [{ name: "DB_PASSWORD", valueFrom: { secretKeyRef: { name: "db-secret", key: "password" } } }] },
111
- ],
112
- },
113
- },
114
- },
115
- }));
116
- const diags = wk8005.check(ctx);
117
- expect(diags.length).toBe(0);
118
- });
119
-
120
- test("passes when env var name is not sensitive", () => {
121
- const ctx = makeCtx(JSON.stringify({
122
- apiVersion: "apps/v1",
123
- kind: "Deployment",
124
- metadata: { name: "app" },
125
- spec: {
126
- template: {
127
- spec: {
128
- containers: [
129
- { name: "app", image: "app:1.0", env: [{ name: "LOG_LEVEL", value: "info" }] },
130
- ],
131
- },
132
- },
133
- },
134
- }));
135
- const diags = wk8005.check(ctx);
136
- expect(diags.length).toBe(0);
137
- });
138
-
139
- function envCtx(name: string, value: string) {
140
- return makeCtx(JSON.stringify({
141
- apiVersion: "apps/v1",
142
- kind: "Deployment",
143
- metadata: { name: "app" },
144
- spec: { template: { spec: { containers: [{ name: "app", image: "app:1.0", env: [{ name, value }] }] } } },
145
- }));
146
- }
147
-
148
- test.each([
149
- ["AWS_WEB_IDENTITY_TOKEN_FILE", "/var/run/secrets/aws-iam-token/serviceaccount/token"],
150
- ["AZURE_FEDERATED_TOKEN_FILE", "/var/run/secrets/azure-token/serviceaccount/token"],
151
- ["TLS_KEY_PATH", "/etc/tls/tls.key"],
152
- ["DB_PASSWORD_FILE", "./secrets/db-password"],
153
- ["SECRET_DIR", "/etc/secrets"],
154
- ])("passes when %s points at a path", (name, value) => {
155
- expect(wk8005.check(envCtx(name, value)).length).toBe(0);
156
- });
157
-
158
- test.each([
159
- ["LOG_MESSAGE_KEY", "msg"],
160
- ["PARTITION_KEY", "tenant"],
161
- ["SORT_KEY", "created"],
162
- ["sortKey", "created"],
163
- ])("passes when %s is a field name", (name, value) => {
164
- expect(wk8005.check(envCtx(name, value)).length).toBe(0);
165
- });
166
-
167
- test.each([
168
- ["API_KEY", "abc123"],
169
- ["KEY", "abc123"],
170
- ["STRIPE_KEY", "sk_live_abc"],
171
- ["PRIVATE_KEY", "abc"],
172
- ["APIKEY", "abc"],
173
- ["DB_PASSWORD", "/hunter2/abc"],
174
- ["AUTH_TOKEN_FILE", "ghp_abcdefghijklmnop0123456789"],
175
- ["API_TOKEN_PATH", "abc/def+ghi=="],
176
- ["SECRET_PARTITION_KEY", "abc123"],
177
- ["LOG_MESSAGE_KEY_SECRET", "abc123"],
178
- ])("still flags %s", (name, value) => {
179
- expect(wk8005.check(envCtx(name, value)).length).toBe(1);
180
- });
181
- });
182
-
183
- // ── WK8006: Latest tag ──────────────────────────────────────────────
184
-
185
- describe("WK8006: Latest/untagged images", () => {
186
- test("flags image with :latest tag", () => {
187
- const ctx = makeCtx(`
188
- apiVersion: apps/v1
189
- kind: Deployment
190
- metadata:
191
- name: app
192
- spec:
193
- template:
194
- spec:
195
- containers:
196
- - name: app
197
- image: nginx:latest
198
- `);
199
- const diags = wk8006.check(ctx);
200
- expect(diags.length).toBe(1);
201
- expect(diags[0].checkId).toBe("WK8006");
202
- });
203
-
204
- test("flags untagged image", () => {
205
- const ctx = makeCtx(`
206
- apiVersion: apps/v1
207
- kind: Deployment
208
- metadata:
209
- name: app
210
- spec:
211
- template:
212
- spec:
213
- containers:
214
- - name: app
215
- image: nginx
216
- `);
217
- const diags = wk8006.check(ctx);
218
- expect(diags.length).toBe(1);
219
- });
220
-
221
- test("passes for explicitly tagged image", () => {
222
- const ctx = makeCtx(`
223
- apiVersion: apps/v1
224
- kind: Deployment
225
- metadata:
226
- name: app
227
- spec:
228
- template:
229
- spec:
230
- containers:
231
- - name: app
232
- image: nginx:1.25
233
- `);
234
- const diags = wk8006.check(ctx);
235
- expect(diags.length).toBe(0);
236
- });
237
- });
238
-
239
- // ── WK8041: API keys ────────────────────────────────────────────────
240
-
241
- describe("WK8041: API keys in env", () => {
242
- test("flags Stripe key pattern", () => {
243
- const ctx = makeCtx(JSON.stringify({
244
- apiVersion: "apps/v1",
245
- kind: "Deployment",
246
- metadata: { name: "app" },
247
- spec: {
248
- template: {
249
- spec: {
250
- containers: [
251
- { name: "app", image: "app:1.0", env: [{ name: "STRIPE_KEY", value: "sk_live_abc123def456" }] },
252
- ],
253
- },
254
- },
255
- },
256
- }));
257
- const diags = wk8041.check(ctx);
258
- expect(diags.length).toBeGreaterThanOrEqual(1);
259
- expect(diags[0].checkId).toBe("WK8041");
260
- });
261
-
262
- test("passes for normal values", () => {
263
- const ctx = makeCtx(JSON.stringify({
264
- apiVersion: "apps/v1",
265
- kind: "Deployment",
266
- metadata: { name: "app" },
267
- spec: {
268
- template: {
269
- spec: {
270
- containers: [
271
- { name: "app", image: "app:1.0", env: [{ name: "APP_MODE", value: "production" }] },
272
- ],
273
- },
274
- },
275
- },
276
- }));
277
- const diags = wk8041.check(ctx);
278
- expect(diags.length).toBe(0);
279
- });
280
- });
281
-
282
- // ── WK8042: Private keys ───────────────────────────────────────────
283
-
284
- describe("WK8042: Private keys in manifests", () => {
285
- test("flags private key in ConfigMap", () => {
286
- const ctx = makeCtx(JSON.stringify({
287
- apiVersion: "v1",
288
- kind: "ConfigMap",
289
- metadata: { name: "config" },
290
- data: {
291
- "cert.pem": "-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQEA...\n-----END RSA PRIVATE KEY-----",
292
- },
293
- }));
294
- const diags = wk8042.check(ctx);
295
- expect(diags.length).toBeGreaterThanOrEqual(1);
296
- expect(diags[0].checkId).toBe("WK8042");
297
- });
298
-
299
- test("passes for normal ConfigMap data", () => {
300
- const ctx = makeCtx(JSON.stringify({
301
- apiVersion: "v1",
302
- kind: "ConfigMap",
303
- metadata: { name: "config" },
304
- data: { "config.json": '{"key": "value"}' },
305
- }));
306
- const diags = wk8042.check(ctx);
307
- expect(diags.length).toBe(0);
308
- });
309
- });
310
-
311
- // ── WK8101: Selector mismatch ──────────────────────────────────────
312
-
313
- describe("WK8101: Selector must match template labels", () => {
314
- test("flags when matchLabels != template labels", () => {
315
- const ctx = makeCtx(`
316
- apiVersion: apps/v1
317
- kind: Deployment
318
- metadata:
319
- name: app
320
- spec:
321
- selector:
322
- matchLabels:
323
- app: my-app
324
- template:
325
- metadata:
326
- labels:
327
- app: different-app
328
- spec:
329
- containers:
330
- - name: app
331
- image: app:1.0
332
- `);
333
- const diags = wk8101.check(ctx);
334
- expect(diags.length).toBeGreaterThanOrEqual(1);
335
- expect(diags[0].checkId).toBe("WK8101");
336
- });
337
-
338
- test("passes when selector matches template labels", () => {
339
- const ctx = makeCtx(`
340
- apiVersion: apps/v1
341
- kind: Deployment
342
- metadata:
343
- name: app
344
- spec:
345
- selector:
346
- matchLabels:
347
- app: my-app
348
- template:
349
- metadata:
350
- labels:
351
- app: my-app
352
- spec:
353
- containers:
354
- - name: app
355
- image: app:1.0
356
- `);
357
- const diags = wk8101.check(ctx);
358
- expect(diags.length).toBe(0);
359
- });
360
- });
361
-
362
- // ── WK8102: Missing labels ─────────────────────────────────────────
363
-
364
- describe("WK8102: Missing metadata.labels", () => {
365
- test("flags resource without labels", () => {
366
- const ctx = makeCtx(`
367
- apiVersion: apps/v1
368
- kind: Deployment
369
- metadata:
370
- name: app
371
- spec:
372
- template:
373
- spec:
374
- containers:
375
- - name: app
376
- image: app:1.0
377
- `);
378
- const diags = wk8102.check(ctx);
379
- expect(diags.length).toBeGreaterThanOrEqual(1);
380
- expect(diags[0].checkId).toBe("WK8102");
381
- });
382
-
383
- test("passes with labels present", () => {
384
- const ctx = makeCtx(`
385
- apiVersion: apps/v1
386
- kind: Deployment
387
- metadata:
388
- name: app
389
- labels:
390
- app: my-app
391
- spec:
392
- template:
393
- spec:
394
- containers:
395
- - name: app
396
- image: app:1.0
397
- `);
398
- const diags = wk8102.check(ctx);
399
- expect(diags.length).toBe(0);
400
- });
401
-
402
- test("a metadata.name that is a map is described, not printed as [object Object]", () => {
403
- const ctx = makeCtx(`
404
- apiVersion: v1
405
- kind: Namespace
406
- metadata:
407
- name: {{name}}
408
- `);
409
- const diags = wk8102.check(ctx);
410
- expect(diags).toHaveLength(1);
411
- expect(diags[0].message).toContain("metadata.name is a map");
412
- expect(diags[0].message).toContain("template");
413
- expect(diags[0].message).not.toContain("[object Object]");
414
- expect(diags[0].entity).toBe("Namespace");
415
- });
416
-
417
- test("other name-formatting rules fall back to the kind for a non-string name", () => {
418
- const ctx = makeCtx(`
419
- apiVersion: apps/v1
420
- kind: Deployment
421
- metadata:
422
- name: {{name}}
423
- spec:
424
- template:
425
- spec:
426
- containers:
427
- - name: app
428
- image: app
429
- `);
430
- const diags = [...wk8006.check(ctx), ...wk8201.check(ctx), ...wk8102.check(ctx)];
431
- expect(diags.length).toBeGreaterThanOrEqual(3);
432
- for (const d of diags) {
433
- expect(d.message).not.toContain("[object Object]");
434
- expect(typeof d.entity).toBe("string");
435
- }
436
- });
437
- });
438
-
439
- // ── WK8103: Container name ─────────────────────────────────────────
440
-
441
- describe("WK8103: Container missing name", () => {
442
- test("flags container without name", () => {
443
- const ctx = makeCtx(`
444
- apiVersion: apps/v1
445
- kind: Deployment
446
- metadata:
447
- name: app
448
- spec:
449
- template:
450
- spec:
451
- containers:
452
- - image: app:1.0
453
- `);
454
- const diags = wk8103.check(ctx);
455
- expect(diags.length).toBeGreaterThanOrEqual(1);
456
- expect(diags[0].checkId).toBe("WK8103");
457
- });
458
-
459
- test("passes with container name", () => {
460
- const ctx = makeCtx(`
461
- apiVersion: apps/v1
462
- kind: Deployment
463
- metadata:
464
- name: app
465
- spec:
466
- template:
467
- spec:
468
- containers:
469
- - name: app
470
- image: app:1.0
471
- `);
472
- const diags = wk8103.check(ctx);
473
- expect(diags.length).toBe(0);
474
- });
475
- });
476
-
477
- // ── WK8104: Named ports ────────────────────────────────────────────
478
-
479
- describe("WK8104: Unnamed container ports", () => {
480
- test("flags unnamed ports", () => {
481
- const ctx = makeCtx(JSON.stringify({
482
- apiVersion: "apps/v1",
483
- kind: "Deployment",
484
- metadata: { name: "app" },
485
- spec: {
486
- template: {
487
- spec: {
488
- containers: [
489
- { name: "app", image: "app:1.0", ports: [{ containerPort: 8080 }] },
490
- ],
491
- },
492
- },
493
- },
494
- }));
495
- const diags = wk8104.check(ctx);
496
- expect(diags.length).toBeGreaterThanOrEqual(1);
497
- expect(diags[0].checkId).toBe("WK8104");
498
- });
499
-
500
- test("passes with named ports", () => {
501
- const ctx = makeCtx(JSON.stringify({
502
- apiVersion: "apps/v1",
503
- kind: "Deployment",
504
- metadata: { name: "app" },
505
- spec: {
506
- template: {
507
- spec: {
508
- containers: [
509
- { name: "app", image: "app:1.0", ports: [{ containerPort: 8080, name: "http" }] },
510
- ],
511
- },
512
- },
513
- },
514
- }));
515
- const diags = wk8104.check(ctx);
516
- expect(diags.length).toBe(0);
517
- });
518
- });
519
-
520
- // ── WK8105: imagePullPolicy ────────────────────────────────────────
521
-
522
- describe("WK8105: Missing imagePullPolicy", () => {
523
- test("flags missing imagePullPolicy", () => {
524
- const ctx = makeCtx(JSON.stringify({
525
- apiVersion: "apps/v1",
526
- kind: "Deployment",
527
- metadata: { name: "app" },
528
- spec: {
529
- template: {
530
- spec: {
531
- containers: [{ name: "app", image: "app:1.0" }],
532
- },
533
- },
534
- },
535
- }));
536
- const diags = wk8105.check(ctx);
537
- expect(diags.length).toBeGreaterThanOrEqual(1);
538
- expect(diags[0].checkId).toBe("WK8105");
539
- });
540
-
541
- test("passes with explicit imagePullPolicy", () => {
542
- const ctx = makeCtx(JSON.stringify({
543
- apiVersion: "apps/v1",
544
- kind: "Deployment",
545
- metadata: { name: "app" },
546
- spec: {
547
- template: {
548
- spec: {
549
- containers: [{ name: "app", image: "app:1.0", imagePullPolicy: "IfNotPresent" }],
550
- },
551
- },
552
- },
553
- }));
554
- const diags = wk8105.check(ctx);
555
- expect(diags.length).toBe(0);
556
- });
557
- });
558
-
559
- // ── WK8201: Resource limits ────────────────────────────────────────
560
-
561
- describe("WK8201: Resource limits required", () => {
562
- test("flags container without resource limits", () => {
563
- const ctx = makeCtx(JSON.stringify({
564
- apiVersion: "apps/v1",
565
- kind: "Deployment",
566
- metadata: { name: "app" },
567
- spec: {
568
- template: {
569
- spec: {
570
- containers: [{ name: "app", image: "app:1.0" }],
571
- },
572
- },
573
- },
574
- }));
575
- const diags = wk8201.check(ctx);
576
- expect(diags.length).toBeGreaterThanOrEqual(1);
577
- expect(diags[0].checkId).toBe("WK8201");
578
- });
579
-
580
- test("passes with resource limits", () => {
581
- const ctx = makeCtx(JSON.stringify({
582
- apiVersion: "apps/v1",
583
- kind: "Deployment",
584
- metadata: { name: "app" },
585
- spec: {
586
- template: {
587
- spec: {
588
- containers: [
589
- { name: "app", image: "app:1.0", resources: { limits: { cpu: "500m", memory: "256Mi" } } },
590
- ],
591
- },
592
- },
593
- },
594
- }));
595
- const diags = wk8201.check(ctx);
596
- expect(diags.length).toBe(0);
597
- });
598
- });
599
-
600
- // ── WK8202: Privileged ─────────────────────────────────────────────
601
-
602
- describe("WK8202: Privileged containers", () => {
603
- test("flags privileged: true", () => {
604
- const ctx = makeCtx(JSON.stringify({
605
- apiVersion: "apps/v1",
606
- kind: "Deployment",
607
- metadata: { name: "app" },
608
- spec: {
609
- template: {
610
- spec: {
611
- containers: [
612
- { name: "app", image: "app:1.0", securityContext: { privileged: true } },
613
- ],
614
- },
615
- },
616
- },
617
- }));
618
- const diags = wk8202.check(ctx);
619
- expect(diags.length).toBe(1);
620
- expect(diags[0].checkId).toBe("WK8202");
621
- });
622
-
623
- test("passes with privileged: false", () => {
624
- const ctx = makeCtx(JSON.stringify({
625
- apiVersion: "apps/v1",
626
- kind: "Deployment",
627
- metadata: { name: "app" },
628
- spec: {
629
- template: {
630
- spec: {
631
- containers: [
632
- { name: "app", image: "app:1.0", securityContext: { privileged: false } },
633
- ],
634
- },
635
- },
636
- },
637
- }));
638
- const diags = wk8202.check(ctx);
639
- expect(diags.length).toBe(0);
640
- });
641
- });
642
-
643
- // ── WK8203: readOnlyRootFilesystem ─────────────────────────────────
644
-
645
- describe("WK8203: readOnlyRootFilesystem", () => {
646
- test("flags missing readOnlyRootFilesystem", () => {
647
- const ctx = makeCtx(JSON.stringify({
648
- apiVersion: "apps/v1",
649
- kind: "Deployment",
650
- metadata: { name: "app" },
651
- spec: {
652
- template: {
653
- spec: {
654
- containers: [
655
- { name: "app", image: "app:1.0", securityContext: {} },
656
- ],
657
- },
658
- },
659
- },
660
- }));
661
- const diags = wk8203.check(ctx);
662
- expect(diags.length).toBeGreaterThanOrEqual(1);
663
- expect(diags[0].checkId).toBe("WK8203");
664
- });
665
-
666
- test("passes with readOnlyRootFilesystem: true", () => {
667
- const ctx = makeCtx(JSON.stringify({
668
- apiVersion: "apps/v1",
669
- kind: "Deployment",
670
- metadata: { name: "app" },
671
- spec: {
672
- template: {
673
- spec: {
674
- containers: [
675
- { name: "app", image: "app:1.0", securityContext: { readOnlyRootFilesystem: true } },
676
- ],
677
- },
678
- },
679
- },
680
- }));
681
- const diags = wk8203.check(ctx);
682
- expect(diags.length).toBe(0);
683
- });
684
- });
685
-
686
- // ── WK8204: runAsNonRoot ───────────────────────────────────────────
687
-
688
- describe("WK8204: runAsNonRoot", () => {
689
- test("flags missing runAsNonRoot", () => {
690
- const ctx = makeCtx(JSON.stringify({
691
- apiVersion: "apps/v1",
692
- kind: "Deployment",
693
- metadata: { name: "app" },
694
- spec: {
695
- template: {
696
- spec: {
697
- containers: [
698
- { name: "app", image: "app:1.0", securityContext: {} },
699
- ],
700
- },
701
- },
702
- },
703
- }));
704
- const diags = wk8204.check(ctx);
705
- expect(diags.length).toBeGreaterThanOrEqual(1);
706
- expect(diags[0].checkId).toBe("WK8204");
707
- });
708
-
709
- test("warns when runAsNonRoot: true but no runAsUser", () => {
710
- const ctx = makeCtx(JSON.stringify({
711
- apiVersion: "apps/v1",
712
- kind: "Deployment",
713
- metadata: { name: "app" },
714
- spec: {
715
- template: {
716
- spec: {
717
- containers: [
718
- { name: "app", image: "app:1.0", securityContext: { runAsNonRoot: true } },
719
- ],
720
- },
721
- },
722
- },
723
- }));
724
- const diags = wk8204.check(ctx);
725
- expect(diags.length).toBe(1);
726
- expect(diags[0].checkId).toBe("WK8204");
727
- expect(diags[0].message).toContain("no explicit runAsUser");
728
- });
729
-
730
- test("warns when runAsNonRoot: true with runAsUser: 0 (contradictory)", () => {
731
- const ctx = makeCtx(JSON.stringify({
732
- apiVersion: "apps/v1",
733
- kind: "Deployment",
734
- metadata: { name: "app" },
735
- spec: {
736
- template: {
737
- spec: {
738
- containers: [
739
- { name: "app", image: "app:1.0", securityContext: { runAsNonRoot: true, runAsUser: 0 } },
740
- ],
741
- },
742
- },
743
- },
744
- }));
745
- const diags = wk8204.check(ctx);
746
- expect(diags.length).toBe(1);
747
- expect(diags[0].checkId).toBe("WK8204");
748
- expect(diags[0].message).toContain("contradictory");
749
- });
750
-
751
- test("passes with runAsNonRoot: true and runAsUser: 65534", () => {
752
- const ctx = makeCtx(JSON.stringify({
753
- apiVersion: "apps/v1",
754
- kind: "Deployment",
755
- metadata: { name: "app" },
756
- spec: {
757
- template: {
758
- spec: {
759
- containers: [
760
- { name: "app", image: "app:1.0", securityContext: { runAsNonRoot: true, runAsUser: 65534 } },
761
- ],
762
- },
763
- },
764
- },
765
- }));
766
- const diags = wk8204.check(ctx);
767
- expect(diags.length).toBe(0);
768
- });
769
-
770
- // #1482 — the manifest arrives as real YAML, and the initContainer's args is
771
- // a block scalar. The parser bug turned `- |` into the string "|" and hoisted
772
- // every key after it (securityContext, the containers list itself) to the
773
- // document root, so this check warned on a compliant initContainer and never
774
- // saw the app container at all.
775
- test("initContainer with a block-scalar arg keeps its securityContext, and the app container is still checked (#1482)", () => {
776
- const yaml = [
777
- "apiVersion: apps/v1",
778
- "kind: Deployment",
779
- "metadata:",
780
- " name: app",
781
- "spec:",
782
- " template:",
783
- " spec:",
784
- " initContainers:",
785
- " - name: wait",
786
- " image: pg:16",
787
- " args:",
788
- " - |",
789
- " set -eu",
790
- " echo ready",
791
- " securityContext:",
792
- " runAsNonRoot: true",
793
- " runAsUser: 1001",
794
- " containers:",
795
- " - name: app",
796
- " image: app:1.0",
797
- " securityContext: {}",
798
- "",
799
- ].join("\n");
800
- const ctx = makeCtx(yaml);
801
- const diags = wk8204.check(ctx);
802
- // The compliant initContainer produces nothing; the bare app container is
803
- // the one — and the only one — that warns.
804
- expect(diags.length).toBe(1);
805
- expect(diags[0].message).toContain('"app"');
806
- expect(diags[0].message).not.toContain("wait");
807
- });
808
-
809
- test("pod-level runAsUser satisfies container-level runAsNonRoot", () => {
810
- const ctx = makeCtx(JSON.stringify({
811
- apiVersion: "apps/v1",
812
- kind: "Deployment",
813
- metadata: { name: "app" },
814
- spec: {
815
- template: {
816
- spec: {
817
- securityContext: { runAsUser: 1000 },
818
- containers: [
819
- { name: "app", image: "app:1.0", securityContext: { runAsNonRoot: true } },
820
- ],
821
- },
822
- },
823
- },
824
- }));
825
- const diags = wk8204.check(ctx);
826
- expect(diags.length).toBe(0);
827
- });
828
- });
829
-
830
- // ── WK8205: Drop capabilities ──────────────────────────────────────
831
-
832
- describe("WK8205: Drop all capabilities", () => {
833
- test("flags missing capability drop", () => {
834
- const ctx = makeCtx(JSON.stringify({
835
- apiVersion: "apps/v1",
836
- kind: "Deployment",
837
- metadata: { name: "app" },
838
- spec: {
839
- template: {
840
- spec: {
841
- containers: [
842
- { name: "app", image: "app:1.0", securityContext: {} },
843
- ],
844
- },
845
- },
846
- },
847
- }));
848
- const diags = wk8205.check(ctx);
849
- expect(diags.length).toBeGreaterThanOrEqual(1);
850
- expect(diags[0].checkId).toBe("WK8205");
851
- });
852
-
853
- test("passes with drop ALL", () => {
854
- const ctx = makeCtx(JSON.stringify({
855
- apiVersion: "apps/v1",
856
- kind: "Deployment",
857
- metadata: { name: "app" },
858
- spec: {
859
- template: {
860
- spec: {
861
- containers: [
862
- { name: "app", image: "app:1.0", securityContext: { capabilities: { drop: ["ALL"] } } },
863
- ],
864
- },
865
- },
866
- },
867
- }));
868
- const diags = wk8205.check(ctx);
869
- expect(diags.length).toBe(0);
870
- });
871
- });
872
-
873
- // ── WK8207: hostNetwork ────────────────────────────────────────────
874
-
875
- describe("WK8207: hostNetwork", () => {
876
- test("flags hostNetwork: true", () => {
877
- const ctx = makeCtx(`
878
- apiVersion: apps/v1
879
- kind: Deployment
880
- metadata:
881
- name: app
882
- spec:
883
- template:
884
- spec:
885
- hostNetwork: true
886
- containers:
887
- - name: app
888
- image: app:1.0
889
- `);
890
- const diags = wk8207.check(ctx);
891
- expect(diags.length).toBe(1);
892
- expect(diags[0].checkId).toBe("WK8207");
893
- });
894
-
895
- test("passes without hostNetwork", () => {
896
- const ctx = makeCtx(`
897
- apiVersion: apps/v1
898
- kind: Deployment
899
- metadata:
900
- name: app
901
- spec:
902
- template:
903
- spec:
904
- containers:
905
- - name: app
906
- image: app:1.0
907
- `);
908
- const diags = wk8207.check(ctx);
909
- expect(diags.length).toBe(0);
910
- });
911
- });
912
-
913
- // ── WK8208: hostPID ────────────────────────────────────────────────
914
-
915
- describe("WK8208: hostPID", () => {
916
- test("flags hostPID: true", () => {
917
- const ctx = makeCtx(`
918
- apiVersion: apps/v1
919
- kind: Deployment
920
- metadata:
921
- name: app
922
- spec:
923
- template:
924
- spec:
925
- hostPID: true
926
- containers:
927
- - name: app
928
- image: app:1.0
929
- `);
930
- const diags = wk8208.check(ctx);
931
- expect(diags.length).toBe(1);
932
- expect(diags[0].checkId).toBe("WK8208");
933
- });
934
-
935
- test("passes without hostPID", () => {
936
- const ctx = makeCtx(`
937
- apiVersion: apps/v1
938
- kind: Deployment
939
- metadata:
940
- name: app
941
- spec:
942
- template:
943
- spec:
944
- containers:
945
- - name: app
946
- image: app:1.0
947
- `);
948
- const diags = wk8208.check(ctx);
949
- expect(diags.length).toBe(0);
950
- });
951
- });
952
-
953
- // ── WK8209: hostIPC ────────────────────────────────────────────────
954
-
955
- describe("WK8209: hostIPC", () => {
956
- test("flags hostIPC: true", () => {
957
- const ctx = makeCtx(`
958
- apiVersion: apps/v1
959
- kind: Deployment
960
- metadata:
961
- name: app
962
- spec:
963
- template:
964
- spec:
965
- hostIPC: true
966
- containers:
967
- - name: app
968
- image: app:1.0
969
- `);
970
- const diags = wk8209.check(ctx);
971
- expect(diags.length).toBe(1);
972
- expect(diags[0].checkId).toBe("WK8209");
973
- });
974
-
975
- test("passes without hostIPC", () => {
976
- const ctx = makeCtx(`
977
- apiVersion: apps/v1
978
- kind: Deployment
979
- metadata:
980
- name: app
981
- spec:
982
- template:
983
- spec:
984
- containers:
985
- - name: app
986
- image: app:1.0
987
- `);
988
- const diags = wk8209.check(ctx);
989
- expect(diags.length).toBe(0);
990
- });
991
- });
992
-
993
- // ── WK8301: Probes required ────────────────────────────────────────
994
-
995
- describe("WK8301: Probes required", () => {
996
- test("flags port-serving container without probes", () => {
997
- const ctx = makeCtx(JSON.stringify({
998
- apiVersion: "apps/v1",
999
- kind: "Deployment",
1000
- metadata: { name: "app" },
1001
- spec: {
1002
- template: {
1003
- spec: {
1004
- containers: [
1005
- { name: "app", image: "app:1.0", ports: [{ containerPort: 8080 }] },
1006
- ],
1007
- },
1008
- },
1009
- },
1010
- }));
1011
- const diags = wk8301.check(ctx);
1012
- expect(diags.length).toBeGreaterThanOrEqual(1);
1013
- expect(diags[0].checkId).toBe("WK8301");
1014
- });
1015
-
1016
- test("skips port-less worker Deployment (no inbound traffic to probe)", () => {
1017
- const ctx = makeCtx(JSON.stringify({
1018
- apiVersion: "apps/v1",
1019
- kind: "Deployment",
1020
- metadata: { name: "worker" },
1021
- spec: {
1022
- template: {
1023
- spec: {
1024
- // A queue/Temporal worker — long-running, no port, no probes by design.
1025
- containers: [{ name: "worker", image: "worker:1.0" }],
1026
- },
1027
- },
1028
- },
1029
- }));
1030
- const diags = wk8301.check(ctx);
1031
- expect(diags.length).toBe(0);
1032
- });
1033
-
1034
- test("passes with both probes", () => {
1035
- const ctx = makeCtx(JSON.stringify({
1036
- apiVersion: "apps/v1",
1037
- kind: "Deployment",
1038
- metadata: { name: "app" },
1039
- spec: {
1040
- template: {
1041
- spec: {
1042
- containers: [
1043
- {
1044
- name: "app",
1045
- image: "app:1.0",
1046
- ports: [{ containerPort: 8080 }],
1047
- livenessProbe: { httpGet: { path: "/healthz", port: 8080 } },
1048
- readinessProbe: { httpGet: { path: "/readyz", port: 8080 } },
1049
- },
1050
- ],
1051
- },
1052
- },
1053
- },
1054
- }));
1055
- const diags = wk8301.check(ctx);
1056
- expect(diags.length).toBe(0);
1057
- });
1058
-
1059
- test("skips Job (probes not needed)", () => {
1060
- const ctx = makeCtx(JSON.stringify({
1061
- apiVersion: "batch/v1",
1062
- kind: "Job",
1063
- metadata: { name: "job" },
1064
- spec: {
1065
- template: {
1066
- spec: {
1067
- containers: [{ name: "worker", image: "worker:1.0" }],
1068
- },
1069
- },
1070
- },
1071
- }));
1072
- const diags = wk8301.check(ctx);
1073
- expect(diags.length).toBe(0);
1074
- });
1075
-
1076
- test("skips CronJob", () => {
1077
- const ctx = makeCtx(JSON.stringify({
1078
- apiVersion: "batch/v1",
1079
- kind: "CronJob",
1080
- metadata: { name: "cron" },
1081
- spec: {
1082
- schedule: "0 * * * *",
1083
- jobTemplate: {
1084
- spec: {
1085
- template: {
1086
- spec: {
1087
- containers: [{ name: "cron", image: "cron:1.0" }],
1088
- },
1089
- },
1090
- },
1091
- },
1092
- },
1093
- }));
1094
- const diags = wk8301.check(ctx);
1095
- expect(diags.length).toBe(0);
1096
- });
1097
- });
1098
-
1099
- // ── WK8302: Single replica ─────────────────────────────────────────
1100
-
1101
- describe("WK8302: Single replica deployment", () => {
1102
- test("flags replicas: 1", () => {
1103
- const ctx = makeCtx(`
1104
- apiVersion: apps/v1
1105
- kind: Deployment
1106
- metadata:
1107
- name: app
1108
- spec:
1109
- replicas: 1
1110
- template:
1111
- spec:
1112
- containers:
1113
- - name: app
1114
- image: app:1.0
1115
- `);
1116
- const diags = wk8302.check(ctx);
1117
- expect(diags.length).toBeGreaterThanOrEqual(1);
1118
- expect(diags[0].checkId).toBe("WK8302");
1119
- });
1120
-
1121
- test("passes with replicas: 3", () => {
1122
- const ctx = makeCtx(`
1123
- apiVersion: apps/v1
1124
- kind: Deployment
1125
- metadata:
1126
- name: app
1127
- spec:
1128
- replicas: 3
1129
- template:
1130
- spec:
1131
- containers:
1132
- - name: app
1133
- image: app:1.0
1134
- `);
1135
- const diags = wk8302.check(ctx);
1136
- expect(diags.length).toBe(0);
1137
- });
1138
- });
1139
-
1140
- // ── WK8303: PDB missing ───────────────────────────────────────────
1141
-
1142
- describe("WK8303: HA Deployment without PDB", () => {
1143
- test("flags HA Deployment without PDB", () => {
1144
- const ctx = makeCtx(`
1145
- apiVersion: apps/v1
1146
- kind: Deployment
1147
- metadata:
1148
- name: app
1149
- labels:
1150
- app: my-app
1151
- spec:
1152
- replicas: 3
1153
- selector:
1154
- matchLabels:
1155
- app: my-app
1156
- template:
1157
- metadata:
1158
- labels:
1159
- app: my-app
1160
- spec:
1161
- containers:
1162
- - name: app
1163
- image: app:1.0
1164
- `);
1165
- const diags = wk8303.check(ctx);
1166
- expect(diags.length).toBeGreaterThanOrEqual(1);
1167
- expect(diags[0].checkId).toBe("WK8303");
1168
- });
1169
-
1170
- test("passes with PDB present", () => {
1171
- const ctx = makeCtx(`
1172
- apiVersion: apps/v1
1173
- kind: Deployment
1174
- metadata:
1175
- name: app
1176
- labels:
1177
- app: my-app
1178
- spec:
1179
- replicas: 3
1180
- selector:
1181
- matchLabels:
1182
- app: my-app
1183
- template:
1184
- metadata:
1185
- labels:
1186
- app: my-app
1187
- spec:
1188
- containers:
1189
- - name: app
1190
- image: app:1.0
1191
- ---
1192
- apiVersion: policy/v1
1193
- kind: PodDisruptionBudget
1194
- metadata:
1195
- name: app-pdb
1196
- spec:
1197
- minAvailable: 1
1198
- selector:
1199
- matchLabels:
1200
- app: my-app
1201
- `);
1202
- const diags = wk8303.check(ctx);
1203
- expect(diags.length).toBe(0);
1204
- });
1205
- });
1206
-
1207
- // ── WK8304: SSL redirect without certificate ────────────────────────
1208
-
1209
- describe("WK8304: SSL redirect without certificate", () => {
1210
- test("flags ssl-redirect without certificate-arn", () => {
1211
- const ctx = makeCtx(JSON.stringify({
1212
- apiVersion: "networking.k8s.io/v1",
1213
- kind: "Ingress",
1214
- metadata: {
1215
- name: "app-ingress",
1216
- annotations: {
1217
- "alb.ingress.kubernetes.io/ssl-redirect": "443",
1218
- "alb.ingress.kubernetes.io/scheme": "internet-facing",
1219
- },
1220
- },
1221
- spec: { rules: [] },
1222
- }));
1223
- const diags = wk8304.check(ctx);
1224
- expect(diags.length).toBe(1);
1225
- expect(diags[0].checkId).toBe("WK8304");
1226
- expect(diags[0].severity).toBe("warning");
1227
- });
1228
-
1229
- test("flags ssl-redirect with valid cert but no HTTPS in listen-ports", () => {
1230
- const ctx = makeCtx(JSON.stringify({
1231
- apiVersion: "networking.k8s.io/v1",
1232
- kind: "Ingress",
1233
- metadata: {
1234
- name: "app-ingress",
1235
- annotations: {
1236
- "alb.ingress.kubernetes.io/ssl-redirect": "443",
1237
- "alb.ingress.kubernetes.io/certificate-arn": "arn:aws:acm:us-east-1:123:certificate/abc",
1238
- "alb.ingress.kubernetes.io/listen-ports": '[{"HTTP":80}]',
1239
- },
1240
- },
1241
- spec: { rules: [] },
1242
- }));
1243
- const diags = wk8304.check(ctx);
1244
- expect(diags.length).toBe(1);
1245
- expect(diags[0].checkId).toBe("WK8304");
1246
- });
1247
-
1248
- test("passes with valid cert and HTTPS listen-ports", () => {
1249
- const ctx = makeCtx(JSON.stringify({
1250
- apiVersion: "networking.k8s.io/v1",
1251
- kind: "Ingress",
1252
- metadata: {
1253
- name: "app-ingress",
1254
- annotations: {
1255
- "alb.ingress.kubernetes.io/ssl-redirect": "443",
1256
- "alb.ingress.kubernetes.io/certificate-arn": "arn:aws:acm:us-east-1:123:certificate/abc",
1257
- "alb.ingress.kubernetes.io/listen-ports": '[{"HTTPS":443}]',
1258
- },
1259
- },
1260
- spec: { rules: [] },
1261
- }));
1262
- const diags = wk8304.check(ctx);
1263
- expect(diags.length).toBe(0);
1264
- });
1265
-
1266
- test("passes with no ssl-redirect annotation", () => {
1267
- const ctx = makeCtx(JSON.stringify({
1268
- apiVersion: "networking.k8s.io/v1",
1269
- kind: "Ingress",
1270
- metadata: {
1271
- name: "app-ingress",
1272
- annotations: {
1273
- "alb.ingress.kubernetes.io/scheme": "internet-facing",
1274
- },
1275
- },
1276
- spec: { rules: [] },
1277
- }));
1278
- const diags = wk8304.check(ctx);
1279
- expect(diags.length).toBe(0);
1280
- });
1281
- });
1282
-
1283
- // ── WK8305: Ingress port not matching Service ───────────────────────
1284
-
1285
- describe("WK8305: Ingress port not matching Service", () => {
1286
- test("flags Ingress backend port not on Service", () => {
1287
- const svc = JSON.stringify({
1288
- apiVersion: "v1",
1289
- kind: "Service",
1290
- metadata: { name: "api", namespace: "default" },
1291
- spec: { ports: [{ port: 80, targetPort: 8080 }] },
1292
- });
1293
- const ingress = JSON.stringify({
1294
- apiVersion: "networking.k8s.io/v1",
1295
- kind: "Ingress",
1296
- metadata: { name: "api-ingress", namespace: "default" },
1297
- spec: {
1298
- rules: [{
1299
- host: "api.example.com",
1300
- http: {
1301
- paths: [{
1302
- path: "/",
1303
- backend: { service: { name: "api", port: { number: 8080 } } },
1304
- }],
1305
- },
1306
- }],
1307
- },
1308
- });
1309
- const ctx = makeCtx(`${svc}\n---\n${ingress}`);
1310
- const diags = wk8305.check(ctx);
1311
- expect(diags.length).toBe(1);
1312
- expect(diags[0].checkId).toBe("WK8305");
1313
- expect(diags[0].severity).toBe("warning");
1314
- });
1315
-
1316
- test("passes when port matches Service", () => {
1317
- const svc = JSON.stringify({
1318
- apiVersion: "v1",
1319
- kind: "Service",
1320
- metadata: { name: "api", namespace: "default" },
1321
- spec: { ports: [{ port: 80, targetPort: 8080 }] },
1322
- });
1323
- const ingress = JSON.stringify({
1324
- apiVersion: "networking.k8s.io/v1",
1325
- kind: "Ingress",
1326
- metadata: { name: "api-ingress", namespace: "default" },
1327
- spec: {
1328
- rules: [{
1329
- host: "api.example.com",
1330
- http: {
1331
- paths: [{
1332
- path: "/",
1333
- backend: { service: { name: "api", port: { number: 80 } } },
1334
- }],
1335
- },
1336
- }],
1337
- },
1338
- });
1339
- const ctx = makeCtx(`${svc}\n---\n${ingress}`);
1340
- const diags = wk8305.check(ctx);
1341
- expect(diags.length).toBe(0);
1342
- });
1343
-
1344
- test("skips when Service not in manifest set", () => {
1345
- const ctx = makeCtx(JSON.stringify({
1346
- apiVersion: "networking.k8s.io/v1",
1347
- kind: "Ingress",
1348
- metadata: { name: "api-ingress", namespace: "default" },
1349
- spec: {
1350
- rules: [{
1351
- host: "api.example.com",
1352
- http: {
1353
- paths: [{
1354
- path: "/",
1355
- backend: { service: { name: "external-svc", port: { number: 443 } } },
1356
- }],
1357
- },
1358
- }],
1359
- },
1360
- }));
1361
- const diags = wk8305.check(ctx);
1362
- expect(diags.length).toBe(0);
1363
- });
1364
-
1365
- test("passes with multiple Services, correct match", () => {
1366
- const svc1 = JSON.stringify({
1367
- apiVersion: "v1",
1368
- kind: "Service",
1369
- metadata: { name: "api", namespace: "prod" },
1370
- spec: { ports: [{ port: 80 }, { port: 443 }] },
1371
- });
1372
- const svc2 = JSON.stringify({
1373
- apiVersion: "v1",
1374
- kind: "Service",
1375
- metadata: { name: "web", namespace: "prod" },
1376
- spec: { ports: [{ port: 3000 }] },
1377
- });
1378
- const ingress = JSON.stringify({
1379
- apiVersion: "networking.k8s.io/v1",
1380
- kind: "Ingress",
1381
- metadata: { name: "main-ingress", namespace: "prod" },
1382
- spec: {
1383
- rules: [{
1384
- host: "app.example.com",
1385
- http: {
1386
- paths: [
1387
- { path: "/api", backend: { service: { name: "api", port: { number: 443 } } } },
1388
- { path: "/", backend: { service: { name: "web", port: { number: 3000 } } } },
1389
- ],
1390
- },
1391
- }],
1392
- },
1393
- });
1394
- const ctx = makeCtx(`${svc1}\n---\n${svc2}\n---\n${ingress}`);
1395
- const diags = wk8305.check(ctx);
1396
- expect(diags.length).toBe(0);
1397
- });
1398
- });
1399
-
1400
- // ── WK8306: Container command starts with flag ───────────────────
1401
-
1402
- describe("WK8306: Container command starts with flag", () => {
1403
- test("flags command[0] starting with --", () => {
1404
- const ctx = makeCtx(JSON.stringify({
1405
- apiVersion: "apps/v1",
1406
- kind: "Deployment",
1407
- metadata: { name: "adot" },
1408
- spec: {
1409
- template: {
1410
- spec: {
1411
- containers: [
1412
- { name: "collector", image: "otel:1.0", command: ["--config=/etc/adot/config.yaml"] },
1413
- ],
1414
- },
1415
- },
1416
- },
1417
- }));
1418
- const diags = wk8306.check(ctx);
1419
- expect(diags.length).toBe(1);
1420
- expect(diags[0].checkId).toBe("WK8306");
1421
- expect(diags[0].severity).toBe("error");
1422
- expect(diags[0].message).toContain("--config");
1423
- });
1424
-
1425
- test("flags command[0] starting with -", () => {
1426
- const ctx = makeCtx(JSON.stringify({
1427
- apiVersion: "apps/v1",
1428
- kind: "Deployment",
1429
- metadata: { name: "app" },
1430
- spec: {
1431
- template: {
1432
- spec: {
1433
- containers: [
1434
- { name: "app", image: "app:1.0", command: ["-c", "echo hello"] },
1435
- ],
1436
- },
1437
- },
1438
- },
1439
- }));
1440
- const diags = wk8306.check(ctx);
1441
- expect(diags.length).toBe(1);
1442
- expect(diags[0].severity).toBe("error");
1443
- });
1444
-
1445
- test("passes when command[0] is a binary path", () => {
1446
- const ctx = makeCtx(JSON.stringify({
1447
- apiVersion: "apps/v1",
1448
- kind: "Deployment",
1449
- metadata: { name: "app" },
1450
- spec: {
1451
- template: {
1452
- spec: {
1453
- containers: [
1454
- { name: "app", image: "app:1.0", command: ["/usr/bin/app", "--flag"] },
1455
- ],
1456
- },
1457
- },
1458
- },
1459
- }));
1460
- const diags = wk8306.check(ctx);
1461
- expect(diags.length).toBe(0);
1462
- });
1463
-
1464
- test("passes when flags are in args (correct usage)", () => {
1465
- const ctx = makeCtx(JSON.stringify({
1466
- apiVersion: "apps/v1",
1467
- kind: "Deployment",
1468
- metadata: { name: "app" },
1469
- spec: {
1470
- template: {
1471
- spec: {
1472
- containers: [
1473
- { name: "app", image: "app:1.0", args: ["--config=foo"] },
1474
- ],
1475
- },
1476
- },
1477
- },
1478
- }));
1479
- const diags = wk8306.check(ctx);
1480
- expect(diags.length).toBe(0);
1481
- });
1482
-
1483
- test("passes when no command field", () => {
1484
- const ctx = makeCtx(JSON.stringify({
1485
- apiVersion: "apps/v1",
1486
- kind: "Deployment",
1487
- metadata: { name: "app" },
1488
- spec: {
1489
- template: {
1490
- spec: {
1491
- containers: [
1492
- { name: "app", image: "app:1.0" },
1493
- ],
1494
- },
1495
- },
1496
- },
1497
- }));
1498
- const diags = wk8306.check(ctx);
1499
- expect(diags.length).toBe(0);
1500
- });
1501
- });
1502
-
1503
- // ── WK8401: shmSize exceeds memory limit ────────────────────────────────────
1504
-
1505
- function makeRayCluster(overrides: {
1506
- shmSizeLimit?: string;
1507
- memoryLimit?: string;
1508
- workerShmSizeLimit?: string;
1509
- workerMemoryLimit?: string;
1510
- rayVersion?: string;
1511
- headImage?: string;
1512
- }) {
1513
- const headImage = overrides.headImage ?? "rayproject/ray:2.40.0-py310-cpu";
1514
- return JSON.stringify({
1515
- apiVersion: "ray.io/v1alpha1",
1516
- kind: "RayCluster",
1517
- metadata: { name: "ray" },
1518
- spec: {
1519
- ...(overrides.rayVersion !== undefined && { rayVersion: overrides.rayVersion }),
1520
- headGroupSpec: {
1521
- template: {
1522
- spec: {
1523
- volumes: [{ name: "dshm", emptyDir: { medium: "Memory", ...(overrides.shmSizeLimit !== undefined && { sizeLimit: overrides.shmSizeLimit }) } }],
1524
- containers: [{ name: "ray-head", image: headImage, resources: { limits: { memory: overrides.memoryLimit ?? "8Gi" } } }],
1525
- },
1526
- },
1527
- },
1528
- workerGroupSpecs: [
1529
- {
1530
- groupName: "cpu",
1531
- template: {
1532
- spec: {
1533
- volumes: [{ name: "dshm", emptyDir: { medium: "Memory", ...(overrides.workerShmSizeLimit !== undefined && { sizeLimit: overrides.workerShmSizeLimit }) } }],
1534
- containers: [{ name: "ray-worker", image: headImage, resources: { limits: { memory: overrides.workerMemoryLimit ?? "4Gi" } } }],
1535
- },
1536
- },
1537
- },
1538
- ],
1539
- },
1540
- });
1541
- }
1542
-
1543
- describe("WK8401: shmSize exceeds memory limit", () => {
1544
- test("passes when shmSize equals memory limit", () => {
1545
- const ctx = makeCtx(makeRayCluster({ shmSizeLimit: "8Gi", memoryLimit: "8Gi" }));
1546
- const diags = wk8401.check(ctx);
1547
- expect(diags.filter((d) => d.checkId === "WK8401").length).toBe(0);
1548
- });
1549
-
1550
- test("passes when shmSize is less than memory limit", () => {
1551
- const ctx = makeCtx(makeRayCluster({ shmSizeLimit: "2Gi", memoryLimit: "8Gi" }));
1552
- const diags = wk8401.check(ctx);
1553
- expect(diags.filter((d) => d.checkId === "WK8401").length).toBe(0);
1554
- });
1555
-
1556
- test("errors when head shmSize exceeds memory limit", () => {
1557
- const ctx = makeCtx(makeRayCluster({ shmSizeLimit: "16Gi", memoryLimit: "8Gi" }));
1558
- const diags = wk8401.check(ctx);
1559
- const errors = diags.filter((d) => d.checkId === "WK8401" && d.severity === "error");
1560
- expect(errors.length).toBeGreaterThanOrEqual(1);
1561
- expect(errors[0].message).toContain("head");
1562
- expect(errors[0].message).toContain("16Gi");
1563
- });
1564
-
1565
- test("errors when worker shmSize exceeds memory limit", () => {
1566
- const ctx = makeCtx(makeRayCluster({ workerShmSizeLimit: "8Gi", workerMemoryLimit: "4Gi" }));
1567
- const diags = wk8401.check(ctx);
1568
- const errors = diags.filter((d) => d.checkId === "WK8401" && d.severity === "error");
1569
- expect(errors.length).toBeGreaterThanOrEqual(1);
1570
- expect(errors[0].message).toContain("worker");
1571
- });
1572
-
1573
- test("skips check when no sizeLimit set on emptyDir", () => {
1574
- const ctx = makeCtx(makeRayCluster({ shmSizeLimit: undefined }));
1575
- const diags = wk8401.check(ctx);
1576
- expect(diags.filter((d) => d.checkId === "WK8401").length).toBe(0);
1577
- });
1578
-
1579
- test("ignores non-RayCluster manifests", () => {
1580
- const ctx = makeCtx(JSON.stringify({
1581
- apiVersion: "apps/v1",
1582
- kind: "Deployment",
1583
- metadata: { name: "app" },
1584
- spec: { template: { spec: { volumes: [{ name: "dshm", emptyDir: { medium: "Memory", sizeLimit: "16Gi" } }], containers: [{ name: "app", image: "app:1.0", resources: { limits: { memory: "4Gi" } } }] } } },
1585
- }));
1586
- const diags = wk8401.check(ctx);
1587
- expect(diags.filter((d) => d.checkId === "WK8401").length).toBe(0);
1588
- });
1589
- });
1590
-
1591
- // ── WK8402: RayCluster missing spec.rayVersion ───────────────────────────────
1592
-
1593
- describe("WK8402: RayCluster missing spec.rayVersion", () => {
1594
- test("passes when rayVersion is set", () => {
1595
- const ctx = makeCtx(makeRayCluster({ rayVersion: "2.40.0" }));
1596
- const diags = wk8402.check(ctx);
1597
- expect(diags.filter((d) => d.checkId === "WK8402").length).toBe(0);
1598
- });
1599
-
1600
- test("warns when rayVersion is absent", () => {
1601
- const ctx = makeCtx(makeRayCluster({}));
1602
- const diags = wk8402.check(ctx);
1603
- const warns = diags.filter((d) => d.checkId === "WK8402");
1604
- expect(warns.length).toBe(1);
1605
- expect(warns[0].severity).toBe("warning");
1606
- expect(warns[0].message).toContain("latest");
1607
- });
1608
-
1609
- test("ignores non-RayCluster manifests", () => {
1610
- const ctx = makeCtx(JSON.stringify({ apiVersion: "apps/v1", kind: "Deployment", metadata: { name: "app" }, spec: {} }));
1611
- const diags = wk8402.check(ctx);
1612
- expect(diags.filter((d) => d.checkId === "WK8402").length).toBe(0);
1613
- });
1614
- });
1615
-
1616
- // ── WK8403: spec.rayVersion / image tag mismatch ─────────────────────────────
1617
-
1618
- describe("WK8403: spec.rayVersion does not match image tag", () => {
1619
- test("passes when versions match", () => {
1620
- const ctx = makeCtx(makeRayCluster({ rayVersion: "2.40.0", headImage: "rayproject/ray:2.40.0-py310-cpu" }));
1621
- const diags = wk8403.check(ctx);
1622
- expect(diags.filter((d) => d.checkId === "WK8403").length).toBe(0);
1623
- });
1624
-
1625
- test("warns when rayVersion does not match image tag", () => {
1626
- const ctx = makeCtx(makeRayCluster({ rayVersion: "2.39.0", headImage: "rayproject/ray:2.40.0-py310-cpu" }));
1627
- const diags = wk8403.check(ctx);
1628
- const warns = diags.filter((d) => d.checkId === "WK8403");
1629
- expect(warns.length).toBe(1);
1630
- expect(warns[0].severity).toBe("warning");
1631
- expect(warns[0].message).toContain("2.39.0");
1632
- expect(warns[0].message).toContain("2.40.0");
1633
- });
1634
-
1635
- test("skips when rayVersion is absent (WK8402 covers that)", () => {
1636
- const ctx = makeCtx(makeRayCluster({ headImage: "rayproject/ray:2.40.0" }));
1637
- const diags = wk8403.check(ctx);
1638
- expect(diags.filter((d) => d.checkId === "WK8403").length).toBe(0);
1639
- });
1640
-
1641
- test("skips when image tag has no parseable version", () => {
1642
- const ctx = makeCtx(makeRayCluster({ rayVersion: "2.40.0", headImage: "rayproject/ray:latest" }));
1643
- const diags = wk8403.check(ctx);
1644
- expect(diags.filter((d) => d.checkId === "WK8403").length).toBe(0);
1645
- });
1646
- });
1647
-
1648
- // ── WK8404: GPU request without a matching toleration ─────────────────────────
1649
-
1650
- function servingRuntime(opts: {
1651
- resources?: Record<string, unknown>;
1652
- tolerations?: unknown[];
1653
- kind?: string;
1654
- }) {
1655
- return {
1656
- apiVersion: "serving.kserve.io/v1alpha1",
1657
- kind: opts.kind ?? "ServingRuntime",
1658
- metadata: { name: "vllm-runtime", namespace: "models" },
1659
- spec: {
1660
- containers: [
1661
- {
1662
- name: "kserve-container",
1663
- image: "vllm/vllm-openai:v0.7.0",
1664
- ...(opts.resources && { resources: opts.resources }),
1665
- },
1666
- ],
1667
- ...(opts.tolerations && { tolerations: opts.tolerations }),
1668
- },
1669
- };
1670
- }
1671
-
1672
- describe("WK8404: GPU request without a matching toleration", () => {
1673
- test("flags a GPU request with no toleration", () => {
1674
- const ctx = makeCtx(JSON.stringify(servingRuntime({
1675
- resources: { requests: { "nvidia.com/gpu": "1" }, limits: { "nvidia.com/gpu": "1" } },
1676
- })));
1677
- const diags = wk8404.check(ctx);
1678
- expect(diags.length).toBe(1);
1679
- expect(diags[0].checkId).toBe("WK8404");
1680
- expect(diags[0].severity).toBe("error");
1681
- expect(diags[0].message).toContain("nvidia.com/gpu");
1682
- });
1683
-
1684
- test("passes with an explicit nvidia.com/gpu toleration", () => {
1685
- const ctx = makeCtx(JSON.stringify(servingRuntime({
1686
- resources: { requests: { "nvidia.com/gpu": "1" }, limits: { "nvidia.com/gpu": "1" } },
1687
- tolerations: [{ key: "nvidia.com/gpu", operator: "Exists", effect: "NoSchedule" }],
1688
- })));
1689
- expect(wk8404.check(ctx).length).toBe(0);
1690
- });
1691
-
1692
- test("passes with a wildcard Exists toleration (no key)", () => {
1693
- const ctx = makeCtx(JSON.stringify(servingRuntime({
1694
- resources: { requests: { "nvidia.com/gpu": "1" } },
1695
- tolerations: [{ operator: "Exists" }],
1696
- })));
1697
- expect(wk8404.check(ctx).length).toBe(0);
1698
- });
1699
-
1700
- test("skips containers that don't request a GPU", () => {
1701
- const ctx = makeCtx(JSON.stringify(servingRuntime({
1702
- resources: { requests: { cpu: "2" }, limits: { cpu: "2" } },
1703
- })));
1704
- expect(wk8404.check(ctx).length).toBe(0);
1705
- });
1706
-
1707
- test("also flags a plain Deployment requesting a GPU with no toleration", () => {
1708
- const ctx = makeCtx(JSON.stringify({
1709
- apiVersion: "apps/v1",
1710
- kind: "Deployment",
1711
- metadata: { name: "gpu-app" },
1712
- spec: {
1713
- template: {
1714
- spec: {
1715
- containers: [
1716
- { name: "app", image: "app:1.0", resources: { requests: { "nvidia.com/gpu": "2" }, limits: { "nvidia.com/gpu": "2" } } },
1717
- ],
1718
- },
1719
- },
1720
- },
1721
- }));
1722
- const diags = wk8404.check(ctx);
1723
- expect(diags.length).toBe(1);
1724
- expect(diags[0].entity).toBe("gpu-app");
1725
- });
1726
- });
1727
-
1728
- // ── WK8405: Serving workload without a PodDisruptionBudget ─────────────────────
1729
-
1730
- function inferenceService(opts: { name?: string; labels?: Record<string, string> }) {
1731
- return {
1732
- apiVersion: "serving.kserve.io/v1beta1",
1733
- kind: "InferenceService",
1734
- metadata: {
1735
- name: opts.name ?? "llama-3-8b",
1736
- namespace: "serving",
1737
- labels: { "app.kubernetes.io/component": "inference-service", ...opts.labels },
1738
- },
1739
- spec: {
1740
- predictor: {
1741
- model: { runtime: "vllm-runtime", storageUri: "gs://my-models/llama-3-8b/v1" },
1742
- },
1743
- },
1744
- };
1745
- }
1746
-
1747
- function pdb(matchLabels: Record<string, string>) {
1748
- return {
1749
- apiVersion: "policy/v1",
1750
- kind: "PodDisruptionBudget",
1751
- metadata: { name: "pdb" },
1752
- spec: { minAvailable: 1, selector: { matchLabels } },
1753
- };
1754
- }
1755
-
1756
- describe("WK8405: Serving workload without a PDB", () => {
1757
- test("flags an InferenceService with no covering PDB", () => {
1758
- const ctx = makeCtx(JSON.stringify(inferenceService({})));
1759
- const diags = wk8405.check(ctx);
1760
- expect(diags.length).toBe(1);
1761
- expect(diags[0].checkId).toBe("WK8405");
1762
- expect(diags[0].severity).toBe("info");
1763
- });
1764
-
1765
- test("passes when a PDB selector covers the InferenceService's labels", () => {
1766
- const ctx = manifestsCtx(
1767
- inferenceService({}),
1768
- pdb({ "app.kubernetes.io/component": "inference-service" }),
1769
- );
1770
- expect(wk8405.check(ctx).length).toBe(0);
1771
- });
1772
-
1773
- test("flags a Deployment labeled as a serving component with no PDB", () => {
1774
- const ctx = makeCtx(JSON.stringify({
1775
- apiVersion: "apps/v1",
1776
- kind: "Deployment",
1777
- metadata: { name: "serving-dep", labels: { "app.kubernetes.io/component": "vllm-serving-runtime" } },
1778
- spec: { replicas: 1, template: { spec: { containers: [{ name: "app", image: "app:1.0" }] } } },
1779
- }));
1780
- const diags = wk8405.check(ctx);
1781
- expect(diags.length).toBe(1);
1782
- expect(diags[0].entity).toBe("serving-dep");
1783
- });
1784
-
1785
- test("ignores a plain Deployment with no serving component label", () => {
1786
- const ctx = makeCtx(JSON.stringify({
1787
- apiVersion: "apps/v1",
1788
- kind: "Deployment",
1789
- metadata: { name: "other-dep", labels: { "app.kubernetes.io/component": "web" } },
1790
- spec: { replicas: 1, template: { spec: { containers: [{ name: "app", image: "app:1.0" }] } } },
1791
- }));
1792
- expect(wk8405.check(ctx).length).toBe(0);
1793
- });
1794
- });
1795
-
1796
- // ── WK8406: No resource limits on a GPU pod ─────────────────────────────────
1797
-
1798
- describe("WK8406: GPU container missing resource limits", () => {
1799
- test("flags a GPU-requesting container with no limits", () => {
1800
- const ctx = makeCtx(JSON.stringify(servingRuntime({
1801
- resources: { requests: { "nvidia.com/gpu": "1" } },
1802
- })));
1803
- const diags = wk8406.check(ctx);
1804
- expect(diags.length).toBe(1);
1805
- expect(diags[0].checkId).toBe("WK8406");
1806
- expect(diags[0].severity).toBe("warning");
1807
- expect(diags[0].message).toContain("cpu, memory");
1808
- });
1809
-
1810
- test("flags a GPU-requesting container missing only memory limit", () => {
1811
- const ctx = makeCtx(JSON.stringify(servingRuntime({
1812
- resources: { requests: { "nvidia.com/gpu": "1" }, limits: { cpu: "4", "nvidia.com/gpu": "1" } },
1813
- })));
1814
- const diags = wk8406.check(ctx);
1815
- expect(diags.length).toBe(1);
1816
- expect(diags[0].message).toContain("memory");
1817
- expect(diags[0].message).not.toContain("cpu,");
1818
- });
1819
-
1820
- test("passes with full cpu/memory limits on the GPU container", () => {
1821
- const ctx = makeCtx(JSON.stringify(servingRuntime({
1822
- resources: { requests: { "nvidia.com/gpu": "1" }, limits: { cpu: "4", memory: "16Gi", "nvidia.com/gpu": "1" } },
1823
- })));
1824
- expect(wk8406.check(ctx).length).toBe(0);
1825
- });
1826
-
1827
- test("ignores containers with no GPU request even without limits", () => {
1828
- const ctx = makeCtx(JSON.stringify(servingRuntime({})));
1829
- expect(wk8406.check(ctx).length).toBe(0);
1830
- });
1831
- });
1832
-
1833
- // ── WK8407: Unpinned model version ──────────────────────────────────────────
1834
-
1835
- describe("WK8407: Unpinned model version", () => {
1836
- test("flags a storageUri with no version segment", () => {
1837
- const manifest = inferenceService({});
1838
- manifest.spec.predictor.model.storageUri = "gs://my-models-bucket";
1839
- const diags = wk8407.check(makeCtx(JSON.stringify(manifest)));
1840
- expect(diags.length).toBe(1);
1841
- expect(diags[0].checkId).toBe("WK8407");
1842
- expect(diags[0].severity).toBe("warning");
1843
- });
1844
-
1845
- test("flags a floating tag (latest) as unpinned", () => {
1846
- const manifest = inferenceService({});
1847
- manifest.spec.predictor.model.storageUri = "gs://my-models-bucket/llama-3-8b/latest";
1848
- const diags = wk8407.check(makeCtx(JSON.stringify(manifest)));
1849
- expect(diags.length).toBe(1);
1850
- });
1851
-
1852
- test("passes a pinned storageUri (scheme://id/version)", () => {
1853
- const manifest = inferenceService({});
1854
- manifest.spec.predictor.model.storageUri = "gs://my-models/llama-3-8b/2024-07-01";
1855
- const diags = wk8407.check(makeCtx(JSON.stringify(manifest)));
1856
- expect(diags.length).toBe(0);
1857
- });
1858
-
1859
- test("passes a pinned storageUri with a semver version", () => {
1860
- const manifest = inferenceService({});
1861
- manifest.spec.predictor.model.storageUri = "hf://meta-llama/Llama-3-8B/v1.0.0";
1862
- const diags = wk8407.check(makeCtx(JSON.stringify(manifest)));
1863
- expect(diags.length).toBe(0);
1864
- });
1865
-
1866
- test("ignores non-InferenceService manifests", () => {
1867
- const ctx = makeCtx(JSON.stringify({
1868
- apiVersion: "apps/v1",
1869
- kind: "Deployment",
1870
- metadata: { name: "app" },
1871
- spec: { template: { spec: { containers: [{ name: "app", image: "app:1.0" }] } } },
1872
- }));
1873
- expect(wk8407.check(ctx).length).toBe(0);
1874
- });
1875
- });
1876
-
1877
- // ── ARGO002: Application.spec.project references a declared AppProject ─────────
1878
-
1879
- function argoApp(name: string, spec: Record<string, unknown>) {
1880
- return { apiVersion: "argoproj.io/v1alpha1", kind: "Application", metadata: { name }, spec };
1881
- }
1882
- function appProject(name: string) {
1883
- return { apiVersion: "argoproj.io/v1alpha1", kind: "AppProject", metadata: { name }, spec: {} };
1884
- }
1885
- const inClusterDest = { server: "https://kubernetes.default.svc", namespace: "demo" };
1886
-
1887
- describe("ARGO002: Application project references a declared AppProject", () => {
1888
- test("metadata", () => {
1889
- expect(argo002.id).toBe("ARGO002");
1890
- });
1891
-
1892
- test("flags an Application referencing an undeclared project", () => {
1893
- const ctx = manifestsCtx(argoApp("api", { project: "team-a", destination: inClusterDest }));
1894
- const diags = argo002.check(ctx);
1895
- expect(diags.length).toBe(1);
1896
- expect(diags[0].checkId).toBe("ARGO002");
1897
- expect(diags[0].message).toContain("team-a");
1898
- });
1899
-
1900
- test("passes when the AppProject is declared in the same build", () => {
1901
- const ctx = manifestsCtx(
1902
- appProject("team-a"),
1903
- argoApp("api", { project: "team-a", destination: inClusterDest }),
1904
- );
1905
- expect(argo002.check(ctx).length).toBe(0);
1906
- });
1907
-
1908
- test("does NOT flag the built-in default project", () => {
1909
- const ctx = manifestsCtx(argoApp("api", { project: "default", destination: inClusterDest }));
1910
- expect(argo002.check(ctx).length).toBe(0);
1911
- });
1912
- });
1913
-
1914
- // ── ARGO003: Application destination references a registered cluster ──────────
1915
-
1916
- function clusterSecret(name: string, server: string) {
1917
- return {
1918
- apiVersion: "v1",
1919
- kind: "Secret",
1920
- metadata: { name, labels: { "argocd.argoproj.io/secret-type": "cluster" } },
1921
- stringData: { name, server },
1922
- };
1923
- }
1924
-
1925
- describe("ARGO003: Application destination references a registered cluster", () => {
1926
- test("metadata", () => {
1927
- expect(argo003.id).toBe("ARGO003");
1928
- });
1929
-
1930
- test("does NOT flag the in-cluster destination", () => {
1931
- const ctx = manifestsCtx(argoApp("api", { project: "default", destination: inClusterDest }));
1932
- expect(argo003.check(ctx).length).toBe(0);
1933
- });
1934
-
1935
- test("flags an unregistered cluster server", () => {
1936
- const ctx = manifestsCtx(
1937
- argoApp("api", { project: "default", destination: { server: "https://prod.example.com", namespace: "demo" } }),
1938
- );
1939
- const diags = argo003.check(ctx);
1940
- expect(diags.length).toBe(1);
1941
- expect(diags[0].checkId).toBe("ARGO003");
1942
- expect(diags[0].message).toContain("prod.example.com");
1943
- });
1944
-
1945
- test("passes when the cluster is registered via a cluster Secret", () => {
1946
- const ctx = manifestsCtx(
1947
- clusterSecret("prod", "https://prod.example.com"),
1948
- argoApp("api", { project: "default", destination: { server: "https://prod.example.com", namespace: "demo" } }),
1949
- );
1950
- expect(argo003.check(ctx).length).toBe(0);
1951
- });
1952
-
1953
- test("flags a destination with neither server nor name", () => {
1954
- const ctx = manifestsCtx(argoApp("api", { project: "default", destination: { namespace: "demo" } }));
1955
- expect(argo003.check(ctx).length).toBe(1);
1956
- });
1957
-
1958
- test("a cluster Secret whose fields a live read masked registers nothing under the masked value", () => {
1959
- for (const mask of ["<masked>", "[REDACTED]"]) {
1960
- const masked = { ...clusterSecret("prod", "https://prod.example.com"), stringData: { name: mask, server: mask } };
1961
- const byServer = manifestsCtx(masked, argoApp("api", { project: "default", destination: { server: mask, namespace: "demo" } }));
1962
- expect(argo003.check(byServer).length).toBe(1);
1963
- const byName = manifestsCtx(masked, argoApp("api", { project: "default", destination: { name: mask } }));
1964
- expect(argo003.check(byName).length).toBe(1);
1965
- const byMetadataName = manifestsCtx(masked, argoApp("api", { project: "default", destination: { name: "prod" } }));
1966
- expect(argo003.check(byMetadataName).length).toBe(0);
1967
- }
1968
- });
1969
- });
1970
-
1971
- // ── ARGO005: Application source.path resolves to an existing directory ────────
1972
-
1973
- describe("ARGO005: Application source path exists", () => {
1974
- test("metadata", () => {
1975
- expect(argo005.id).toBe("ARGO005");
1976
- });
1977
-
1978
- test("does NOT flag a path that exists under the build root", () => {
1979
- // `lexicons` is a directory at the repo root (the vitest cwd).
1980
- const ctx = manifestsCtx(
1981
- argoApp("api", { project: "default", destination: inClusterDest, source: { repoURL: "x", path: "lexicons" } }),
1982
- );
1983
- expect(argo005.check(ctx).length).toBe(0);
1984
- });
1985
-
1986
- test("warns on a path that does not resolve to a directory", () => {
1987
- const ctx = manifestsCtx(
1988
- argoApp("api", { project: "default", destination: inClusterDest, source: { repoURL: "x", path: "no-such-argo-dir-xyz" } }),
1989
- );
1990
- const diags = argo005.check(ctx);
1991
- expect(diags.length).toBe(1);
1992
- expect(diags[0].checkId).toBe("ARGO005");
1993
- expect(diags[0].severity).toBe("warning");
1994
- });
1995
-
1996
- test("skips Helm chart sources", () => {
1997
- const ctx = manifestsCtx(
1998
- argoApp("api", { project: "default", destination: inClusterDest, source: { repoURL: "x", chart: "redis" } }),
1999
- );
2000
- expect(argo005.check(ctx).length).toBe(0);
2001
- });
2002
-
2003
- // #5109: under `chant audit` the path resolves against the audited tree, not the working directory.
2004
- describe("under chant audit", () => {
2005
- const repo = "https://github.com/acme/infra";
2006
- function tree(origin?: string): string {
2007
- const dir = mkdtempSync(join(tmpdir(), "chant-argo005-"));
2008
- execFileSync("git", ["init", "-q"], { cwd: dir });
2009
- if (origin) execFileSync("git", ["remote", "add", "origin", origin], { cwd: dir });
2010
- mkdirSync(join(dir, "kubernetes/app"), { recursive: true });
2011
- return dir;
2012
- }
2013
- function auditCtx(root: string | undefined, path: string, repoURL = repo): PostSynthContext {
2014
- const ctx = manifestsCtx(argoApp("api", { project: "default", destination: inClusterDest, source: { repoURL, path } }));
2015
- return { ...ctx, audit: root === undefined ? {} : { root } };
2016
- }
2017
-
2018
- test("a path that exists in the audited tree is not flagged, whatever the working directory", () => {
2019
- const dir = tree(`${repo}.git`);
2020
- expect(process.cwd()).not.toBe(dir);
2021
- expect(argo005.check(auditCtx(dir, "kubernetes/app")).length).toBe(0);
2022
- });
2023
-
2024
- test("a path missing from the audited tree is flagged, with the path it looked for", () => {
2025
- const dir = tree(`${repo}.git`);
2026
- const diags = argo005.check(auditCtx(dir, "kubernetes/gone"));
2027
- expect(diags.length).toBe(1);
2028
- expect(diags[0].message).toContain('"kubernetes/gone"');
2029
- expect(diags[0].message).toContain("audited repository");
2030
- });
2031
-
2032
- test("a path that exists only in the working directory is flagged", () => {
2033
- const dir = tree(`${repo}.git`);
2034
- expect(argo005.check(auditCtx(dir, "lexicons")).length).toBe(1);
2035
- });
2036
-
2037
- test("an Application of another repository is left alone", () => {
2038
- const dir = tree(`${repo}.git`);
2039
- expect(argo005.check(auditCtx(dir, "kubernetes/gone", "https://github.com/acme/other")).length).toBe(0);
2040
- });
2041
-
2042
- test("a tree with no origin is checked against the directory", () => {
2043
- const dir = tree();
2044
- expect(argo005.check(auditCtx(dir, "kubernetes/app")).length).toBe(0);
2045
- expect(argo005.check(auditCtx(dir, "kubernetes/gone")).length).toBe(1);
2046
- });
2047
-
2048
- test("a tree with nothing on disk gets no finding", () => {
2049
- expect(argo005.check(auditCtx(undefined, "kubernetes/gone")).length).toBe(0);
2050
- });
2051
- });
2052
- });
2053
-
2054
- // ── FLUX002: Kustomization sourceRef references a declared source ─────────────
2055
-
2056
- function fluxKustomization(name: string, spec: Record<string, unknown>) {
2057
- return {
2058
- apiVersion: "kustomize.toolkit.fluxcd.io/v1",
2059
- kind: "Kustomization",
2060
- metadata: { name, namespace: "flux-system" },
2061
- spec: { interval: "10m", path: "./k8s", prune: true, wait: true, ...spec },
2062
- };
2063
- }
2064
- function fluxGitRepository(name: string) {
2065
- return {
2066
- apiVersion: "source.toolkit.fluxcd.io/v1",
2067
- kind: "GitRepository",
2068
- metadata: { name, namespace: "flux-system" },
2069
- spec: { interval: "5m", url: `https://example.com/${name}`, ref: { branch: "main" } },
2070
- };
2071
- }
2072
- const gitSourceRef = (name: string) => ({ sourceRef: { kind: "GitRepository", name } });
2073
-
2074
- describe("FLUX002: Kustomization sourceRef references a declared source", () => {
2075
- test("metadata", () => {
2076
- expect(flux002.id).toBe("FLUX002");
2077
- });
2078
-
2079
- test("flags a Kustomization referencing an undeclared GitRepository", () => {
2080
- const ctx = manifestsCtx(fluxKustomization("hello", gitSourceRef("home-chant")));
2081
- const diags = flux002.check(ctx);
2082
- expect(diags.length).toBe(1);
2083
- expect(diags[0].checkId).toBe("FLUX002");
2084
- expect(diags[0].severity).toBe("error");
2085
- expect(diags[0].message).toContain("home-chant");
2086
- });
2087
-
2088
- test("passes when the GitRepository is declared in the same build", () => {
2089
- const ctx = manifestsCtx(
2090
- fluxGitRepository("home-chant"),
2091
- fluxKustomization("hello", gitSourceRef("home-chant")),
2092
- );
2093
- expect(flux002.check(ctx).length).toBe(0);
2094
- });
2095
-
2096
- test("does NOT flag the bootstrap-created flux-system source", () => {
2097
- const ctx = manifestsCtx(fluxKustomization("mealie", gitSourceRef("flux-system")));
2098
- expect(flux002.check(ctx).length).toBe(0);
2099
- });
2100
-
2101
- test("matches on source kind — a GitRepository does not satisfy an OCIRepository ref", () => {
2102
- const ctx = manifestsCtx(
2103
- fluxGitRepository("fountain"),
2104
- fluxKustomization("fountain", { sourceRef: { kind: "OCIRepository", name: "fountain" } }),
2105
- );
2106
- const diags = flux002.check(ctx);
2107
- expect(diags.length).toBe(1);
2108
- expect(diags[0].message).toContain("OCIRepository");
2109
- });
2110
-
2111
- test("flags a Kustomization with no sourceRef at all", () => {
2112
- const ctx = manifestsCtx(fluxKustomization("hello", {}));
2113
- const diags = flux002.check(ctx);
2114
- expect(diags.length).toBe(1);
2115
- expect(diags[0].message).toContain("no spec.sourceRef.name");
2116
- });
2117
-
2118
- test("skips kustomize.config.k8s.io Kustomizations (not Flux CRs)", () => {
2119
- const ctx = manifestsCtx({
2120
- apiVersion: "kustomize.config.k8s.io/v1beta1",
2121
- kind: "Kustomization",
2122
- metadata: { name: "overlay" },
2123
- spec: {},
2124
- });
2125
- expect(flux002.check(ctx).length).toBe(0);
2126
- });
2127
- });
2128
-
2129
- // ── FLUX003: Kustomization dependsOn names declared Kustomizations ────────────
2130
-
2131
- describe("FLUX003: Kustomization dependsOn names declared Kustomizations", () => {
2132
- test("metadata", () => {
2133
- expect(flux003.id).toBe("FLUX003");
2134
- });
2135
-
2136
- test("flags a dependsOn entry nothing in the build declares", () => {
2137
- const ctx = manifestsCtx(
2138
- fluxKustomization("hello", { ...gitSourceRef("flux-system"), dependsOn: [{ name: "cert-manger" }] }),
2139
- );
2140
- const diags = flux003.check(ctx);
2141
- expect(diags.length).toBe(1);
2142
- expect(diags[0].checkId).toBe("FLUX003");
2143
- expect(diags[0].severity).toBe("warning");
2144
- expect(diags[0].message).toContain("cert-manger");
2145
- });
2146
-
2147
- test("passes when every dependency is declared", () => {
2148
- const ctx = manifestsCtx(
2149
- fluxKustomization("cert-manager", gitSourceRef("flux-system")),
2150
- fluxKustomization("traefik", gitSourceRef("flux-system")),
2151
- fluxKustomization("hello", {
2152
- ...gitSourceRef("flux-system"),
2153
- dependsOn: [{ name: "cert-manager" }, { name: "traefik" }],
2154
- }),
2155
- );
2156
- expect(flux003.check(ctx).length).toBe(0);
2157
- });
2158
-
2159
- test("flags a self-referencing dependsOn entry", () => {
2160
- const ctx = manifestsCtx(
2161
- fluxKustomization("hello", { ...gitSourceRef("flux-system"), dependsOn: [{ name: "hello" }] }),
2162
- );
2163
- const diags = flux003.check(ctx);
2164
- expect(diags.length).toBe(1);
2165
- expect(diags[0].message).toContain("itself");
2166
- });
2167
-
2168
- test("reports every broken edge, not just the first", () => {
2169
- const ctx = manifestsCtx(
2170
- fluxKustomization("hello", {
2171
- ...gitSourceRef("flux-system"),
2172
- dependsOn: [{ name: "nope-a" }, { name: "nope-b" }],
2173
- }),
2174
- );
2175
- expect(flux003.check(ctx).length).toBe(2);
2176
- });
2177
-
2178
- test("skips a Kustomization without dependsOn", () => {
2179
- const ctx = manifestsCtx(fluxKustomization("hello", gitSourceRef("flux-system")));
2180
- expect(flux003.check(ctx).length).toBe(0);
2181
- });
2182
- });
2183
-
2184
- // ── WK8501 / WK8502: custom-resource spec against the CRD schema (chant #1372) ──
2185
-
2186
- describe("WK8501/WK8502: custom resource spec validated against the shipped CRD schema", () => {
2187
- const hasLexicon = getCrdSchemaRegistry().size > 0;
2188
-
2189
- function microVm(spec: Record<string, unknown>) {
2190
- return {
2191
- apiVersion: "lambda.aws.amazon.com/v1alpha1",
2192
- kind: "MicroVM",
2193
- metadata: { name: "agent-1", namespace: "vms" },
2194
- spec,
2195
- };
2196
- }
2197
-
2198
- // chant #13 — CAPI's own Cluster (K8s::CAPI::Cluster) and ACK's S3 Bucket
2199
- // (K8s::S3::Bucket), the CAPI/CAPA and ACK kinds this suite's WK8501/WK8502
2200
- // coverage exercises. Same shape as `microVm` above: a bare manifest, spec
2201
- // supplied per test.
2202
- function capiCluster(spec: Record<string, unknown>) {
2203
- return {
2204
- apiVersion: "cluster.x-k8s.io/v1beta2",
2205
- kind: "Cluster",
2206
- metadata: { name: "prod-cluster", namespace: "capi-system" },
2207
- spec,
2208
- };
2209
- }
2210
-
2211
- function ackBucket(spec: Record<string, unknown>) {
2212
- return {
2213
- apiVersion: "s3.services.k8s.aws/v1alpha1",
2214
- kind: "Bucket",
2215
- metadata: { name: "build-artifacts", namespace: "aws-system" },
2216
- spec,
2217
- };
2218
- }
2219
-
2220
- test("metadata", () => {
2221
- expect(wk8501.id).toBe("WK8501");
2222
- expect(wk8502.id).toBe("WK8502");
2223
- });
2224
-
2225
- test.skipIf(!hasLexicon)("the lexicon ships a spec schema for every CRD-derived kind", () => {
2226
- const registry = getCrdSchemaRegistry();
2227
- for (const key of ["lambda.aws.amazon.com/v1alpha1/MicroVM", "cert-manager.io/v1/Certificate", "ray.io/v1/RayCluster"]) {
2228
- expect(registry.get(key)?.type, key).toBe("object");
2229
- }
2230
- // Built-in kinds are typed by the .d.ts and carry no schema.
2231
- expect(registry.has("apps/v1/Deployment")).toBe(false);
2232
- });
2233
-
2234
- test.skipIf(!hasLexicon)("WK8501 flags a misspelled MicroVM field and suggests the real one", () => {
2235
- // The kubemicrovm-ops case from #1372: `classname` type-checks, applies
2236
- // cleanly, and the controller runs the VM with the default class.
2237
- const ctx = manifestsCtx(microVm({ classname: "large", imageRef: "img" }));
2238
- const diags = wk8501.check(ctx);
2239
- expect(diags.length).toBe(1);
2240
- expect(diags[0].severity).toBe("error");
2241
- expect(diags[0].entity).toBe("agent-1");
2242
- expect(diags[0].message).toContain('unknown field "spec.classname"');
2243
- expect(diags[0].message).toContain('did you mean "className"');
2244
- // WK8502 has nothing to say about a field the schema does not know.
2245
- expect(wk8502.check(ctx).length).toBe(0);
2246
- });
2247
-
2248
- test.skipIf(!hasLexicon)("WK8502 flags a wrong-typed scalar and a value outside its enum", () => {
2249
- const ctx = manifestsCtx(microVm({
2250
- className: "large",
2251
- maxIdleDurationSeconds: "300",
2252
- desiredState: "Runing",
2253
- autoResumeEnabled: "yes",
2254
- }));
2255
- const diags = wk8502.check(ctx);
2256
- const messages = diags.map((d) => d.message);
2257
- expect(messages).toEqual([
2258
- expect.stringContaining('"spec.maxIdleDurationSeconds" expects an integer, got string "300"'),
2259
- expect.stringContaining('"spec.desiredState" must be one of "Running", "Suspended", "Terminated", got string "Runing"'),
2260
- expect.stringContaining('"spec.autoResumeEnabled" expects a boolean, got string "yes"'),
2261
- ]);
2262
- expect(diags.every((d) => d.checkId === "WK8502" && d.severity === "error")).toBe(true);
2263
- expect(wk8501.check(ctx).length).toBe(0);
2264
- });
2265
-
2266
- test.skipIf(!hasLexicon)("a well-formed custom resource passes both checks", () => {
2267
- const ctx = manifestsCtx(
2268
- microVm({ className: "large", desiredState: "Running", maxIdleDurationSeconds: 300, tags: { team: "ml", any: 1 } }),
2269
- {
2270
- apiVersion: "cert-manager.io/v1",
2271
- kind: "Certificate",
2272
- metadata: { name: "web-tls" },
2273
- spec: {
2274
- secretName: "web-tls",
2275
- dnsNames: ["example.com"],
2276
- issuerRef: { name: "letsencrypt", kind: "ClusterIssuer" },
2277
- privateKey: { algorithm: "ECDSA", size: 256 },
2278
- },
2279
- },
2280
- );
2281
- expect(wk8501.check(ctx)).toEqual([]);
2282
- expect(wk8502.check(ctx)).toEqual([]);
2283
- });
2284
-
2285
- test.skipIf(!hasLexicon)("walks nested objects and array elements", () => {
2286
- const ctx = manifestsCtx({
2287
- apiVersion: "cert-manager.io/v1",
2288
- kind: "Certificate",
2289
- metadata: { name: "web-tls" },
2290
- spec: {
2291
- secretName: "web-tls",
2292
- issuerRef: { nmae: "letsencrypt" },
2293
- additionalOutputFormats: [{ type: "DER" }, { type: "PEM" }],
2294
- privateKey: { algorithm: "DSA" },
2295
- },
2296
- });
2297
- expect(wk8501.check(ctx).map((d) => d.message)).toEqual([
2298
- expect.stringContaining('unknown field "spec.issuerRef.nmae" (did you mean "name"?)'),
2299
- ]);
2300
- expect(wk8502.check(ctx).map((d) => d.message)).toEqual([
2301
- expect.stringContaining('"spec.additionalOutputFormats[1].type" must be one of "DER", "CombinedPEM"'),
2302
- expect.stringContaining('"spec.privateKey.algorithm" must be one of "RSA", "ECDSA", "Ed25519"'),
2303
- ]);
2304
- });
2305
-
2306
- // chant #13 — coverage proving the epic's actual point: the CAPI/CAPA and
2307
- // ACK sources added in #10/#11/#12 carry the same WK8501/WK8502 schema
2308
- // guarantee as every other CRD source, not just types with no lint behind
2309
- // them.
2310
-
2311
- test.skipIf(!hasLexicon)("WK8501 flags a misspelled CAPI Cluster field and suggests the real one", () => {
2312
- const ctx = manifestsCtx(capiCluster({ paused: true, clusterNetwok: { serviceDomain: "cluster.local" } }));
2313
- const diags = wk8501.check(ctx);
2314
- expect(diags.length).toBe(1);
2315
- expect(diags[0].severity).toBe("error");
2316
- expect(diags[0].entity).toBe("prod-cluster");
2317
- expect(diags[0].message).toContain('unknown field "spec.clusterNetwok"');
2318
- expect(diags[0].message).toContain('did you mean "clusterNetwork"');
2319
- // WK8502 has nothing to say about a field the schema does not know.
2320
- expect(wk8502.check(ctx).length).toBe(0);
2321
- });
2322
-
2323
- test.skipIf(!hasLexicon)("WK8502 flags a wrong-typed scalar and an out-of-enum value on CAPI Cluster", () => {
2324
- const ctx = manifestsCtx(capiCluster({
2325
- paused: "yes",
2326
- availabilityGates: [{ conditionType: "Ready", polarity: "Postive" }],
2327
- }));
2328
- const diags = wk8502.check(ctx);
2329
- const messages = diags.map((d) => d.message);
2330
- expect(messages).toEqual([
2331
- expect.stringContaining('"spec.paused" expects a boolean, got string "yes"'),
2332
- expect.stringContaining('"spec.availabilityGates[0].polarity" must be one of "Positive", "Negative", got string "Postive"'),
2333
- ]);
2334
- expect(diags.every((d) => d.checkId === "WK8502" && d.severity === "error")).toBe(true);
2335
- expect(wk8501.check(ctx).length).toBe(0);
2336
- });
2337
-
2338
- test.skipIf(!hasLexicon)("WK8501 flags a misspelled ACK S3 Bucket field and suggests the real one", () => {
2339
- const ctx = manifestsCtx(ackBucket({ nmae: "build-artifacts", objectLockEnabledForBucket: true }));
2340
- const diags = wk8501.check(ctx);
2341
- expect(diags.length).toBe(1);
2342
- expect(diags[0].severity).toBe("error");
2343
- expect(diags[0].entity).toBe("build-artifacts");
2344
- expect(diags[0].message).toContain('unknown field "spec.nmae"');
2345
- expect(diags[0].message).toContain('did you mean "name"');
2346
- expect(wk8502.check(ctx).length).toBe(0);
2347
- });
2348
-
2349
- test.skipIf(!hasLexicon)("WK8502 flags a wrong-typed scalar on ACK S3 Bucket", () => {
2350
- const ctx = manifestsCtx(ackBucket({ name: "build-artifacts", objectLockEnabledForBucket: "true" }));
2351
- const diags = wk8502.check(ctx);
2352
- expect(diags.length).toBe(1);
2353
- expect(diags[0].checkId).toBe("WK8502");
2354
- expect(diags[0].severity).toBe("error");
2355
- expect(diags[0].message).toContain('"spec.objectLockEnabledForBucket" expects a boolean, got string "true"');
2356
- expect(wk8501.check(ctx).length).toBe(0);
2357
- });
2358
-
2359
- test("built-in kinds and unknown apiVersion/kind pairs are never checked", () => {
2360
- const ctx = manifestsCtx(
2361
- { apiVersion: "apps/v1", kind: "Deployment", metadata: { name: "web" }, spec: { replicas: "2", bogus: true } },
2362
- { apiVersion: "example.com/v1", kind: "Widget", metadata: { name: "w" }, spec: { bogus: true } },
2363
- );
2364
- expect(wk8501.check(ctx)).toEqual([]);
2365
- expect(wk8502.check(ctx)).toEqual([]);
2366
- });
2367
-
2368
- // chant #2013 — the Argo AppProject from behold's example-argo-estate, as
2369
- // YAML text rather than JSON on purpose: `sourceRepos` is a list of bare
2370
- // URLs, and the core parser used to hand this check `{ https: "//github…" }`
2371
- // for each one. WK8502 then reported an object on a field the source had
2372
- // declared, and the emitter had written, as a string.
2373
- test.skipIf(!hasLexicon)("a bare URL in an AppProject's sourceRepos reaches the check as a string", () => {
2374
- const ctx = makeCtx([
2375
- "apiVersion: argoproj.io/v1alpha1",
2376
- "kind: AppProject",
2377
- "metadata:",
2378
- " name: estate",
2379
- "spec:",
2380
- " sourceRepos:",
2381
- " - https://github.com/INTENTIUS/behold",
2382
- " destinations:",
2383
- " - namespace: '*'",
2384
- " server: https://kubernetes.default.svc",
2385
- "",
2386
- ].join("\n"));
2387
- expect(wk8501.check(ctx)).toEqual([]);
2388
- expect(wk8502.check(ctx)).toEqual([]);
2389
- });
2390
-
2391
- test("open objects and int-or-string accept anything (stub registry)", () => {
2392
- setCrdSchemaRegistry(new Map([[
2393
- "example.com/v1/Widget",
2394
- {
2395
- type: "object",
2396
- fields: {
2397
- labels: { type: "object", open: true },
2398
- port: { open: true },
2399
- replicas: { type: "integer" },
2400
- items: { type: "array", items: { type: "string" } },
2401
- },
2402
- },
2403
- ]]));
2404
- try {
2405
- const ok = manifestsCtx({
2406
- apiVersion: "example.com/v1", kind: "Widget", metadata: { name: "w" },
2407
- spec: { labels: { anything: { nested: true } }, port: "http", replicas: 2, items: ["a"] },
2408
- });
2409
- expect(wk8501.check(ok)).toEqual([]);
2410
- expect(wk8502.check(ok)).toEqual([]);
2411
-
2412
- const bad = manifestsCtx({
2413
- apiVersion: "example.com/v1", kind: "Widget", metadata: { name: "w" },
2414
- spec: { replicas: 2.5, items: "a" },
2415
- });
2416
- expect(wk8502.check(bad).map((d) => d.message)).toEqual([
2417
- expect.stringContaining('"spec.replicas" expects an integer, got number 2.5'),
2418
- expect.stringContaining('"spec.items" expects an array, got string "a"'),
2419
- ]);
2420
- } finally {
2421
- setCrdSchemaRegistry(null);
2422
- }
2423
- });
2424
-
2425
- test("validateSpec reports unknown fields and type mismatches with dotted paths", () => {
2426
- const schema = { type: "object" as const, fields: { a: { type: "object" as const, fields: { b: { type: "boolean" as const } } } } };
2427
- expect(validateSpec({ a: { b: "x", c: 1 }, d: 2 }, schema)).toEqual([
2428
- { kind: "type-mismatch", path: "spec.a.b", message: expect.stringContaining("expects a boolean") },
2429
- { kind: "unknown-field", path: "spec.a.c", message: expect.stringContaining('unknown field "spec.a.c"') },
2430
- { kind: "unknown-field", path: "spec.d", message: expect.stringContaining('unknown field "spec.d"') },
2431
- ]);
2432
- });
2433
- });
2434
-
2435
- // ── WK8503: consumed-but-unproduced Secret ──────────────────────────
2436
-
2437
- describe("WK8503: workload consumes a Secret nothing in the output produces", () => {
2438
- function appConsuming(name: string) {
2439
- return {
2440
- apiVersion: "apps/v1",
2441
- kind: "Deployment",
2442
- metadata: { name: "app", namespace: "web" },
2443
- spec: {
2444
- template: {
2445
- spec: {
2446
- containers: [
2447
- { name: "app", image: "app:1.0", envFrom: [{ secretRef: { name } }] },
2448
- ],
2449
- },
2450
- },
2451
- },
2452
- };
2453
- }
2454
-
2455
- /** Like manifestsCtx, but with SecretProvenance declarations discovered as entities. */
2456
- function ctxWithDeclarations(decls: SecretDeclarationInput[], ...objs: unknown[]): PostSynthContext {
2457
- const ctx = manifestsCtx(...objs);
2458
- decls.forEach((d, i) => ctx.entities.set(`secretDecl${i}`, declareSecret(d as never)));
2459
- return ctx;
2460
- }
2461
-
2462
- test("metadata", () => {
2463
- expect(wk8503.id).toBe("WK8503");
2464
- });
2465
-
2466
- test("fires when nothing produces the consumed Secret", () => {
2467
- const diags = wk8503.check(manifestsCtx(appConsuming("fountain-secrets")));
2468
- expect(diags.length).toBe(1);
2469
- expect(diags[0].checkId).toBe("WK8503");
2470
- expect(diags[0].severity).toBe("error");
2471
- expect(diags[0].entity).toBe("app");
2472
- expect(diags[0].message).toContain('Secret "fountain-secrets"');
2473
- expect(diags[0].message).toContain("envFrom.secretRef");
2474
- });
2475
-
2476
- test("quiet when a Secret manifest in the output produces it", () => {
2477
- const ctx = manifestsCtx(
2478
- appConsuming("fountain-secrets"),
2479
- { apiVersion: "v1", kind: "Secret", metadata: { name: "fountain-secrets", namespace: "web" }, stringData: {} },
2480
- );
2481
- expect(wk8503.check(ctx)).toEqual([]);
2482
- });
2483
-
2484
- test("quiet when an ExternalSecret materializes the target name", () => {
2485
- const ctx = manifestsCtx(
2486
- appConsuming("fountain-secrets"),
2487
- {
2488
- apiVersion: "external-secrets.io/v1",
2489
- kind: "ExternalSecret",
2490
- metadata: { name: "fountain-secrets-eso", namespace: "web" },
2491
- spec: {
2492
- secretStoreRef: { name: "store", kind: "ClusterSecretStore" },
2493
- target: { name: "fountain-secrets", creationPolicy: "Owner" },
2494
- data: [],
2495
- },
2496
- },
2497
- );
2498
- expect(wk8503.check(ctx)).toEqual([]);
2499
- });
2500
-
2501
- test("an ExternalSecret with no explicit target produces its own name", () => {
2502
- const ctx = manifestsCtx(
2503
- appConsuming("fountain-secrets"),
2504
- {
2505
- apiVersion: "external-secrets.io/v1",
2506
- kind: "ExternalSecret",
2507
- metadata: { name: "fountain-secrets", namespace: "web" },
2508
- spec: { secretStoreRef: { name: "store", kind: "ClusterSecretStore" }, data: [] },
2509
- },
2510
- );
2511
- expect(wk8503.check(ctx)).toEqual([]);
2512
- });
2513
-
2514
- test("quiet when an InfisicalSecret's managedSecretReference produces it", () => {
2515
- const ctx = manifestsCtx(
2516
- appConsuming("fountain-secrets"),
2517
- {
2518
- apiVersion: "secrets.infisical.com/v1alpha1",
2519
- kind: "InfisicalSecret",
2520
- metadata: { name: "fountain-sync", namespace: "infisical-operator" },
2521
- spec: {
2522
- managedSecretReference: { secretName: "fountain-secrets", secretNamespace: "web" },
2523
- },
2524
- },
2525
- );
2526
- expect(wk8503.check(ctx)).toEqual([]);
2527
- });
2528
-
2529
- test("an InfisicalSecret targeting a different namespace does not cover the consumer", () => {
2530
- const ctx = manifestsCtx(
2531
- appConsuming("fountain-secrets"),
2532
- {
2533
- apiVersion: "secrets.infisical.com/v1alpha1",
2534
- kind: "InfisicalSecret",
2535
- metadata: { name: "fountain-sync", namespace: "web" },
2536
- spec: {
2537
- managedSecretReference: { secretName: "fountain-secrets", secretNamespace: "other" },
2538
- },
2539
- },
2540
- );
2541
- expect(wk8503.check(ctx).length).toBe(1);
2542
- });
2543
-
2544
- test("quiet when a cert-manager Certificate materializes the secretName", () => {
2545
- const consumer = {
2546
- apiVersion: "apps/v1",
2547
- kind: "StatefulSet",
2548
- metadata: { name: "db", namespace: "web" },
2549
- spec: {
2550
- template: {
2551
- spec: {
2552
- containers: [{ name: "db", image: "db:1" }],
2553
- volumes: [{ name: "tls", secret: { secretName: "db-tls" } }],
2554
- },
2555
- },
2556
- },
2557
- };
2558
- const ctx = manifestsCtx(consumer, {
2559
- apiVersion: "cert-manager.io/v1",
2560
- kind: "Certificate",
2561
- metadata: { name: "db-cert", namespace: "web" },
2562
- spec: { secretName: "db-tls", issuerRef: { name: "issuer" } },
2563
- });
2564
- expect(wk8503.check(ctx)).toEqual([]);
2565
- });
2566
-
2567
- test("a `referenced` provenance declaration waives the check", () => {
2568
- const ctx = ctxWithDeclarations(
2569
- [{ name: "fountain-secrets", provenance: "referenced", scope: "minted by `just secret`" }],
2570
- appConsuming("fountain-secrets"),
2571
- );
2572
- expect(wk8503.check(ctx)).toEqual([]);
2573
- });
2574
-
2575
- test("a `generated-once` provenance declaration waives the check", () => {
2576
- const ctx = ctxWithDeclarations(
2577
- [{ name: "fountain-secrets", provenance: "generated-once", keys: ["token"] }],
2578
- appConsuming("fountain-secrets"),
2579
- );
2580
- expect(wk8503.check(ctx)).toEqual([]);
2581
- });
2582
-
2583
- test("a declaration covering a different name does not waive the check", () => {
2584
- const ctx = ctxWithDeclarations(
2585
- [{ name: "some-other-secret", provenance: "referenced" }],
2586
- appConsuming("fountain-secrets"),
2587
- );
2588
- const diags = wk8503.check(ctx);
2589
- expect(diags.length).toBe(1);
2590
- expect(diags[0].message).toContain('"fountain-secrets"');
2591
- });
2592
-
2593
- test("optional references are skipped", () => {
2594
- const ctx = manifestsCtx({
2595
- apiVersion: "apps/v1",
2596
- kind: "Deployment",
2597
- metadata: { name: "app", namespace: "web" },
2598
- spec: {
2599
- template: {
2600
- spec: {
2601
- containers: [
2602
- {
2603
- name: "app",
2604
- image: "app:1.0",
2605
- envFrom: [{ secretRef: { name: "maybe-env", optional: true } }],
2606
- env: [{ name: "TOKEN", valueFrom: { secretKeyRef: { name: "maybe-key", key: "t", optional: true } } }],
2607
- },
2608
- ],
2609
- volumes: [{ name: "v", secret: { secretName: "maybe-vol", optional: true } }],
2610
- },
2611
- },
2612
- },
2613
- });
2614
- expect(wk8503.check(ctx)).toEqual([]);
2615
- });
2616
-
2617
- test("covers secretKeyRef, projected sources, imagePullSecrets, and initContainers", () => {
2618
- const ctx = manifestsCtx({
2619
- apiVersion: "batch/v1",
2620
- kind: "CronJob",
2621
- metadata: { name: "sync", namespace: "web" },
2622
- spec: {
2623
- jobTemplate: {
2624
- spec: {
2625
- template: {
2626
- spec: {
2627
- imagePullSecrets: [{ name: "registry-creds" }],
2628
- initContainers: [
2629
- { name: "init", image: "i:1", env: [{ name: "T", valueFrom: { secretKeyRef: { name: "api-token", key: "t" } } }] },
2630
- ],
2631
- containers: [{ name: "sync", image: "s:1" }],
2632
- volumes: [
2633
- { name: "p", projected: { sources: [{ secret: { name: "projected-secret" } }] } },
2634
- ],
2635
- },
2636
- },
2637
- },
2638
- },
2639
- },
2640
- });
2641
- const secrets = wk8503.check(ctx).map((d) => d.message.match(/consumes Secret "([^"]+)"/)?.[1]).sort();
2642
- expect(secrets).toEqual(["api-token", "projected-secret", "registry-creds"]);
2643
- });
2644
-
2645
- test("a Secret in an explicit different namespace does not cover the consumer", () => {
2646
- const ctx = manifestsCtx(
2647
- appConsuming("fountain-secrets"),
2648
- { apiVersion: "v1", kind: "Secret", metadata: { name: "fountain-secrets", namespace: "other" }, stringData: {} },
2649
- );
2650
- expect(wk8503.check(ctx).length).toBe(1);
2651
- });
2652
-
2653
- test("a Secret with no namespace covers a namespaced consumer", () => {
2654
- const ctx = manifestsCtx(
2655
- appConsuming("fountain-secrets"),
2656
- { apiVersion: "v1", kind: "Secret", metadata: { name: "fountain-secrets" }, stringData: {} },
2657
- );
2658
- expect(wk8503.check(ctx)).toEqual([]);
2659
- });
2660
-
2661
- test("reports a missing Secret once per workload even when referenced twice", () => {
2662
- const ctx = manifestsCtx({
2663
- apiVersion: "apps/v1",
2664
- kind: "Deployment",
2665
- metadata: { name: "app", namespace: "web" },
2666
- spec: {
2667
- template: {
2668
- spec: {
2669
- containers: [
2670
- {
2671
- name: "app",
2672
- image: "app:1.0",
2673
- envFrom: [{ secretRef: { name: "fountain-secrets" } }],
2674
- env: [{ name: "T", valueFrom: { secretKeyRef: { name: "fountain-secrets", key: "t" } } }],
2675
- },
2676
- ],
2677
- },
2678
- },
2679
- },
2680
- });
2681
- expect(wk8503.check(ctx).length).toBe(1);
2682
- });
2683
- });
2684
-
2685
- // ── WK8504: committed-encrypted declaration does not resolve ─────────
2686
- //
2687
- // The fixture is a real sops-shaped document (cleartext structure, ENC[...]
2688
- // values, an age recipient block, a mac). Nothing here decrypts anything.
2689
-
2690
- describe("WK8504: committed-encrypted secret declaration does not resolve", () => {
2691
- const CIPHERTEXT = readFileSync(
2692
- join(dirname(fileURLToPath(import.meta.url)), "..", "..", "testdata", "sops", "db-credentials.sops.yaml"),
2693
- "utf-8",
2694
- );
2695
-
2696
- /**
2697
- * A context whose k8s output carries `manifests` in the primary document and
2698
- * the ciphertext as a SIDECAR — the only place the check can find it.
2699
- */
2700
- function sopsCtx(
2701
- opts: { ciphertext?: string; file?: string; declaredName?: string; manifests?: unknown[]; omitSidecar?: boolean } = {},
2702
- ): PostSynthContext {
2703
- const primary = (opts.manifests ?? []).map((o) => JSON.stringify(o)).join("\n---\n");
2704
- const file = opts.file ?? "secrets/db-credentials.sops.yaml";
2705
- const output: SerializerResult = {
2706
- primary,
2707
- files: opts.omitSidecar
2708
- ? {}
2709
- : { "db-credentials.sops.yaml": opts.ciphertext ?? CIPHERTEXT },
2710
- };
2711
- const outputs = new Map<string, string | SerializerResult>([["k8s", output]]);
2712
- const entities = new Map<string, Declarable>([
2713
- [
2714
- "dbCredentials",
2715
- declareSecret({
2716
- name: opts.declaredName ?? "db-credentials",
2717
- provenance: "committed-encrypted",
2718
- file,
2719
- keys: ["POSTGRES_USER", "POSTGRES_PASSWORD"],
2720
- }),
2721
- ],
2722
- ]);
2723
- return {
2724
- outputs,
2725
- entities,
2726
- buildResult: { outputs, entities, warnings: [], errors: [], sourceFileCount: 1 },
2727
- };
2728
- }
2729
-
2730
- test("metadata", () => {
2731
- expect(wk8504.id).toBe("WK8504");
2732
- });
2733
-
2734
- test("quiet when the declared file resolved to encrypted ciphertext", () => {
2735
- expect(wk8504.check(sopsCtx())).toEqual([]);
2736
- });
2737
-
2738
- test("quiet when the project declares no committed-encrypted secret", () => {
2739
- expect(wk8504.check(manifestsCtx({ apiVersion: "v1", kind: "ConfigMap", metadata: { name: "c" } }))).toEqual([]);
2740
- });
2741
-
2742
- test("fires when the build emitted no file for the declaration", () => {
2743
- const diags = wk8504.check(sopsCtx({ omitSidecar: true }));
2744
- expect(diags.length).toBe(1);
2745
- expect(diags[0].checkId).toBe("WK8504");
2746
- expect(diags[0].severity).toBe("error");
2747
- expect(diags[0].entity).toBe("db-credentials");
2748
- expect(diags[0].message).toContain("secrets/db-credentials.sops.yaml");
2749
- expect(diags[0].message).toContain("did not resolve");
2750
- });
2751
-
2752
- test("fires when metadata.name disagrees with the declaration", () => {
2753
- const diags = wk8504.check(sopsCtx({ declaredName: "other-credentials" }));
2754
- // The name mismatch; the sidecar filename still matches, so it is found.
2755
- expect(diags.some((d) => /metadata\.name "db-credentials"/.test(d.message))).toBe(true);
2756
- });
2757
-
2758
- test("fires when the document carries no sops block", () => {
2759
- const decrypted = CIPHERTEXT.slice(0, CIPHERTEXT.indexOf("sops:"));
2760
- const diags = wk8504.check(sopsCtx({ ciphertext: decrypted }));
2761
- expect(diags.some((d) => /no top-level `sops` block/.test(d.message))).toBe(true);
2762
- });
2763
-
2764
- test("fires when a data value is not ENC[...], naming the key and not the value", () => {
2765
- const leaked = CIPHERTEXT.replace(/POSTGRES_PASSWORD: ENC\[[^\]]*\]/, "POSTGRES_PASSWORD: hunter2");
2766
- const diags = wk8504.check(sopsCtx({ ciphertext: leaked }));
2767
- expect(diags.length).toBe(1);
2768
- expect(diags[0].message).toContain('stringData."POSTGRES_PASSWORD" is not encrypted');
2769
- expect(diags[0].message).not.toContain("hunter2");
2770
- });
2771
-
2772
- test("reports every problem on a declaration at once", () => {
2773
- const broken = CIPHERTEXT.replace("kind: Secret", "kind: ConfigMap").replace(
2774
- /POSTGRES_USER: ENC\[[^\]]*\]/,
2775
- "POSTGRES_USER: postgres",
2776
- );
2777
- expect(wk8504.check(sopsCtx({ ciphertext: broken })).length).toBeGreaterThanOrEqual(2);
2778
- });
2779
-
2780
- test("post-synth checks that read only the primary output stay blind to the sidecar", () => {
2781
- // The ciphertext must never reach the primary output — that is what makes
2782
- // applying an undecrypted Secret structurally impossible — so the rules
2783
- // that look for hardcoded material see nothing here.
2784
- const ctx = sopsCtx({ manifests: [{ apiVersion: "apps/v1", kind: "Deployment", metadata: { name: "app" } }] });
2785
- expect(wk8005.check(ctx)).toEqual([]);
2786
- expect(wk8041.check(ctx)).toEqual([]);
2787
- expect(wk8042.check(ctx)).toEqual([]);
2788
- });
2789
-
2790
- describe("WK8503 is satisfied through the producer set, not the waiver set", () => {
2791
- function consumerIn(namespace: string) {
2792
- return {
2793
- apiVersion: "apps/v1",
2794
- kind: "Deployment",
2795
- metadata: { name: "api", namespace },
2796
- spec: {
2797
- template: {
2798
- spec: {
2799
- containers: [
2800
- { name: "api", image: "api:1.0", envFrom: [{ secretRef: { name: "db-credentials" } }] },
2801
- ],
2802
- },
2803
- },
2804
- },
2805
- };
2806
- }
2807
-
2808
- test("a resolved declaration produces the Secret in its own namespace", () => {
2809
- // The fixture is `namespace: apps`, read from the ciphertext itself.
2810
- expect(wk8503.check(sopsCtx({ manifests: [consumerIn("apps")] }))).toEqual([]);
2811
- });
2812
-
2813
- test("namespace matching applies — another namespace is not covered", () => {
2814
- const diags = wk8503.check(sopsCtx({ manifests: [consumerIn("platform")] }));
2815
- expect(diags.length).toBe(1);
2816
- expect(diags[0].message).toContain('Secret "db-credentials"');
2817
- });
2818
-
2819
- test("a declaration whose file did not resolve waives nothing", () => {
2820
- const ctx = sopsCtx({ omitSidecar: true, manifests: [consumerIn("apps")] });
2821
- expect(wk8504.check(ctx).length).toBe(1);
2822
- expect(wk8503.check(ctx).length).toBe(1);
2823
- });
2824
-
2825
- test("a declaration whose ciphertext is not encrypted waives nothing", () => {
2826
- const leaked = CIPHERTEXT.replace(/POSTGRES_USER: ENC\[[^\]]*\]/, "POSTGRES_USER: postgres");
2827
- const ctx = sopsCtx({ ciphertext: leaked, manifests: [consumerIn("apps")] });
2828
- expect(wk8504.check(ctx).length).toBe(1);
2829
- expect(wk8503.check(ctx).length).toBe(1);
2830
- });
2831
- });
2832
- });
2833
-
2834
- // ── WK8505: committed-encrypted secret with no Flux decryption wiring ─────
2835
- //
2836
- // Reuses the FLUX002 fixture helpers (fluxKustomization, gitSourceRef) and
2837
- // the same real sops-shaped ciphertext fixture WK8504 validates against.
2838
-
2839
- describe("WK8505: committed-encrypted secret with no Flux decryption wiring", () => {
2840
- const CIPHERTEXT = readFileSync(
2841
- join(dirname(fileURLToPath(import.meta.url)), "..", "..", "testdata", "sops", "db-credentials.sops.yaml"),
2842
- "utf-8",
2843
- );
2844
-
2845
- /**
2846
- * A context carrying one committed-encrypted declaration (resolved to its
2847
- * sidecar unless `omitSidecar`) plus whatever Flux/other manifests are
2848
- * passed in the primary output.
2849
- */
2850
- function sopsCtx(opts: { manifests?: unknown[]; omitSidecar?: boolean } = {}): PostSynthContext {
2851
- const primary = (opts.manifests ?? []).map((o) => JSON.stringify(o)).join("\n---\n");
2852
- const output: SerializerResult = {
2853
- primary,
2854
- files: opts.omitSidecar ? {} : { "db-credentials.sops.yaml": CIPHERTEXT },
2855
- };
2856
- const outputs = new Map<string, string | SerializerResult>([["k8s", output]]);
2857
- const entities = new Map<string, Declarable>([
2858
- [
2859
- "dbCredentials",
2860
- declareSecret({
2861
- name: "db-credentials",
2862
- provenance: "committed-encrypted",
2863
- file: "secrets/db-credentials.sops.yaml",
2864
- keys: ["POSTGRES_USER", "POSTGRES_PASSWORD"],
2865
- }),
2866
- ],
2867
- ]);
2868
- return {
2869
- outputs,
2870
- entities,
2871
- buildResult: { outputs, entities, warnings: [], errors: [], sourceFileCount: 1 },
2872
- };
2873
- }
2874
-
2875
- test("metadata", () => {
2876
- expect(wk8505.id).toBe("WK8505");
2877
- });
2878
-
2879
- test("quiet when the build has no Flux Kustomization at all", () => {
2880
- expect(wk8505.check(sopsCtx())).toEqual([]);
2881
- });
2882
-
2883
- test("quiet when the build declares no committed-encrypted secret", () => {
2884
- const ctx = manifestsCtx(fluxKustomization("app", gitSourceRef("flux-system")));
2885
- expect(wk8505.check(ctx)).toEqual([]);
2886
- });
2887
-
2888
- test("fires when a Kustomization exists but none sets spec.decryption", () => {
2889
- const ctx = sopsCtx({ manifests: [fluxKustomization("app", gitSourceRef("flux-system"))] });
2890
- const diags = wk8505.check(ctx);
2891
- expect(diags.length).toBe(1);
2892
- expect(diags[0].checkId).toBe("WK8505");
2893
- expect(diags[0].severity).toBe("warning");
2894
- expect(diags[0].entity).toBe("db-credentials");
2895
- expect(diags[0].message).toContain("spec.decryption");
2896
- });
2897
-
2898
- test("quiet when a Kustomization sets spec.decryption", () => {
2899
- const ctx = sopsCtx({
2900
- manifests: [
2901
- fluxKustomization("app", {
2902
- ...gitSourceRef("flux-system"),
2903
- decryption: { provider: "sops", secretRef: { name: "sops-age" } },
2904
- }),
2905
- ],
2906
- });
2907
- expect(wk8505.check(ctx)).toEqual([]);
2908
- });
2909
-
2910
- test("a decrypting Kustomization elsewhere in the build satisfies every declaration", () => {
2911
- const ctx = sopsCtx({
2912
- manifests: [
2913
- fluxKustomization("infra", gitSourceRef("flux-system")),
2914
- fluxKustomization("secrets", {
2915
- ...gitSourceRef("flux-system"),
2916
- decryption: { provider: "sops", secretRef: { name: "sops-age" } },
2917
- }),
2918
- ],
2919
- });
2920
- expect(wk8505.check(ctx)).toEqual([]);
2921
- });
2922
-
2923
- test("an unresolved declaration does not also fire WK8505 — WK8504 already reports it", () => {
2924
- const ctx = sopsCtx({ omitSidecar: true, manifests: [fluxKustomization("app", gitSourceRef("flux-system"))] });
2925
- expect(wk8504.check(ctx).length).toBe(1);
2926
- expect(wk8505.check(ctx)).toEqual([]);
2927
- });
2928
-
2929
- test("skips kustomize.config.k8s.io Kustomizations (not Flux CRs)", () => {
2930
- const ctx = sopsCtx({
2931
- manifests: [
2932
- {
2933
- apiVersion: "kustomize.config.k8s.io/v1beta1",
2934
- kind: "Kustomization",
2935
- metadata: { name: "overlay" },
2936
- spec: {},
2937
- },
2938
- ],
2939
- });
2940
- expect(wk8505.check(ctx)).toEqual([]);
2941
- });
2942
- });