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,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zone-pinned CHI layout compilation.
|
|
3
|
+
*
|
|
4
|
+
* WHY THIS EXISTS: the clickhouse-operator's own `podDistribution` supports
|
|
5
|
+
* ONLY the `kubernetes.io/hostname` topologyKey (Altinity/clickhouse-operator
|
|
6
|
+
* issue #772), so per-ZONE spreading cannot be expressed operator-natively.
|
|
7
|
+
* On EKS this matters operationally: EBS volumes are ZONAL, so a replica pod
|
|
8
|
+
* rescheduled into another AZ strands its PVC and the pod wedges Pending
|
|
9
|
+
* (we hit exactly this in production). The fix the operator DOES support is a
|
|
10
|
+
* per-replica `layout.replicas:` list where each replica's pod template pins
|
|
11
|
+
* one zone via nodeAffinity on `topology.kubernetes.io/zone` — this module
|
|
12
|
+
* compiles that layout deterministically.
|
|
13
|
+
*
|
|
14
|
+
* These helpers are pure (no resource construction) and unit-tested directly.
|
|
15
|
+
*/
|
|
16
|
+
/** Standard Kubernetes zone topology label. */
|
|
17
|
+
export const ZONE_TOPOLOGY_KEY = 'topology.kubernetes.io/zone';
|
|
18
|
+
/**
|
|
19
|
+
* Assign one zone per replica index, round-robin.
|
|
20
|
+
*
|
|
21
|
+
* When `replicaCount > zones.length`, zones repeat in order:
|
|
22
|
+
* replicas=5, zones=[a,b,c] → [a, b, c, a, b].
|
|
23
|
+
*
|
|
24
|
+
* @param replicaCount - Number of replicas per shard
|
|
25
|
+
* @param zones - Non-empty list of availability zones
|
|
26
|
+
* @returns Zone for each replica index (length === replicaCount)
|
|
27
|
+
*/
|
|
28
|
+
export function assignZonesRoundRobin(replicaCount, zones) {
|
|
29
|
+
if (zones.length === 0) {
|
|
30
|
+
throw new Error('assignZonesRoundRobin requires at least one zone');
|
|
31
|
+
}
|
|
32
|
+
if (!Number.isInteger(replicaCount) || replicaCount < 1) {
|
|
33
|
+
throw new Error(`assignZonesRoundRobin requires a positive integer replica count, got ${replicaCount}`);
|
|
34
|
+
}
|
|
35
|
+
return Array.from({ length: replicaCount }, (_, index) => {
|
|
36
|
+
const zone = zones[index % zones.length];
|
|
37
|
+
if (zone === undefined) {
|
|
38
|
+
throw new Error(`Zone assignment failed for replica ${index}`);
|
|
39
|
+
}
|
|
40
|
+
return zone;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Deterministic pod template name for a zone-pinned template.
|
|
45
|
+
*
|
|
46
|
+
* Zone names are DNS-safe label values, so embedding them keeps the template
|
|
47
|
+
* name valid and self-describing (e.g. `clickhouse-us-east-2a`).
|
|
48
|
+
*/
|
|
49
|
+
export function zonePodTemplateName(baseName, zone) {
|
|
50
|
+
return `${baseName}-${zone}`;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Explicit required nodeAffinity pinning a pod to one zone.
|
|
54
|
+
*
|
|
55
|
+
* Emitted as a plain PodSpec affinity (rather than the operator's
|
|
56
|
+
* `podTemplate.zone` sugar) so the pinning is visible verbatim in the
|
|
57
|
+
* rendered CHI and doesn't depend on operator-side template expansion.
|
|
58
|
+
*/
|
|
59
|
+
export function zoneNodeAffinity(zone) {
|
|
60
|
+
return {
|
|
61
|
+
nodeAffinity: {
|
|
62
|
+
requiredDuringSchedulingIgnoredDuringExecution: {
|
|
63
|
+
nodeSelectorTerms: [
|
|
64
|
+
{
|
|
65
|
+
matchExpressions: [
|
|
66
|
+
{
|
|
67
|
+
key: ZONE_TOPOLOGY_KEY,
|
|
68
|
+
operator: 'In',
|
|
69
|
+
values: [zone],
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Compile the per-replica zone-pinned layout for a CHI cluster.
|
|
80
|
+
*
|
|
81
|
+
* @param options.replicaCount - Replicas per shard
|
|
82
|
+
* @param options.zones - Availability zones to round-robin replicas across
|
|
83
|
+
* @param options.podTemplateBaseName - Base name for generated pod templates
|
|
84
|
+
* @param options.podSpec - Shared PodSpec (containers etc.); the zone
|
|
85
|
+
* nodeAffinity is merged in per template
|
|
86
|
+
*/
|
|
87
|
+
export function compileZonePinnedLayout(options) {
|
|
88
|
+
const { replicaCount, zones, podTemplateBaseName, podSpec } = options;
|
|
89
|
+
const assignments = assignZonesRoundRobin(replicaCount, zones);
|
|
90
|
+
const distinctZones = [...new Set(assignments)];
|
|
91
|
+
const podTemplates = distinctZones.map((zone) => ({
|
|
92
|
+
name: zonePodTemplateName(podTemplateBaseName, zone),
|
|
93
|
+
spec: {
|
|
94
|
+
...podSpec,
|
|
95
|
+
affinity: zoneNodeAffinity(zone),
|
|
96
|
+
},
|
|
97
|
+
}));
|
|
98
|
+
const replicas = assignments.map((zone) => ({
|
|
99
|
+
templates: { podTemplate: zonePodTemplateName(podTemplateBaseName, zone) },
|
|
100
|
+
}));
|
|
101
|
+
return { replicas, podTemplates };
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=zone-layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zone-layout.js","sourceRoot":"","sources":["../../../../src/factories/clickhouse/utils/zone-layout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,+CAA+C;AAC/C,MAAM,CAAC,MAAM,iBAAiB,GAAG,6BAA6B,CAAC;AAE/D;;;;;;;;;GASG;AACH,MAAM,UAAU,qBAAqB,CACnC,YAAoB,EACpB,KAAwB;IAExB,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACtE,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,YAAY,GAAG,CAAC,EAAE,CAAC;QACxD,MAAM,IAAI,KAAK,CACb,wEAAwE,YAAY,EAAE,CACvF,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE;QACvD,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;QACzC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,sCAAsC,KAAK,EAAE,CAAC,CAAC;QACjE,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AAC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E,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ClickStack (HyperDX) Bootstrap Composition — EXTERNAL ClickHouse only.
|
|
3
|
+
*
|
|
4
|
+
* Deploys the OFFICIAL `clickstack` chart (3.0.x, MIT) from
|
|
5
|
+
* https://clickhouse.github.io/ClickStack-helm-charts via HelmRepository and
|
|
6
|
+
* HelmRelease resources. Build-around: we wrap the official chart — never
|
|
7
|
+
* hand-rolled manifests. NOT the archived hyperdxio/helm-charts repo, NOT the
|
|
8
|
+
* deprecated `hdx-oss-v2` chart, and NOT the `clickstack-operators`
|
|
9
|
+
* prerequisite chart (its ClickHouse operator CRDs would collide with the
|
|
10
|
+
* Altinity clickhouse-operator that manages our ClickHouseInstallation, and
|
|
11
|
+
* it drags in a MongoDB operator we don't want).
|
|
12
|
+
*
|
|
13
|
+
* BUILD-TIME vs RUNTIME: `makeClickstackBootstrap(options)` constructs a
|
|
14
|
+
* composition VARIANT. Options that decide WHICH resources exist (the Mongo
|
|
15
|
+
* mode + its storage shape) and the static raw chart values are build-time —
|
|
16
|
+
* plain JS may branch on them because they are always concrete. The runtime
|
|
17
|
+
* spec carries only proxy-safe values (names, namespaces, endpoints,
|
|
18
|
+
* versions, credentials); a user composing with `schema.spec.*` refs never
|
|
19
|
+
* hits a JS branch on a proxy.
|
|
20
|
+
*
|
|
21
|
+
* What gets deployed:
|
|
22
|
+
* 1. The target Namespace.
|
|
23
|
+
* 2. The shared ClickStack HelmRepository singleton.
|
|
24
|
+
* 3. Internal-Mongo variant only: a minimal single-replica Mongo
|
|
25
|
+
* StatefulSet + Service (`mongo:7`, no operator/CRDs/auth — APP METADATA
|
|
26
|
+
* ONLY, dev-first; see resources/mongo.ts for the loud caveats).
|
|
27
|
+
* 4. The clickstack HelmRelease: HyperDX (UI/API/OpAMP) + the OTel gateway
|
|
28
|
+
* collector subchart, wired to the EXTERNAL ClickHouse
|
|
29
|
+
* (`clickhouse.enabled: false` and `mongodb.enabled: false` are hard-pinned
|
|
30
|
+
* by the values mapper and beat the build-time values passthrough).
|
|
31
|
+
*
|
|
32
|
+
* STATUS CONTRACT: beyond ready/phase, the status exposes `ui.url`,
|
|
33
|
+
* `gateway.otlpHttpEndpoint` / `gateway.otlpGrpcEndpoint`, and
|
|
34
|
+
* `app.host/appPort/apiPort` so downstream compositions (e.g.
|
|
35
|
+
* `clickstackK8sTelemetry`) consume connection details without reconstructing
|
|
36
|
+
* chart naming rules. The mapper pins `fullnameOverride` to the release name
|
|
37
|
+
* to make that naming deterministic; endpoints are derived from the owned
|
|
38
|
+
* HelmRelease resource's metadata (never `schema.spec.*` — KRO status CEL
|
|
39
|
+
* cannot reference the instance spec).
|
|
40
|
+
*
|
|
41
|
+
* SCHEMA / REPLICATION CAVEAT: on first start the gateway collector's goose
|
|
42
|
+
* migrations create `otel_logs` / `otel_traces` / `otel_metrics_*` /
|
|
43
|
+
* `hyperdx_sessions` in the external ClickHouse as plain single-node
|
|
44
|
+
* MergeTree tables. That matches a 1-replica CHI (our dev-first sizing);
|
|
45
|
+
* multi-replica / `ON CLUSTER` schemas are NOT supported by ClickStack's
|
|
46
|
+
* tooling — revisit (and see `CLICKSTACK_CLICKHOUSE_GUIDANCE`) before scaling
|
|
47
|
+
* the CHI. Version coupling is loose: chart vendors CH 25.7, seed schemas
|
|
48
|
+
* carry a <26.2 compat variant, and the optional JSON-typed schema
|
|
49
|
+
* (`HYPERDX_OTEL_EXPORTER_CLICKHOUSE_JSON_ENABLE`) wants CH 25.3+.
|
|
50
|
+
*
|
|
51
|
+
* @example Internal Mongo (default)
|
|
52
|
+
* ```typescript
|
|
53
|
+
* const factory = clickstackBootstrap.factory('kro', { namespace: 'clickstack' });
|
|
54
|
+
*
|
|
55
|
+
* await factory.deploy({
|
|
56
|
+
* name: 'clickstack',
|
|
57
|
+
* clickhouse: {
|
|
58
|
+
* host: 'clickhouse-observability.clickhouse.svc.cluster.local',
|
|
59
|
+
* username: 'otelcollector',
|
|
60
|
+
* password: '…',
|
|
61
|
+
* },
|
|
62
|
+
* });
|
|
63
|
+
* ```
|
|
64
|
+
*
|
|
65
|
+
* @example External Mongo (build-time variant)
|
|
66
|
+
* ```typescript
|
|
67
|
+
* const bootstrap = makeClickstackBootstrap({ mongo: { mode: 'external' } });
|
|
68
|
+
*
|
|
69
|
+
* await bootstrap.factory('kro').deploy({
|
|
70
|
+
* name: 'clickstack',
|
|
71
|
+
* clickhouse: { host: '…' },
|
|
72
|
+
* mongoUri: 'mongodb://user:pass@mongo.example.com:27017/hyperdx',
|
|
73
|
+
* });
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
import { type ClickStackExternalMongoBuildOptions, type ClickStackInternalMongoBuildOptions } from '../types.js';
|
|
77
|
+
declare function buildInternalComposition(options: ClickStackInternalMongoBuildOptions): import("../../../index.js").CallableComposition<{
|
|
78
|
+
name: string;
|
|
79
|
+
clickhouse: {
|
|
80
|
+
host: string;
|
|
81
|
+
nativePort?: number;
|
|
82
|
+
httpPort?: number;
|
|
83
|
+
database?: string;
|
|
84
|
+
username?: string;
|
|
85
|
+
password?: string;
|
|
86
|
+
appUsername?: string;
|
|
87
|
+
appPassword?: string;
|
|
88
|
+
};
|
|
89
|
+
namespace?: string;
|
|
90
|
+
version?: string;
|
|
91
|
+
apiKey?: string;
|
|
92
|
+
hyperdx?: {
|
|
93
|
+
replicas?: number;
|
|
94
|
+
resources?: {
|
|
95
|
+
requests?: {
|
|
96
|
+
cpu?: string;
|
|
97
|
+
memory?: string;
|
|
98
|
+
};
|
|
99
|
+
limits?: {
|
|
100
|
+
cpu?: string;
|
|
101
|
+
memory?: string;
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
image?: {
|
|
105
|
+
repository?: string;
|
|
106
|
+
tag?: string;
|
|
107
|
+
pullPolicy?: "Always" | "IfNotPresent" | "Never";
|
|
108
|
+
};
|
|
109
|
+
frontendUrl?: string;
|
|
110
|
+
};
|
|
111
|
+
}, {
|
|
112
|
+
ready: boolean;
|
|
113
|
+
phase: "Ready" | "Failed" | "Installing";
|
|
114
|
+
ui: {
|
|
115
|
+
url: string;
|
|
116
|
+
};
|
|
117
|
+
gateway: {
|
|
118
|
+
otlpHttpEndpoint: string;
|
|
119
|
+
otlpGrpcEndpoint: string;
|
|
120
|
+
};
|
|
121
|
+
app: {
|
|
122
|
+
host: string;
|
|
123
|
+
appPort: number;
|
|
124
|
+
apiPort: number;
|
|
125
|
+
};
|
|
126
|
+
version?: string;
|
|
127
|
+
}>;
|
|
128
|
+
declare function buildExternalComposition(options: ClickStackExternalMongoBuildOptions): import("../../../index.js").CallableComposition<{
|
|
129
|
+
mongoUri: string;
|
|
130
|
+
name: string;
|
|
131
|
+
clickhouse: {
|
|
132
|
+
host: string;
|
|
133
|
+
nativePort?: number;
|
|
134
|
+
httpPort?: number;
|
|
135
|
+
database?: string;
|
|
136
|
+
username?: string;
|
|
137
|
+
password?: string;
|
|
138
|
+
appUsername?: string;
|
|
139
|
+
appPassword?: string;
|
|
140
|
+
};
|
|
141
|
+
namespace?: string;
|
|
142
|
+
version?: string;
|
|
143
|
+
apiKey?: string;
|
|
144
|
+
hyperdx?: {
|
|
145
|
+
replicas?: number;
|
|
146
|
+
resources?: {
|
|
147
|
+
requests?: {
|
|
148
|
+
cpu?: string;
|
|
149
|
+
memory?: string;
|
|
150
|
+
};
|
|
151
|
+
limits?: {
|
|
152
|
+
cpu?: string;
|
|
153
|
+
memory?: string;
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
image?: {
|
|
157
|
+
repository?: string;
|
|
158
|
+
tag?: string;
|
|
159
|
+
pullPolicy?: "Always" | "IfNotPresent" | "Never";
|
|
160
|
+
};
|
|
161
|
+
frontendUrl?: string;
|
|
162
|
+
};
|
|
163
|
+
}, {
|
|
164
|
+
ready: boolean;
|
|
165
|
+
phase: "Ready" | "Failed" | "Installing";
|
|
166
|
+
ui: {
|
|
167
|
+
url: string;
|
|
168
|
+
};
|
|
169
|
+
gateway: {
|
|
170
|
+
otlpHttpEndpoint: string;
|
|
171
|
+
otlpGrpcEndpoint: string;
|
|
172
|
+
};
|
|
173
|
+
app: {
|
|
174
|
+
host: string;
|
|
175
|
+
appPort: number;
|
|
176
|
+
apiPort: number;
|
|
177
|
+
};
|
|
178
|
+
version?: string;
|
|
179
|
+
}>;
|
|
180
|
+
/** Composition type for the internal-Mongo variant. */
|
|
181
|
+
export type ClickStackBootstrapComposition = ReturnType<typeof buildInternalComposition>;
|
|
182
|
+
/** Composition type for the external-Mongo variant. */
|
|
183
|
+
export type ClickStackExternalMongoBootstrapComposition = ReturnType<typeof buildExternalComposition>;
|
|
184
|
+
/**
|
|
185
|
+
* Construct a ClickStack bootstrap composition variant. Build-time options
|
|
186
|
+
* select WHICH resources exist (Mongo mode/storage) and bake static raw chart
|
|
187
|
+
* values; everything per-instance stays in the runtime spec.
|
|
188
|
+
*/
|
|
189
|
+
export declare function makeClickstackBootstrap(options?: ClickStackInternalMongoBuildOptions): ClickStackBootstrapComposition;
|
|
190
|
+
export declare function makeClickstackBootstrap(options: ClickStackExternalMongoBuildOptions): ClickStackExternalMongoBootstrapComposition;
|
|
191
|
+
/**
|
|
192
|
+
* The default ClickStack bootstrap: internal single-replica Mongo (dev-first),
|
|
193
|
+
* default RGD name/kind. Use `makeClickstackBootstrap(...)` for the
|
|
194
|
+
* external-Mongo variant, custom Mongo storage, or static raw chart values.
|
|
195
|
+
*/
|
|
196
|
+
export declare const clickstackBootstrap: import("../../../index.js").CallableComposition<{
|
|
197
|
+
name: string;
|
|
198
|
+
clickhouse: {
|
|
199
|
+
host: string;
|
|
200
|
+
nativePort?: number;
|
|
201
|
+
httpPort?: number;
|
|
202
|
+
database?: string;
|
|
203
|
+
username?: string;
|
|
204
|
+
password?: string;
|
|
205
|
+
appUsername?: string;
|
|
206
|
+
appPassword?: string;
|
|
207
|
+
};
|
|
208
|
+
namespace?: string;
|
|
209
|
+
version?: string;
|
|
210
|
+
apiKey?: string;
|
|
211
|
+
hyperdx?: {
|
|
212
|
+
replicas?: number;
|
|
213
|
+
resources?: {
|
|
214
|
+
requests?: {
|
|
215
|
+
cpu?: string;
|
|
216
|
+
memory?: string;
|
|
217
|
+
};
|
|
218
|
+
limits?: {
|
|
219
|
+
cpu?: string;
|
|
220
|
+
memory?: string;
|
|
221
|
+
};
|
|
222
|
+
};
|
|
223
|
+
image?: {
|
|
224
|
+
repository?: string;
|
|
225
|
+
tag?: string;
|
|
226
|
+
pullPolicy?: "Always" | "IfNotPresent" | "Never";
|
|
227
|
+
};
|
|
228
|
+
frontendUrl?: string;
|
|
229
|
+
};
|
|
230
|
+
}, {
|
|
231
|
+
ready: boolean;
|
|
232
|
+
phase: "Ready" | "Failed" | "Installing";
|
|
233
|
+
ui: {
|
|
234
|
+
url: string;
|
|
235
|
+
};
|
|
236
|
+
gateway: {
|
|
237
|
+
otlpHttpEndpoint: string;
|
|
238
|
+
otlpGrpcEndpoint: string;
|
|
239
|
+
};
|
|
240
|
+
app: {
|
|
241
|
+
host: string;
|
|
242
|
+
appPort: number;
|
|
243
|
+
apiPort: number;
|
|
244
|
+
};
|
|
245
|
+
version?: string;
|
|
246
|
+
}>;
|
|
247
|
+
export {};
|
|
248
|
+
//# sourceMappingURL=clickstack-bootstrap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clickstack-bootstrap.d.ts","sourceRoot":"","sources":["../../../../src/factories/clickstack/compositions/clickstack-bootstrap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0EG;AAoBH,OAAO,EAQL,KAAK,mCAAmC,EACxC,KAAK,mCAAmC,EAEzC,MAAM,aAAa,CAAC;AAwJrB,iBAAS,wBAAwB,CAAC,OAAO,EAAE,mCAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAe7E;AAED,iBAAS,wBAAwB,CAAC,OAAO,EAAE,mCAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAc7E;AAED,uDAAuD;AACvD,MAAM,MAAM,8BAA8B,GAAG,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAEzF,uDAAuD;AACvD,MAAM,MAAM,2CAA2C,GAAG,UAAU,CAClE,OAAO,wBAAwB,CAChC,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,CAAC,EAAE,mCAAmC,GAC5C,8BAA8B,CAAC;AAClC,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,mCAAmC,GAC3C,2CAA2C,CAAC;AAmB/C;;;;GAIG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA4B,CAAC"}
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ClickStack (HyperDX) Bootstrap Composition — EXTERNAL ClickHouse only.
|
|
3
|
+
*
|
|
4
|
+
* Deploys the OFFICIAL `clickstack` chart (3.0.x, MIT) from
|
|
5
|
+
* https://clickhouse.github.io/ClickStack-helm-charts via HelmRepository and
|
|
6
|
+
* HelmRelease resources. Build-around: we wrap the official chart — never
|
|
7
|
+
* hand-rolled manifests. NOT the archived hyperdxio/helm-charts repo, NOT the
|
|
8
|
+
* deprecated `hdx-oss-v2` chart, and NOT the `clickstack-operators`
|
|
9
|
+
* prerequisite chart (its ClickHouse operator CRDs would collide with the
|
|
10
|
+
* Altinity clickhouse-operator that manages our ClickHouseInstallation, and
|
|
11
|
+
* it drags in a MongoDB operator we don't want).
|
|
12
|
+
*
|
|
13
|
+
* BUILD-TIME vs RUNTIME: `makeClickstackBootstrap(options)` constructs a
|
|
14
|
+
* composition VARIANT. Options that decide WHICH resources exist (the Mongo
|
|
15
|
+
* mode + its storage shape) and the static raw chart values are build-time —
|
|
16
|
+
* plain JS may branch on them because they are always concrete. The runtime
|
|
17
|
+
* spec carries only proxy-safe values (names, namespaces, endpoints,
|
|
18
|
+
* versions, credentials); a user composing with `schema.spec.*` refs never
|
|
19
|
+
* hits a JS branch on a proxy.
|
|
20
|
+
*
|
|
21
|
+
* What gets deployed:
|
|
22
|
+
* 1. The target Namespace.
|
|
23
|
+
* 2. The shared ClickStack HelmRepository singleton.
|
|
24
|
+
* 3. Internal-Mongo variant only: a minimal single-replica Mongo
|
|
25
|
+
* StatefulSet + Service (`mongo:7`, no operator/CRDs/auth — APP METADATA
|
|
26
|
+
* ONLY, dev-first; see resources/mongo.ts for the loud caveats).
|
|
27
|
+
* 4. The clickstack HelmRelease: HyperDX (UI/API/OpAMP) + the OTel gateway
|
|
28
|
+
* collector subchart, wired to the EXTERNAL ClickHouse
|
|
29
|
+
* (`clickhouse.enabled: false` and `mongodb.enabled: false` are hard-pinned
|
|
30
|
+
* by the values mapper and beat the build-time values passthrough).
|
|
31
|
+
*
|
|
32
|
+
* STATUS CONTRACT: beyond ready/phase, the status exposes `ui.url`,
|
|
33
|
+
* `gateway.otlpHttpEndpoint` / `gateway.otlpGrpcEndpoint`, and
|
|
34
|
+
* `app.host/appPort/apiPort` so downstream compositions (e.g.
|
|
35
|
+
* `clickstackK8sTelemetry`) consume connection details without reconstructing
|
|
36
|
+
* chart naming rules. The mapper pins `fullnameOverride` to the release name
|
|
37
|
+
* to make that naming deterministic; endpoints are derived from the owned
|
|
38
|
+
* HelmRelease resource's metadata (never `schema.spec.*` — KRO status CEL
|
|
39
|
+
* cannot reference the instance spec).
|
|
40
|
+
*
|
|
41
|
+
* SCHEMA / REPLICATION CAVEAT: on first start the gateway collector's goose
|
|
42
|
+
* migrations create `otel_logs` / `otel_traces` / `otel_metrics_*` /
|
|
43
|
+
* `hyperdx_sessions` in the external ClickHouse as plain single-node
|
|
44
|
+
* MergeTree tables. That matches a 1-replica CHI (our dev-first sizing);
|
|
45
|
+
* multi-replica / `ON CLUSTER` schemas are NOT supported by ClickStack's
|
|
46
|
+
* tooling — revisit (and see `CLICKSTACK_CLICKHOUSE_GUIDANCE`) before scaling
|
|
47
|
+
* the CHI. Version coupling is loose: chart vendors CH 25.7, seed schemas
|
|
48
|
+
* carry a <26.2 compat variant, and the optional JSON-typed schema
|
|
49
|
+
* (`HYPERDX_OTEL_EXPORTER_CLICKHOUSE_JSON_ENABLE`) wants CH 25.3+.
|
|
50
|
+
*
|
|
51
|
+
* @example Internal Mongo (default)
|
|
52
|
+
* ```typescript
|
|
53
|
+
* const factory = clickstackBootstrap.factory('kro', { namespace: 'clickstack' });
|
|
54
|
+
*
|
|
55
|
+
* await factory.deploy({
|
|
56
|
+
* name: 'clickstack',
|
|
57
|
+
* clickhouse: {
|
|
58
|
+
* host: 'clickhouse-observability.clickhouse.svc.cluster.local',
|
|
59
|
+
* username: 'otelcollector',
|
|
60
|
+
* password: '…',
|
|
61
|
+
* },
|
|
62
|
+
* });
|
|
63
|
+
* ```
|
|
64
|
+
*
|
|
65
|
+
* @example External Mongo (build-time variant)
|
|
66
|
+
* ```typescript
|
|
67
|
+
* const bootstrap = makeClickstackBootstrap({ mongo: { mode: 'external' } });
|
|
68
|
+
*
|
|
69
|
+
* await bootstrap.factory('kro').deploy({
|
|
70
|
+
* name: 'clickstack',
|
|
71
|
+
* clickhouse: { host: '…' },
|
|
72
|
+
* mongoUri: 'mongodb://user:pass@mongo.example.com:27017/hyperdx',
|
|
73
|
+
* });
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
import { kubernetesComposition } from '../../../core/composition/imperative.js';
|
|
77
|
+
import { DEFAULT_FLUX_NAMESPACE } from '../../../core/config/defaults.js';
|
|
78
|
+
import { Cel } from '../../../core/references/cel.js';
|
|
79
|
+
import { singleton } from '../../../core/singleton/singleton.js';
|
|
80
|
+
import { containsKubernetesRefs, isKubernetesRef } from '../../../utils/type-guards.js';
|
|
81
|
+
import { namespace } from '../../kubernetes/core/namespace.js';
|
|
82
|
+
import { CLICKSTACK_API_PORT, CLICKSTACK_APP_PORT, CLICKSTACK_GATEWAY_NAME_SUFFIX, CLICKSTACK_OTLP_GRPC_PORT, CLICKSTACK_OTLP_HTTP_PORT, clickstackHelmRelease, DEFAULT_CLICKSTACK_REPO_NAME, DEFAULT_CLICKSTACK_REPO_URL, DEFAULT_CLICKSTACK_VERSION, } from '../resources/helm.js';
|
|
83
|
+
import { clickstackMongoService, clickstackMongoStatefulSet } from '../resources/mongo.js';
|
|
84
|
+
import { ClickStackBootstrapConfigSchema, ClickStackBootstrapStatusSchema, ClickStackExternalMongoBootstrapConfigSchema, } from '../types.js';
|
|
85
|
+
import { DEFAULT_CLICKSTACK_NAMESPACE, mapClickStackConfigToHelmValues, } from '../utils/helm-values-mapper.js';
|
|
86
|
+
import { clickstackHelmRepositoryBootstrap } from './clickstack-helm-repository.js';
|
|
87
|
+
/**
|
|
88
|
+
* Shared composition body. `build` is CONCRETE (construction-time), so every
|
|
89
|
+
* plain-JS branch below is on build config — never on the (possibly
|
|
90
|
+
* schema-proxy) runtime spec.
|
|
91
|
+
*
|
|
92
|
+
* NOTE: the variant builders pass INLINE delegating arrows
|
|
93
|
+
* (`(spec) => bootstrapBody(spec, build)`) to `kubernetesComposition` — a
|
|
94
|
+
* composition function that is itself a returned closure defeats the
|
|
95
|
+
* composition analyzer and mis-serializes mixed CEL templates (verified
|
|
96
|
+
* empirically: `Cel.template` values came out double-wrapped as
|
|
97
|
+
* `${tcp://${…}}`).
|
|
98
|
+
*/
|
|
99
|
+
function bootstrapBody(spec, build) {
|
|
100
|
+
{
|
|
101
|
+
const resolvedNamespace = isKubernetesRef(spec.namespace)
|
|
102
|
+
? Cel.default(spec.namespace, DEFAULT_CLICKSTACK_NAMESPACE)
|
|
103
|
+
: (spec.namespace ?? DEFAULT_CLICKSTACK_NAMESPACE);
|
|
104
|
+
const resolvedVersion = isKubernetesRef(spec.version)
|
|
105
|
+
? Cel.default(spec.version, DEFAULT_CLICKSTACK_VERSION)
|
|
106
|
+
: (spec.version ?? DEFAULT_CLICKSTACK_VERSION);
|
|
107
|
+
const helmValues = mapClickStackConfigToHelmValues(spec, {
|
|
108
|
+
mongoMode: build.mongoMode,
|
|
109
|
+
...(build.values !== undefined && { values: build.values }),
|
|
110
|
+
});
|
|
111
|
+
const _clickstackNamespace = namespace({
|
|
112
|
+
metadata: {
|
|
113
|
+
name: resolvedNamespace,
|
|
114
|
+
labels: {
|
|
115
|
+
'app.kubernetes.io/name': 'clickstack',
|
|
116
|
+
'app.kubernetes.io/instance': spec.name,
|
|
117
|
+
'app.kubernetes.io/managed-by': 'typekro',
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
id: 'clickstackNamespace',
|
|
121
|
+
});
|
|
122
|
+
// One cluster-level Flux source shared by every ClickStack instance —
|
|
123
|
+
// singleton(...) keeps it out of any single instance's KRO ApplySet
|
|
124
|
+
// (see clickstack-helm-repository.ts for the ownership rationale).
|
|
125
|
+
const _clickstackHelmRepository = singleton(clickstackHelmRepositoryBootstrap, {
|
|
126
|
+
id: 'clickstack-helm-repository',
|
|
127
|
+
spec: {
|
|
128
|
+
name: DEFAULT_CLICKSTACK_REPO_NAME,
|
|
129
|
+
namespace: DEFAULT_FLUX_NAMESPACE,
|
|
130
|
+
url: DEFAULT_CLICKSTACK_REPO_URL,
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
// ── Internal Mongo (build-time variant) ─────────────────────────────
|
|
134
|
+
if (build.mongoMode === 'internal') {
|
|
135
|
+
const _mongoStatefulSet = clickstackMongoStatefulSet({
|
|
136
|
+
name: spec.name,
|
|
137
|
+
namespace: resolvedNamespace,
|
|
138
|
+
...(build.storage?.size !== undefined && { storageSize: build.storage.size }),
|
|
139
|
+
...(build.storage?.storageClassName !== undefined && {
|
|
140
|
+
storageClassName: build.storage.storageClassName,
|
|
141
|
+
}),
|
|
142
|
+
statefulSetId: 'clickstackMongoStatefulSet',
|
|
143
|
+
});
|
|
144
|
+
const _mongoService = clickstackMongoService({
|
|
145
|
+
name: spec.name,
|
|
146
|
+
namespace: resolvedNamespace,
|
|
147
|
+
serviceId: 'clickstackMongoService',
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
// ── ClickStack HelmRelease ───────────────────────────────────────────
|
|
151
|
+
//
|
|
152
|
+
// The HelmRelease does not set `disableWait`, so helm-controller waits
|
|
153
|
+
// for the chart's workloads (HyperDX app + gateway collector) before
|
|
154
|
+
// reporting Ready — readiness is workload-aware, mirroring the
|
|
155
|
+
// dagster/clickhouse bootstraps. The HyperDX pod's own waitForMongodb
|
|
156
|
+
// init container gates on Mongo reachability, so no explicit dependency
|
|
157
|
+
// on the internal Mongo is needed.
|
|
158
|
+
const _clickstackHelmRelease = clickstackHelmRelease({
|
|
159
|
+
name: spec.name,
|
|
160
|
+
namespace: resolvedNamespace,
|
|
161
|
+
version: resolvedVersion,
|
|
162
|
+
values: helmValues,
|
|
163
|
+
id: 'clickstackHelmRelease',
|
|
164
|
+
});
|
|
165
|
+
const helmReleaseReady = Cel.expr(_clickstackHelmRelease.status.conditions, '.exists(c, c.type == "Ready" && c.status == "True")');
|
|
166
|
+
// Status endpoints derive from the owned HelmRelease resource so they
|
|
167
|
+
// serialize as KRO status CEL and land on the live KRO CR's status
|
|
168
|
+
// (same reachability class as the PR #93 review finding). Naming is
|
|
169
|
+
// deterministic because the mapper pins `fullnameOverride` to the release
|
|
170
|
+
// name: HyperDX Service = `<name>`, gateway Service =
|
|
171
|
+
// `<name>-otel-collector`. Ports are chart defaults (see resources/helm.ts)
|
|
172
|
+
// and ride INSIDE the resource-derived URL strings.
|
|
173
|
+
//
|
|
174
|
+
// RAW Cel.expr over the resource id is required: the status-builder proxy
|
|
175
|
+
// passes `metadata` values through VERBATIM, and the HelmRelease's
|
|
176
|
+
// metadata.name in the template is itself a schema ref — a Cel.template
|
|
177
|
+
// over `_clickstackHelmRelease.metadata.name` therefore resolves back to
|
|
178
|
+
// `schema.spec.name`, gets classified static (client-hydrated), and is
|
|
179
|
+
// DROPPED from the KRO status. A raw resource-path expression survives
|
|
180
|
+
// serialization as genuine KRO CEL.
|
|
181
|
+
const releaseMeta = 'clickstackHelmRelease.metadata';
|
|
182
|
+
const appHostCel = `${releaseMeta}.name + "." + ${releaseMeta}.namespace + ".svc.cluster.local"`;
|
|
183
|
+
const gatewayHostCel = `${releaseMeta}.name + "${CLICKSTACK_GATEWAY_NAME_SUFFIX}." + ${releaseMeta}.namespace + ".svc.cluster.local"`;
|
|
184
|
+
return {
|
|
185
|
+
ready: helmReleaseReady,
|
|
186
|
+
phase: Cel.expr('clickstackHelmRelease.status.conditions.exists(c, c.type == "Ready" && c.status == "False") ' +
|
|
187
|
+
'? "Failed" : clickstackHelmRelease.status.conditions.exists(c, c.type == "Ready" && ' +
|
|
188
|
+
'c.status == "True") ? "Ready" : "Installing"'),
|
|
189
|
+
version: resolvedVersion,
|
|
190
|
+
ui: {
|
|
191
|
+
url: Cel.expr(`"http://" + ${appHostCel} + ":${CLICKSTACK_APP_PORT}"`),
|
|
192
|
+
},
|
|
193
|
+
gateway: {
|
|
194
|
+
otlpHttpEndpoint: Cel.expr(`"http://" + ${gatewayHostCel} + ":${CLICKSTACK_OTLP_HTTP_PORT}"`),
|
|
195
|
+
otlpGrpcEndpoint: Cel.expr(`"http://" + ${gatewayHostCel} + ":${CLICKSTACK_OTLP_GRPC_PORT}"`),
|
|
196
|
+
},
|
|
197
|
+
app: {
|
|
198
|
+
host: Cel.expr(appHostCel),
|
|
199
|
+
// Bare numeric constants — no resource anchor, so client-hydrated
|
|
200
|
+
// only; both ports are KRO-visible inside the URL fields above.
|
|
201
|
+
appPort: CLICKSTACK_APP_PORT,
|
|
202
|
+
apiPort: CLICKSTACK_API_PORT,
|
|
203
|
+
},
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
function buildInternalComposition(options) {
|
|
208
|
+
const build = {
|
|
209
|
+
mongoMode: 'internal',
|
|
210
|
+
...(options.mongo?.storage !== undefined && { storage: options.mongo.storage }),
|
|
211
|
+
...(options.values !== undefined && { values: options.values }),
|
|
212
|
+
};
|
|
213
|
+
return kubernetesComposition({
|
|
214
|
+
name: options.name ?? 'clickstack-bootstrap',
|
|
215
|
+
kind: options.kind ?? 'ClickStackBootstrap',
|
|
216
|
+
spec: ClickStackBootstrapConfigSchema,
|
|
217
|
+
status: ClickStackBootstrapStatusSchema,
|
|
218
|
+
}, (spec) => bootstrapBody(spec, build));
|
|
219
|
+
}
|
|
220
|
+
function buildExternalComposition(options) {
|
|
221
|
+
const build = {
|
|
222
|
+
mongoMode: 'external',
|
|
223
|
+
...(options.values !== undefined && { values: options.values }),
|
|
224
|
+
};
|
|
225
|
+
return kubernetesComposition({
|
|
226
|
+
name: options.name ?? 'clickstack-bootstrap-external-mongo',
|
|
227
|
+
kind: options.kind ?? 'ClickStackExternalMongoBootstrap',
|
|
228
|
+
spec: ClickStackExternalMongoBootstrapConfigSchema,
|
|
229
|
+
status: ClickStackBootstrapStatusSchema,
|
|
230
|
+
}, (spec) => bootstrapBody(spec, build));
|
|
231
|
+
}
|
|
232
|
+
export function makeClickstackBootstrap(options = {}) {
|
|
233
|
+
// Build-time options must be CONCRETE: they select which resources exist and bake static chart
|
|
234
|
+
// values at construction — a schema ref here can never serialize (loud > silent mis-serialization).
|
|
235
|
+
if (containsKubernetesRefs(options)) {
|
|
236
|
+
throw new Error('makeClickstackBootstrap: build-time options contain a schema/resource reference. ' +
|
|
237
|
+
'Build-time options (mongo mode/storage, static chart values, name/kind) are fixed at ' +
|
|
238
|
+
'construction — move per-instance values into the runtime spec instead.');
|
|
239
|
+
}
|
|
240
|
+
if (options.mongo?.mode === 'external') {
|
|
241
|
+
return buildExternalComposition(options);
|
|
242
|
+
}
|
|
243
|
+
return buildInternalComposition(options);
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* The default ClickStack bootstrap: internal single-replica Mongo (dev-first),
|
|
247
|
+
* default RGD name/kind. Use `makeClickstackBootstrap(...)` for the
|
|
248
|
+
* external-Mongo variant, custom Mongo storage, or static raw chart values.
|
|
249
|
+
*/
|
|
250
|
+
export const clickstackBootstrap = makeClickstackBootstrap();
|
|
251
|
+
//# sourceMappingURL=clickstack-bootstrap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clickstack-bootstrap.js","sourceRoot":"","sources":["../../../../src/factories/clickstack/compositions/clickstack-bootstrap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0EG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AACjE,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACxF,OAAO,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAC/D,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,8BAA8B,EAC9B,yBAAyB,EACzB,yBAAyB,EACzB,qBAAqB,EACrB,4BAA4B,EAC5B,2BAA2B,EAC3B,0BAA0B,GAC3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAC3F,OAAO,EAEL,+BAA+B,EAE/B,+BAA+B,EAG/B,4CAA4C,GAI7C,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,4BAA4B,EAC5B,+BAA+B,GAChC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,iCAAiC,EAAE,MAAM,iCAAiC,CAAC;AASpF;;;;;;;;;;;GAWG;AACH,SAAS,aAAa,CAAC,IAAsC,EA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
|
+
* The official ClickStack chart repository
|
|
5
|
+
* (https://clickhouse.github.io/ClickStack-helm-charts) is a single
|
|
6
|
+
* cluster-level Flux source — the same URL serves every consumer. Deploying it
|
|
7
|
+
* inline in the `clickstackBootstrap` RGD would make each instance's KRO
|
|
8
|
+
* ApplySet try to *own* the HelmRepository exclusively, so a second instance
|
|
9
|
+
* of the RGD fails to reconcile ("resource belongs to a different ApplySet
|
|
10
|
+
* ... cannot reassign"). Modelling the repository as its own composition lets
|
|
11
|
+
* the bootstrap consume it via `singleton(...)`, so one shared HelmRepository
|
|
12
|
+
* is owned outside any single instance's ApplySet and every instance's
|
|
13
|
+
* HelmRelease references it by the same `sourceRef`. (Same pattern as the
|
|
14
|
+
* dagster/clickhouse bootstraps' shared repositories.)
|
|
15
|
+
*/
|
|
16
|
+
export declare const clickstackHelmRepositoryBootstrap: import("../../../index.js").CallableComposition<{
|
|
17
|
+
name: string;
|
|
18
|
+
namespace: string;
|
|
19
|
+
url: string;
|
|
20
|
+
}, {
|
|
21
|
+
ready: boolean;
|
|
22
|
+
}>;
|
|
23
|
+
//# sourceMappingURL=clickstack-helm-repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clickstack-helm-repository.d.ts","sourceRoot":"","sources":["../../../../src/factories/clickstack/compositions/clickstack-helm-repository.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,iCAAiC;;;;;;EAsB7C,CAAC"}
|