Skip to content

Commit 33e0405

Browse files
authored
feat: Add secret support for default connections and sources (#103)
Fixes: HDX-2206 Fixes #93
1 parent 10737b0 commit 33e0405

File tree

5 files changed

+386
-2
lines changed

5 files changed

+386
-2
lines changed

.changeset/curly-onions-promise.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"helm-charts": patch
3+
---
4+
5+
feat: Add secret support for default connections and sources

README.md

Lines changed: 97 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ helm install my-hyperdx hyperdx/hdx-oss-v2
6969

7070
### External ClickHouse
7171

72-
If you have an existing ClickHouse cluster:
72+
If you have an existing ClickHouse cluster, you have two options for configuring connections:
73+
74+
#### Option 1: Inline Configuration (Simple)
7375

7476
```yaml
7577
# values-external-clickhouse.yaml
@@ -93,6 +95,93 @@ hyperdx:
9395
]
9496
```
9597
98+
#### Option 2: External Secret (Recommended for Production)
99+
100+
For production deployments where you want to keep credentials separate from your Helm configuration:
101+
102+
```yaml
103+
# values-external-clickhouse-secret.yaml
104+
clickhouse:
105+
enabled: false # Disable the built-in ClickHouse
106+
107+
otel:
108+
clickhouseEndpoint: "tcp://your-clickhouse-server:9000"
109+
clickhousePrometheusEndpoint: "http://your-clickhouse-server:9363" # Optional
110+
111+
hyperdx:
112+
# Use an existing secret for complete configuration (connections + sources)
113+
useExistingConfigSecret: true
114+
existingConfigSecret: "hyperdx-external-config"
115+
existingConfigConnectionsKey: "connections.json"
116+
existingConfigSourcesKey: "sources.json"
117+
```
118+
119+
Create your configuration secret:
120+
121+
```bash
122+
# Create the connections JSON
123+
cat <<EOF > connections.json
124+
[
125+
{
126+
"name": "Production ClickHouse",
127+
"host": "https://your-production-clickhouse.com:8123",
128+
"port": 8123,
129+
"username": "hyperdx_user",
130+
"password": "your-secure-password"
131+
}
132+
]
133+
EOF
134+
135+
# Create the sources JSON
136+
cat <<EOF > sources.json
137+
[
138+
{
139+
"from": {
140+
"databaseName": "default",
141+
"tableName": "otel_logs"
142+
},
143+
"kind": "log",
144+
"name": "Logs",
145+
"connection": "Production ClickHouse",
146+
"timestampValueExpression": "TimestampTime",
147+
"displayedTimestampValueExpression": "Timestamp",
148+
"implicitColumnExpression": "Body",
149+
"serviceNameExpression": "ServiceName",
150+
"bodyExpression": "Body",
151+
"eventAttributesExpression": "LogAttributes",
152+
"resourceAttributesExpression": "ResourceAttributes",
153+
"severityTextExpression": "SeverityText",
154+
"traceIdExpression": "TraceId",
155+
"spanIdExpression": "SpanId"
156+
},
157+
{
158+
"from": {
159+
"databaseName": "default",
160+
"tableName": "otel_traces"
161+
},
162+
"kind": "trace",
163+
"name": "Traces",
164+
"connection": "Production ClickHouse",
165+
"timestampValueExpression": "Timestamp",
166+
"displayedTimestampValueExpression": "Timestamp",
167+
"implicitColumnExpression": "SpanName",
168+
"serviceNameExpression": "ServiceName",
169+
"traceIdExpression": "TraceId",
170+
"spanIdExpression": "SpanId",
171+
"durationExpression": "Duration"
172+
}
173+
]
174+
EOF
175+
176+
# Create the Kubernetes secret
177+
kubectl create secret generic hyperdx-external-config \
178+
--from-file=connections.json=connections.json \
179+
--from-file=sources.json=sources.json
180+
181+
# Clean up the local files
182+
rm connections.json sources.json
183+
```
184+
96185
### External OTEL Collector
97186

98187
If you have an existing OTEL collector setup:
@@ -125,6 +214,7 @@ otel:
125214

126215
hyperdx:
127216
otelExporterEndpoint: "http://your-otel-collector:4318"
217+
# Option 1: Inline configuration (for testing/development)
128218
defaultConnections: |
129219
[
130220
{
@@ -135,6 +225,12 @@ hyperdx:
135225
"password": "your-password"
136226
}
137227
]
228+
229+
# Option 2: External secret (recommended for production)
230+
# useExistingConfigSecret: true
231+
# existingConfigSecret: "my-external-config"
232+
# existingConfigConnectionsKey: "connections.json"
233+
# existingConfigSourcesKey: "sources.json"
138234
```
139235

140236
## Configuration

charts/hdx-oss-v2/templates/hyperdx-deployment.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,20 @@ spec:
9797
secretKeyRef:
9898
name: {{ include "hdx-oss.fullname" . }}-app-secrets
9999
key: api-key
100+
{{- if .Values.hyperdx.useExistingConfigSecret }}
101+
- name: DEFAULT_CONNECTIONS
102+
valueFrom:
103+
secretKeyRef:
104+
name: {{ .Values.hyperdx.existingConfigSecret | quote }}
105+
key: {{ .Values.hyperdx.existingConfigConnectionsKey | quote }}
106+
optional: false
107+
- name: DEFAULT_SOURCES
108+
valueFrom:
109+
secretKeyRef:
110+
name: {{ .Values.hyperdx.existingConfigSecret | quote }}
111+
key: {{ .Values.hyperdx.existingConfigSourcesKey | quote }}
112+
optional: false
113+
{{- else }}
100114
{{- if .Values.hyperdx.defaultConnections }}
101115
- name: DEFAULT_CONNECTIONS
102116
value: {{ tpl .Values.hyperdx.defaultConnections . | quote }}
@@ -105,6 +119,7 @@ spec:
105119
- name: DEFAULT_SOURCES
106120
value: {{ tpl .Values.hyperdx.defaultSources . | quote }}
107121
{{- end }}
122+
{{- end }}
108123
{{- with .Values.hyperdx.env }}
109124
{{- toYaml . | nindent 12 }}
110125
{{- end }}

0 commit comments

Comments
 (0)