@intentius/chant-lexicon-k8s 0.124.31 → 0.124.32

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 (270) hide show
  1. package/dist/actions/apps.js +18 -0
  2. package/dist/actions/batch.js +6 -0
  3. package/dist/actions/core.js +48 -0
  4. package/dist/actions/index.js +13 -0
  5. package/dist/actions/networking.js +11 -0
  6. package/dist/actions/rbac.js +8 -0
  7. package/dist/api/classify.js +123 -0
  8. package/dist/api/connect.js +62 -0
  9. package/dist/api/fake-cluster.js +175 -0
  10. package/dist/api/operation-surface.d.ts.map +1 -1
  11. package/dist/api/operation-surface.js +109 -0
  12. package/dist/api/owner-chain.js +100 -0
  13. package/dist/api/sweep-types.js +35 -0
  14. package/dist/behaviour-kinds.js +82 -0
  15. package/dist/codegen/docs-cli.js +2 -0
  16. package/dist/codegen/docs.js +146 -0
  17. package/dist/codegen/generate-cli.js +30 -0
  18. package/dist/codegen/generate-lexicon.js +74 -0
  19. package/dist/codegen/generate-list-map-keys.js +88 -0
  20. package/dist/codegen/generate-operations.js +53 -0
  21. package/dist/codegen/generate-typescript.js +124 -0
  22. package/dist/codegen/generate.js +173 -0
  23. package/dist/codegen/naming.js +174 -0
  24. package/dist/codegen/package.js +36 -0
  25. package/dist/codegen/patches.js +88 -0
  26. package/dist/codegen/typecheck.js +4 -0
  27. package/dist/codegen/versions.js +41 -0
  28. package/dist/components/argo-app.js +51 -0
  29. package/dist/components/builders.js +22 -0
  30. package/dist/components/capability-plugin.js +31 -0
  31. package/dist/components/flux-reconcile.js +61 -0
  32. package/dist/components/index.d.ts +1 -1
  33. package/dist/components/index.d.ts.map +1 -1
  34. package/dist/components/index.js +18 -0
  35. package/dist/components/kubectl-apply.d.ts +83 -1
  36. package/dist/components/kubectl-apply.d.ts.map +1 -1
  37. package/dist/components/kubectl-apply.js +274 -0
  38. package/dist/components/kustomize-apply.js +25 -0
  39. package/dist/composites/adot-collector.js +184 -0
  40. package/dist/composites/agic-ingress.js +85 -0
  41. package/dist/composites/aks-external-dns-agent.js +146 -0
  42. package/dist/composites/alb-ingress.js +86 -0
  43. package/dist/composites/argo-app.js +199 -0
  44. package/dist/composites/autoscaled-service.js +174 -0
  45. package/dist/composites/azure-disk-storage-class.js +47 -0
  46. package/dist/composites/azure-file-storage-class.js +48 -0
  47. package/dist/composites/azure-monitor-collector.js +176 -0
  48. package/dist/composites/batch-job.js +139 -0
  49. package/dist/composites/catalog.js +4110 -0
  50. package/dist/composites/cockroachdb-cluster.js +371 -0
  51. package/dist/composites/cockroachdb-region-stack.js +369 -0
  52. package/dist/composites/config-connector-context.js +40 -0
  53. package/dist/composites/configured-app.js +135 -0
  54. package/dist/composites/cron-schedule.js +38 -0
  55. package/dist/composites/cron-workload.js +109 -0
  56. package/dist/composites/ebs-storage-class.js +54 -0
  57. package/dist/composites/efs-storage-class.js +46 -0
  58. package/dist/composites/external-dns-agent.js +122 -0
  59. package/dist/composites/filestore-storage-class.js +49 -0
  60. package/dist/composites/fluent-bit-agent.js +157 -0
  61. package/dist/composites/flux-app.js +156 -0
  62. package/dist/composites/gce-ingress.js +83 -0
  63. package/dist/composites/gce-pd-storage-class.js +49 -0
  64. package/dist/composites/gke-external-dns-agent.js +129 -0
  65. package/dist/composites/gke-fluent-bit-agent.js +165 -0
  66. package/dist/composites/gke-gateway.js +91 -0
  67. package/dist/composites/gke-otel-collector.js +94 -0
  68. package/dist/composites/index.js +51 -0
  69. package/dist/composites/inference-service.js +76 -0
  70. package/dist/composites/irsa-service-account.js +77 -0
  71. package/dist/composites/member-defaults.js +14 -0
  72. package/dist/composites/metrics-server.js +181 -0
  73. package/dist/composites/model.js +92 -0
  74. package/dist/composites/monitored-service.js +152 -0
  75. package/dist/composites/namespace-env.js +114 -0
  76. package/dist/composites/network-isolated-app.js +124 -0
  77. package/dist/composites/node-agent.js +149 -0
  78. package/dist/composites/operator-stack.js +268 -0
  79. package/dist/composites/otel-collector-agent.js +142 -0
  80. package/dist/composites/otel-collector-gateway.js +216 -0
  81. package/dist/composites/otel-collector-node.js +176 -0
  82. package/dist/composites/otel-collector-rbac.js +115 -0
  83. package/dist/composites/otel-collector-shape.js +128 -0
  84. package/dist/composites/otel-collector.js +115 -0
  85. package/dist/composites/otel-operator-collector.js +123 -0
  86. package/dist/composites/ray-cluster.js +378 -0
  87. package/dist/composites/ray-job.js +136 -0
  88. package/dist/composites/ray-service.js +178 -0
  89. package/dist/composites/secure-ingress.js +100 -0
  90. package/dist/composites/security-context.js +1 -0
  91. package/dist/composites/sidecar-app.js +105 -0
  92. package/dist/composites/stateful-app.js +111 -0
  93. package/dist/composites/vllm-serving-runtime.js +114 -0
  94. package/dist/composites/web-app.js +157 -0
  95. package/dist/composites/worker-pool.js +167 -0
  96. package/dist/composites/workload-identity-sa.js +81 -0
  97. package/dist/composites/workload-identity-service-account.js +77 -0
  98. package/dist/config-schema.js +72 -0
  99. package/dist/config.js +59 -0
  100. package/dist/coverage.js +27 -0
  101. package/dist/crd/crd-sources.js +615 -0
  102. package/dist/crd/loader.js +181 -0
  103. package/dist/crd/oci-chart.js +144 -0
  104. package/dist/crd/parser.js +382 -0
  105. package/dist/crd/project-codegen.js +273 -0
  106. package/dist/crd/types.js +7 -0
  107. package/dist/deep-observe-hooks.js +306 -0
  108. package/dist/deep-observe.js +234 -0
  109. package/dist/default-labels.js +87 -0
  110. package/dist/describe-resources.js +699 -0
  111. package/dist/describe-stack-status.js +99 -0
  112. package/dist/detect.js +11 -0
  113. package/dist/effect-receipt-row.js +205 -0
  114. package/dist/export-resources.js +39 -0
  115. package/dist/generated/index.js +1092 -0
  116. package/dist/generated/runtime.js +4 -0
  117. package/dist/group-namespace.js +96 -0
  118. package/dist/import/embedded.js +197 -0
  119. package/dist/import/generator.js +288 -0
  120. package/dist/import/live-export.js +85 -0
  121. package/dist/import/parser.js +204 -0
  122. package/dist/import/testdata/embedded/fixtures.js +60 -0
  123. package/dist/include/entity.js +78 -0
  124. package/dist/include/resolve.js +170 -0
  125. package/dist/index.js +59 -0
  126. package/dist/integrity.json +3 -3
  127. package/dist/kube/apply.js +90 -0
  128. package/dist/kube/connect.js +46 -0
  129. package/dist/kube/delete.js +138 -0
  130. package/dist/kube/describe.js +169 -0
  131. package/dist/kube/events.js +132 -0
  132. package/dist/kube/flags.js +91 -0
  133. package/dist/kube/get.js +159 -0
  134. package/dist/kube/group.js +123 -0
  135. package/dist/kube/logs.js +82 -0
  136. package/dist/kube/project.js +94 -0
  137. package/dist/kube/render.js +227 -0
  138. package/dist/kube/source.js +122 -0
  139. package/dist/kube/target.js +63 -0
  140. package/dist/kube/testing.js +28 -0
  141. package/dist/kube/top.js +99 -0
  142. package/dist/kube/verdict.js +72 -0
  143. package/dist/kube/wait.js +129 -0
  144. package/dist/kustomize/render.js +73 -0
  145. package/dist/kustomize/rendered-entity.js +67 -0
  146. package/dist/kustomize/root.js +68 -0
  147. package/dist/lint/audit-catalog.js +61 -0
  148. package/dist/lint/audit-lineage.js +118 -0
  149. package/dist/lint/post-synth/argo-helpers.js +36 -0
  150. package/dist/lint/post-synth/argo002.js +31 -0
  151. package/dist/lint/post-synth/argo003.js +53 -0
  152. package/dist/lint/post-synth/argo005.js +54 -0
  153. package/dist/lint/post-synth/crd-schema-helpers.d.ts.map +1 -1
  154. package/dist/lint/post-synth/crd-schema-helpers.js +214 -0
  155. package/dist/lint/post-synth/flux002.js +56 -0
  156. package/dist/lint/post-synth/flux003.js +50 -0
  157. package/dist/lint/post-synth/index.js +104 -0
  158. package/dist/lint/post-synth/k8s-helpers.js +186 -0
  159. package/dist/lint/post-synth/monitoring-selection-helpers.js +163 -0
  160. package/dist/lint/post-synth/otel-placement-helpers.js +293 -0
  161. package/dist/lint/post-synth/sops-helpers.js +43 -0
  162. package/dist/lint/post-synth/wk8005.js +44 -0
  163. package/dist/lint/post-synth/wk8006.js +56 -0
  164. package/dist/lint/post-synth/wk8041.js +60 -0
  165. package/dist/lint/post-synth/wk8042.js +36 -0
  166. package/dist/lint/post-synth/wk8101.js +52 -0
  167. package/dist/lint/post-synth/wk8102.js +30 -0
  168. package/dist/lint/post-synth/wk8103.js +33 -0
  169. package/dist/lint/post-synth/wk8104.js +58 -0
  170. package/dist/lint/post-synth/wk8105.js +33 -0
  171. package/dist/lint/post-synth/wk8201.js +44 -0
  172. package/dist/lint/post-synth/wk8202.js +34 -0
  173. package/dist/lint/post-synth/wk8203.js +34 -0
  174. package/dist/lint/post-synth/wk8204.js +71 -0
  175. package/dist/lint/post-synth/wk8205.js +38 -0
  176. package/dist/lint/post-synth/wk8207.js +33 -0
  177. package/dist/lint/post-synth/wk8208.js +33 -0
  178. package/dist/lint/post-synth/wk8209.js +33 -0
  179. package/dist/lint/post-synth/wk8301.js +49 -0
  180. package/dist/lint/post-synth/wk8302.js +34 -0
  181. package/dist/lint/post-synth/wk8303.js +68 -0
  182. package/dist/lint/post-synth/wk8304.js +58 -0
  183. package/dist/lint/post-synth/wk8305.js +96 -0
  184. package/dist/lint/post-synth/wk8306.js +38 -0
  185. package/dist/lint/post-synth/wk8401.js +86 -0
  186. package/dist/lint/post-synth/wk8402.js +31 -0
  187. package/dist/lint/post-synth/wk8403.js +49 -0
  188. package/dist/lint/post-synth/wk8404.js +36 -0
  189. package/dist/lint/post-synth/wk8405.js +65 -0
  190. package/dist/lint/post-synth/wk8406.js +50 -0
  191. package/dist/lint/post-synth/wk8407.js +58 -0
  192. package/dist/lint/post-synth/wk8501.js +36 -0
  193. package/dist/lint/post-synth/wk8502.js +35 -0
  194. package/dist/lint/post-synth/wk8503.js +164 -0
  195. package/dist/lint/post-synth/wk8504.js +20 -0
  196. package/dist/lint/post-synth/wk8505.js +31 -0
  197. package/dist/lint/post-synth/wk8601.js +40 -0
  198. package/dist/lint/post-synth/wk8602.js +120 -0
  199. package/dist/lint/post-synth/wk8603.js +63 -0
  200. package/dist/lint/post-synth/wk8604.js +31 -0
  201. package/dist/lint/post-synth/wk8605.js +124 -0
  202. package/dist/lint/post-synth/wk8606.js +22 -0
  203. package/dist/lint/post-synth/wk8701.js +31 -0
  204. package/dist/lint/post-synth/wk8702.js +37 -0
  205. package/dist/lint/post-synth/wk8703.js +31 -0
  206. package/dist/lint/post-synth/wk8704.js +135 -0
  207. package/dist/lint/post-synth/wk8705.js +38 -0
  208. package/dist/lint/rules/argo-appset-single-project.js +56 -0
  209. package/dist/lint/rules/argo-ast.js +94 -0
  210. package/dist/lint/rules/argo-automated-prune.js +59 -0
  211. package/dist/lint/rules/flux-source-ref-pin.js +44 -0
  212. package/dist/lint/rules/hardcoded-namespace.js +57 -0
  213. package/dist/lint/rules/latest-image-tag.js +103 -0
  214. package/dist/lint/rules/missing-resource-limits.js +85 -0
  215. package/dist/lsp/completions.d.ts.map +1 -1
  216. package/dist/lsp/completions.js +18 -0
  217. package/dist/lsp/hover.d.ts.map +1 -1
  218. package/dist/lsp/hover.js +57 -0
  219. package/dist/manifest-entity.js +71 -0
  220. package/dist/manifest.json +1 -1
  221. package/dist/micro-time.js +49 -0
  222. package/dist/op/activities/apply-diff.d.ts +31 -0
  223. package/dist/op/activities/apply-diff.d.ts.map +1 -0
  224. package/dist/op/activities/apply-diff.js +79 -0
  225. package/dist/op/activities/argo.js +98 -0
  226. package/dist/op/activities/ensure-secret.js +38 -0
  227. package/dist/op/activities/index.js +51 -0
  228. package/dist/op/activities/kubectl.d.ts +64 -0
  229. package/dist/op/activities/kubectl.d.ts.map +1 -1
  230. package/dist/op/activities/kubectl.js +517 -0
  231. package/dist/op/activities/wait-for-ready.js +229 -0
  232. package/dist/op/builders.js +68 -0
  233. package/dist/package-cli.js +21 -0
  234. package/dist/patch/json-patch.js +187 -0
  235. package/dist/patch/rendered-patch.js +94 -0
  236. package/dist/plugin.js +741 -0
  237. package/dist/project-kinds.js +56 -0
  238. package/dist/receipt-store.js +216 -0
  239. package/dist/rules/crd-schema-helpers.ts +2 -1
  240. package/dist/secret-labels.js +33 -0
  241. package/dist/secret-store.js +116 -0
  242. package/dist/serializer.d.ts.map +1 -1
  243. package/dist/serializer.js +578 -0
  244. package/dist/sops/encrypted-secret-file.js +194 -0
  245. package/dist/sops/entity.js +32 -0
  246. package/dist/spec/fetch.js +58 -0
  247. package/dist/spec/parse.js +622 -0
  248. package/dist/subscribe-changes.js +168 -0
  249. package/dist/teardown.js +197 -0
  250. package/dist/telemetry-release.js +86 -0
  251. package/dist/validate-cli.js +17 -0
  252. package/dist/validate.js +47 -0
  253. package/dist/variables.js +34 -0
  254. package/dist/whoami.js +109 -0
  255. package/package.json +12 -12
  256. package/src/api/operation-surface.ts +2 -1
  257. package/src/codegen/package.ts +2 -2
  258. package/src/components/index.ts +3 -0
  259. package/src/components/kubectl-apply-plan.k3d.e2e.test.ts +127 -0
  260. package/src/components/kubectl-apply.test.ts +262 -0
  261. package/src/components/kubectl-apply.ts +341 -12
  262. package/src/deep-observe-hooks.ts +2 -2
  263. package/src/import/roundtrip-build.test.ts +46 -0
  264. package/src/lint/post-synth/crd-schema-helpers.ts +2 -1
  265. package/src/lsp/completions.ts +2 -1
  266. package/src/lsp/hover.ts +2 -1
  267. package/src/op/activities/apply-diff.ts +87 -0
  268. package/src/op/activities/kubectl-plan.test.ts +224 -0
  269. package/src/op/activities/kubectl.ts +204 -16
  270. package/src/serializer.ts +2 -1
@@ -0,0 +1,184 @@
1
+ /**
2
+ * AdotCollector composite — DaemonSet + RBAC + ConfigMap for AWS Distro for OpenTelemetry.
3
+ *
4
+ * @eks ADOT collector for CloudWatch and X-Ray. NodeAgent specialization
5
+ * with pre-configured pipelines for AWS observability.
6
+ */
7
+ import { Composite, mergeDefaults } from "@intentius/chant";
8
+ import { DaemonSet, ServiceAccount, ClusterRole, ClusterRoleBinding, ConfigMap } from "../generated/index.js";
9
+ /**
10
+ * Create an AdotCollector composite — returns prop objects for
11
+ * a DaemonSet, ServiceAccount, ClusterRole, ClusterRoleBinding, and ConfigMap.
12
+ *
13
+ * @eks
14
+ * @example
15
+ * ```ts
16
+ * import { AdotCollector } from "@intentius/chant-lexicon-k8s";
17
+ *
18
+ * const { daemonSet, serviceAccount, clusterRole, clusterRoleBinding, configMap } = AdotCollector({
19
+ * region: "us-east-1",
20
+ * clusterName: "my-cluster",
21
+ * exporters: ["cloudwatch", "xray"],
22
+ * });
23
+ * ```
24
+ */
25
+ export const AdotCollector = Composite((props) => {
26
+ const { region, clusterName, exporters = ["cloudwatch", "xray"], name = "adot-collector", image = "public.ecr.aws/aws-observability/aws-otel-collector:latest", namespace = "amazon-metrics", labels: extraLabels = {}, cpuRequest = "100m", memoryRequest = "256Mi", cpuLimit = "500m", memoryLimit = "512Mi", iamRoleArn, defaults: defs, } = props;
27
+ const saName = `${name}-sa`;
28
+ const clusterRoleName = `${name}-role`;
29
+ const bindingName = `${name}-binding`;
30
+ const configMapName = `${name}-config`;
31
+ const commonLabels = {
32
+ "app.kubernetes.io/name": name,
33
+ "app.kubernetes.io/managed-by": "chant",
34
+ ...extraLabels,
35
+ };
36
+ // Build ADOT config YAML
37
+ const exporterConfigs = [];
38
+ const exporterNames = [];
39
+ if (exporters.includes("cloudwatch")) {
40
+ exporterConfigs.push(` awsemf:
41
+ region: ${region}
42
+ namespace: ContainerInsights
43
+ log_group_name: '/aws/containerinsights/${clusterName}/performance'
44
+ dimension_rollup_option: NoDimensionRollup`);
45
+ exporterNames.push("awsemf");
46
+ }
47
+ if (exporters.includes("xray")) {
48
+ exporterConfigs.push(` awsxray:
49
+ region: ${region}`);
50
+ exporterNames.push("awsxray");
51
+ }
52
+ if (exporters.includes("prometheus")) {
53
+ exporterConfigs.push(` prometheusremotewrite:
54
+ endpoint: http://prometheus:9090/api/v1/write`);
55
+ exporterNames.push("prometheusremotewrite");
56
+ }
57
+ const adotConfig = `receivers:
58
+ otlp:
59
+ protocols:
60
+ grpc:
61
+ endpoint: 0.0.0.0:4317
62
+ http:
63
+ endpoint: 0.0.0.0:4318
64
+
65
+ processors:
66
+ batch:
67
+ timeout: 30s
68
+ send_batch_size: 8192
69
+
70
+ exporters:
71
+ ${exporterConfigs.join("\n")}
72
+
73
+ service:
74
+ pipelines:
75
+ metrics:
76
+ receivers: [otlp]
77
+ processors: [batch]
78
+ exporters: [${exporterNames.filter((e) => e !== "awsxray").join(", ") || "awsemf"}]
79
+ traces:
80
+ receivers: [otlp]
81
+ processors: [batch]
82
+ exporters: [${exporterNames.filter((e) => e !== "awsemf").join(", ") || "awsxray"}]
83
+ `;
84
+ const container = {
85
+ name,
86
+ image,
87
+ args: ["--config=/etc/adot/config.yaml"],
88
+ ports: [
89
+ { containerPort: 4317, name: "otlp-grpc" },
90
+ { containerPort: 4318, name: "otlp-http" },
91
+ ],
92
+ resources: {
93
+ requests: { cpu: cpuRequest, memory: memoryRequest },
94
+ limits: { cpu: cpuLimit, memory: memoryLimit },
95
+ },
96
+ volumeMounts: [
97
+ { name: "config", mountPath: "/etc/adot", readOnly: true },
98
+ ],
99
+ securityContext: {
100
+ runAsNonRoot: true,
101
+ runAsUser: 10001,
102
+ readOnlyRootFilesystem: true,
103
+ allowPrivilegeEscalation: false,
104
+ },
105
+ };
106
+ const daemonSet = new DaemonSet(mergeDefaults({
107
+ metadata: {
108
+ name,
109
+ namespace,
110
+ labels: { ...commonLabels, "app.kubernetes.io/component": "agent" },
111
+ },
112
+ spec: {
113
+ selector: { matchLabels: { "app.kubernetes.io/name": name } },
114
+ template: {
115
+ metadata: { labels: { "app.kubernetes.io/name": name, ...extraLabels } },
116
+ spec: {
117
+ serviceAccountName: saName,
118
+ containers: [container],
119
+ volumes: [
120
+ { name: "config", configMap: { name: configMapName } },
121
+ ],
122
+ tolerations: [{ operator: "Exists" }],
123
+ },
124
+ },
125
+ },
126
+ }, defs?.daemonSet));
127
+ const serviceAccount = new ServiceAccount(mergeDefaults({
128
+ metadata: {
129
+ name: saName,
130
+ namespace,
131
+ labels: { ...commonLabels, "app.kubernetes.io/component": "agent" },
132
+ ...(iamRoleArn ? { annotations: { "eks.amazonaws.com/role-arn": iamRoleArn } } : {}),
133
+ },
134
+ }, defs?.serviceAccount));
135
+ const clusterRole = new ClusterRole(mergeDefaults({
136
+ metadata: {
137
+ name: clusterRoleName,
138
+ labels: { ...commonLabels, "app.kubernetes.io/component": "rbac" },
139
+ },
140
+ rules: [
141
+ { apiGroups: [""], resources: ["pods", "nodes", "endpoints"], verbs: ["get", "list", "watch"] },
142
+ { apiGroups: ["apps"], resources: ["replicasets"], verbs: ["get", "list", "watch"] },
143
+ { apiGroups: ["batch"], resources: ["jobs"], verbs: ["get", "list", "watch"] },
144
+ { apiGroups: [""], resources: ["nodes/proxy"], verbs: ["get"] },
145
+ { apiGroups: [""], resources: ["nodes/stats", "configmaps", "events"], verbs: ["create", "get"] },
146
+ { apiGroups: [""], resources: ["configmaps"], verbs: ["get", "update", "create"], resourceNames: ["otel-container-insight-clusterleader"] },
147
+ ],
148
+ }, defs?.clusterRole));
149
+ const clusterRoleBinding = new ClusterRoleBinding(mergeDefaults({
150
+ metadata: {
151
+ name: bindingName,
152
+ labels: { ...commonLabels, "app.kubernetes.io/component": "rbac" },
153
+ },
154
+ roleRef: {
155
+ apiGroup: "rbac.authorization.k8s.io",
156
+ kind: "ClusterRole",
157
+ name: clusterRoleName,
158
+ },
159
+ subjects: [
160
+ {
161
+ kind: "ServiceAccount",
162
+ name: saName,
163
+ namespace,
164
+ },
165
+ ],
166
+ }, defs?.clusterRoleBinding));
167
+ const configMap = new ConfigMap(mergeDefaults({
168
+ metadata: {
169
+ name: configMapName,
170
+ namespace,
171
+ labels: { ...commonLabels, "app.kubernetes.io/component": "config" },
172
+ },
173
+ data: {
174
+ "config.yaml": adotConfig,
175
+ },
176
+ }, defs?.configMap));
177
+ return {
178
+ daemonSet,
179
+ serviceAccount,
180
+ clusterRole,
181
+ clusterRoleBinding,
182
+ configMap,
183
+ };
184
+ }, "AdotCollector");
@@ -0,0 +1,85 @@
1
+ /**
2
+ * AgicIngress composite — Ingress with Azure Application Gateway Ingress Controller annotations.
3
+ *
4
+ * @aks Full `appgw.ingress.kubernetes.io/*` annotation set including SSL redirect,
5
+ * WAF policy, backend path prefix, and cookie-based affinity.
6
+ */
7
+ import { Composite, mergeDefaults } from "@intentius/chant";
8
+ import { Ingress } from "../generated/index.js";
9
+ /**
10
+ * Create an AgicIngress composite — returns prop objects for
11
+ * an Ingress with Azure Application Gateway Ingress Controller annotations.
12
+ *
13
+ * @aks
14
+ * @example
15
+ * ```ts
16
+ * import { AgicIngress } from "@intentius/chant-lexicon-k8s";
17
+ *
18
+ * const { ingress } = AgicIngress({
19
+ * name: "api-ingress",
20
+ * hosts: [
21
+ * {
22
+ * hostname: "api.example.com",
23
+ * paths: [{ path: "/", serviceName: "api", servicePort: 80 }],
24
+ * },
25
+ * ],
26
+ * certificateArn: "keyvault-secret-name",
27
+ * wafPolicyId: "/subscriptions/.../Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies/my-waf",
28
+ * });
29
+ * ```
30
+ */
31
+ export const AgicIngress = Composite((props) => {
32
+ const { name, hosts, certificateArn, wafPolicyId, healthCheckPath, sslRedirect, backendPathPrefix, cookieAffinity = false, annotations: extraAnnotations = {}, labels: extraLabels = {}, namespace, defaults: defs, } = props;
33
+ const commonLabels = {
34
+ "app.kubernetes.io/name": name,
35
+ "app.kubernetes.io/managed-by": "chant",
36
+ ...extraLabels,
37
+ };
38
+ // Build AGIC annotations
39
+ const annotations = {
40
+ "kubernetes.io/ingress.class": "azure/application-gateway",
41
+ ...extraAnnotations,
42
+ };
43
+ if (sslRedirect ?? (certificateArn !== undefined)) {
44
+ annotations["appgw.ingress.kubernetes.io/ssl-redirect"] = "true";
45
+ }
46
+ if (certificateArn) {
47
+ annotations["appgw.ingress.kubernetes.io/appgw-ssl-certificate"] = certificateArn;
48
+ }
49
+ if (wafPolicyId) {
50
+ annotations["appgw.ingress.kubernetes.io/waf-policy-for-path"] = wafPolicyId;
51
+ }
52
+ if (healthCheckPath) {
53
+ annotations["appgw.ingress.kubernetes.io/health-probe-path"] = healthCheckPath;
54
+ }
55
+ if (backendPathPrefix) {
56
+ annotations["appgw.ingress.kubernetes.io/backend-path-prefix"] = backendPathPrefix;
57
+ }
58
+ if (cookieAffinity) {
59
+ annotations["appgw.ingress.kubernetes.io/cookie-based-affinity"] = "true";
60
+ }
61
+ const ingressRules = hosts.map((host) => ({
62
+ host: host.hostname,
63
+ http: {
64
+ paths: host.paths.map((p) => ({
65
+ path: p.path,
66
+ pathType: p.pathType ?? "Prefix",
67
+ backend: {
68
+ service: { name: p.serviceName, port: { number: p.servicePort } },
69
+ },
70
+ })),
71
+ },
72
+ }));
73
+ const ingress = new Ingress(mergeDefaults({
74
+ metadata: {
75
+ name,
76
+ ...(namespace && { namespace }),
77
+ labels: { ...commonLabels, "app.kubernetes.io/component": "ingress" },
78
+ annotations,
79
+ },
80
+ spec: {
81
+ rules: ingressRules,
82
+ },
83
+ }, defs?.ingress));
84
+ return { ingress };
85
+ }, "AgicIngress");
@@ -0,0 +1,146 @@
1
+ /**
2
+ * AksExternalDnsAgent composite — Deployment + ServiceAccount + ClusterRole + ClusterRoleBinding.
3
+ *
4
+ * @aks Like ExternalDnsAgent but uses --provider=azure and AKS Workload Identity
5
+ * instead of IRSA for Azure DNS management.
6
+ */
7
+ import { Composite, mergeDefaults } from "@intentius/chant";
8
+ import { Deployment, ServiceAccount, ClusterRole, ClusterRoleBinding } from "../generated/index.js";
9
+ /**
10
+ * Create an AksExternalDnsAgent composite — returns prop objects for
11
+ * a Deployment, ServiceAccount (with AKS Workload Identity), ClusterRole, and ClusterRoleBinding.
12
+ *
13
+ * @aks
14
+ * @example
15
+ * ```ts
16
+ * import { AksExternalDnsAgent } from "@intentius/chant-lexicon-k8s";
17
+ *
18
+ * const { deployment, serviceAccount, clusterRole, clusterRoleBinding } = AksExternalDnsAgent({
19
+ * clientId: "00000000-0000-0000-0000-000000000000",
20
+ * resourceGroup: "my-rg",
21
+ * subscriptionId: "00000000-0000-0000-0000-000000000000",
22
+ * tenantId: "00000000-0000-0000-0000-000000000000",
23
+ * domainFilters: ["example.com"],
24
+ * txtOwnerId: "my-cluster",
25
+ * });
26
+ * ```
27
+ */
28
+ export const AksExternalDnsAgent = Composite((props) => {
29
+ const { clientId, resourceGroup, subscriptionId, tenantId, domainFilters, txtOwnerId, source = "ingress", name = "external-dns", image = "registry.k8s.io/external-dns/external-dns:v0.14.0", namespace = "kube-system", labels: extraLabels = {}, defaults: defs, } = props;
30
+ const saName = `${name}-sa`;
31
+ const clusterRoleName = `${name}-role`;
32
+ const bindingName = `${name}-binding`;
33
+ const commonLabels = {
34
+ "app.kubernetes.io/name": name,
35
+ "app.kubernetes.io/managed-by": "chant",
36
+ ...extraLabels,
37
+ };
38
+ const args = [
39
+ `--source=${source}`,
40
+ "--provider=azure",
41
+ `--azure-resource-group=${resourceGroup}`,
42
+ `--azure-subscription-id=${subscriptionId}`,
43
+ "--policy=upsert-only",
44
+ "--registry=txt",
45
+ ];
46
+ for (const domain of domainFilters) {
47
+ args.push(`--domain-filter=${domain}`);
48
+ }
49
+ if (txtOwnerId) {
50
+ args.push(`--txt-owner-id=${txtOwnerId}`);
51
+ }
52
+ const deployment = new Deployment(mergeDefaults({
53
+ metadata: {
54
+ name,
55
+ namespace,
56
+ labels: { ...commonLabels, "app.kubernetes.io/component": "dns" },
57
+ },
58
+ spec: {
59
+ replicas: 1,
60
+ selector: { matchLabels: { "app.kubernetes.io/name": name } },
61
+ template: {
62
+ metadata: {
63
+ labels: {
64
+ "app.kubernetes.io/name": name,
65
+ "azure.workload.identity/use": "true",
66
+ ...extraLabels,
67
+ },
68
+ },
69
+ spec: {
70
+ serviceAccountName: saName,
71
+ containers: [
72
+ {
73
+ name,
74
+ image,
75
+ args,
76
+ env: [
77
+ { name: "AZURE_TENANT_ID", value: tenantId },
78
+ { name: "AZURE_SUBSCRIPTION_ID", value: subscriptionId },
79
+ { name: "AZURE_RESOURCE_GROUP", value: resourceGroup },
80
+ ],
81
+ resources: {
82
+ requests: { cpu: "50m", memory: "64Mi" },
83
+ limits: { cpu: "100m", memory: "128Mi" },
84
+ },
85
+ securityContext: {
86
+ runAsNonRoot: true,
87
+ runAsUser: 65534,
88
+ readOnlyRootFilesystem: true,
89
+ allowPrivilegeEscalation: false,
90
+ },
91
+ },
92
+ ],
93
+ },
94
+ },
95
+ },
96
+ }, defs?.deployment));
97
+ const serviceAccount = new ServiceAccount(mergeDefaults({
98
+ metadata: {
99
+ name: saName,
100
+ namespace,
101
+ labels: {
102
+ ...commonLabels,
103
+ "app.kubernetes.io/component": "dns",
104
+ "azure.workload.identity/use": "true",
105
+ },
106
+ annotations: {
107
+ "azure.workload.identity/client-id": clientId,
108
+ },
109
+ },
110
+ }, defs?.serviceAccount));
111
+ const clusterRole = new ClusterRole(mergeDefaults({
112
+ metadata: {
113
+ name: clusterRoleName,
114
+ labels: { ...commonLabels, "app.kubernetes.io/component": "rbac" },
115
+ },
116
+ rules: [
117
+ { apiGroups: [""], resources: ["services", "endpoints", "pods"], verbs: ["get", "watch", "list"] },
118
+ { apiGroups: ["extensions", "networking.k8s.io"], resources: ["ingresses"], verbs: ["get", "watch", "list"] },
119
+ { apiGroups: [""], resources: ["nodes"], verbs: ["list", "watch"] },
120
+ ],
121
+ }, defs?.clusterRole));
122
+ const clusterRoleBinding = new ClusterRoleBinding(mergeDefaults({
123
+ metadata: {
124
+ name: bindingName,
125
+ labels: { ...commonLabels, "app.kubernetes.io/component": "rbac" },
126
+ },
127
+ roleRef: {
128
+ apiGroup: "rbac.authorization.k8s.io",
129
+ kind: "ClusterRole",
130
+ name: clusterRoleName,
131
+ },
132
+ subjects: [
133
+ {
134
+ kind: "ServiceAccount",
135
+ name: saName,
136
+ namespace,
137
+ },
138
+ ],
139
+ }, defs?.clusterRoleBinding));
140
+ return {
141
+ deployment,
142
+ serviceAccount,
143
+ clusterRole,
144
+ clusterRoleBinding,
145
+ };
146
+ }, "AksExternalDnsAgent");
@@ -0,0 +1,86 @@
1
+ /**
2
+ * AlbIngress composite — Ingress with AWS Load Balancer Controller annotations.
3
+ *
4
+ * @eks Full `alb.ingress.kubernetes.io/*` annotation set including group name
5
+ * (shared ALB), SSL redirect, subnets, security groups.
6
+ */
7
+ import { Composite, mergeDefaults } from "@intentius/chant";
8
+ import { Ingress } from "../generated/index.js";
9
+ /**
10
+ * Create an AlbIngress composite — returns prop objects for
11
+ * an Ingress with AWS ALB Controller annotations.
12
+ *
13
+ * @eks
14
+ * @example
15
+ * ```ts
16
+ * import { AlbIngress } from "@intentius/chant-lexicon-k8s";
17
+ *
18
+ * const { ingress } = AlbIngress({
19
+ * name: "api-ingress",
20
+ * hosts: [
21
+ * {
22
+ * hostname: "api.example.com",
23
+ * paths: [{ path: "/", serviceName: "api", servicePort: 80 }],
24
+ * },
25
+ * ],
26
+ * scheme: "internet-facing",
27
+ * certificateArn: "arn:aws:acm:us-east-1:123456789012:certificate/abc-123",
28
+ * groupName: "shared-alb",
29
+ * });
30
+ * ```
31
+ */
32
+ export const AlbIngress = Composite((props) => {
33
+ const { name, hosts, scheme = "internet-facing", targetType = "ip", certificateArn, wafAclArn, healthCheckPath, groupName, sslRedirect, annotations: extraAnnotations = {}, labels: extraLabels = {}, namespace, defaults: defs, } = props;
34
+ const commonLabels = {
35
+ "app.kubernetes.io/name": name,
36
+ "app.kubernetes.io/managed-by": "chant",
37
+ ...extraLabels,
38
+ };
39
+ // Build ALB annotations
40
+ const annotations = {
41
+ "alb.ingress.kubernetes.io/scheme": scheme,
42
+ "alb.ingress.kubernetes.io/target-type": targetType,
43
+ ...extraAnnotations,
44
+ };
45
+ if (certificateArn) {
46
+ annotations["alb.ingress.kubernetes.io/certificate-arn"] = certificateArn;
47
+ annotations["alb.ingress.kubernetes.io/listen-ports"] = '[{"HTTPS":443}]';
48
+ }
49
+ if (sslRedirect ?? !!certificateArn) {
50
+ annotations["alb.ingress.kubernetes.io/ssl-redirect"] = "443";
51
+ }
52
+ if (wafAclArn) {
53
+ annotations["alb.ingress.kubernetes.io/wafv2-acl-arn"] = wafAclArn;
54
+ }
55
+ if (healthCheckPath) {
56
+ annotations["alb.ingress.kubernetes.io/healthcheck-path"] = healthCheckPath;
57
+ }
58
+ if (groupName) {
59
+ annotations["alb.ingress.kubernetes.io/group.name"] = groupName;
60
+ }
61
+ const ingressRules = hosts.map((host) => ({
62
+ host: host.hostname,
63
+ http: {
64
+ paths: host.paths.map((p) => ({
65
+ path: p.path,
66
+ pathType: p.pathType ?? "Prefix",
67
+ backend: {
68
+ service: { name: p.serviceName, port: { number: p.servicePort } },
69
+ },
70
+ })),
71
+ },
72
+ }));
73
+ const ingress = new Ingress(mergeDefaults({
74
+ metadata: {
75
+ name,
76
+ ...(namespace && { namespace }),
77
+ labels: { ...commonLabels, "app.kubernetes.io/component": "ingress" },
78
+ annotations,
79
+ },
80
+ spec: {
81
+ ingressClassName: "alb",
82
+ rules: ingressRules,
83
+ },
84
+ }, defs?.ingress));
85
+ return { ingress };
86
+ }, "AlbIngress");