typekro 0.22.1 → 0.24.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.
- package/dist/.tsbuildinfo +1 -1
- package/dist/core/deployment/kro-factory.d.ts +19 -0
- package/dist/core/deployment/kro-factory.d.ts.map +1 -1
- package/dist/core/deployment/kro-factory.js +60 -6
- package/dist/core/deployment/kro-factory.js.map +1 -1
- package/dist/core/proxy/create-resource.d.ts.map +1 -1
- package/dist/core/proxy/create-resource.js +37 -0
- package/dist/core/proxy/create-resource.js.map +1 -1
- package/dist/core/references/schema-proxy.d.ts.map +1 -1
- package/dist/core/references/schema-proxy.js +21 -5
- package/dist/core/references/schema-proxy.js.map +1 -1
- package/dist/factories/clickhouse/compositions/clickhouse-cluster.d.ts +78 -0
- package/dist/factories/clickhouse/compositions/clickhouse-cluster.d.ts.map +1 -0
- package/dist/factories/clickhouse/compositions/clickhouse-cluster.js +258 -0
- package/dist/factories/clickhouse/compositions/clickhouse-cluster.js.map +1 -0
- package/dist/factories/clickhouse/compositions/clickhouse-helm-repository.d.ts +22 -0
- package/dist/factories/clickhouse/compositions/clickhouse-helm-repository.d.ts.map +1 -0
- package/dist/factories/clickhouse/compositions/clickhouse-helm-repository.js +35 -0
- package/dist/factories/clickhouse/compositions/clickhouse-helm-repository.js.map +1 -0
- package/dist/factories/clickhouse/compositions/clickhouse-operator-bootstrap.d.ts +68 -0
- package/dist/factories/clickhouse/compositions/clickhouse-operator-bootstrap.d.ts.map +1 -0
- package/dist/factories/clickhouse/compositions/clickhouse-operator-bootstrap.js +137 -0
- package/dist/factories/clickhouse/compositions/clickhouse-operator-bootstrap.js.map +1 -0
- package/dist/factories/clickhouse/compositions/index.d.ts +4 -0
- package/dist/factories/clickhouse/compositions/index.d.ts.map +1 -0
- package/dist/factories/clickhouse/compositions/index.js +4 -0
- package/dist/factories/clickhouse/compositions/index.js.map +1 -0
- package/dist/factories/clickhouse/index.d.ts +70 -0
- package/dist/factories/clickhouse/index.d.ts.map +1 -0
- package/dist/factories/clickhouse/index.js +70 -0
- package/dist/factories/clickhouse/index.js.map +1 -0
- package/dist/factories/clickhouse/resources/helm.d.ts +62 -0
- package/dist/factories/clickhouse/resources/helm.d.ts.map +1 -0
- package/dist/factories/clickhouse/resources/helm.js +94 -0
- package/dist/factories/clickhouse/resources/helm.js.map +1 -0
- package/dist/factories/clickhouse/resources/index.d.ts +4 -0
- package/dist/factories/clickhouse/resources/index.d.ts.map +1 -0
- package/dist/factories/clickhouse/resources/index.js +4 -0
- package/dist/factories/clickhouse/resources/index.js.map +1 -0
- package/dist/factories/clickhouse/resources/installation.d.ts +83 -0
- package/dist/factories/clickhouse/resources/installation.d.ts.map +1 -0
- package/dist/factories/clickhouse/resources/installation.js +316 -0
- package/dist/factories/clickhouse/resources/installation.js.map +1 -0
- package/dist/factories/clickhouse/resources/keeper.d.ts +40 -0
- package/dist/factories/clickhouse/resources/keeper.d.ts.map +1 -0
- package/dist/factories/clickhouse/resources/keeper.js +107 -0
- package/dist/factories/clickhouse/resources/keeper.js.map +1 -0
- package/dist/factories/clickhouse/types.d.ts +552 -0
- package/dist/factories/clickhouse/types.d.ts.map +1 -0
- package/dist/factories/clickhouse/types.js +295 -0
- package/dist/factories/clickhouse/types.js.map +1 -0
- package/dist/factories/clickhouse/utils/helm-values-mapper.d.ts +65 -0
- package/dist/factories/clickhouse/utils/helm-values-mapper.d.ts.map +1 -0
- package/dist/factories/clickhouse/utils/helm-values-mapper.js +80 -0
- package/dist/factories/clickhouse/utils/helm-values-mapper.js.map +1 -0
- package/dist/factories/clickhouse/utils/index.d.ts +4 -0
- package/dist/factories/clickhouse/utils/index.d.ts.map +1 -0
- package/dist/factories/clickhouse/utils/index.js +4 -0
- package/dist/factories/clickhouse/utils/index.js.map +1 -0
- package/dist/factories/clickhouse/utils/validation.d.ts +21 -0
- package/dist/factories/clickhouse/utils/validation.d.ts.map +1 -0
- package/dist/factories/clickhouse/utils/validation.js +27 -0
- package/dist/factories/clickhouse/utils/validation.js.map +1 -0
- package/dist/factories/clickhouse/utils/zone-layout.d.ts +74 -0
- package/dist/factories/clickhouse/utils/zone-layout.d.ts.map +1 -0
- package/dist/factories/clickhouse/utils/zone-layout.js +103 -0
- package/dist/factories/clickhouse/utils/zone-layout.js.map +1 -0
- package/dist/factories/clickstack/compositions/clickstack-bootstrap.d.ts +248 -0
- package/dist/factories/clickstack/compositions/clickstack-bootstrap.d.ts.map +1 -0
- package/dist/factories/clickstack/compositions/clickstack-bootstrap.js +251 -0
- package/dist/factories/clickstack/compositions/clickstack-bootstrap.js.map +1 -0
- package/dist/factories/clickstack/compositions/clickstack-helm-repository.d.ts +23 -0
- package/dist/factories/clickstack/compositions/clickstack-helm-repository.d.ts.map +1 -0
- package/dist/factories/clickstack/compositions/clickstack-helm-repository.js +36 -0
- package/dist/factories/clickstack/compositions/clickstack-helm-repository.js.map +1 -0
- package/dist/factories/clickstack/compositions/index.d.ts +5 -0
- package/dist/factories/clickstack/compositions/index.d.ts.map +1 -0
- package/dist/factories/clickstack/compositions/index.js +5 -0
- package/dist/factories/clickstack/compositions/index.js.map +1 -0
- package/dist/factories/clickstack/compositions/k8s-telemetry.d.ts +83 -0
- package/dist/factories/clickstack/compositions/k8s-telemetry.d.ts.map +1 -0
- package/dist/factories/clickstack/compositions/k8s-telemetry.js +134 -0
- package/dist/factories/clickstack/compositions/k8s-telemetry.js.map +1 -0
- package/dist/factories/clickstack/compositions/otel-helm-repository.d.ts +18 -0
- package/dist/factories/clickstack/compositions/otel-helm-repository.d.ts.map +1 -0
- package/dist/factories/clickstack/compositions/otel-helm-repository.js +31 -0
- package/dist/factories/clickstack/compositions/otel-helm-repository.js.map +1 -0
- package/dist/factories/clickstack/index.d.ts +40 -0
- package/dist/factories/clickstack/index.d.ts.map +1 -0
- package/dist/factories/clickstack/index.js +40 -0
- package/dist/factories/clickstack/index.js.map +1 -0
- package/dist/factories/clickstack/resources/helm.d.ts +78 -0
- package/dist/factories/clickstack/resources/helm.d.ts.map +1 -0
- package/dist/factories/clickstack/resources/helm.js +139 -0
- package/dist/factories/clickstack/resources/helm.js.map +1 -0
- package/dist/factories/clickstack/resources/index.d.ts +3 -0
- package/dist/factories/clickstack/resources/index.d.ts.map +1 -0
- package/dist/factories/clickstack/resources/index.js +3 -0
- package/dist/factories/clickstack/resources/index.js.map +1 -0
- package/dist/factories/clickstack/resources/mongo.d.ts +40 -0
- package/dist/factories/clickstack/resources/mongo.d.ts.map +1 -0
- package/dist/factories/clickstack/resources/mongo.js +122 -0
- package/dist/factories/clickstack/resources/mongo.js.map +1 -0
- package/dist/factories/clickstack/types.d.ts +483 -0
- package/dist/factories/clickstack/types.d.ts.map +1 -0
- package/dist/factories/clickstack/types.js +300 -0
- package/dist/factories/clickstack/types.js.map +1 -0
- package/dist/factories/clickstack/utils/helm-values-mapper.d.ts +118 -0
- package/dist/factories/clickstack/utils/helm-values-mapper.d.ts.map +1 -0
- package/dist/factories/clickstack/utils/helm-values-mapper.js +505 -0
- package/dist/factories/clickstack/utils/helm-values-mapper.js.map +1 -0
- package/dist/factories/clickstack/utils/index.d.ts +2 -0
- package/dist/factories/clickstack/utils/index.d.ts.map +1 -0
- package/dist/factories/clickstack/utils/index.js +2 -0
- package/dist/factories/clickstack/utils/index.js.map +1 -0
- package/dist/factories/index.d.ts +1 -0
- package/dist/factories/index.d.ts.map +1 -1
- package/dist/factories/index.js +4 -0
- package/dist/factories/index.js.map +1 -1
- package/package.json +9 -1
|
@@ -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,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D;IAC7D,0DAA0D;IAC1D,OAAO;QACL,KAAK,EAAE,GAAG,CAAC,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"}
|
|
@@ -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.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","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"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ClickHouse Operator Helm Resource Factories
|
|
3
|
+
*
|
|
4
|
+
* Wrappers around the generic Helm factories with Altinity-specific defaults.
|
|
5
|
+
* Used by the `clickhouseOperatorBootstrap` composition to install the
|
|
6
|
+
* OFFICIAL Altinity clickhouse-operator (build-around: we wrap the official
|
|
7
|
+
* chart rather than hand-rolling operator manifests).
|
|
8
|
+
*
|
|
9
|
+
* Chart: `altinity-clickhouse-operator` from https://helm.altinity.com
|
|
10
|
+
* (Apache-2.0). The operator is cluster-scoped and owns the ClickHouse CRDs —
|
|
11
|
+
* exactly ONE install per cluster.
|
|
12
|
+
*/
|
|
13
|
+
import type { Composable, Enhanced } from '../../../core/types/index.js';
|
|
14
|
+
import { type HelmRepositorySpec, type HelmRepositoryStatus } from '../../helm/helm-repository.js';
|
|
15
|
+
import type { HelmReleaseSpec, HelmReleaseStatus } from '../../helm/types.js';
|
|
16
|
+
import type { ClickHouseHelmRepositoryConfig, ClickHouseOperatorHelmReleaseConfig } from '../types.js';
|
|
17
|
+
/** Official Altinity Helm chart repository URL. */
|
|
18
|
+
export declare const DEFAULT_CLICKHOUSE_REPO_URL = "https://helm.altinity.com";
|
|
19
|
+
/** Default Flux HelmRepository name for the Altinity chart repository. */
|
|
20
|
+
export declare const DEFAULT_CLICKHOUSE_REPO_NAME = "altinity";
|
|
21
|
+
/** Official operator chart name. */
|
|
22
|
+
export declare const CLICKHOUSE_OPERATOR_CHART_NAME = "altinity-clickhouse-operator";
|
|
23
|
+
/** Default altinity-clickhouse-operator chart version. */
|
|
24
|
+
export declare const DEFAULT_CLICKHOUSE_OPERATOR_VERSION = "0.27.1";
|
|
25
|
+
/**
|
|
26
|
+
* Create a Flux HelmRepository for the official Altinity chart repository.
|
|
27
|
+
*
|
|
28
|
+
* @param config - Repository configuration with Altinity defaults
|
|
29
|
+
* @returns Enhanced HelmRepository resource
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* const repo = clickhouseHelmRepository({
|
|
34
|
+
* name: 'altinity',
|
|
35
|
+
* namespace: 'flux-system',
|
|
36
|
+
* id: 'clickhouseHelmRepository',
|
|
37
|
+
* });
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare function clickhouseHelmRepository(config: Composable<ClickHouseHelmRepositoryConfig>): Enhanced<HelmRepositorySpec, HelmRepositoryStatus>;
|
|
41
|
+
/**
|
|
42
|
+
* Create a Flux HelmRelease for the Altinity clickhouse-operator.
|
|
43
|
+
*
|
|
44
|
+
* IMPORTANT: the operator owns the ClickHouse CRDs and watches cluster-wide —
|
|
45
|
+
* install exactly ONE release per cluster (enforced by convention via the
|
|
46
|
+
* `shared` default in `clickhouseOperatorBootstrap`).
|
|
47
|
+
*
|
|
48
|
+
* @param config - Release configuration with Altinity defaults
|
|
49
|
+
* @returns Enhanced HelmRelease resource
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* const release = clickhouseOperatorHelmRelease({
|
|
54
|
+
* name: 'clickhouse-operator',
|
|
55
|
+
* namespace: 'clickhouse-system',
|
|
56
|
+
* version: '0.27.1',
|
|
57
|
+
* id: 'clickhouseOperatorHelmRelease',
|
|
58
|
+
* });
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
export declare function clickhouseOperatorHelmRelease(config: Composable<ClickHouseOperatorHelmReleaseConfig>): Enhanced<HelmReleaseSpec, HelmReleaseStatus>;
|
|
62
|
+
//# sourceMappingURL=helm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helm.d.ts","sourceRoot":"","sources":["../../../../src/factories/clickhouse/resources/helm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAEzE,OAAO,EAGL,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EAC1B,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,KAAK,EACV,8BAA8B,EAC9B,mCAAmC,EACpC,MAAM,aAAa,CAAC;AAErB,mDAAmD;AACnD,eAAO,MAAM,2BAA2B,8BAA8B,CAAC;AAEvE,0EAA0E;AAC1E,eAAO,MAAM,4BAA4B,aAAa,CAAC;AAEvD,oCAAoC;AACpC,eAAO,MAAM,8BAA8B,iCAAiC,CAAC;AAE7E,0DAA0D;AAC1D,eAAO,MAAM,mCAAmC,WAAW,CAAC;AAE5D;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,UAAU,CAAC,8BAA8B,CAAC,GACjD,QAAQ,CAAC,kBAAkB,EAAE,oBAAoB,CAAC,CAgBpD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,UAAU,CAAC,mCAAmC,CAAC,GACtD,QAAQ,CAAC,eAAe,EAAE,iBAAiB,CAAC,CAqB9C"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ClickHouse Operator Helm Resource Factories
|
|
3
|
+
*
|
|
4
|
+
* Wrappers around the generic Helm factories with Altinity-specific defaults.
|
|
5
|
+
* Used by the `clickhouseOperatorBootstrap` composition to install the
|
|
6
|
+
* OFFICIAL Altinity clickhouse-operator (build-around: we wrap the official
|
|
7
|
+
* chart rather than hand-rolling operator manifests).
|
|
8
|
+
*
|
|
9
|
+
* Chart: `altinity-clickhouse-operator` from https://helm.altinity.com
|
|
10
|
+
* (Apache-2.0). The operator is cluster-scoped and owns the ClickHouse CRDs —
|
|
11
|
+
* exactly ONE install per cluster.
|
|
12
|
+
*/
|
|
13
|
+
import { DEFAULT_FLUX_NAMESPACE } from '../../../core/config/defaults.js';
|
|
14
|
+
import { setMetadataField } from '../../../core/metadata/resource-metadata.js';
|
|
15
|
+
import { helmRelease } from '../../helm/helm-release.js';
|
|
16
|
+
import { createHelmRepositoryReadinessEvaluator, helmRepository, } from '../../helm/helm-repository.js';
|
|
17
|
+
import { createLabeledHelmReleaseEvaluator } from '../../helm/readiness-evaluators.js';
|
|
18
|
+
/** Official Altinity Helm chart repository URL. */
|
|
19
|
+
export const DEFAULT_CLICKHOUSE_REPO_URL = 'https://helm.altinity.com';
|
|
20
|
+
/** Default Flux HelmRepository name for the Altinity chart repository. */
|
|
21
|
+
export const DEFAULT_CLICKHOUSE_REPO_NAME = 'altinity';
|
|
22
|
+
/** Official operator chart name. */
|
|
23
|
+
export const CLICKHOUSE_OPERATOR_CHART_NAME = 'altinity-clickhouse-operator';
|
|
24
|
+
/** Default altinity-clickhouse-operator chart version. */
|
|
25
|
+
export const DEFAULT_CLICKHOUSE_OPERATOR_VERSION = '0.27.1';
|
|
26
|
+
/**
|
|
27
|
+
* Create a Flux HelmRepository for the official Altinity chart repository.
|
|
28
|
+
*
|
|
29
|
+
* @param config - Repository configuration with Altinity defaults
|
|
30
|
+
* @returns Enhanced HelmRepository resource
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* const repo = clickhouseHelmRepository({
|
|
35
|
+
* name: 'altinity',
|
|
36
|
+
* namespace: 'flux-system',
|
|
37
|
+
* id: 'clickhouseHelmRepository',
|
|
38
|
+
* });
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export function clickhouseHelmRepository(config) {
|
|
42
|
+
const repo = helmRepository({
|
|
43
|
+
name: config.name || DEFAULT_CLICKHOUSE_REPO_NAME,
|
|
44
|
+
namespace: config.namespace || DEFAULT_FLUX_NAMESPACE,
|
|
45
|
+
url: config.url || DEFAULT_CLICKHOUSE_REPO_URL,
|
|
46
|
+
interval: config.interval || '5m',
|
|
47
|
+
...(config.id && { id: config.id }),
|
|
48
|
+
}).withReadinessEvaluator(createHelmRepositoryReadinessEvaluator('ClickHouse'));
|
|
49
|
+
// The chart repository is one cluster-level Flux source shared by every
|
|
50
|
+
// consumer — never torn down with an individual instance.
|
|
51
|
+
setMetadataField(repo, 'scopes', ['cluster']);
|
|
52
|
+
return repo;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Create a Flux HelmRelease for the Altinity clickhouse-operator.
|
|
56
|
+
*
|
|
57
|
+
* IMPORTANT: the operator owns the ClickHouse CRDs and watches cluster-wide —
|
|
58
|
+
* install exactly ONE release per cluster (enforced by convention via the
|
|
59
|
+
* `shared` default in `clickhouseOperatorBootstrap`).
|
|
60
|
+
*
|
|
61
|
+
* @param config - Release configuration with Altinity defaults
|
|
62
|
+
* @returns Enhanced HelmRelease resource
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```typescript
|
|
66
|
+
* const release = clickhouseOperatorHelmRelease({
|
|
67
|
+
* name: 'clickhouse-operator',
|
|
68
|
+
* namespace: 'clickhouse-system',
|
|
69
|
+
* version: '0.27.1',
|
|
70
|
+
* id: 'clickhouseOperatorHelmRelease',
|
|
71
|
+
* });
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
export function clickhouseOperatorHelmRelease(config) {
|
|
75
|
+
// Pass values directly — the core proxy system handles serialization.
|
|
76
|
+
return helmRelease({
|
|
77
|
+
name: config.name,
|
|
78
|
+
namespace: config.namespace || 'clickhouse-system',
|
|
79
|
+
chart: {
|
|
80
|
+
repository: DEFAULT_CLICKHOUSE_REPO_URL,
|
|
81
|
+
name: CLICKHOUSE_OPERATOR_CHART_NAME,
|
|
82
|
+
version: config.version || DEFAULT_CLICKHOUSE_OPERATOR_VERSION,
|
|
83
|
+
},
|
|
84
|
+
sourceRef: {
|
|
85
|
+
name: config.repositoryName || DEFAULT_CLICKHOUSE_REPO_NAME,
|
|
86
|
+
namespace: DEFAULT_FLUX_NAMESPACE,
|
|
87
|
+
kind: 'HelmRepository',
|
|
88
|
+
},
|
|
89
|
+
driftDetection: { mode: 'enabled' },
|
|
90
|
+
values: config.values || {},
|
|
91
|
+
...(config.id && { id: config.id }),
|
|
92
|
+
}).withReadinessEvaluator(createLabeledHelmReleaseEvaluator('ClickHouse'));
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=helm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helm.js","sourceRoot":"","sources":["../../../../src/factories/clickhouse/resources/helm.ts"],"names":[],"mappings":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U,6BAA6B,CAC3C,MAAuD;IAEvD,sEAAsE;IACtE,OAAO,WAAW,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,SAAS,EAAE,MAAM,CAAC,SAAS,IAAI,mBAAmB;QAClD,KAAK,EAAE;YACL,UAAU,EAAE,2BAA2B;YACvC,IAAI,EAAE,8BAA8B;YACpC,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,mCAAmC;SAC/D;QACD,SAAS,EAAE;YACT,IAAI,EAAE,MAAM,CAAC,cAAc,IAAI,4BAA4B;YAC3D,SAAS,EAAE,sBAAsB;YACjC,IAAI,EAAE,gBAAgB;SACvB;QACD,cAAc,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;QACnC,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,EAAE;QAC3B,GAAG,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC;KACpC,CAAC,CAAC,sBAAsB,CACvB,iCAAiC,CAAC,YAAY,CAAC,CACA,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/factories/clickhouse/resources/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/factories/clickhouse/resources/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ClickHouseInstallation (CHI) Factory
|
|
3
|
+
*
|
|
4
|
+
* Compiles a high-level typed config into a `clickhouse.altinity.com/v1`
|
|
5
|
+
* ClickHouseInstallation managed by the Altinity clickhouse-operator.
|
|
6
|
+
*
|
|
7
|
+
* THE POINT of this typed factory is the zone-pinned layout: the operator's
|
|
8
|
+
* `podDistribution` supports only the `kubernetes.io/hostname` topologyKey
|
|
9
|
+
* (Altinity/clickhouse-operator#772), so per-zone spreading must be compiled
|
|
10
|
+
* as a per-replica `layout.replicas:` list with zone-pinned pod templates.
|
|
11
|
+
* On EKS, EBS volumes are zonal — a replica rescheduled into another AZ
|
|
12
|
+
* strands its PVC (production incident) — so `zones` should be set for any
|
|
13
|
+
* multi-replica production CHI.
|
|
14
|
+
*
|
|
15
|
+
* CHI shape follows the official examples
|
|
16
|
+
* (docs/chi-examples/01-simple-layout-01-1shard-1repl.yaml and
|
|
17
|
+
* 14-zones-distribution-01.yaml in the operator repo).
|
|
18
|
+
*/
|
|
19
|
+
import type { Composable, Enhanced, ResourceStatus } from '../../../core/types/index.js';
|
|
20
|
+
import type { ClickHouseInstallationConfig, ClickHouseInstallationSpec, ClickHouseInstallationStatus } from '../types.js';
|
|
21
|
+
/**
|
|
22
|
+
* Known CHI/CHK reconcile status strings.
|
|
23
|
+
*
|
|
24
|
+
* Source: clickhouse-operator `pkg/apis/clickhouse.altinity.com/v1/type_status.go`
|
|
25
|
+
* (StatusInProgress/StatusCompleted/StatusAborted/StatusTerminating). The
|
|
26
|
+
* operator writes them to `status.status`; `Completed` means the installation
|
|
27
|
+
* is fully reconciled.
|
|
28
|
+
*/
|
|
29
|
+
export declare const CHI_STATUS: {
|
|
30
|
+
readonly IN_PROGRESS: "InProgress";
|
|
31
|
+
readonly COMPLETED: "Completed";
|
|
32
|
+
readonly ABORTED: "Aborted";
|
|
33
|
+
readonly TERMINATING: "Terminating";
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* CHI/CHK Readiness Evaluator
|
|
37
|
+
*
|
|
38
|
+
* Keys off the operator-reported `status.status` reconcile state (see
|
|
39
|
+
* CHI_STATUS). Unlike condition-based CRDs, the clickhouse-operator reports a
|
|
40
|
+
* single status string plus host progress counters.
|
|
41
|
+
*/
|
|
42
|
+
export declare function chiReadinessEvaluator(liveResource: unknown): ResourceStatus;
|
|
43
|
+
/**
|
|
44
|
+
* Default logical cluster name.
|
|
45
|
+
*
|
|
46
|
+
* SIGNOZ COMPATIBILITY: SigNoz's ClickHouse migrations hardcode the cluster
|
|
47
|
+
* name `cluster`, so a CHI consumed by SigNoz MUST keep this default.
|
|
48
|
+
*/
|
|
49
|
+
export declare const DEFAULT_CHI_CLUSTER_NAME = "cluster";
|
|
50
|
+
/**
|
|
51
|
+
* ClickHouseInstallation Factory (LOW-LEVEL, concrete topology)
|
|
52
|
+
*
|
|
53
|
+
* Creates a ClickHouse cluster managed by the Altinity clickhouse-operator.
|
|
54
|
+
*
|
|
55
|
+
* BUILD-TIME topology fields (`shards`, `replicas`, `zones`, user names) must
|
|
56
|
+
* be concrete JS values — the factory throws loudly if any receives a schema
|
|
57
|
+
* reference (the compiler enumerates templates/replica entries from them).
|
|
58
|
+
* Prefer `makeClickHouseCluster()` in compositions: it fixes the topology at
|
|
59
|
+
* construction time and exposes only proxy-safe runtime spec.
|
|
60
|
+
*
|
|
61
|
+
* @param config - High-level installation configuration
|
|
62
|
+
* @returns Enhanced ClickHouseInstallation resource with readiness evaluation
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```typescript
|
|
66
|
+
* const chi = clickHouseInstallation({
|
|
67
|
+
* name: 'signoz-clickhouse',
|
|
68
|
+
* namespace: 'observability',
|
|
69
|
+
* version: '25.12.5', // SigNoz-coupled server version
|
|
70
|
+
* shards: 1,
|
|
71
|
+
* replicas: 2,
|
|
72
|
+
* zones: ['us-east-2a', 'us-east-2b'], // zone-pinned replicas (EBS is zonal)
|
|
73
|
+
* storage: { size: '100Gi', storageClassName: 'gp3-expandable' },
|
|
74
|
+
* users: [{ name: 'signoz', passwordSha256Hex: '...', networksIp: ['::/0'] }],
|
|
75
|
+
* keeper: { host: 'keeper-signoz.observability.svc.cluster.local' },
|
|
76
|
+
* id: 'signozClickhouse',
|
|
77
|
+
* });
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
declare function createClickHouseInstallationResource(config: Composable<ClickHouseInstallationConfig>): Enhanced<ClickHouseInstallationSpec, ClickHouseInstallationStatus>;
|
|
81
|
+
export declare const clickHouseInstallation: typeof createClickHouseInstallationResource;
|
|
82
|
+
export {};
|
|
83
|
+
//# sourceMappingURL=installation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installation.d.ts","sourceRoot":"","sources":["../../../../src/factories/clickhouse/resources/installation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAGzF,OAAO,KAAK,EAEV,4BAA4B,EAC5B,0BAA0B,EAC1B,4BAA4B,EAC7B,MAAM,aAAa,CAAC;AAIrB;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU;;;;;CAKb,CAAC;AAEX;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,OAAO,GAAG,cAAc,CAoD3E;AAKD;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,YAAY,CAAC;AA6LlD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,iBAAS,oCAAoC,CAC3C,MAAM,EAAE,UAAU,CAAC,4BAA4B,CAAC,GAC/C,QAAQ,CAAC,0BAA0B,EAAE,4BAA4B,CAAC,CAmBpE;AAED,eAAO,MAAM,sBAAsB,6CAAuC,CAAC"}
|