@intentius/chant-lexicon-k8s 0.41.20 → 0.44.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (365) hide show
  1. package/dist/api/classify.d.ts.map +1 -1
  2. package/dist/api/connect.d.ts.map +1 -1
  3. package/dist/codegen/docs.d.ts.map +1 -1
  4. package/dist/components/argo-app.d.ts +104 -0
  5. package/dist/components/argo-app.d.ts.map +1 -0
  6. package/dist/components/builders.d.ts +8 -0
  7. package/dist/components/builders.d.ts.map +1 -1
  8. package/dist/components/capability-plugin.d.ts +1 -0
  9. package/dist/components/capability-plugin.d.ts.map +1 -1
  10. package/dist/components/flux-reconcile.d.ts +84 -0
  11. package/dist/components/flux-reconcile.d.ts.map +1 -0
  12. package/dist/components/index.d.ts +2 -0
  13. package/dist/components/index.d.ts.map +1 -1
  14. package/dist/components/kustomize-apply.d.ts +29 -7
  15. package/dist/components/kustomize-apply.d.ts.map +1 -1
  16. package/dist/composites/flux-app.d.ts +132 -0
  17. package/dist/composites/flux-app.d.ts.map +1 -0
  18. package/dist/composites/index.d.ts +2 -0
  19. package/dist/composites/index.d.ts.map +1 -1
  20. package/dist/config-schema.d.ts +3 -0
  21. package/dist/config-schema.d.ts.map +1 -1
  22. package/dist/config.d.ts +32 -5
  23. package/dist/config.d.ts.map +1 -1
  24. package/dist/crd/crd-sources.d.ts.map +1 -1
  25. package/dist/crd/parser.d.ts.map +1 -1
  26. package/dist/deep-observe-hooks.d.ts +8 -0
  27. package/dist/deep-observe-hooks.d.ts.map +1 -1
  28. package/dist/describe-resources.d.ts +10 -8
  29. package/dist/describe-resources.d.ts.map +1 -1
  30. package/dist/generated/index.d.ts +15 -4
  31. package/dist/generated/index.d.ts.map +1 -1
  32. package/dist/index.d.ts +2 -2
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/integrity.json +10 -6
  35. package/dist/kube/connect.d.ts +5 -4
  36. package/dist/kube/connect.d.ts.map +1 -1
  37. package/dist/kube/get.d.ts +4 -4
  38. package/dist/kustomize/render.d.ts +15 -0
  39. package/dist/kustomize/render.d.ts.map +1 -0
  40. package/dist/kustomize/rendered-entity.d.ts +39 -0
  41. package/dist/kustomize/rendered-entity.d.ts.map +1 -0
  42. package/dist/kustomize/root.d.ts +19 -0
  43. package/dist/kustomize/root.d.ts.map +1 -0
  44. package/dist/lint/audit-catalog.d.ts.map +1 -1
  45. package/dist/lint/post-synth/argo-helpers.d.ts +2 -0
  46. package/dist/lint/post-synth/argo-helpers.d.ts.map +1 -1
  47. package/dist/lint/post-synth/flux002.d.ts +14 -0
  48. package/dist/lint/post-synth/flux002.d.ts.map +1 -0
  49. package/dist/lint/post-synth/flux003.d.ts +17 -0
  50. package/dist/lint/post-synth/flux003.d.ts.map +1 -0
  51. package/dist/lint/post-synth/index.d.ts.map +1 -1
  52. package/dist/lint/rules/flux-source-ref-pin.d.ts +16 -0
  53. package/dist/lint/rules/flux-source-ref-pin.d.ts.map +1 -0
  54. package/dist/manifest.json +1 -1
  55. package/dist/meta.json +92 -16
  56. package/dist/okf/index.md +256 -0
  57. package/dist/okf/rules/ARGO001.md +16 -0
  58. package/dist/okf/rules/ARGO002.md +16 -0
  59. package/dist/okf/rules/ARGO003.md +15 -0
  60. package/dist/okf/rules/ARGO004.md +17 -0
  61. package/dist/okf/rules/ARGO005.md +15 -0
  62. package/dist/okf/rules/FLUX001.md +17 -0
  63. package/dist/okf/rules/FLUX002.md +19 -0
  64. package/dist/okf/rules/FLUX003.md +15 -0
  65. package/dist/okf/rules/WK8001.md +16 -0
  66. package/dist/okf/rules/WK8002.md +20 -0
  67. package/dist/okf/rules/WK8003.md +19 -0
  68. package/dist/okf/rules/WK8005.md +11 -0
  69. package/dist/okf/rules/WK8006.md +11 -0
  70. package/dist/okf/rules/WK8041.md +11 -0
  71. package/dist/okf/rules/WK8042.md +11 -0
  72. package/dist/okf/rules/WK8101.md +11 -0
  73. package/dist/okf/rules/WK8102.md +11 -0
  74. package/dist/okf/rules/WK8103.md +11 -0
  75. package/dist/okf/rules/WK8104.md +15 -0
  76. package/dist/okf/rules/WK8105.md +11 -0
  77. package/dist/okf/rules/WK8201.md +11 -0
  78. package/dist/okf/rules/WK8202.md +11 -0
  79. package/dist/okf/rules/WK8203.md +11 -0
  80. package/dist/okf/rules/WK8204.md +11 -0
  81. package/dist/okf/rules/WK8205.md +11 -0
  82. package/dist/okf/rules/WK8207.md +11 -0
  83. package/dist/okf/rules/WK8208.md +11 -0
  84. package/dist/okf/rules/WK8209.md +11 -0
  85. package/dist/okf/rules/WK8301.md +16 -0
  86. package/dist/okf/rules/WK8302.md +11 -0
  87. package/dist/okf/rules/WK8303.md +15 -0
  88. package/dist/okf/rules/WK8304.md +15 -0
  89. package/dist/okf/rules/WK8305.md +15 -0
  90. package/dist/okf/rules/WK8306.md +11 -0
  91. package/dist/okf/rules/WK8401.md +15 -0
  92. package/dist/okf/rules/WK8402.md +15 -0
  93. package/dist/okf/rules/WK8403.md +15 -0
  94. package/dist/okf/types/APIGroup.md +16 -0
  95. package/dist/okf/types/APIGroupList.md +13 -0
  96. package/dist/okf/types/APIResourceList.md +14 -0
  97. package/dist/okf/types/APIService.md +14 -0
  98. package/dist/okf/types/APIServiceList.md +14 -0
  99. package/dist/okf/types/APIVersions.md +14 -0
  100. package/dist/okf/types/Addon.md +14 -0
  101. package/dist/okf/types/Alert.md +14 -0
  102. package/dist/okf/types/AppProject.md +19 -0
  103. package/dist/okf/types/Application.md +23 -0
  104. package/dist/okf/types/ApplicationSet.md +18 -0
  105. package/dist/okf/types/Backup.md +14 -0
  106. package/dist/okf/types/BatchJob.md +14 -0
  107. package/dist/okf/types/Binding.md +14 -0
  108. package/dist/okf/types/Bucket.md +18 -0
  109. package/dist/okf/types/CM.md +16 -0
  110. package/dist/okf/types/CSIDriver.md +14 -0
  111. package/dist/okf/types/CSIDriverList.md +14 -0
  112. package/dist/okf/types/CSINode.md +14 -0
  113. package/dist/okf/types/CSINodeList.md +14 -0
  114. package/dist/okf/types/CSIStorageCapacity.md +17 -0
  115. package/dist/okf/types/CSIStorageCapacityList.md +14 -0
  116. package/dist/okf/types/Certificate.md +18 -0
  117. package/dist/okf/types/CertificateRequest.md +14 -0
  118. package/dist/okf/types/CertificateSigningRequest.md +14 -0
  119. package/dist/okf/types/CertificateSigningRequestList.md +14 -0
  120. package/dist/okf/types/Challenge.md +14 -0
  121. package/dist/okf/types/Cluster.md +14 -0
  122. package/dist/okf/types/ClusterIssuer.md +14 -0
  123. package/dist/okf/types/ClusterRole.md +15 -0
  124. package/dist/okf/types/ClusterRoleBinding.md +15 -0
  125. package/dist/okf/types/ClusterRoleBindingList.md +14 -0
  126. package/dist/okf/types/ClusterRoleList.md +14 -0
  127. package/dist/okf/types/ClusterTrustBundle.md +14 -0
  128. package/dist/okf/types/ClusterTrustBundleList.md +14 -0
  129. package/dist/okf/types/ComponentStatus.md +14 -0
  130. package/dist/okf/types/ComponentStatusList.md +14 -0
  131. package/dist/okf/types/ConfigMapList.md +14 -0
  132. package/dist/okf/types/ControllerRevision.md +15 -0
  133. package/dist/okf/types/ControllerRevisionList.md +14 -0
  134. package/dist/okf/types/CoreEventList.md +14 -0
  135. package/dist/okf/types/CrdbCluster.md +14 -0
  136. package/dist/okf/types/CronJob.md +20 -0
  137. package/dist/okf/types/CronJobList.md +14 -0
  138. package/dist/okf/types/CustomResourceDefinition.md +14 -0
  139. package/dist/okf/types/CustomResourceDefinitionList.md +14 -0
  140. package/dist/okf/types/DaemonSet.md +19 -0
  141. package/dist/okf/types/DaemonSetList.md +14 -0
  142. package/dist/okf/types/DeleteOptions.md +18 -0
  143. package/dist/okf/types/Deploy.md +14 -0
  144. package/dist/okf/types/DeploymentList.md +14 -0
  145. package/dist/okf/types/DeviceClass.md +14 -0
  146. package/dist/okf/types/DeviceClassList.md +14 -0
  147. package/dist/okf/types/DeviceTaintRule.md +14 -0
  148. package/dist/okf/types/DeviceTaintRuleList.md +14 -0
  149. package/dist/okf/types/EndpointSlice.md +16 -0
  150. package/dist/okf/types/EndpointSliceList.md +14 -0
  151. package/dist/okf/types/Endpoints.md +14 -0
  152. package/dist/okf/types/EndpointsList.md +14 -0
  153. package/dist/okf/types/Event.md +27 -0
  154. package/dist/okf/types/EventsEvent.md +27 -0
  155. package/dist/okf/types/EventsEventList.md +14 -0
  156. package/dist/okf/types/Eviction.md +14 -0
  157. package/dist/okf/types/FlowSchema.md +14 -0
  158. package/dist/okf/types/FlowSchemaList.md +14 -0
  159. package/dist/okf/types/FluxHelmChart.md +14 -0
  160. package/dist/okf/types/FluxInstance.md +14 -0
  161. package/dist/okf/types/FluxReport.md +14 -0
  162. package/dist/okf/types/GRPCRoute.md +14 -0
  163. package/dist/okf/types/Gateway.md +14 -0
  164. package/dist/okf/types/GatewayClass.md +14 -0
  165. package/dist/okf/types/GitRepository.md +19 -0
  166. package/dist/okf/types/HTTPRoute.md +14 -0
  167. package/dist/okf/types/HelmChartConfig.md +14 -0
  168. package/dist/okf/types/HelmRelease.md +14 -0
  169. package/dist/okf/types/HelmRepository.md +14 -0
  170. package/dist/okf/types/HorizontalPodAutoscaler.md +14 -0
  171. package/dist/okf/types/HorizontalPodAutoscalerList.md +14 -0
  172. package/dist/okf/types/IPAddress.md +14 -0
  173. package/dist/okf/types/IPAddressList.md +14 -0
  174. package/dist/okf/types/ImagePolicy.md +14 -0
  175. package/dist/okf/types/ImageRepository.md +14 -0
  176. package/dist/okf/types/ImageUpdateAutomation.md +14 -0
  177. package/dist/okf/types/InfisicalDynamicSecret.md +14 -0
  178. package/dist/okf/types/InfisicalPushSecret.md +14 -0
  179. package/dist/okf/types/InfisicalSecret.md +14 -0
  180. package/dist/okf/types/Ing.md +14 -0
  181. package/dist/okf/types/IngressClass.md +14 -0
  182. package/dist/okf/types/IngressClassList.md +14 -0
  183. package/dist/okf/types/IngressList.md +14 -0
  184. package/dist/okf/types/IngressRoute.md +14 -0
  185. package/dist/okf/types/IngressRouteTCP.md +14 -0
  186. package/dist/okf/types/IngressRouteUDP.md +14 -0
  187. package/dist/okf/types/Issuer.md +14 -0
  188. package/dist/okf/types/JobList.md +14 -0
  189. package/dist/okf/types/K3sHelmChart.md +14 -0
  190. package/dist/okf/types/Kustomization.md +20 -0
  191. package/dist/okf/types/Lease.md +14 -0
  192. package/dist/okf/types/LeaseCandidate.md +14 -0
  193. package/dist/okf/types/LeaseCandidateList.md +14 -0
  194. package/dist/okf/types/LeaseList.md +14 -0
  195. package/dist/okf/types/LimitRange.md +14 -0
  196. package/dist/okf/types/LimitRangeList.md +14 -0
  197. package/dist/okf/types/LocalSubjectAccessReview.md +14 -0
  198. package/dist/okf/types/MicroVM.md +14 -0
  199. package/dist/okf/types/MicroVMClass.md +14 -0
  200. package/dist/okf/types/MicroVMImage.md +14 -0
  201. package/dist/okf/types/MicroVMNetwork.md +14 -0
  202. package/dist/okf/types/MicroVMReplicaSet.md +14 -0
  203. package/dist/okf/types/Middleware.md +14 -0
  204. package/dist/okf/types/MiddlewareTCP.md +14 -0
  205. package/dist/okf/types/MutatingAdmissionPolicy.md +14 -0
  206. package/dist/okf/types/MutatingAdmissionPolicyBinding.md +14 -0
  207. package/dist/okf/types/MutatingAdmissionPolicyBindingList.md +14 -0
  208. package/dist/okf/types/MutatingAdmissionPolicyList.md +14 -0
  209. package/dist/okf/types/MutatingWebhookConfiguration.md +14 -0
  210. package/dist/okf/types/MutatingWebhookConfigurationList.md +14 -0
  211. package/dist/okf/types/Namespace.md +19 -0
  212. package/dist/okf/types/NamespaceList.md +14 -0
  213. package/dist/okf/types/NetPol.md +14 -0
  214. package/dist/okf/types/NetworkPolicyList.md +14 -0
  215. package/dist/okf/types/Node.md +22 -0
  216. package/dist/okf/types/NodeList.md +14 -0
  217. package/dist/okf/types/OCIRepository.md +18 -0
  218. package/dist/okf/types/ObjectStore.md +14 -0
  219. package/dist/okf/types/Order.md +14 -0
  220. package/dist/okf/types/PDB.md +18 -0
  221. package/dist/okf/types/PersistentVolume.md +14 -0
  222. package/dist/okf/types/PersistentVolumeClaim.md +14 -0
  223. package/dist/okf/types/PersistentVolumeClaimList.md +14 -0
  224. package/dist/okf/types/PersistentVolumeList.md +14 -0
  225. package/dist/okf/types/Pod.md +18 -0
  226. package/dist/okf/types/PodCertificateRequest.md +14 -0
  227. package/dist/okf/types/PodCertificateRequestList.md +14 -0
  228. package/dist/okf/types/PodDisruptionBudgetList.md +14 -0
  229. package/dist/okf/types/PodList.md +14 -0
  230. package/dist/okf/types/PodTemplate.md +14 -0
  231. package/dist/okf/types/PodTemplateList.md +14 -0
  232. package/dist/okf/types/Pooler.md +14 -0
  233. package/dist/okf/types/PriorityClass.md +17 -0
  234. package/dist/okf/types/PriorityClassList.md +14 -0
  235. package/dist/okf/types/PriorityLevelConfiguration.md +14 -0
  236. package/dist/okf/types/PriorityLevelConfigurationList.md +14 -0
  237. package/dist/okf/types/PrometheusRule.md +14 -0
  238. package/dist/okf/types/Provider.md +14 -0
  239. package/dist/okf/types/RayCluster.md +20 -0
  240. package/dist/okf/types/RayJob.md +14 -0
  241. package/dist/okf/types/RayService.md +14 -0
  242. package/dist/okf/types/Receiver.md +14 -0
  243. package/dist/okf/types/ReferenceGrant.md +14 -0
  244. package/dist/okf/types/ReplicaSet.md +19 -0
  245. package/dist/okf/types/ReplicaSetList.md +14 -0
  246. package/dist/okf/types/ReplicationController.md +14 -0
  247. package/dist/okf/types/ReplicationControllerList.md +14 -0
  248. package/dist/okf/types/ResourceClaim.md +14 -0
  249. package/dist/okf/types/ResourceClaimList.md +14 -0
  250. package/dist/okf/types/ResourceClaimTemplate.md +14 -0
  251. package/dist/okf/types/ResourceClaimTemplateList.md +14 -0
  252. package/dist/okf/types/ResourceQuota.md +14 -0
  253. package/dist/okf/types/ResourceQuotaList.md +14 -0
  254. package/dist/okf/types/ResourceSet.md +14 -0
  255. package/dist/okf/types/ResourceSetInputProvider.md +14 -0
  256. package/dist/okf/types/ResourceSlice.md +14 -0
  257. package/dist/okf/types/ResourceSliceList.md +14 -0
  258. package/dist/okf/types/Role.md +14 -0
  259. package/dist/okf/types/RoleBinding.md +15 -0
  260. package/dist/okf/types/RoleBindingList.md +14 -0
  261. package/dist/okf/types/RoleList.md +14 -0
  262. package/dist/okf/types/RuntimeClass.md +16 -0
  263. package/dist/okf/types/RuntimeClassList.md +14 -0
  264. package/dist/okf/types/SA.md +16 -0
  265. package/dist/okf/types/Scale.md +14 -0
  266. package/dist/okf/types/ScheduledBackup.md +14 -0
  267. package/dist/okf/types/Sec.md +17 -0
  268. package/dist/okf/types/SecretList.md +14 -0
  269. package/dist/okf/types/SelfSubjectAccessReview.md +14 -0
  270. package/dist/okf/types/SelfSubjectReview.md +13 -0
  271. package/dist/okf/types/SelfSubjectRulesReview.md +14 -0
  272. package/dist/okf/types/ServersTransport.md +14 -0
  273. package/dist/okf/types/ServersTransportTCP.md +14 -0
  274. package/dist/okf/types/Service.md +20 -0
  275. package/dist/okf/types/ServiceAccountList.md +14 -0
  276. package/dist/okf/types/ServiceCIDR.md +14 -0
  277. package/dist/okf/types/ServiceCIDRList.md +14 -0
  278. package/dist/okf/types/ServiceList.md +14 -0
  279. package/dist/okf/types/ServiceMonitor.md +14 -0
  280. package/dist/okf/types/StatefulSet.md +19 -0
  281. package/dist/okf/types/StatefulSetList.md +14 -0
  282. package/dist/okf/types/Status.md +17 -0
  283. package/dist/okf/types/StorageClass.md +20 -0
  284. package/dist/okf/types/StorageClassList.md +14 -0
  285. package/dist/okf/types/StorageVersionMigration.md +14 -0
  286. package/dist/okf/types/StorageVersionMigrationList.md +14 -0
  287. package/dist/okf/types/SubjectAccessReview.md +14 -0
  288. package/dist/okf/types/TLSOption.md +14 -0
  289. package/dist/okf/types/TLSStore.md +14 -0
  290. package/dist/okf/types/TokenRequest.md +14 -0
  291. package/dist/okf/types/TokenReview.md +14 -0
  292. package/dist/okf/types/TraefikService.md +14 -0
  293. package/dist/okf/types/ValidatingAdmissionPolicy.md +14 -0
  294. package/dist/okf/types/ValidatingAdmissionPolicyBinding.md +14 -0
  295. package/dist/okf/types/ValidatingAdmissionPolicyBindingList.md +14 -0
  296. package/dist/okf/types/ValidatingAdmissionPolicyList.md +14 -0
  297. package/dist/okf/types/ValidatingWebhookConfiguration.md +14 -0
  298. package/dist/okf/types/ValidatingWebhookConfigurationList.md +14 -0
  299. package/dist/okf/types/VolumeAttachment.md +14 -0
  300. package/dist/okf/types/VolumeAttachmentList.md +14 -0
  301. package/dist/okf/types/VolumeAttributesClass.md +15 -0
  302. package/dist/okf/types/VolumeAttributesClassList.md +14 -0
  303. package/dist/okf/types/WatchEvent.md +14 -0
  304. package/dist/plugin.d.ts.map +1 -1
  305. package/dist/rules/argo-helpers.ts +2 -0
  306. package/dist/rules/flux-source-ref-pin.ts +52 -0
  307. package/dist/rules/flux002.ts +77 -0
  308. package/dist/rules/flux003.ts +75 -0
  309. package/dist/serializer.d.ts.map +1 -1
  310. package/dist/skills/chant-k8s-flux.md +162 -0
  311. package/dist/types/index.d.ts +41 -3
  312. package/dist/validate.d.ts.map +1 -1
  313. package/package.json +3 -3
  314. package/src/api/classify.test.ts +20 -0
  315. package/src/api/classify.ts +8 -1
  316. package/src/api/connect.ts +10 -0
  317. package/src/codegen/docs.ts +11 -0
  318. package/src/components/argo-app.test.ts +137 -0
  319. package/src/components/argo-app.ts +163 -0
  320. package/src/components/builders.ts +8 -0
  321. package/src/components/capability-plugin.ts +11 -1
  322. package/src/components/flux-reconcile.test.ts +145 -0
  323. package/src/components/flux-reconcile.ts +159 -0
  324. package/src/components/index.ts +13 -0
  325. package/src/components/kustomize-apply.ts +12 -41
  326. package/src/composites/composites.test.ts +122 -0
  327. package/src/composites/flux-app.ts +274 -0
  328. package/src/composites/index.ts +9 -0
  329. package/src/config-augmentation.test.ts +72 -0
  330. package/src/config-schema.ts +5 -0
  331. package/src/config.ts +33 -5
  332. package/src/crd/crd-sources.ts +37 -0
  333. package/src/crd/parser.ts +6 -0
  334. package/src/deep-observe-hooks.ts +60 -0
  335. package/src/deep-observe.test.ts +114 -0
  336. package/src/describe-resources.test.ts +215 -6
  337. package/src/describe-resources.ts +197 -118
  338. package/src/generated/index.d.ts +41 -3
  339. package/src/generated/index.ts +15 -4
  340. package/src/generated/lexicon-k8s.json +92 -16
  341. package/src/generated/operations.json +48 -0
  342. package/src/index.ts +4 -0
  343. package/src/kube/connect.ts +5 -4
  344. package/src/kube/get.ts +4 -4
  345. package/src/kustomize/render.ts +84 -0
  346. package/src/kustomize/rendered-entity.ts +72 -0
  347. package/src/kustomize/root.test.ts +268 -0
  348. package/src/kustomize/root.ts +109 -0
  349. package/src/lint/audit-catalog.ts +2 -0
  350. package/src/lint/post-synth/argo-helpers.ts +2 -0
  351. package/src/lint/post-synth/flux002.ts +77 -0
  352. package/src/lint/post-synth/flux003.ts +75 -0
  353. package/src/lint/post-synth/index.ts +4 -0
  354. package/src/lint/post-synth/post-synth.test.ts +132 -0
  355. package/src/lint/rules/flux-source-ref-pin.ts +52 -0
  356. package/src/lint/rules/rules.test.ts +51 -0
  357. package/src/plugin.test.ts +2 -0
  358. package/src/plugin.ts +47 -0
  359. package/src/serializer.ts +34 -4
  360. package/src/skills/chant-k8s-flux.md +162 -0
  361. package/src/testdata/kustomize-root/base/deployment.yaml +17 -0
  362. package/src/testdata/kustomize-root/base/kustomization.yaml +3 -0
  363. package/src/testdata/kustomize-root/base/service.yaml +9 -0
  364. package/src/testdata/kustomize-root/overlays/prod/kustomization.yaml +6 -0
  365. package/src/validate.ts +4 -0
@@ -0,0 +1,77 @@
1
+ /**
2
+ * FLUX002: Kustomization.spec.sourceRef must reference a declared source
3
+ *
4
+ * A Flux `Kustomization` names its source in `spec.sourceRef` — a
5
+ * `GitRepository`, `OCIRepository`, or `Bucket` the source-controller fetches.
6
+ * If the referenced source isn't declared in the build, the
7
+ * kustomize-controller waits on an artifact that never arrives and the
8
+ * Kustomization stalls. The bootstrap-created `flux-system` GitRepository
9
+ * always exists on a bootstrapped cluster, so a reference to it is never
10
+ * flagged — the Flux analogue of ARGO002's built-in `default` project.
11
+ */
12
+ import type { PostSynthCheck, PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
13
+ import { allManifests, manifestsOfKind } from "./argo-helpers";
14
+
15
+ /** Source kinds the kustomize-controller can reconcile from. */
16
+ const SOURCE_KINDS = ["GitRepository", "OCIRepository", "Bucket"] as const;
17
+
18
+ /** The GitRepository `flux bootstrap` creates alongside the controllers. */
19
+ const BOOTSTRAP_SOURCE_NAME = "flux-system";
20
+
21
+ export const flux002: PostSynthCheck = {
22
+ id: "FLUX002",
23
+ description: "Kustomization.spec.sourceRef must reference a declared source (or the bootstrap flux-system repo)",
24
+
25
+ check(ctx: PostSynthContext): PostSynthDiagnostic[] {
26
+ const diagnostics: PostSynthDiagnostic[] = [];
27
+ const manifests = allManifests(ctx);
28
+
29
+ // Declared sources, keyed "Kind/name". Namespace is deliberately ignored:
30
+ // an unset sourceRef.namespace resolves in the Kustomization's own, and
31
+ // the common estate keeps everything in flux-system anyway.
32
+ const declaredSources = new Set<string>();
33
+ for (const kind of SOURCE_KINDS) {
34
+ for (const source of manifestsOfKind(manifests, kind)) {
35
+ const name = source.metadata?.name;
36
+ if (typeof name === "string") declaredSources.add(`${kind}/${name}`);
37
+ }
38
+ }
39
+
40
+ for (const kustomization of manifestsOfKind(manifests, "Kustomization")) {
41
+ // Flux and kustomize.config.k8s.io share the kind name; only the Flux CR
42
+ // carries a sourceRef-bearing spec.
43
+ const apiVersion = kustomization.apiVersion;
44
+ if (typeof apiVersion === "string" && !apiVersion.startsWith("kustomize.toolkit.fluxcd.io/")) continue;
45
+
46
+ const name = kustomization.metadata?.name ?? "Kustomization";
47
+ const sourceRef = kustomization.spec?.sourceRef as
48
+ | { kind?: unknown; name?: unknown }
49
+ | undefined;
50
+
51
+ if (!sourceRef || typeof sourceRef.name !== "string" || sourceRef.name === "") {
52
+ diagnostics.push({
53
+ checkId: "FLUX002",
54
+ severity: "error",
55
+ message: `Kustomization "${name}" has no spec.sourceRef.name — the kustomize-controller cannot resolve a source.`,
56
+ entity: name,
57
+ lexicon: "k8s",
58
+ });
59
+ continue;
60
+ }
61
+
62
+ const kind = typeof sourceRef.kind === "string" && sourceRef.kind !== "" ? sourceRef.kind : "GitRepository";
63
+ if (kind === "GitRepository" && sourceRef.name === BOOTSTRAP_SOURCE_NAME) continue;
64
+ if (declaredSources.has(`${kind}/${sourceRef.name}`)) continue;
65
+
66
+ diagnostics.push({
67
+ checkId: "FLUX002",
68
+ severity: "error",
69
+ message: `Kustomization "${name}" references ${kind} "${sourceRef.name}", which is not declared. Declare the source (e.g. FluxGitSource) or point sourceRef at the bootstrap flux-system repo.`,
70
+ entity: name,
71
+ lexicon: "k8s",
72
+ });
73
+ }
74
+
75
+ return diagnostics;
76
+ },
77
+ };
@@ -0,0 +1,75 @@
1
+ /**
2
+ * FLUX003: Kustomization.spec.dependsOn entries should name declared Kustomizations
3
+ *
4
+ * `dependsOn` is Flux's reconcile-ordering edge: the Kustomization stays
5
+ * pending until every named Kustomization is ready. The names are plain
6
+ * strings with no referential integrity — a typo, or an entry left behind
7
+ * after a rename, stalls the app silently. This check joins each entry
8
+ * against the Kustomizations the build actually declares.
9
+ *
10
+ * It is a warning, not an error: estates legitimately split infra and apps
11
+ * across repos, so a dependency (say `cert-manager`) may be declared by a
12
+ * build this one never sees. A self-referencing entry is flagged too — Flux
13
+ * can never satisfy it.
14
+ */
15
+ import type { PostSynthCheck, PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
16
+ import { allManifests, manifestsOfKind } from "./argo-helpers";
17
+ import type { K8sManifest } from "./k8s-helpers";
18
+
19
+ /** Flux Kustomizations only — the kustomize.config.k8s.io kind shares the name. */
20
+ function fluxKustomizations(manifests: K8sManifest[]): K8sManifest[] {
21
+ return manifestsOfKind(manifests, "Kustomization").filter((m) => {
22
+ const apiVersion = m.apiVersion;
23
+ return typeof apiVersion !== "string" || apiVersion.startsWith("kustomize.toolkit.fluxcd.io/");
24
+ });
25
+ }
26
+
27
+ export const flux003: PostSynthCheck = {
28
+ id: "FLUX003",
29
+ description: "Kustomization.spec.dependsOn entries should name Kustomizations declared in the build",
30
+
31
+ check(ctx: PostSynthContext): PostSynthDiagnostic[] {
32
+ const diagnostics: PostSynthDiagnostic[] = [];
33
+ const kustomizations = fluxKustomizations(allManifests(ctx));
34
+
35
+ const declared = new Set(
36
+ kustomizations
37
+ .map((k) => k.metadata?.name)
38
+ .filter((n): n is string => typeof n === "string"),
39
+ );
40
+
41
+ for (const kustomization of kustomizations) {
42
+ const name = kustomization.metadata?.name ?? "Kustomization";
43
+ const dependsOn = kustomization.spec?.dependsOn;
44
+ if (!Array.isArray(dependsOn)) continue;
45
+
46
+ for (const entry of dependsOn) {
47
+ const depName = (entry as { name?: unknown } | null)?.name;
48
+ if (typeof depName !== "string" || depName === "") continue;
49
+
50
+ if (depName === name) {
51
+ diagnostics.push({
52
+ checkId: "FLUX003",
53
+ severity: "warning",
54
+ message: `Kustomization "${name}" depends on itself — Flux can never satisfy the edge and the app will not reconcile.`,
55
+ entity: name,
56
+ lexicon: "k8s",
57
+ });
58
+ continue;
59
+ }
60
+
61
+ if (declared.has(depName)) continue;
62
+
63
+ diagnostics.push({
64
+ checkId: "FLUX003",
65
+ severity: "warning",
66
+ message: `Kustomization "${name}" depends on Kustomization "${depName}", which nothing in the build declares — reconciliation stalls until it exists. Fix the name, or ignore if it is declared in another repo.`,
67
+ entity: name,
68
+ lexicon: "k8s",
69
+ });
70
+ }
71
+ }
72
+
73
+ return diagnostics;
74
+ },
75
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../src/serializer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAsC,MAAM,6BAA6B,CAAC;AA6MlG;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,UA8I3B,CAAC"}
1
+ {"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../src/serializer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAsC,MAAM,6BAA6B,CAAC;AA8MlG;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,UA2K3B,CAAC"}
@@ -0,0 +1,162 @@
1
+ ---
2
+ skill: chant-k8s-flux
3
+ description: Flux CD composites for GitOps reconciliation — FluxGitSource + FluxAppFor, the one-source-many-apps shape, dependsOn ordering, the FLUX rules, and the flux-reconcile deploy step
4
+ user-invocable: true
5
+ ---
6
+
7
+ # Flux CD Composites
8
+
9
+ Chant authors typed infrastructure into manifests. Flux continuously reconciles those manifests into a cluster from git. These composites are the opt-in bridge — the k8s lexicon itself stays runtime-agnostic and only emits YAML; nothing here is implied unless you reach for it.
10
+
11
+ ## The split
12
+
13
+ | Layer | Owns | In Chant |
14
+ |---|---|---|
15
+ | **Chant** | Authoring typed infra → manifests, committed to git | the lexicons |
16
+ | **Flux** | Continuously reconciling those manifests (source-controller fetches, kustomize-controller applies) | `FluxGitSource` / `FluxAppFor` |
17
+ | **Chant again** | Reading convergence back | `flux-reconcile` deploy step, `chant components status --live` |
18
+
19
+ Flux never learns Chant exists — it fetches a git path and applies what it finds there. Chant's job ends at emitting the manifests and the Flux CRs that point at them.
20
+
21
+ ## Prerequisites
22
+
23
+ The Flux controllers must be installed in the target cluster before applying any Flux CRs:
24
+
25
+ ```bash
26
+ kubectl apply -f https://github.com/fluxcd/flux2/releases/download/v2.9.1/install.yaml
27
+ kubectl -n flux-system wait deploy --all --for=condition=Available --timeout=180s
28
+ ```
29
+
30
+ (Or `flux install` / `flux bootstrap` with the Flux CLI. `flux bootstrap` also creates a `flux-system` `GitRepository` — FLUX002 knows about it, see below.)
31
+
32
+ ## When to use which
33
+
34
+ | Composite | Use case |
35
+ |---|---|
36
+ | `FluxGitSource` | Declare the git repo the source-controller fetches — **once per repo** |
37
+ | `FluxAppFor` | One `Kustomization` reconciling one path out of a declared source — once per app |
38
+
39
+ ---
40
+
41
+ ## FluxGitSource — declare the repo once
42
+
43
+ ```typescript
44
+ import { FluxGitSource } from "@intentius/chant-lexicon-k8s";
45
+
46
+ export const source = FluxGitSource("home-chant", {
47
+ url: "https://github.com/jhgaylor/home-chant",
48
+ branch: "main",
49
+ });
50
+ ```
51
+
52
+ `FluxGitSource(name, options)` returns `{ gitRepository }` — a single `K8s::Flux::GitRepository` in `flux-system`. Options:
53
+
54
+ - **`url`** (required) — the repo the source-controller fetches.
55
+ - **`branch`** — defaults to `"main"`. **`tag`** pins a tag instead and wins over `branch`.
56
+ - **`interval`** — fetch interval, default `"5m"`.
57
+ - **`secretRef`** — name of the Secret holding git credentials, for private repos.
58
+ - **`fluxNamespace`** — where the CR lives, default `"flux-system"`.
59
+
60
+ > **FLUX001** — a hand-written `GitRepository` whose spec has a `url` but no `ref` is flagged: an unset `spec.ref` falls back to the `master` branch, which on most repos no longer exists, so the source stalls with a checkout error and every Kustomization downstream stalls too. `FluxGitSource` always emits a `ref` (branch or tag), so composite output is FLUX001-clean by construction.
61
+
62
+ ## FluxAppFor — one Kustomization per app
63
+
64
+ ```typescript
65
+ import { FluxAppFor } from "@intentius/chant-lexicon-k8s";
66
+
67
+ export const hello = FluxAppFor("hello-chant", {
68
+ source, // the FluxGitSource result above
69
+ path: "./apps/hello-chant/k8s",
70
+ targetNamespace: "default",
71
+ dependsOn: ["cert-manager", "traefik"],
72
+ });
73
+ ```
74
+
75
+ `FluxAppFor(target, options)` returns `{ kustomization }` — a single `K8s::Flux::Kustomization`. Defaults are taken from real Flux estates, not the docs:
76
+
77
+ - **`interval`** — `"10m"` (the source polls at 5m; reconcile less often than you fetch).
78
+ - **`prune: true`** — resources that disappear from the source are deleted.
79
+ - **`wait: true`** — the Kustomization reports Ready only when the reconciled resources are ready.
80
+ - **`targetNamespace`** — optional; sets `spec.targetNamespace` (kustomize-controller stamps it on every reconciled resource).
81
+ - **`timeout`**, **`suspend`**, **`serviceAccountName`** — pass-throughs for the matching spec fields.
82
+
83
+ ### The source option
84
+
85
+ `source` accepts three shapes:
86
+
87
+ ```typescript
88
+ FluxAppFor("app", { source, path: "./apps/app" }); // FluxGitSource result
89
+ FluxAppFor("app", { source: "flux-system", path: "./apps/app" }); // name of an existing GitRepository
90
+ FluxAppFor("app", { source: { kind: "OCIRepository", name: "images" }, path: "./apps/app" }); // explicit ref
91
+ ```
92
+
93
+ The first is the normal case. The second targets a source declared elsewhere — typically the bootstrap-created `flux-system` repo. The third covers `OCIRepository` / `Bucket` sources.
94
+
95
+ > **FLUX002** — every `Kustomization.spec.sourceRef` must name a source the build declares (`GitRepository`, `OCIRepository`, or `Bucket`), or the kustomize-controller waits forever on an artifact that never arrives. The bootstrap-created `flux-system` `GitRepository` is exempt — it always exists on a bootstrapped cluster, the Flux analogue of ARGO002's built-in `default` project.
96
+
97
+ ### One source, many apps
98
+
99
+ The common estate shape is **one `GitRepository` shared by many `Kustomization`s** — a multi-app repo with one Kustomization per path. A `GitRepository` per app is the mistake the composite split makes hard: declare the source once, hand its result to every `FluxAppFor`.
100
+
101
+ ```typescript
102
+ const source = FluxGitSource("infra", { url: "https://github.com/acme/infra" });
103
+
104
+ export const platform = FluxAppFor("platform", { source, path: "./dist/platform" });
105
+ export const api = FluxAppFor("api", { source, path: "./dist/apps/api", dependsOn: ["platform"] });
106
+ export const web = FluxAppFor("web", { source, path: "./dist/apps/web", dependsOn: ["platform", "api"] });
107
+ ```
108
+
109
+ ### dependsOn — ordering as a validated name list
110
+
111
+ `dependsOn` is a plain string list rendered to `spec.dependsOn`; the Kustomization stays pending until every named Kustomization is Ready. In raw YAML those names have no referential integrity — a typo, or an entry left behind after a rename, stalls the app silently.
112
+
113
+ > **FLUX003** — every `dependsOn` entry is joined against the Kustomizations the build actually declares. An entry naming nothing is a warning (not an error — estates legitimately split infra and apps across repos, so `cert-manager` may be declared by a build this one never sees). A self-referencing entry is always flagged: Flux can never satisfy it.
114
+
115
+ ---
116
+
117
+ ## Deploying — the flux-reconcile step
118
+
119
+ Applying `dist/flux.yaml` with `kubectl` works. For the component model, `fluxReconcile` is the typed deploy leaf (the sibling of `argo-app`):
120
+
121
+ ```typescript
122
+ import { phase, type Component } from "@intentius/chant/components/component";
123
+ import { fluxReconcile } from "@intentius/chant-lexicon-k8s/components";
124
+
125
+ export const bootstrap: Component = {
126
+ name: "flux-bootstrap",
127
+ archetype: "service",
128
+ dependsOn: [],
129
+ deploy: [
130
+ phase("Reconcile", [
131
+ fluxReconcile({
132
+ manifest: "dist/flux.yaml",
133
+ stack: "my-estate",
134
+ noRollback: "server-side apply keeps no previous object state; the declared source is the restore path",
135
+ }),
136
+ ]),
137
+ ],
138
+ };
139
+ ```
140
+
141
+ What it does:
142
+
143
+ 1. **Applies** the Flux CRs through the same server-side apply `kubectl-apply` uses — ownership stamping, marker-scoped prune, stack labels all identical.
144
+ 2. **Waits for Ready, sources first.** A Kustomization cannot become Ready before its GitRepository has an artifact, so gating on `source.toolkit.fluxcd.io` kinds first surfaces a wedged clone as the source's error rather than a reconciler timeout downstream. The generic `waitForReady` handles the rest of the toolkit (kstatus-conformant), with fail-fast on wedge reasons like `BuildFailed` or `UpgradeFailed` from the readiness registry.
145
+ 3. **Refuses non-Flux manifests.** If the manifest applies no Flux CR at all, the step errors — a plain manifest belongs on `kubectl-apply`, and two things applying the same resources is the failure mode worth engineering against.
146
+
147
+ It is a `needs-opt-out` capability (COMP003): every step needs `noRollback: "<reason>"`, a component `rollback` phase, or a sibling safety step — same posture as `kubectl-apply`, and for the same reason.
148
+
149
+ ## Reading convergence back
150
+
151
+ The build stamps `app.kubernetes.io/managed-by: chant` and (with `ownership` configured) `chant.intentius.io/stack: <stack>` labels on every resource. Flux applies the manifests, but the labels travel with them — so `chant components status --live` attributes the running workloads to the stack through the k8s lexicon's label-selector read, regardless of who did the applying. Flux prunes by its own labels; chant observes by its own labels; neither needs the other's.
152
+
153
+ ## Troubleshooting
154
+
155
+ | Symptom | Likely cause | Fix |
156
+ |---|---|---|
157
+ | Kustomization stuck, no artifact | Source stalled — unset `spec.ref` fell back to `master` | Pin a branch/tag (FLUX001); `FluxGitSource` does this by default |
158
+ | Kustomization waits forever | `sourceRef` names an undeclared source | Declare it with `FluxGitSource`, or point at the bootstrap `flux-system` repo (FLUX002) |
159
+ | App pending, dependencies "not ready" | `dependsOn` names a Kustomization that doesn't exist (typo/rename) | Fix the name (FLUX003), or confirm the other repo declares it |
160
+ | App pending forever, no error | `dependsOn` self-reference | Remove the self-edge (FLUX003 flags it) |
161
+ | Resources deleted unexpectedly | `prune: true` (the default) and the path stopped emitting them | Intended GitOps behavior; pass `prune: false` to opt out |
162
+ | `flux-reconcile` step errors immediately | Manifest contains no Flux CR | Use `kubectl-apply` for plain manifests |
@@ -2,6 +2,18 @@
2
2
 
3
3
  // --- Kubernetes Resource classes ---
4
4
 
5
+ export declare class Addon {
6
+ constructor(props: {
7
+ /** Standard object's metadata. */
8
+ metadata?: ObjectMeta;
9
+ /** Spec provides information about the on-disk manifest backing this resource. */
10
+ spec?: Record<string, unknown>;
11
+ });
12
+ readonly name: string;
13
+ readonly namespace: string;
14
+ readonly uid: string;
15
+ }
16
+
5
17
  export declare class Alert {
6
18
  constructor(props: {
7
19
  /** Standard object's metadata. */
@@ -920,6 +932,19 @@ export declare class FlowSchemaList {
920
932
  readonly uid: string;
921
933
  }
922
934
 
935
+ export declare class FluxHelmChart {
936
+ constructor(props: {
937
+ /** Standard object's metadata. */
938
+ metadata?: ObjectMeta;
939
+ /** HelmChartSpec specifies the desired state of a Helm chart. */
940
+ spec?: Record<string, unknown>;
941
+ });
942
+ readonly name: string;
943
+ readonly namespace: string;
944
+ readonly status: Record<string, unknown>;
945
+ readonly uid: string;
946
+ }
947
+
923
948
  export declare class FluxInstance {
924
949
  constructor(props: {
925
950
  /** Standard object's metadata. */
@@ -999,16 +1024,16 @@ export declare class GRPCRoute {
999
1024
  readonly uid: string;
1000
1025
  }
1001
1026
 
1002
- export declare class HelmChart {
1027
+ export declare class HelmChartConfig {
1003
1028
  constructor(props: {
1004
1029
  /** Standard object's metadata. */
1005
1030
  metadata?: ObjectMeta;
1006
- /** HelmChartSpec specifies the desired state of a Helm chart. */
1031
+ /** HelmChartConfigSpec represents additional user-configurable details of an installed and configured Helm chart release.
1032
+ These fields are merged with or override the corresponding fields on the related HelmChart resource. */
1007
1033
  spec?: Record<string, unknown>;
1008
1034
  });
1009
1035
  readonly name: string;
1010
1036
  readonly namespace: string;
1011
- readonly status: Record<string, unknown>;
1012
1037
  readonly uid: string;
1013
1038
  }
1014
1039
 
@@ -1325,6 +1350,19 @@ export declare class JobList {
1325
1350
  readonly uid: string;
1326
1351
  }
1327
1352
 
1353
+ export declare class K3sHelmChart {
1354
+ constructor(props: {
1355
+ /** Standard object's metadata. */
1356
+ metadata?: ObjectMeta;
1357
+ /** HelmChartSpec represents the user-configurable details for installation and upgrade of a Helm chart release. */
1358
+ spec?: Record<string, unknown>;
1359
+ });
1360
+ readonly name: string;
1361
+ readonly namespace: string;
1362
+ readonly status: Record<string, unknown>;
1363
+ readonly uid: string;
1364
+ }
1365
+
1328
1366
  export declare class Kustomization {
1329
1367
  constructor(props: {
1330
1368
  /** Standard object's metadata. */
@@ -1 +1 @@
1
- {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAA4B,KAAK,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAElG,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAuBvF;;GAEG;AACH,wBAAsB,QAAQ,CAAC,IAAI,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CAQpF"}
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAA4B,KAAK,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAElG,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAuBvF;;GAEG;AACH,wBAAsB,QAAQ,CAAC,IAAI,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CAYpF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intentius/chant-lexicon-k8s",
3
- "version": "0.41.20",
3
+ "version": "0.44.1",
4
4
  "description": "Kubernetes lexicon for chant — declarative IaC in TypeScript",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://intentius.io/chant",
@@ -76,7 +76,7 @@
76
76
  "@types/js-yaml": "^4.0.9"
77
77
  },
78
78
  "optionalDependencies": {
79
- "@intentius/chant-k8s-client": "^0.41.5"
79
+ "@intentius/chant-k8s-client": "^0.44.1"
80
80
  },
81
81
  "devDependencies": {
82
82
  "@intentius/chant": "*",
@@ -84,7 +84,7 @@
84
84
  },
85
85
  "peerDependencies": {
86
86
  "zod": "^4.3.6",
87
- "@intentius/chant": "^0.41.20",
87
+ "@intentius/chant": "^0.44.1",
88
88
  "typescript": "^5.9.3"
89
89
  }
90
90
  }
@@ -93,6 +93,26 @@ describe("classifyApiFailure", () => {
93
93
  }
94
94
  });
95
95
 
96
+ test("the detail names the context the client read, when the failure carries it (#1488)", () => {
97
+ const err = status(500, "InternalError");
98
+ err.contextNote = 'context "k3d-kubemicrovm-local" (ambient; no k8s.profiles.local binding)';
99
+ const outcome = classifyApiFailure(err);
100
+ expect(outcome.kind).toBe("unobserved");
101
+ if (outcome.kind === "unobserved") {
102
+ expect(outcome.detail).toContain('context "k3d-kubemicrovm-local" (ambient; no k8s.profiles.local binding)');
103
+ }
104
+ });
105
+
106
+ test("the context note survives the one-line cap rather than truncating with the message (#1488)", () => {
107
+ const err = new K8sApiError(500, "InternalError", "x".repeat(500));
108
+ err.contextNote = 'context "prod-eks" (bound by k8s.profiles.prod.context)';
109
+ const outcome = classifyApiFailure(err);
110
+ expect(outcome.kind).toBe("unobserved");
111
+ if (outcome.kind === "unobserved") {
112
+ expect(outcome.detail.endsWith('context "prod-eks" (bound by k8s.profiles.prod.context)')).toBe(true);
113
+ }
114
+ });
115
+
96
116
  test("classification survives a duplicated copy of the client package", () => {
97
117
  // Discrimination is by `name`, not `instanceof`, so an error from a second
98
118
  // physical copy of the package in a consumer's tree still classifies.
@@ -47,6 +47,8 @@ interface ErrorLike {
47
47
  message?: string;
48
48
  statusCode?: number;
49
49
  reason?: string;
50
+ /** Which cluster the failing read talked to — stamped by the typed client (chant #1488). */
51
+ contextNote?: string;
50
52
  }
51
53
 
52
54
  function shapeOf(err: unknown): ErrorLike {
@@ -140,5 +142,10 @@ export const MISSING_CLIENT_DETAIL =
140
142
  function detailOf(err: unknown): string {
141
143
  const text = err instanceof Error ? err.message : String(err);
142
144
  const line = text.split("\n").find((l) => l.trim().length > 0)?.trim() ?? text.trim();
143
- return line.length > 200 ? `${line.slice(0, 197)}...` : line;
145
+ const capped = line.length > 200 ? `${line.slice(0, 197)}...` : line;
146
+ // #1488 — a reason that does not say which cluster was read turned an
147
+ // ambient-context switch into an afternoon. The client stamps the context it
148
+ // resolved onto every failure; append it after the cap so it never truncates.
149
+ const note = shapeOf(err).contextNote;
150
+ return note ? `${capped} — ${note}` : capped;
144
151
  }
@@ -65,6 +65,7 @@ export const defaultK8sConnector: K8sConnector = async (options) => {
65
65
  const client = await createK8sClient({
66
66
  context: options.context,
67
67
  contextSource: "bound",
68
+ contextLabel: "explicit --context",
68
69
  ...options.client,
69
70
  });
70
71
  return { client, target: { context: options.context, source: "bound" } };
@@ -84,10 +85,19 @@ export const defaultK8sConnector: K8sConnector = async (options) => {
84
85
  // is supplied.
85
86
  const target = await resolveClusterTarget(config as Record<string, unknown>, options.environment, "k8s");
86
87
 
88
+ // #1488 — every failure the client throws names the cluster it read and how
89
+ // that cluster was selected, so a `read-failed` against the wrong context is
90
+ // legible from the reason alone.
91
+ const contextLabel =
92
+ target.source === "bound"
93
+ ? `bound by k8s.profiles.${options.environment}.context`
94
+ : `ambient; no k8s.profiles.${options.environment} binding`;
95
+
87
96
  const client = await createK8sClient({
88
97
  ...options.client,
89
98
  ...(target.context ? { context: target.context } : {}),
90
99
  contextSource: target.source,
100
+ contextLabel,
91
101
  ...(execAllowlist ? { execAllowlist } : {}),
92
102
  });
93
103
  return { client, target };
@@ -409,6 +409,16 @@ Quality checks for the [Argo CD composites](/chant/lexicons/k8s/argo-composites/
409
409
  | ARGO004 | \`ApplicationSet\` template doesn't scope to a single static \`AppProject\` |
410
410
  | ARGO005 | \`Application\` \`source.path\` doesn't resolve to a directory (warn) |
411
411
 
412
+ ### Flux
413
+
414
+ Quality checks for the [Flux composites](/chant/lexicons/k8s/flux-composites/) (\`FluxGitSource\` / \`FluxAppFor\`). FLUX001 is declarative (source AST); FLUX002/003 are post-synth (cross-resource).
415
+
416
+ | Rule | Description |
417
+ |------|-------------|
418
+ | FLUX001 | \`GitRepository\` has no \`spec.ref\` pin — Flux falls back to the \`master\` branch |
419
+ | FLUX002 | \`Kustomization.spec.sourceRef\` references an undeclared source (the bootstrap \`flux-system\` repo is exempt) |
420
+ | FLUX003 | \`Kustomization.spec.dependsOn\` names a \`Kustomization\` nothing in the build declares, or itself (warn) |
421
+
412
422
  ## Running lint
413
423
 
414
424
  \`\`\`bash
@@ -1160,6 +1170,7 @@ The lexicon also provides MCP (Model Context Protocol) tools and resources:
1160
1170
  },
1161
1171
  { label: "CRD-Generated Classes", slug: "crd-classes" },
1162
1172
  { label: "Argo CD Composites", slug: "argo-composites" },
1173
+ { label: "Flux Composites", slug: "flux-composites" },
1163
1174
  {
1164
1175
  label: "Vendor Composites",
1165
1176
  items: [