typekro 0.23.0 → 0.24.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 (70) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/core/deployment/kro-factory.d.ts +19 -0
  3. package/dist/core/deployment/kro-factory.d.ts.map +1 -1
  4. package/dist/core/deployment/kro-factory.js +60 -6
  5. package/dist/core/deployment/kro-factory.js.map +1 -1
  6. package/dist/core/proxy/create-resource.d.ts.map +1 -1
  7. package/dist/core/proxy/create-resource.js +37 -0
  8. package/dist/core/proxy/create-resource.js.map +1 -1
  9. package/dist/core/references/schema-proxy.d.ts.map +1 -1
  10. package/dist/core/references/schema-proxy.js +21 -5
  11. package/dist/core/references/schema-proxy.js.map +1 -1
  12. package/dist/factories/clickhouse/compositions/clickhouse-cluster.d.ts.map +1 -1
  13. package/dist/factories/clickhouse/compositions/clickhouse-cluster.js +47 -28
  14. package/dist/factories/clickhouse/compositions/clickhouse-cluster.js.map +1 -1
  15. package/dist/factories/clickhouse/types.d.ts +31 -0
  16. package/dist/factories/clickhouse/types.d.ts.map +1 -1
  17. package/dist/factories/clickhouse/types.js.map +1 -1
  18. package/dist/factories/clickstack/compositions/clickstack-bootstrap.d.ts +248 -0
  19. package/dist/factories/clickstack/compositions/clickstack-bootstrap.d.ts.map +1 -0
  20. package/dist/factories/clickstack/compositions/clickstack-bootstrap.js +257 -0
  21. package/dist/factories/clickstack/compositions/clickstack-bootstrap.js.map +1 -0
  22. package/dist/factories/clickstack/compositions/clickstack-helm-repository.d.ts +23 -0
  23. package/dist/factories/clickstack/compositions/clickstack-helm-repository.d.ts.map +1 -0
  24. package/dist/factories/clickstack/compositions/clickstack-helm-repository.js +36 -0
  25. package/dist/factories/clickstack/compositions/clickstack-helm-repository.js.map +1 -0
  26. package/dist/factories/clickstack/compositions/index.d.ts +5 -0
  27. package/dist/factories/clickstack/compositions/index.d.ts.map +1 -0
  28. package/dist/factories/clickstack/compositions/index.js +5 -0
  29. package/dist/factories/clickstack/compositions/index.js.map +1 -0
  30. package/dist/factories/clickstack/compositions/k8s-telemetry.d.ts +83 -0
  31. package/dist/factories/clickstack/compositions/k8s-telemetry.d.ts.map +1 -0
  32. package/dist/factories/clickstack/compositions/k8s-telemetry.js +134 -0
  33. package/dist/factories/clickstack/compositions/k8s-telemetry.js.map +1 -0
  34. package/dist/factories/clickstack/compositions/otel-helm-repository.d.ts +18 -0
  35. package/dist/factories/clickstack/compositions/otel-helm-repository.d.ts.map +1 -0
  36. package/dist/factories/clickstack/compositions/otel-helm-repository.js +31 -0
  37. package/dist/factories/clickstack/compositions/otel-helm-repository.js.map +1 -0
  38. package/dist/factories/clickstack/index.d.ts +40 -0
  39. package/dist/factories/clickstack/index.d.ts.map +1 -0
  40. package/dist/factories/clickstack/index.js +40 -0
  41. package/dist/factories/clickstack/index.js.map +1 -0
  42. package/dist/factories/clickstack/resources/helm.d.ts +78 -0
  43. package/dist/factories/clickstack/resources/helm.d.ts.map +1 -0
  44. package/dist/factories/clickstack/resources/helm.js +139 -0
  45. package/dist/factories/clickstack/resources/helm.js.map +1 -0
  46. package/dist/factories/clickstack/resources/index.d.ts +3 -0
  47. package/dist/factories/clickstack/resources/index.d.ts.map +1 -0
  48. package/dist/factories/clickstack/resources/index.js +3 -0
  49. package/dist/factories/clickstack/resources/index.js.map +1 -0
  50. package/dist/factories/clickstack/resources/mongo.d.ts +40 -0
  51. package/dist/factories/clickstack/resources/mongo.d.ts.map +1 -0
  52. package/dist/factories/clickstack/resources/mongo.js +122 -0
  53. package/dist/factories/clickstack/resources/mongo.js.map +1 -0
  54. package/dist/factories/clickstack/types.d.ts +485 -0
  55. package/dist/factories/clickstack/types.d.ts.map +1 -0
  56. package/dist/factories/clickstack/types.js +302 -0
  57. package/dist/factories/clickstack/types.js.map +1 -0
  58. package/dist/factories/clickstack/utils/helm-values-mapper.d.ts +118 -0
  59. package/dist/factories/clickstack/utils/helm-values-mapper.d.ts.map +1 -0
  60. package/dist/factories/clickstack/utils/helm-values-mapper.js +505 -0
  61. package/dist/factories/clickstack/utils/helm-values-mapper.js.map +1 -0
  62. package/dist/factories/clickstack/utils/index.d.ts +2 -0
  63. package/dist/factories/clickstack/utils/index.d.ts.map +1 -0
  64. package/dist/factories/clickstack/utils/index.js +2 -0
  65. package/dist/factories/clickstack/utils/index.js.map +1 -0
  66. package/dist/factories/index.d.ts +1 -0
  67. package/dist/factories/index.d.ts.map +1 -1
  68. package/dist/factories/index.js +4 -0
  69. package/dist/factories/index.js.map +1 -1
  70. package/package.json +5 -1
@@ -0,0 +1,302 @@
1
+ /**
2
+ * ClickStack (HyperDX) Type Definitions
3
+ *
4
+ * ArkType schemas as the single source of truth for config shapes, with types
5
+ * inferred via `typeof Schema.infer` (mirrors the clickhouse/dagster families).
6
+ *
7
+ * Wraps the OFFICIAL ClickStack Helm chart (MIT):
8
+ * - Chart: `clickstack` 3.0.x from https://clickhouse.github.io/ClickStack-helm-charts
9
+ * (classic Helm repo, NOT OCI). The old hyperdxio/helm-charts repo is archived
10
+ * and its `hdx-oss-v2` chart is deprecated — do not use them.
11
+ * - Components: the HyperDX app (UI + API + OpAMP server on 4320 that remotely
12
+ * configures the collector), an OTel gateway collector (the chart's only Helm
13
+ * dependency: the official `opentelemetry-collector` subchart, alias
14
+ * `otel-collector`), and schema "goose" migrations run by the collector at
15
+ * startup that auto-create `otel_logs` / `otel_traces` / `otel_metrics_*` /
16
+ * `hyperdx_sessions`.
17
+ *
18
+ * EXTERNAL CLICKHOUSE ONLY: this family hard-codes `clickhouse.enabled: false`
19
+ * and `mongodb.enabled: false`. The chart's bundled ClickHouse/Keeper and
20
+ * MongoDB are CRDs owned by the separate `clickstack-operators` prerequisite
21
+ * chart (ClickHouse Inc.'s own operator + a MongoDB community operator), which
22
+ * we deliberately do NOT install — its ClickHouse CRDs would collide with the
23
+ * Altinity clickhouse-operator that manages our ClickHouseInstallation.
24
+ *
25
+ * BUILD-TIME vs RUNTIME SPLIT: choices that decide WHICH resources exist or
26
+ * how values trees are shaped (the Mongo mode, internal-Mongo storage, static
27
+ * raw chart values) are CONSTRUCTION-time options on
28
+ * `makeClickstackBootstrap(...)` / `makeClickstackK8sTelemetry(...)` — plain
29
+ * JS branches on them are safe because they are always concrete. The runtime
30
+ * spec (these schemas) carries only proxy-safe VALUES (names, namespaces,
31
+ * endpoints, versions, credentials) that serialize cleanly as CEL refs in KRO
32
+ * mode.
33
+ *
34
+ * SCHEMA / REPLICATION CAVEAT: the collector's auto-migrations create plain
35
+ * single-node MergeTree tables — fine for a 1-replica CHI (dev-first sizing);
36
+ * multi-replica / `ON CLUSTER` schemas are NOT supported by ClickStack's
37
+ * tooling. Revisit before scaling the external ClickHouse beyond one replica.
38
+ *
39
+ * @see https://github.com/ClickHouse/ClickStack-helm-charts
40
+ * @see https://clickhouse.com/docs/use-cases/observability/clickstack
41
+ */
42
+ import { type } from 'arktype';
43
+ // ============================================================================
44
+ // ClickHouse version-coupling guidance
45
+ // ============================================================================
46
+ /**
47
+ * Loose ClickHouse version coupling facts for the external-ClickHouse mode,
48
+ * exported for downstream platform layers that own the CHI sizing/versioning.
49
+ *
50
+ * Sources (verified 2026-07-06 against ClickHouse/ClickStack-helm-charts main):
51
+ * - The chart vendors ClickHouse `25.7-alpine` for its (disabled here) bundled
52
+ * cluster (charts/clickstack/values.yaml `clickhouse.cluster.spec.containerTemplate`).
53
+ * - ClickStack's seed schemas ship a "<26.2 compatibility" variant, so recent
54
+ * 25.x/26.x servers are accepted — the coupling is loose, not pinned.
55
+ * - The optional JSON-typed schema is gated behind the
56
+ * `HYPERDX_OTEL_EXPORTER_CLICKHOUSE_JSON_ENABLE` env flag and wants
57
+ * ClickHouse 25.3+ (native JSON type maturity).
58
+ */
59
+ export const CLICKSTACK_CLICKHOUSE_GUIDANCE = {
60
+ /** ClickHouse version the chart vendors/tests against for its bundled cluster. */
61
+ chartVendoredClickHouseVersion: '25.7',
62
+ /** Minimum recommended ClickHouse version for an external cluster. */
63
+ minRecommendedClickHouseVersion: '25.3',
64
+ /** Env flag (in `hyperdx.config`) enabling the JSON-typed OTel schema. */
65
+ jsonSchemaFlag: 'HYPERDX_OTEL_EXPORTER_CLICKHOUSE_JSON_ENABLE',
66
+ /** Minimum ClickHouse version for the JSON-typed schema. */
67
+ jsonSchemaMinClickHouseVersion: '25.3',
68
+ /**
69
+ * The collector's goose migrations create single-node MergeTree tables only;
70
+ * multi-replica / ON CLUSTER schemas are not supported by ClickStack tooling.
71
+ */
72
+ singleNodeSchemaOnly: true,
73
+ };
74
+ // ============================================================================
75
+ // Shared ArkType shapes
76
+ // ============================================================================
77
+ const resourceRequirementsShape = {
78
+ 'requests?': { 'cpu?': 'string', 'memory?': 'string' },
79
+ 'limits?': { 'cpu?': 'string', 'memory?': 'string' },
80
+ };
81
+ const imageShape = {
82
+ 'repository?': 'string',
83
+ 'tag?': 'string',
84
+ 'pullPolicy?': '"Always" | "IfNotPresent" | "Never"',
85
+ };
86
+ // ============================================================================
87
+ // Bootstrap runtime spec (external ClickHouse)
88
+ // ============================================================================
89
+ const bootstrapBaseShape = {
90
+ /** Release name for the Helm installation. */
91
+ name: 'string',
92
+ /** Namespace for the stack (default: 'clickstack'). */
93
+ 'namespace?': 'string',
94
+ /** Chart version (default: '3.0.1'). */
95
+ 'version?': 'string',
96
+ // SECRETS CAVEAT: `password`/`appPassword` below (and `apiKey` further
97
+ // down) travel as PLAINTEXT runtime spec values all the way into the
98
+ // generated HelmRelease's `spec.values.hyperdx.secrets.*` — a Kubernetes
99
+ // object stored in etcd, readable by anyone with read access to the
100
+ // HelmRelease/RGD instance (`kubectl get helmrelease -o yaml`), unlike
101
+ // `k8s-telemetry.ts`'s `apiKeySecret` (a `secretKeyRef` env var — the
102
+ // value never appears in any CR spec). There is currently NO
103
+ // existing-Secret / secretKeyRef alternative for these three fields.
104
+ // Treat them as no more protected than any other spec field; do not
105
+ // consider this family production-ready for credentials that need
106
+ // stronger-than-etcd-RBAC protection until that gap is closed.
107
+ /** External ClickHouse connection (REQUIRED — external-only build-around). */
108
+ clickhouse: {
109
+ /** DNS host of the external ClickHouse service (no scheme, no port). */
110
+ host: 'string',
111
+ /** Native TCP port (default: 9000) → `CLICKHOUSE_ENDPOINT`/`CLICKHOUSE_SERVER_ENDPOINT`. */
112
+ 'nativePort?': 'number',
113
+ /** HTTP port (default: 8123) → HyperDX UI `defaultConnections` host. */
114
+ 'httpPort?': 'number',
115
+ /** OTel export target database (default: 'default') → `HYPERDX_OTEL_EXPORTER_CLICKHOUSE_DATABASE`. */
116
+ 'database?': 'string',
117
+ /** Ingest/collector user (default: 'default') → `hyperdx.config.CLICKHOUSE_USER`. Needs SELECT,INSERT,CREATE,SHOW on the database. */
118
+ 'username?': 'string',
119
+ /** Ingest/collector password → `hyperdx.secrets.CLICKHOUSE_PASSWORD` (default: ''). PLAINTEXT in the HelmRelease spec — see the secrets caveat above. */
120
+ 'password?': 'string',
121
+ /** Read-mostly UI user for HyperDX connections (default: `username`). Needs SHOW + SELECT. */
122
+ 'appUsername?': 'string',
123
+ /** UI user password → `hyperdx.secrets.CLICKHOUSE_APP_PASSWORD` (default: `password`). PLAINTEXT in the HelmRelease spec — see the secrets caveat above. */
124
+ 'appPassword?': 'string',
125
+ },
126
+ /** HyperDX ingestion API key → `hyperdx.secrets.HYPERDX_API_KEY`. PLAINTEXT in the HelmRelease spec — see the secrets caveat above `clickhouse`. */
127
+ 'apiKey?': 'string',
128
+ /** HyperDX app (UI/API) conveniences. */
129
+ 'hyperdx?': {
130
+ 'replicas?': 'number',
131
+ 'resources?': resourceRequirementsShape,
132
+ 'image?': imageShape,
133
+ /** Public URL of the HyperDX UI → `hyperdx.config.FRONTEND_URL`. */
134
+ 'frontendUrl?': 'string',
135
+ },
136
+ // NOTE: `customValues` is NOT part of this schema, so KRO-mode callers
137
+ // (validated against this shape) can't use it — the mapped values tree
138
+ // carries CEL templates (CLICKHOUSE_ENDPOINT, defaultConnections, ...),
139
+ // and the runtime values merge cannot embed template leaves inside a KRO
140
+ // map-merge expression (the serialized CEL comes out invalid, verified
141
+ // empirically). `ClickStackBootstrapRuntimeConfig` below re-adds
142
+ // `customValues` as an internal, DIRECT-MODE-ONLY escape hatch (only a
143
+ // concrete object merges — see helm-values-mapper.ts) with no test
144
+ // coverage backing it as a supported feature. For anything beyond ad hoc
145
+ // direct-mode tweaks, use build-time raw chart overrides instead
146
+ // (`makeClickstackBootstrap({ values })`), where the merge happens on
147
+ // concrete objects before serialization.
148
+ };
149
+ /**
150
+ * Runtime spec for the internal-Mongo variant (the default
151
+ * `clickstackBootstrap`). Mongo needs no runtime config — mode and storage
152
+ * are build-time (`makeClickstackBootstrap`).
153
+ */
154
+ export const ClickStackBootstrapConfigSchema = type(bootstrapBaseShape);
155
+ /**
156
+ * Runtime spec for the external-Mongo variant: base + a required `mongoUri`.
157
+ */
158
+ export const ClickStackExternalMongoBootstrapConfigSchema = type({
159
+ ...bootstrapBaseShape,
160
+ /** Full MongoDB connection URI → `hyperdx.config.MONGO_URI` (verbatim). */
161
+ mongoUri: 'string',
162
+ });
163
+ // ============================================================================
164
+ // Bootstrap status — a typed service contract, not just readiness
165
+ // ============================================================================
166
+ /**
167
+ * Observed ClickStack status. Downstream compositions consume connection
168
+ * details from here instead of reconstructing chart service-naming rules —
169
+ * e.g. `clickstackK8sTelemetry` wiring:
170
+ * `{ endpoint: stack.status.gateway.otlpHttpEndpoint }`.
171
+ *
172
+ * Naming anchor: the values mapper pins `fullnameOverride` to the release
173
+ * name, so the HyperDX app Service is named exactly `<name>` (the chart's
174
+ * `clickstack.hyperdx.fullname` helper skips its `-app` suffix when
175
+ * `fullnameOverride` is set) and the gateway Service is
176
+ * `<name>-otel-collector` (subchart naming off `.Release.Name`).
177
+ *
178
+ * KRO STATUS vs CLIENT-HYDRATED SPLIT: fields anchored on the owned
179
+ * HelmRelease resource serialize as KRO status CEL and appear on the live
180
+ * KRO CR's status (GitOps/KRO consumers can read them): `ready`, `phase`,
181
+ * `ui.url`, `gateway.otlpHttpEndpoint`, `gateway.otlpGrpcEndpoint`,
182
+ * `app.host` — natural JS template literals over
183
+ * `clickstackHelmRelease.metadata.name`/`.namespace` (bimodal on typekro
184
+ * >= 0.24.0: status CEL in `factory('kro')`, concrete strings via direct-mode
185
+ * re-execution), never `schema.spec.*` (KRO status CEL cannot reference the
186
+ * instance spec). The BARE build-time constants `app.appPort` (3000) and
187
+ * `app.apiPort` (8000), plus the spec-derived `version`, have no resource
188
+ * anchor and are hydrated CLIENT-SIDE by TypeKro (absent from the KRO CR
189
+ * status); the ports remain KRO-visible inside the URL fields.
190
+ * Ports are the chart defaults (`hyperdx.ports`, `otel-collector.ports`);
191
+ * port overrides via build-time raw values are NOT reflected here.
192
+ */
193
+ export const ClickStackBootstrapStatusSchema = type({
194
+ /** Overall readiness from the owned HelmRelease Ready condition. */
195
+ ready: 'boolean',
196
+ /** Coarse phase from the owned HelmRelease Ready condition. */
197
+ phase: '"Ready" | "Installing" | "Failed"',
198
+ /** Configured chart version. */
199
+ 'version?': 'string',
200
+ /** HyperDX UI. */
201
+ ui: {
202
+ /** In-cluster URL of the HyperDX UI (app port 3000). */
203
+ url: 'string',
204
+ },
205
+ /** OTel gateway collector ingest endpoints (the `otel-collector` subchart Service). */
206
+ gateway: {
207
+ /** OTLP/HTTP ingest endpoint (servicePort 4318). */
208
+ otlpHttpEndpoint: 'string',
209
+ /** OTLP/gRPC ingest endpoint (servicePort 4317). */
210
+ otlpGrpcEndpoint: 'string',
211
+ },
212
+ /** HyperDX app Service coordinates. */
213
+ app: {
214
+ /** In-cluster DNS host of the HyperDX app Service. */
215
+ host: 'string',
216
+ /** UI port. */
217
+ appPort: 'number',
218
+ /** API port. */
219
+ apiPort: 'number',
220
+ },
221
+ });
222
+ /**
223
+ * ArkType schema for ClickStackK8sTelemetryConfig (runtime spec).
224
+ *
225
+ * The documented ClickStack Kubernetes ingestion pattern: TWO instances of the
226
+ * STOCK `opentelemetry-collector` chart —
227
+ * - a daemonset instance (presets: logsCollection, hostMetrics,
228
+ * kubernetesAttributes, kubeletMetrics), and
229
+ * - a deployment instance (presets: kubernetesAttributes, kubernetesEvents,
230
+ * clusterMetrics),
231
+ * both exporting `otlphttp` to the ClickStack gateway collector with
232
+ * `authorization: <HYPERDX_API_KEY>` header auth.
233
+ *
234
+ * @see https://clickhouse.com/docs/use-cases/observability/clickstack/ingesting-data/kubernetes
235
+ */
236
+ export const ClickStackK8sTelemetryConfigSchema = type({
237
+ /** Base release name; the composition derives `<name>-daemonset` and `<name>-deployment`. */
238
+ name: 'string',
239
+ /** Namespace for the collectors (default: 'clickstack-telemetry'). */
240
+ 'namespace?': 'string',
241
+ /** Stock opentelemetry-collector chart version (default: '0.146.1'). */
242
+ 'version?': 'string',
243
+ /**
244
+ * OTLP/HTTP endpoint of the ClickStack gateway collector. Wire it from the
245
+ * bootstrap's status contract (`stack.status.gateway.otlpHttpEndpoint`).
246
+ * Default assumes the canonical install (`name: 'clickstack'` in namespace
247
+ * 'clickstack').
248
+ */
249
+ 'endpoint?': 'string',
250
+ /**
251
+ * Existing Secret holding the HyperDX ingestion API key (REQUIRED). Wired as
252
+ * an env var via `secretKeyRef` and referenced from the exporter's
253
+ * `authorization` header via OTel `${env:...}` config expansion — the key
254
+ * value never lands in Helm values.
255
+ */
256
+ apiKeySecret: {
257
+ name: 'string',
258
+ /** Key inside the Secret (default: 'HYPERDX_API_KEY'). */
259
+ 'key?': 'string',
260
+ },
261
+ });
262
+ /** Observed status of the k8s telemetry collectors. */
263
+ export const ClickStackK8sTelemetryStatusSchema = type({
264
+ /** Both collector HelmReleases report Ready. */
265
+ ready: 'boolean',
266
+ phase: '"Ready" | "Installing"',
267
+ });
268
+ // ============================================================================
269
+ // Shared HelmRepository singletons
270
+ // ============================================================================
271
+ /** Spec accepted by the shared ClickStack HelmRepository singleton. */
272
+ export const ClickStackHelmRepositorySingletonSpecSchema = type({
273
+ name: 'string',
274
+ namespace: 'string',
275
+ url: 'string',
276
+ });
277
+ /** Status surfaced by the shared ClickStack HelmRepository singleton. */
278
+ export const ClickStackHelmRepositorySingletonStatusSchema = type({
279
+ ready: 'boolean',
280
+ });
281
+ /** Spec accepted by the shared OpenTelemetry HelmRepository singleton. */
282
+ export const OtelHelmRepositorySingletonSpecSchema = type({
283
+ name: 'string',
284
+ namespace: 'string',
285
+ url: 'string',
286
+ });
287
+ /** Status surfaced by the shared OpenTelemetry HelmRepository singleton. */
288
+ export const OtelHelmRepositorySingletonStatusSchema = type({
289
+ ready: 'boolean',
290
+ });
291
+ // ============================================================================
292
+ // Helm wrapper configs
293
+ // ============================================================================
294
+ /** Configuration for the ClickStack/OTel HelmRepository wrappers. */
295
+ export const ClickStackHelmRepositoryConfigSchema = type({
296
+ 'name?': 'string',
297
+ 'namespace?': 'string',
298
+ 'url?': 'string',
299
+ 'interval?': 'string',
300
+ 'id?': 'string',
301
+ });
302
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/factories/clickstack/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAI/B,+EAA+E;AAC/E,uCAAuC;AACvC,+EAA+E;AAE/E;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG;IAC5C,kFAAkF;IAClF,8BAA8B,EAAE,MAAM;IACtC,sEAAsE;IACtE,+BAA+B,EAAE,MAAM;IACvC,0EAA0E;IAC1E,cAAc,EAAE,8CAA8C;IAC9D,4DAA4D;IAC5D,8BAA8B,EAAE,MAAM;IACtC;;;OAGG;IACH,oBAAoB,EAAE,IAAI;CAClB,CAAC;AAEX,+EAA+E;AAC/E,wBAAwB;AACxB,+EAA+E;AAE/E,MAAM,yBAAyB,GAAG;IAChC,WAAW,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,Q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ACd,0DAA0D;QAC1D,MAAM,EAAE,QAAQ;KACjB;CACF,CAAC,CAAC;AAKH,uDAAuD;AACvD,MAAM,CAAC,MAAM,kCAAkC,GAAG,IAAI,CAAC;IACrD,gDAAgD;IAChD,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,wBAAwB;CAChC,CAAC,CAAC;AAEH,+EAA+E;AAC/E,mCAAmC;AACnC,+EAA+E;AAE/E,uEAAuE;AACvE,MAAM,CAAC,MAAM,2CAA2C,GAAG,IAAI,CAAC;IAC9D,IAAI,EAAE,QAAQ;IACd,SAAS,EAAE,QAAQ;IACnB,GAAG,EAAE,QAAQ;CACd,CAAC,CAAC;AAEH,yEAAyE;AACzE,MAAM,CAAC,MAAM,6CAA6C,GAAG,IAAI,CAAC;IAChE,KAAK,EAAE,SAAS;CACjB,CAAC,CAAC;AAEH,0EAA0E;AAC1E,MAAM,CAAC,MAAM,qCAAqC,GAAG,IAAI,CAAC;IACxD,IAAI,EAAE,QAAQ;IACd,SAAS,EAAE,QAAQ;IACnB,GAAG,EAAE,QAAQ;CACd,CAAC,CAAC;AAEH,4EAA4E;AAC5E,MAAM,CAAC,MAAM,uCAAuC,GAAG,IAAI,CAAC;IAC1D,KAAK,EAAE,SAAS;CACjB,CAAC,CAAC;AAEH,+EAA+E;AAC/E,uBAAuB;AACvB,+EAA+E;AAE/E,qEAAqE;AACrE,MAAM,CAAC,MAAM,oCAAoC,GAAG,IAAI,CAAC;IACvD,OAAO,EAAE,QAAQ;IACjB,YAAY,EAAE,QAAQ;IACtB,MAAM,EAAE,QAAQ;IAChB,WAAW,EAAE,QAAQ;IACrB,KAAK,EAAE,QAAQ;CAChB,CAAC,CAAC"}
@@ -0,0 +1,118 @@
1
+ /**
2
+ * ClickStack Helm values mappers.
3
+ *
4
+ * Pure functions mapping typed factory config onto OFFICIAL chart values.
5
+ * Bootstrap-only fields (name, namespace, chart version, Flux repository
6
+ * names) stay in TypeKro resource configuration and are never forwarded.
7
+ *
8
+ * BUILD-TIME vs RUNTIME: the mappers take the runtime spec (proxy-safe VALUES
9
+ * only — concrete in direct mode, schema refs in KRO mode) plus concrete
10
+ * build-time options (`mongoMode`, static raw `values`). All plain-JS
11
+ * branching happens on the build-time options; runtime fields are only ever
12
+ * embedded as values or wrapped in explicit `has()`-guarded CEL.
13
+ *
14
+ * Values keys verified 2026-07-06 against
15
+ * https://github.com/ClickHouse/ClickStack-helm-charts
16
+ * charts/clickstack/values.yaml (chart 3.0.1, appVersion 2.29.0):
17
+ * - `hyperdx.config.*` env map: `CLICKHOUSE_ENDPOINT` (native, tcp://…),
18
+ * `CLICKHOUSE_SERVER_ENDPOINT` (host:port), `CLICKHOUSE_USER`,
19
+ * `HYPERDX_OTEL_EXPORTER_CLICKHOUSE_DATABASE`, `MONGO_URI`, `FRONTEND_URL`.
20
+ * - `hyperdx.secrets.*`: `CLICKHOUSE_PASSWORD` (collector/ingest user),
21
+ * `CLICKHOUSE_APP_PASSWORD` (UI user), `HYPERDX_API_KEY`,
22
+ * `MONGODB_PASSWORD` (unused here — internal Mongo runs authless, external
23
+ * Mongo carries credentials in its URI).
24
+ * - DOC-VS-TEMPLATE DISCREPANCY: several docs describe `defaultConnections` /
25
+ * `defaultSources` directly under `hyperdx.*`, but the chart templates read
26
+ * them from `hyperdx.deployment.defaultConnections` /
27
+ * `hyperdx.deployment.defaultSources` (values.yaml lines 100/110) — the
28
+ * deployment block is what we set. The same block offers
29
+ * `useExistingConfigSecret`/`existingConfigSecret` for external secret
30
+ * management (reachable via the build-time `values` passthrough).
31
+ * - `clickhouse.enabled` / `mongodb.enabled`: both HARD-PINNED to false here.
32
+ * The bundled ClickHouse/Keeper are `ClickHouseCluster`/`KeeperCluster`
33
+ * CRDs and the bundled Mongo is a `MongoDBCommunity` CRD — all owned by the
34
+ * separate `clickstack-operators` prerequisite chart we refuse to install
35
+ * (ClickHouse Inc.'s operator CRDs would collide with our Altinity
36
+ * operator). These pins beat the raw `values` passthrough in BOTH modes
37
+ * because the merge happens at construction time on concrete objects.
38
+ * - `fullnameOverride`: pinned to the release name — the status contract's
39
+ * naming anchor. With it set, the chart's `clickstack.hyperdx.fullname`
40
+ * helper names the HyperDX app resources exactly `<release>` (no `-app`
41
+ * suffix), and the gateway Service stays `<release>-otel-collector`
42
+ * (subchart naming from `.Release.Name`), so the bootstrap status can
43
+ * derive endpoints deterministically.
44
+ * - `otel-collector.*`: the gateway subchart (alias) stays enabled with chart
45
+ * defaults; it reads the shared `clickstack-config` ConfigMap and
46
+ * `clickstack-secret` Secret via `extraEnvsFrom`, so the external-CH env
47
+ * above reconfigures it too (its goose migrations create the otel_* tables
48
+ * in the external ClickHouse at startup).
49
+ */
50
+ import type { TypeKroChartValues } from '../../../core/types/common.js';
51
+ import type { ClickStackBootstrapRuntimeConfig, ClickStackHelmValues, ClickStackK8sTelemetryConfig, ClickStackMappedHelmValues, OtelCollectorHelmValues, OtelCollectorMappedHelmValues } from '../types.js';
52
+ /** Default namespace for a ClickStack install. */
53
+ export declare const DEFAULT_CLICKSTACK_NAMESPACE = "clickstack";
54
+ /** Default namespace for the k8s telemetry collectors. */
55
+ export declare const DEFAULT_CLICKSTACK_TELEMETRY_NAMESPACE = "clickstack-telemetry";
56
+ /**
57
+ * Default OTLP/HTTP endpoint of the ClickStack gateway collector, assuming
58
+ * the canonical `clickstackBootstrap` install (release name 'clickstack' in
59
+ * namespace 'clickstack'). The chart names the gateway Service
60
+ * `<release>-otel-collector` (templates/_helpers.tpl `clickstack.otel.fullname`)
61
+ * and exposes otlp-http on servicePort 4318 (values.yaml `otel-collector.ports`).
62
+ * Prefer wiring `stack.status.gateway.otlpHttpEndpoint` instead of relying on
63
+ * this default.
64
+ */
65
+ export declare const DEFAULT_CLICKSTACK_GATEWAY_ENDPOINT = "http://clickstack-otel-collector.clickstack.svc.cluster.local:4318";
66
+ /**
67
+ * Collector image for the k8s telemetry instances. The stock chart ships an
68
+ * empty `image.repository` on purpose; the ClickStack k8s ingestion docs use
69
+ * the contrib distribution (it carries the k8s receivers the presets enable).
70
+ */
71
+ export declare const DEFAULT_K8S_TELEMETRY_COLLECTOR_IMAGE = "otel/opentelemetry-collector-contrib";
72
+ /** Name of the HyperDX connection emitted into `defaultConnections`/`defaultSources`. */
73
+ export declare const CLICKSTACK_CONNECTION_NAME = "External ClickHouse";
74
+ /** Concrete build-time options consumed by the bootstrap values mapper. */
75
+ export interface ClickStackValuesMapperOptions {
76
+ /** Which Mongo wiring to emit (build-time; default 'internal'). */
77
+ mongoMode?: 'internal' | 'external';
78
+ /** Static raw chart values merged after the typed mapping (pins re-applied after). */
79
+ values?: TypeKroChartValues<ClickStackHelmValues>;
80
+ }
81
+ /** Values pair for the two stock collector instances. */
82
+ export interface ClickStackK8sTelemetryValues {
83
+ daemonset: OtelCollectorMappedHelmValues;
84
+ deployment: OtelCollectorMappedHelmValues;
85
+ }
86
+ /**
87
+ * Map typed ClickStack runtime config + build options into official
88
+ * clickstack chart values.
89
+ *
90
+ * Handles both composition modes: concrete config (direct mode) emits plain
91
+ * values; schema-proxy config (KRO mode) emits `has()`-guarded CEL so chart
92
+ * defaults resolve per instance.
93
+ */
94
+ export declare function mapClickStackConfigToHelmValues(config: ClickStackBootstrapRuntimeConfig, options?: ClickStackValuesMapperOptions): ClickStackMappedHelmValues;
95
+ /** Concrete build-time options consumed by the telemetry values mapper. */
96
+ export interface ClickStackK8sTelemetryMapperOptions {
97
+ daemonset?: {
98
+ values?: TypeKroChartValues<OtelCollectorHelmValues>;
99
+ };
100
+ deployment?: {
101
+ values?: TypeKroChartValues<OtelCollectorHelmValues>;
102
+ };
103
+ }
104
+ /**
105
+ * Map k8s telemetry runtime config + build options onto values for TWO stock
106
+ * `opentelemetry-collector` chart instances — the documented ClickStack
107
+ * Kubernetes ingestion pattern (verified 2026-07-06 against
108
+ * https://clickhouse.com/docs/use-cases/observability/clickstack/ingesting-data/kubernetes
109
+ * and the stock chart's values.yaml preset names).
110
+ *
111
+ * The API key reaches the exporter via OTel config `${env:HYPERDX_API_KEY}`
112
+ * expansion backed by a `secretKeyRef` env var — the key value itself never
113
+ * enters Helm values. In KRO mode the literal `${env:…}` would be parsed as a
114
+ * KRO CEL template, so it is emitted as the CEL concat `"$" + "{env:…}"`,
115
+ * which KRO evaluates back to the literal at instance materialization.
116
+ */
117
+ export declare function mapK8sTelemetryConfigToHelmValues(config: ClickStackK8sTelemetryConfig, options?: ClickStackK8sTelemetryMapperOptions): ClickStackK8sTelemetryValues;
118
+ //# sourceMappingURL=helm-values-mapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helm-values-mapper.d.ts","sourceRoot":"","sources":["../../../../src/factories/clickstack/utils/helm-values-mapper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAOH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAGxE,OAAO,KAAK,EACV,gCAAgC,EAChC,oBAAoB,EACpB,4BAA4B,EAC5B,0BAA0B,EAC1B,uBAAuB,EACvB,6BAA6B,EAC9B,MAAM,aAAa,CAAC;AAErB,kDAAkD;AAClD,eAAO,MAAM,4BAA4B,eAAe,CAAC;AAEzD,0DAA0D;AAC1D,eAAO,MAAM,sCAAsC,yBAAyB,CAAC;AAE7E;;;;;;;;GAQG;AACH,eAAO,MAAM,mCAAmC,uEACsB,CAAC;AAEvE;;;;GAIG;AACH,eAAO,MAAM,qCAAqC,yCAAyC,CAAC;AAE5F,yFAAyF;AACzF,eAAO,MAAM,0BAA0B,wBAAwB,CAAC;AAEhE,2EAA2E;AAC3E,MAAM,WAAW,6BAA6B;IAC5C,mEAAmE;IACnE,SAAS,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;IACpC,sFAAsF;IACtF,MAAM,CAAC,EAAE,kBAAkB,CAAC,oBAAoB,CAAC,CAAC;CACnD;AAED,yDAAyD;AACzD,MAAM,WAAW,4BAA4B;IAC3C,SAAS,EAAE,6BAA6B,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