typekro 0.22.0 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/core/composition/nested-status-cel.d.ts +10 -11
  3. package/dist/core/composition/nested-status-cel.d.ts.map +1 -1
  4. package/dist/core/composition/nested-status-cel.js +13 -2
  5. package/dist/core/composition/nested-status-cel.js.map +1 -1
  6. package/dist/core/expressions/analysis/cache.d.ts.map +1 -1
  7. package/dist/core/expressions/analysis/cache.js +4 -0
  8. package/dist/core/expressions/analysis/cache.js.map +1 -1
  9. package/dist/core/validation/cel-validator.d.ts.map +1 -1
  10. package/dist/core/validation/cel-validator.js +92 -52
  11. package/dist/core/validation/cel-validator.js.map +1 -1
  12. package/dist/factories/clickhouse/compositions/clickhouse-cluster.d.ts +78 -0
  13. package/dist/factories/clickhouse/compositions/clickhouse-cluster.d.ts.map +1 -0
  14. package/dist/factories/clickhouse/compositions/clickhouse-cluster.js +251 -0
  15. package/dist/factories/clickhouse/compositions/clickhouse-cluster.js.map +1 -0
  16. package/dist/factories/clickhouse/compositions/clickhouse-helm-repository.d.ts +22 -0
  17. package/dist/factories/clickhouse/compositions/clickhouse-helm-repository.d.ts.map +1 -0
  18. package/dist/factories/clickhouse/compositions/clickhouse-helm-repository.js +35 -0
  19. package/dist/factories/clickhouse/compositions/clickhouse-helm-repository.js.map +1 -0
  20. package/dist/factories/clickhouse/compositions/clickhouse-operator-bootstrap.d.ts +68 -0
  21. package/dist/factories/clickhouse/compositions/clickhouse-operator-bootstrap.d.ts.map +1 -0
  22. package/dist/factories/clickhouse/compositions/clickhouse-operator-bootstrap.js +137 -0
  23. package/dist/factories/clickhouse/compositions/clickhouse-operator-bootstrap.js.map +1 -0
  24. package/dist/factories/clickhouse/compositions/index.d.ts +4 -0
  25. package/dist/factories/clickhouse/compositions/index.d.ts.map +1 -0
  26. package/dist/factories/clickhouse/compositions/index.js +4 -0
  27. package/dist/factories/clickhouse/compositions/index.js.map +1 -0
  28. package/dist/factories/clickhouse/index.d.ts +70 -0
  29. package/dist/factories/clickhouse/index.d.ts.map +1 -0
  30. package/dist/factories/clickhouse/index.js +70 -0
  31. package/dist/factories/clickhouse/index.js.map +1 -0
  32. package/dist/factories/clickhouse/resources/helm.d.ts +62 -0
  33. package/dist/factories/clickhouse/resources/helm.d.ts.map +1 -0
  34. package/dist/factories/clickhouse/resources/helm.js +94 -0
  35. package/dist/factories/clickhouse/resources/helm.js.map +1 -0
  36. package/dist/factories/clickhouse/resources/index.d.ts +4 -0
  37. package/dist/factories/clickhouse/resources/index.d.ts.map +1 -0
  38. package/dist/factories/clickhouse/resources/index.js +4 -0
  39. package/dist/factories/clickhouse/resources/index.js.map +1 -0
  40. package/dist/factories/clickhouse/resources/installation.d.ts +83 -0
  41. package/dist/factories/clickhouse/resources/installation.d.ts.map +1 -0
  42. package/dist/factories/clickhouse/resources/installation.js +316 -0
  43. package/dist/factories/clickhouse/resources/installation.js.map +1 -0
  44. package/dist/factories/clickhouse/resources/keeper.d.ts +40 -0
  45. package/dist/factories/clickhouse/resources/keeper.d.ts.map +1 -0
  46. package/dist/factories/clickhouse/resources/keeper.js +107 -0
  47. package/dist/factories/clickhouse/resources/keeper.js.map +1 -0
  48. package/dist/factories/clickhouse/types.d.ts +532 -0
  49. package/dist/factories/clickhouse/types.d.ts.map +1 -0
  50. package/dist/factories/clickhouse/types.js +295 -0
  51. package/dist/factories/clickhouse/types.js.map +1 -0
  52. package/dist/factories/clickhouse/utils/helm-values-mapper.d.ts +65 -0
  53. package/dist/factories/clickhouse/utils/helm-values-mapper.d.ts.map +1 -0
  54. package/dist/factories/clickhouse/utils/helm-values-mapper.js +80 -0
  55. package/dist/factories/clickhouse/utils/helm-values-mapper.js.map +1 -0
  56. package/dist/factories/clickhouse/utils/index.d.ts +4 -0
  57. package/dist/factories/clickhouse/utils/index.d.ts.map +1 -0
  58. package/dist/factories/clickhouse/utils/index.js +4 -0
  59. package/dist/factories/clickhouse/utils/index.js.map +1 -0
  60. package/dist/factories/clickhouse/utils/validation.d.ts +21 -0
  61. package/dist/factories/clickhouse/utils/validation.d.ts.map +1 -0
  62. package/dist/factories/clickhouse/utils/validation.js +27 -0
  63. package/dist/factories/clickhouse/utils/validation.js.map +1 -0
  64. package/dist/factories/clickhouse/utils/zone-layout.d.ts +74 -0
  65. package/dist/factories/clickhouse/utils/zone-layout.d.ts.map +1 -0
  66. package/dist/factories/clickhouse/utils/zone-layout.js +103 -0
  67. package/dist/factories/clickhouse/utils/zone-layout.js.map +1 -0
  68. package/package.json +5 -1
@@ -0,0 +1,251 @@
1
+ /**
2
+ * ClickHouse Cluster Composition (build-time topology constructor)
3
+ *
4
+ * `makeClickHouseCluster(topology)` separates the two halves of a CHI
5
+ * honestly:
6
+ *
7
+ * - BUILD-TIME topology (`zones`, `replicas`, `shards`, `keeper` presence,
8
+ * user names/networks) is fixed when the composition is CONSTRUCTED. The
9
+ * zone-pinned layout enumerates pod templates and per-replica entries, so
10
+ * it can never be instance-dynamic (the operator's own `podDistribution`
11
+ * supports only the hostname topologyKey — Altinity/clickhouse-operator
12
+ * issue #772 — and EBS volumes are zonal, so replicas must be pinned).
13
+ *
14
+ * - RUNTIME spec (`name`, `namespace`, `version`, `storage`, `clusterName`,
15
+ * keeper host, per-user password hashes) flows through as schema proxies
16
+ * and serializes to clean CEL in kro mode.
17
+ *
18
+ * Same construction pattern as `makeCaddyIngress`: build-time options select
19
+ * the resource/schema shape statically — no runtime `includeWhen`
20
+ * conditionals, no accepted-but-ignored spec fields.
21
+ */
22
+ import { type } from 'arktype';
23
+ import { kubernetesComposition } from '../../../core/composition/imperative.js';
24
+ import { Cel } from '../../../core/references/cel.js';
25
+ import { ClickHouseClusterStatusSchema, } from '../types.js';
26
+ import { clickHouseInstallation, DEFAULT_CHI_CLUSTER_NAME, } from '../resources/installation.js';
27
+ import { assertPositiveIntegerCount } from '../utils/validation.js';
28
+ /** Native (TCP) ClickHouse port — operator default ChDefaultTCPPortNumber. */
29
+ export const CLICKHOUSE_NATIVE_PORT = 9000;
30
+ /** HTTP interface port — operator default ChDefaultHTTPPortNumber. */
31
+ export const CLICKHOUSE_HTTP_PORT = 8123;
32
+ /** Default Keeper/ZooKeeper client port — operator default KpDefaultZKPortNumber. */
33
+ export const CLICKHOUSE_KEEPER_PORT = 2181;
34
+ /** Default database exposed on the status contract. */
35
+ export const CLICKHOUSE_DEFAULT_DATABASE = 'default';
36
+ /** Default allowed source networks for declared users. */
37
+ export const DEFAULT_USER_NETWORKS_IP = ['::/0'];
38
+ /** Resource id of the CHI inside the composition graph. */
39
+ const CHI_RESOURCE_ID = 'clickhouse';
40
+ function resolveTopology(topology) {
41
+ const replicas = topology.replicas ?? 1;
42
+ const shards = topology.shards ?? 1;
43
+ // Fail at CONSTRUCTION time (not first serialization): counts are
44
+ // build-time topology, and zero/fractional/negative counts compile to
45
+ // invalid operator input (`replicasCount: 0` / `shardsCount: 0`).
46
+ assertPositiveIntegerCount('makeClickHouseCluster', 'replicas', replicas);
47
+ assertPositiveIntegerCount('makeClickHouseCluster', 'shards', shards);
48
+ return {
49
+ zones: topology.zones ?? [],
50
+ replicas,
51
+ shards,
52
+ // Replicated tables need coordination — default keeper on for
53
+ // multi-replica clusters unless the caller opts out explicitly.
54
+ keeper: topology.keeper ?? replicas > 1,
55
+ users: (topology.users ?? []).map((user) => ({
56
+ name: user.name,
57
+ networksIp: user.networksIp ?? DEFAULT_USER_NETWORKS_IP,
58
+ })),
59
+ };
60
+ }
61
+ /**
62
+ * Build the runtime spec ArkType schema for a resolved topology. The SHAPE of
63
+ * the schema is a build-time product: `keeper` is required iff the topology
64
+ * enables it, and one `users.<name>` entry (with a required password hash) is
65
+ * required per declared user — user names are literal schema keys, never
66
+ * dynamic path fragments.
67
+ */
68
+ function buildSpecSchema(topology) {
69
+ const definition = {
70
+ name: 'string',
71
+ namespace: 'string',
72
+ version: 'string',
73
+ 'clusterName?': 'string',
74
+ storage: {
75
+ size: 'string',
76
+ 'storageClassName?': 'string',
77
+ },
78
+ 'podResources?': {
79
+ 'requests?': { 'cpu?': 'string', 'memory?': 'string' },
80
+ 'limits?': { 'cpu?': 'string', 'memory?': 'string' },
81
+ },
82
+ };
83
+ if (topology.keeper) {
84
+ definition.keeper = { host: 'string', 'port?': 'number' };
85
+ }
86
+ if (topology.users.length > 0) {
87
+ definition.users = Object.fromEntries(topology.users.map((user) => [user.name, { passwordSha256Hex: 'string' }]));
88
+ }
89
+ return type(definition);
90
+ }
91
+ /**
92
+ * Construct a ClickHouse cluster composition with a FIXED topology.
93
+ *
94
+ * The result is a normal TypeKro composition: use it directly
95
+ * (`factory('kro').deploy({...})`) or nest it in other compositions with
96
+ * schema references for every runtime field.
97
+ *
98
+ * @example
99
+ * ```typescript
100
+ * const clickhouse = makeClickHouseCluster({
101
+ * zones: ['us-east-2a', 'us-east-2b'], // zone-pinned replicas (EBS is zonal)
102
+ * replicas: 2,
103
+ * shards: 1,
104
+ * users: [{ name: 'signoz' }], // names are build-time path fragments
105
+ * });
106
+ *
107
+ * await clickhouse.factory('kro').deploy({
108
+ * name: 'signoz-clickhouse',
109
+ * namespace: 'observability',
110
+ * version: '25.12.5',
111
+ * storage: { size: '100Gi', storageClassName: 'gp3-expandable' },
112
+ * keeper: { host: 'keeper-signoz.observability.svc.cluster.local' },
113
+ * users: { signoz: { passwordSha256Hex: '...' } },
114
+ * });
115
+ * ```
116
+ *
117
+ * Downstream compositions consume the typed service contract:
118
+ * ```typescript
119
+ * signoz({
120
+ * clickhouse: {
121
+ * host: ch.status.clickhouse.host,
122
+ * port: ch.status.clickhouse.port,
123
+ * cluster: ch.status.clickhouse.clusterName,
124
+ * },
125
+ * });
126
+ * ```
127
+ */
128
+ export function makeClickHouseCluster(topology = {}) {
129
+ const resolved = resolveTopology(topology);
130
+ const specSchema = buildSpecSchema(resolved);
131
+ const firstUserName = resolved.users[0]?.name;
132
+ return kubernetesComposition({
133
+ name: 'clickhouse-cluster',
134
+ kind: 'ClickHouseCluster',
135
+ spec: specSchema,
136
+ status: ClickHouseClusterStatusSchema,
137
+ }, (spec) => {
138
+ const clusterName = spec.clusterName ?? DEFAULT_CHI_CLUSTER_NAME;
139
+ // Runtime credentials pair with build-time user names by LITERAL key:
140
+ // `spec.users.<name>.passwordSha256Hex` is a plain schema path, so it
141
+ // serializes to clean CEL. Names/networks come from the topology.
142
+ const users = resolved.users.map((user) => ({
143
+ name: user.name,
144
+ // biome-ignore lint/style/noNonNullAssertion: the generated schema requires one users.<name> entry per declared user
145
+ passwordSha256Hex: spec.users[user.name].passwordSha256Hex,
146
+ networksIp: [...user.networksIp],
147
+ }));
148
+ const clickhouse = clickHouseInstallation({
149
+ name: spec.name,
150
+ namespace: spec.namespace,
151
+ version: spec.version,
152
+ clusterName,
153
+ // BUILD-TIME topology — concrete values from the constructor.
154
+ shards: resolved.shards,
155
+ replicas: resolved.replicas,
156
+ ...(resolved.zones.length > 0 ? { zones: [...resolved.zones] } : {}),
157
+ storage: {
158
+ size: spec.storage.size,
159
+ storageClassName: spec.storage.storageClassName,
160
+ },
161
+ ...(users.length > 0 ? { users } : {}),
162
+ ...(resolved.keeper
163
+ ? {
164
+ keeper: {
165
+ // biome-ignore lint/style/noNonNullAssertion: the generated schema requires keeper when the topology enables it
166
+ host: spec.keeper.host,
167
+ port: spec.keeper?.port ?? CLICKHOUSE_KEEPER_PORT,
168
+ },
169
+ }
170
+ : {}),
171
+ podResources: spec.podResources,
172
+ id: CHI_RESOURCE_ID,
173
+ });
174
+ // Connection contract derived from the operator's ACTUAL naming
175
+ // (release-0.27.1): the CR-level Service is `clickhouse-{chi-name}`
176
+ // (type ClusterIP; pkg/model/chi/namer/patterns.go +
177
+ // pkg/model/chi/creator/service.go), listening on native 9000 /
178
+ // HTTP 8123 (type_host.go defaults). Per-host services
179
+ // (`chi-{chi}-{cluster}-{shard}-{replica}`) exist too but the CR
180
+ // service is the stable entrypoint.
181
+ //
182
+ // DERIVED FROM THE OWNED CHI RESOURCE (not schema.spec): KRO status
183
+ // CEL cannot reference schema.spec.*, so a spec-derived field is
184
+ // classified static (client-hydrated) and DROPPED from the KRO CR's
185
+ // status. Anchoring the derivation on the CHI resource
186
+ // (`clickhouse.metadata.*` / `clickhouse.spec.*`) makes these
187
+ // serialize as KRO status CEL, so GitOps/KRO consumers see the
188
+ // connection contract on the live CR.
189
+ //
190
+ // The string concats are RAW Cel.expr over the resource id: the
191
+ // status-builder proxy passes `metadata` values through verbatim
192
+ // (which would resolve back to schema.spec.name → static), and the
193
+ // serializer inlines CelExpression-valued template fields (like the
194
+ // defaulted clusterName / keeper port) back to their schema
195
+ // expressions — a raw resource-path expression survives both. Port
196
+ // constants ride INSIDE the resource-derived URL strings; the BARE
197
+ // constant fields (port/database/user) have no resource anchor and
198
+ // stay client-hydrated — see ClickHouseClusterStatus for the split.
199
+ const chiMeta = `${CHI_RESOURCE_ID}.metadata`;
200
+ const chiHostCel = `"clickhouse-" + ${chiMeta}.name + "." + ${chiMeta}.namespace + ".svc.cluster.local"`;
201
+ return {
202
+ ready: clickhouse.status.status === 'Completed',
203
+ phase: clickhouse.status.status === 'Completed'
204
+ ? 'Ready'
205
+ : clickhouse.status.status === 'Aborted'
206
+ ? 'Failed'
207
+ : 'Installing',
208
+ clickhouse: {
209
+ host: Cel.expr(chiHostCel),
210
+ // Bare numeric constant — client-hydrated only (no resource
211
+ // anchor); the port also appears in the KRO-visible URLs below.
212
+ port: CLICKHOUSE_NATIVE_PORT,
213
+ nativeUrl: Cel.expr(`"clickhouse://" + ${chiHostCel} + ":${CLICKHOUSE_NATIVE_PORT}"`),
214
+ httpUrl: Cel.expr(`"http://" + ${chiHostCel} + ":${CLICKHOUSE_HTTP_PORT}"`),
215
+ // The resolved logical cluster name is IN the owned CHI
216
+ // (configuration.clusters[0].name), so read it from there — the
217
+ // `spec.clusterName ?? default` expression itself is schema-only
218
+ // and would be dropped.
219
+ clusterName: Cel.expr(`${CHI_RESOURCE_ID}.spec.configuration.clusters[0].name`),
220
+ database: CLICKHOUSE_DEFAULT_DATABASE,
221
+ ...(firstUserName ? { user: firstUserName } : {}),
222
+ },
223
+ ...(resolved.keeper
224
+ ? {
225
+ keeper: {
226
+ // Echo the keeper endpoint from the CHI's own zookeeper
227
+ // section (resource-derived → lands in KRO status) rather
228
+ // than from schema.spec.keeper (static → dropped).
229
+ host: Cel.expr(`${CHI_RESOURCE_ID}.spec.configuration.zookeeper.nodes[0].host`),
230
+ port: Cel.expr(`${CHI_RESOURCE_ID}.spec.configuration.zookeeper.nodes[0].port`),
231
+ },
232
+ }
233
+ : {}),
234
+ installation: {
235
+ // CHI identity from the owned resource (same reachability rule).
236
+ name: Cel.expr(`${chiMeta}.name`),
237
+ namespace: Cel.expr(`${chiMeta}.namespace`),
238
+ endpoint: clickhouse.status.endpoint,
239
+ hostsCount: clickhouse.status.hostsCount,
240
+ hostsCompletedCount: clickhouse.status.hostsCompletedCount,
241
+ },
242
+ };
243
+ });
244
+ }
245
+ /**
246
+ * The default single-node cluster composition (1 shard, 1 replica, no zones,
247
+ * no keeper, no declared users). See {@link makeClickHouseCluster} for
248
+ * topology options.
249
+ */
250
+ export const clickHouseCluster = makeClickHouseCluster();
251
+ //# sourceMappingURL=clickhouse-cluster.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clickhouse-cluster.js","sourceRoot":"","sources":["../../../../src/factories/clickhouse/compositions/clickhouse-cluster.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AAEtD,OAAO,EAEL,6BAA6B,GAI9B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,8BAA8B,CAAC;AACtC,OAAO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BAAsB,GAAG,CACjE;gBACD,OAAO,EAAE,GAAG,CAAC,IAAI,CACf,eAAe,UAAU,QAAQ,oBAAoB,GAAG,CACzD;gBACD,wDAAwD;gBACxD,gEAAgE;gBAChE,iEAAiE;gBACjE,wBAAwB;gBACxB,WAAW,EAAE,GAAG,CAAC,IAAI,CACnB,GAAG,eAAe,sCAAsC,CACzD;gBACD,QAAQ,EAAE,2BAA2B;gBACrC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAClD;YACD,GAAG,CAAC,QAAQ,CAAC,MAAM;gBACjB,CAAC,CAAC;oBACE,MAAM,EAAE;wBACN,wDAAwD;wBACxD,0DAA0D;wBAC1D,mDAAmD;wBACnD,IAAI,EAAE,GAAG,CAAC,IAAI,CACZ,GAAG,eAAe,6CAA6C,CAChE;wBACD,IAAI,EAAE,GAAG,CAAC,IAAI,CACZ,GAAG,eAAe,6CAA6C,CAChE;qBACF;iBACF;gBACH,CAAC,CAAC,EAAE,CAAC;YACP,YAAY,EAAE;gBACZ,iEAAiE;gBACjE,IAAI,EAAE,GAAG,CAAC,IAAI,CAAS,GAAG,OAAO,OAAO,CAAC;gBACzC,SAAS,EAAE,GAAG,CAAC,IAAI,CAAS,GAAG,OAAO,YAAY,CAAC;gBACnD,QAAQ,EAAE,UAAU,CAAC,MAAM,CAAC,QAAQ;gBACpC,UAAU,EAAE,UAAU,CAAC,MAAM,CAAC,UAAU;gBACxC,mBAAmB,EAAE,UAAU,CAAC,MAAM,CAAC,mBAAmB;aAC3D;SACF,CAAC;IACJ,CAAC,CACgF,CAAC;AACtF,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,qBAAqB,EAAE,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Shared Altinity HelmRepository singleton.
3
+ *
4
+ * The official Altinity chart repository (https://helm.altinity.com) is a
5
+ * single cluster-level Flux source — the same URL serves every consumer.
6
+ * Deploying it inline in the `clickhouseOperatorBootstrap` RGD would make
7
+ * each instance's KRO ApplySet try to *own* the HelmRepository exclusively,
8
+ * so a second instance of the RGD fails to reconcile ("resource belongs to a
9
+ * different ApplySet ... cannot reassign"). Modelling the repository as its
10
+ * own composition lets the bootstrap consume it via `singleton(...)`, so one
11
+ * shared HelmRepository is owned outside any single instance's ApplySet and
12
+ * the operator HelmRelease references it by the same `sourceRef`.
13
+ * (Same pattern as the Dagster bootstrap's shared repository.)
14
+ */
15
+ export declare const clickhouseHelmRepositoryBootstrap: import("../../../index.js").CallableComposition<{
16
+ name: string;
17
+ namespace: string;
18
+ url: string;
19
+ }, {
20
+ ready: boolean;
21
+ }>;
22
+ //# sourceMappingURL=clickhouse-helm-repository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clickhouse-helm-repository.d.ts","sourceRoot":"","sources":["../../../../src/factories/clickhouse/compositions/clickhouse-helm-repository.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,iCAAiC;;;;;;EAsB7C,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { kubernetesComposition } from '../../../core/composition/imperative.js';
2
+ import { Cel } from '../../../core/references/cel.js';
3
+ import { clickhouseHelmRepository } from '../resources/helm.js';
4
+ import { ClickHouseHelmRepositorySingletonSpecSchema, ClickHouseHelmRepositorySingletonStatusSchema, } from '../types.js';
5
+ /**
6
+ * Shared Altinity HelmRepository singleton.
7
+ *
8
+ * The official Altinity chart repository (https://helm.altinity.com) is a
9
+ * single cluster-level Flux source — the same URL serves every consumer.
10
+ * Deploying it inline in the `clickhouseOperatorBootstrap` RGD would make
11
+ * each instance's KRO ApplySet try to *own* the HelmRepository exclusively,
12
+ * so a second instance of the RGD fails to reconcile ("resource belongs to a
13
+ * different ApplySet ... cannot reassign"). Modelling the repository as its
14
+ * own composition lets the bootstrap consume it via `singleton(...)`, so one
15
+ * shared HelmRepository is owned outside any single instance's ApplySet and
16
+ * the operator HelmRelease references it by the same `sourceRef`.
17
+ * (Same pattern as the Dagster bootstrap's shared repository.)
18
+ */
19
+ export const clickhouseHelmRepositoryBootstrap = kubernetesComposition({
20
+ name: 'clickhouse-helm-repository',
21
+ kind: 'ClickHouseHelmRepository',
22
+ spec: ClickHouseHelmRepositorySingletonSpecSchema,
23
+ status: ClickHouseHelmRepositorySingletonStatusSchema,
24
+ }, (spec) => {
25
+ const repository = clickhouseHelmRepository({
26
+ name: spec.name,
27
+ namespace: spec.namespace,
28
+ url: spec.url,
29
+ id: 'repository',
30
+ });
31
+ return {
32
+ ready: Cel.expr(repository.status.conditions, '.exists(c, c.type == "Ready" && c.status == "True")'),
33
+ };
34
+ });
35
+ //# sourceMappingURL=clickhouse-helm-repository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clickhouse-helm-repository.js","sourceRoot":"","sources":["../../../../src/factories/clickhouse/compositions/clickhouse-helm-repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EACL,2CAA2C,EAC3C,6CAA6C,GAC9C,MAAM,aAAa,CAAC;AAErB;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,qBAAqB,CACpE;IACE,IAAI,EAAE,4BAA4B;IAClC,IAAI,EAAE,0BAA0B;IAChC,IAAI,EAAE,2CAA2C;IACjD,MAAM,EAAE,6CAA6C;CACtD,EACD,CAAC,IAAI,EAAE,EAAE;IACP,MAAM,UAAU,GAAG,wBAAwB,CAAC;QAC1C,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,GAAG,EAAE,IAAI,CAAC,GAAG;QACb,EAAE,EAAE,YAAY;KACjB,CAAC,CAAC;IAEH,OAAO;QACL,KAAK,EAAE,GAAG,CAAC,IAAI,CACb,UAAU,CAAC,MAAM,CAAC,UAAU,EAC5B,qDAAqD,CACtD;KACF,CAAC;AACJ,CAAC,CACF,CAAC"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Altinity clickhouse-operator Bootstrap Composition
3
+ *
4
+ * Deploys the OFFICIAL Altinity clickhouse-operator via HelmRepository and
5
+ * HelmRelease resources (chart `altinity-clickhouse-operator` 0.27.x from
6
+ * https://helm.altinity.com, Apache-2.0). Build-around: we wrap the official
7
+ * chart — never hand-rolled operator manifests.
8
+ *
9
+ * IMPORTANT — ONE OPERATOR PER CLUSTER: the operator is cluster-scoped and
10
+ * owns the ClickHouse CRDs (`clickhouseinstallations`,
11
+ * `clickhouseinstallationtemplates`, `clickhouseoperatorconfigurations` under
12
+ * `clickhouse.altinity.com/v1`; `clickhousekeeperinstallations` under
13
+ * `clickhouse-keeper.altinity.com/v1`). Install it exactly once; every
14
+ * `clickHouseInstallation()`/`clickHouseKeeperInstallation()` in the cluster
15
+ * is reconciled by that single install. The default `shared: true` tags the
16
+ * operator resources with `scopes: ['cluster']` so instance deletion leaves
17
+ * the shared operator intact.
18
+ *
19
+ * This composition:
20
+ * 1. Creates the target namespace
21
+ * 2. References the shared Altinity HelmRepository singleton
22
+ * 3. Creates a HelmRelease that installs the operator
23
+ *
24
+ * After the operator is running, use `clickHouseInstallation()` and
25
+ * `clickHouseKeeperInstallation()` to create ClickHouse resources.
26
+ *
27
+ * @example
28
+ * ```typescript
29
+ * const operatorFactory = clickhouseOperatorBootstrap.factory('kro', {
30
+ * namespace: 'clickhouse-system',
31
+ * waitForReady: true,
32
+ * });
33
+ *
34
+ * await operatorFactory.deploy({
35
+ * name: 'clickhouse-operator',
36
+ * namespace: 'clickhouse-system',
37
+ * version: '0.27.1',
38
+ * });
39
+ * ```
40
+ */
41
+ export declare const clickhouseOperatorBootstrap: import("../../../index.js").CallableComposition<{
42
+ name: string;
43
+ namespace?: string;
44
+ version?: string;
45
+ metrics?: {
46
+ enabled?: boolean;
47
+ };
48
+ crdHook?: {
49
+ enabled?: boolean;
50
+ };
51
+ resources?: {
52
+ requests?: {
53
+ cpu?: string;
54
+ memory?: string;
55
+ };
56
+ limits?: {
57
+ cpu?: string;
58
+ memory?: string;
59
+ };
60
+ };
61
+ customValues?: Record<string, unknown>;
62
+ shared?: boolean;
63
+ }, {
64
+ phase: "Ready" | "Installing";
65
+ ready: boolean;
66
+ version?: string;
67
+ }>;
68
+ //# sourceMappingURL=clickhouse-operator-bootstrap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clickhouse-operator-bootstrap.d.ts","sourceRoot":"","sources":["../../../../src/factories/clickhouse/compositions/clickhouse-operator-bootstrap.ts"],"names":[],"mappings":"AAoBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;EAoGvC,CAAC"}
@@ -0,0 +1,137 @@
1
+ import { kubernetesComposition } from '../../../core/composition/imperative.js';
2
+ import { DEFAULT_FLUX_NAMESPACE } from '../../../core/config/defaults.js';
3
+ import { setMetadataField } from '../../../core/metadata/index.js';
4
+ import { Cel } from '../../../core/references/cel.js';
5
+ import { singleton } from '../../../core/singleton/singleton.js';
6
+ import { namespace } from '../../kubernetes/core/namespace.js';
7
+ import { clickhouseOperatorHelmRelease, DEFAULT_CLICKHOUSE_OPERATOR_VERSION, DEFAULT_CLICKHOUSE_REPO_NAME, DEFAULT_CLICKHOUSE_REPO_URL, } from '../resources/helm.js';
8
+ import { ClickHouseOperatorBootstrapConfigSchema, ClickHouseOperatorBootstrapStatusSchema, } from '../types.js';
9
+ import { mapClickHouseOperatorConfigToHelmValues } from '../utils/helm-values-mapper.js';
10
+ import { clickhouseHelmRepositoryBootstrap } from './clickhouse-helm-repository.js';
11
+ /**
12
+ * Altinity clickhouse-operator Bootstrap Composition
13
+ *
14
+ * Deploys the OFFICIAL Altinity clickhouse-operator via HelmRepository and
15
+ * HelmRelease resources (chart `altinity-clickhouse-operator` 0.27.x from
16
+ * https://helm.altinity.com, Apache-2.0). Build-around: we wrap the official
17
+ * chart — never hand-rolled operator manifests.
18
+ *
19
+ * IMPORTANT — ONE OPERATOR PER CLUSTER: the operator is cluster-scoped and
20
+ * owns the ClickHouse CRDs (`clickhouseinstallations`,
21
+ * `clickhouseinstallationtemplates`, `clickhouseoperatorconfigurations` under
22
+ * `clickhouse.altinity.com/v1`; `clickhousekeeperinstallations` under
23
+ * `clickhouse-keeper.altinity.com/v1`). Install it exactly once; every
24
+ * `clickHouseInstallation()`/`clickHouseKeeperInstallation()` in the cluster
25
+ * is reconciled by that single install. The default `shared: true` tags the
26
+ * operator resources with `scopes: ['cluster']` so instance deletion leaves
27
+ * the shared operator intact.
28
+ *
29
+ * This composition:
30
+ * 1. Creates the target namespace
31
+ * 2. References the shared Altinity HelmRepository singleton
32
+ * 3. Creates a HelmRelease that installs the operator
33
+ *
34
+ * After the operator is running, use `clickHouseInstallation()` and
35
+ * `clickHouseKeeperInstallation()` to create ClickHouse resources.
36
+ *
37
+ * @example
38
+ * ```typescript
39
+ * const operatorFactory = clickhouseOperatorBootstrap.factory('kro', {
40
+ * namespace: 'clickhouse-system',
41
+ * waitForReady: true,
42
+ * });
43
+ *
44
+ * await operatorFactory.deploy({
45
+ * name: 'clickhouse-operator',
46
+ * namespace: 'clickhouse-system',
47
+ * version: '0.27.1',
48
+ * });
49
+ * ```
50
+ */
51
+ export const clickhouseOperatorBootstrap = kubernetesComposition({
52
+ name: 'clickhouse-operator-bootstrap',
53
+ kind: 'ClickHouseOperatorBootstrap',
54
+ spec: ClickHouseOperatorBootstrapConfigSchema,
55
+ status: ClickHouseOperatorBootstrapStatusSchema,
56
+ }, (spec) => {
57
+ const resolvedNamespace = spec.namespace || 'clickhouse-system';
58
+ const resolvedVersion = spec.version || DEFAULT_CLICKHOUSE_OPERATOR_VERSION;
59
+ // Default to shared-lifecycle: the operator is one-per-cluster
60
+ // infrastructure (it owns the CRDs) and must survive individual consumer
61
+ // instance deletions. `shared: false` exists only for throwaway
62
+ // environments such as kind-cluster integration tests.
63
+ const isShared = spec.shared !== false;
64
+ // Map config to Helm values (metrics.enabled / crdHook.enabled /
65
+ // operator resources + customValues merged LAST). Fields are passed
66
+ // EXPLICITLY — spreading the schema proxy (`...spec`) enumerates proxy
67
+ // keys and leaks `__typekroSchemaKey` markers into the rendered values.
68
+ // In kro mode `spec.customValues` is a schema ref, so the mapper routes
69
+ // it through the graph-aware runtime values merge and the override map
70
+ // lands in the serialized HelmRelease values.
71
+ const helmValues = mapClickHouseOperatorConfigToHelmValues({
72
+ metrics: spec.metrics,
73
+ crdHook: spec.crdHook,
74
+ resources: spec.resources,
75
+ customValues: spec.customValues,
76
+ });
77
+ // Resources are _-prefixed because they're registered via side effects in
78
+ // the kubernetesComposition callback — the composition captures them
79
+ // automatically. They're referenced in the status return via their `id`.
80
+ const _clickhouseNamespace = namespace({
81
+ metadata: {
82
+ name: resolvedNamespace,
83
+ labels: {
84
+ 'app.kubernetes.io/name': 'altinity-clickhouse-operator',
85
+ 'app.kubernetes.io/instance': spec.name,
86
+ 'app.kubernetes.io/version': resolvedVersion,
87
+ 'app.kubernetes.io/managed-by': 'typekro',
88
+ },
89
+ },
90
+ id: 'clickhouseNamespace',
91
+ });
92
+ // The Altinity chart repository is one cluster-level Flux source shared
93
+ // by every consumer, so deploy it once via singleton(...) with a fixed
94
+ // identity (same rationale as the Dagster bootstrap: inlining it would
95
+ // make each instance's KRO ApplySet try to own the HelmRepository
96
+ // exclusively, breaking a second instance with an ApplySet reassignment
97
+ // error). The HelmRelease references the shared repository by the
98
+ // official `sourceRef` defaults.
99
+ const _clickhouseHelmRepository = singleton(clickhouseHelmRepositoryBootstrap, {
100
+ id: 'clickhouse-helm-repository',
101
+ spec: {
102
+ name: DEFAULT_CLICKHOUSE_REPO_NAME,
103
+ namespace: DEFAULT_FLUX_NAMESPACE,
104
+ url: DEFAULT_CLICKHOUSE_REPO_URL,
105
+ },
106
+ });
107
+ // Create HelmRelease for the operator itself.
108
+ const _helmRelease = clickhouseOperatorHelmRelease({
109
+ name: spec.name,
110
+ namespace: resolvedNamespace,
111
+ version: resolvedVersion,
112
+ values: helmValues,
113
+ id: 'clickhouseOperatorHelmRelease',
114
+ });
115
+ // Tag resources with 'cluster' scope so factory-level deleteInstance
116
+ // leaves the shared operator install intact for other consumers. Callers
117
+ // can explicitly tear down shared infra with
118
+ // `deleteInstance(name, { scopes: ['cluster'] })`.
119
+ if (isShared) {
120
+ setMetadataField(_clickhouseNamespace, 'scopes', ['cluster']);
121
+ setMetadataField(_helmRelease, 'scopes', ['cluster']);
122
+ }
123
+ // Status derived from HelmRelease conditions.
124
+ // Flux HelmRelease v2 uses conditions with type='Ready' for readiness;
125
+ // the release does not set `disableWait`, so helm-controller waits for
126
+ // the chart's workloads before reporting Ready (readiness is
127
+ // workload-aware, mirroring the cnpg/dagster bootstraps).
128
+ return {
129
+ ready: Cel.expr(_helmRelease.status.conditions, '.exists(c, c.type == "Ready" && c.status == "True")'),
130
+ // Two-state phase: nested ternaries with .exists() require repeating the
131
+ // full resource path in CEL, which Cel.expr(ref, operator) cannot
132
+ // express (same constraint as the cnpg bootstrap).
133
+ phase: Cel.expr(_helmRelease.status.conditions, '.exists(c, c.type == "Ready" && c.status == "True") ? "Ready" : "Installing"'),
134
+ version: resolvedVersion,
135
+ };
136
+ });
137
+ //# sourceMappingURL=clickhouse-operator-bootstrap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clickhouse-operator-bootstrap.js","sourceRoot":"","sources":["../../../../src/factories/clickhouse/compositions/clickhouse-operator-bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE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,IAAI,CACb,YAAY,CAAC,MAAM,CAAC,UAAU,EAC9B,qDAAqD,CACtD;QACD,yEAAyE;QACzE,kEAAkE;QAClE,mDAAmD;QACnD,KAAK,EAAE,GAAG,CAAC,IAAI,CACb,YAAY,CAAC,MAAM,CAAC,UAAU,EAC9B,8EAA8E,CAC/E;QACD,OAAO,EAAE,eAAe;KACzB,CAAC;AACJ,CAAC,CACF,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { CLICKHOUSE_DEFAULT_DATABASE, CLICKHOUSE_HTTP_PORT, CLICKHOUSE_KEEPER_PORT, CLICKHOUSE_NATIVE_PORT, clickHouseCluster, DEFAULT_USER_NETWORKS_IP, makeClickHouseCluster, } from './clickhouse-cluster.js';
2
+ export { clickhouseHelmRepositoryBootstrap } from './clickhouse-helm-repository.js';
3
+ export { clickhouseOperatorBootstrap } from './clickhouse-operator-bootstrap.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/factories/clickhouse/compositions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,EACtB,iBAAiB,EACjB,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,iCAAiC,EAAE,MAAM,iCAAiC,CAAC;AACpF,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { CLICKHOUSE_DEFAULT_DATABASE, CLICKHOUSE_HTTP_PORT, CLICKHOUSE_KEEPER_PORT, CLICKHOUSE_NATIVE_PORT, clickHouseCluster, DEFAULT_USER_NETWORKS_IP, makeClickHouseCluster, } from './clickhouse-cluster.js';
2
+ export { clickhouseHelmRepositoryBootstrap } from './clickhouse-helm-repository.js';
3
+ export { clickhouseOperatorBootstrap } from './clickhouse-operator-bootstrap.js';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/factories/clickhouse/compositions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,EACtB,iBAAiB,EACjB,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,iCAAiC,EAAE,MAAM,iCAAiC,CAAC;AACpF,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * ClickHouse (Altinity clickhouse-operator) Integration for TypeKro
3
+ *
4
+ * Provides type-safe factories for managing ClickHouse clusters on Kubernetes
5
+ * using the OFFICIAL Altinity clickhouse-operator (build-around: the official
6
+ * `altinity-clickhouse-operator` chart from https://helm.altinity.com,
7
+ * Apache-2.0 — never hand-rolled manifests).
8
+ *
9
+ * ONE OPERATOR PER CLUSTER: the operator is cluster-scoped and owns the
10
+ * ClickHouse CRDs; install exactly one `clickhouseOperatorBootstrap` per
11
+ * cluster and point every CHI/CHK at it.
12
+ *
13
+ * BUILD-TIME vs RUNTIME: topology (`zones`/`replicas`/`shards`/keeper
14
+ * presence/user names) is fixed at CONSTRUCTION time via
15
+ * `makeClickHouseCluster(topology)`; everything else (name, namespace,
16
+ * version, storage, credentials, keeper host) is proxy-safe RUNTIME spec.
17
+ *
18
+ * ## Compositions
19
+ * - `makeClickHouseCluster(topology)` — build-time topology constructor;
20
+ * returns a composition whose runtime spec is fully schema-ref safe and
21
+ * whose status exposes the typed connection contract
22
+ * - `clickHouseCluster` — the default single-node topology
23
+ * - `clickhouseOperatorBootstrap` — complete operator deployment
24
+ * (namespace + shared Helm repo singleton + release)
25
+ * - `clickhouseHelmRepositoryBootstrap` — shared HelmRepository singleton owner
26
+ *
27
+ * ## Resources
28
+ * - `clickHouseInstallation()` — LOW-LEVEL typed CHI (concrete topology only;
29
+ * zone-pinned replica layout, SigNoz-compatible `cluster` name default)
30
+ * - `clickHouseKeeperInstallation()` — typed CHK (coordination service)
31
+ * - `clickhouseHelmRepository()` — Altinity Helm chart repository
32
+ * - `clickhouseOperatorHelmRelease()` — operator installation via Helm
33
+ *
34
+ * @example
35
+ * ```typescript
36
+ * import {
37
+ * clickhouseOperatorBootstrap,
38
+ * makeClickHouseCluster,
39
+ * } from 'typekro/clickhouse';
40
+ *
41
+ * // Install the operator (once per cluster)
42
+ * const operatorFactory = clickhouseOperatorBootstrap.factory('kro', {
43
+ * namespace: 'clickhouse-system',
44
+ * });
45
+ * await operatorFactory.deploy({ name: 'clickhouse-operator' });
46
+ *
47
+ * // Fix the topology at construction, deploy with runtime spec
48
+ * const clickhouse = makeClickHouseCluster({
49
+ * zones: ['us-east-2a', 'us-east-2b'],
50
+ * replicas: 2,
51
+ * users: [{ name: 'signoz' }],
52
+ * });
53
+ * await clickhouse.factory('kro', { namespace: 'observability' }).deploy({
54
+ * name: 'signoz-clickhouse',
55
+ * namespace: 'observability',
56
+ * version: '25.12.5',
57
+ * storage: { size: '100Gi', storageClassName: 'gp3-expandable' },
58
+ * keeper: { host: 'keeper-signoz.observability.svc.cluster.local' },
59
+ * users: { signoz: { passwordSha256Hex: '<sha256-hex>' } },
60
+ * });
61
+ * ```
62
+ *
63
+ * @see https://github.com/Altinity/clickhouse-operator
64
+ * @module
65
+ */
66
+ export * from './compositions/index.js';
67
+ export * from './resources/index.js';
68
+ export * from './types.js';
69
+ export * from './utils/index.js';
70
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/factories/clickhouse/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AACH,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC"}