Skip to content

Commit b95cea1

Browse files
refactor(helm): split app chart, fix labels, allow ingress toggle, conditionally create CH secrets
* Implements the ability to disable the ingress object * Changes the default "app" label to {{ include "hdx-oss.fullname" . }} instead of "app: app" * Implements the ability to add custom labels to hyperdx * Implements the ability to add custom annotations to hyperdx * Disables the deployment of the clickhouse secret if .Values.clickhouse.enabled is false * Splits app chart into separate service, ingress, and deployment charts
1 parent 033b48e commit b95cea1

File tree

6 files changed

+122
-93
lines changed

6 files changed

+122
-93
lines changed

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

Lines changed: 0 additions & 93 deletions
This file was deleted.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "hdx-oss.fullname" . }}-app
5+
labels:
6+
{{- include "hdx-oss.labels" . | nindent 4 }}
7+
app: {{ include "hdx-oss.fullname" . }}
8+
{{- if .Values.hyperdx.labels }}
9+
{{- with .Values.hyperdx.labels }}
10+
{{- toYaml . | nindent 4 }}
11+
{{- end -}}
12+
{{- end }}
13+
spec:
14+
replicas: {{ .Values.hyperdx.replicas | default 1 }}
15+
selector:
16+
matchLabels:
17+
{{- include "hdx-oss.selectorLabels" . | nindent 6 }}
18+
app: {{ include "hdx-oss.fullname" . }}
19+
template:
20+
metadata:
21+
labels:
22+
{{- include "hdx-oss.selectorLabels" . | nindent 8 }}
23+
app: {{ include "hdx-oss.fullname" . }}
24+
annotations:
25+
{{- if .Values.hyperdx.annotations }}
26+
{{- with .Values.hyperdx.annotations }}
27+
{{- toYaml . | nindent 8 }}
28+
{{- end -}}
29+
{{- end }}
30+
spec:
31+
initContainers:
32+
- name: wait-for-mongodb
33+
image: busybox
34+
command: ['sh', '-c', 'until nc -z {{ include "hdx-oss.fullname" . }}-mongodb {{ .Values.mongodb.port }}; do echo waiting for mongodb; sleep 2; done;']
35+
containers:
36+
- name: app
37+
image: "{{ .Values.hyperdx.image }}"
38+
ports:
39+
- name: app-port
40+
containerPort: {{ .Values.hyperdx.appPort }}
41+
- name: api-port
42+
containerPort: {{ .Values.hyperdx.apiPort }}
43+
envFrom:
44+
- configMapRef:
45+
name: {{ include "hdx-oss.fullname" . }}-app-config
46+
env:
47+
- name: HYPERDX_API_KEY
48+
valueFrom:
49+
secretKeyRef:
50+
name: {{ include "hdx-oss.fullname" . }}-app-secrets
51+
key: api-key
52+
{{- with .Values.hyperdx.env }}
53+
{{- toYaml . | nindent 12 }}
54+
{{- end }}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "hdx-oss.fullname" . }}-app
5+
labels:
6+
{{- include "hdx-oss.labels" . | nindent 4 }}
7+
spec:
8+
type: LoadBalancer
9+
ports:
10+
- port: {{ .Values.hyperdx.appPort }}
11+
targetPort: {{ .Values.hyperdx.appPort }}
12+
name: app
13+
selector:
14+
{{- include "hdx-oss.selectorLabels" . | nindent 4 }}
15+
app: {{ include "hdx-oss.fullname" . }}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{{- if .Values.hyperdx.ingress.enabled -}}
2+
apiVersion: networking.k8s.io/v1
3+
kind: Ingress
4+
metadata:
5+
name: {{ include "hdx-oss.fullname" . }}-app-ingress
6+
labels:
7+
{{- include "hdx-oss.labels" . | nindent 4 }}
8+
annotations:
9+
nginx.ingress.kubernetes.io/rewrite-target: /$1
10+
nginx.ingress.kubernetes.io/use-regex: "true"
11+
{{- if .Values.hyperdx.ingress.tls.enabled }}
12+
nginx.ingress.kubernetes.io/ssl-redirect: "true"
13+
nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
14+
{{- end }}
15+
nginx.ingress.kubernetes.io/proxy-body-size: {{ .Values.hyperdx.ingress.proxyBodySize | quote }}
16+
nginx.ingress.kubernetes.io/proxy-connect-timeout: {{ .Values.hyperdx.ingress.proxyConnectTimeout | quote }}
17+
nginx.ingress.kubernetes.io/proxy-send-timeout: {{ .Values.hyperdx.ingress.proxySendTimeout | quote }}
18+
nginx.ingress.kubernetes.io/proxy-read-timeout: {{ .Values.hyperdx.ingress.proxyReadTimeout | quote }}
19+
spec:
20+
ingressClassName: nginx
21+
{{- if .Values.hyperdx.ingress.tls.enabled }}
22+
tls:
23+
- hosts:
24+
- {{ .Values.hyperdx.ingress.host | default "localhost" }}
25+
secretName: {{ .Values.hyperdx.ingress.tlsSecretName | default "hyperdx-tls" }}
26+
{{- end }}
27+
rules:
28+
- host: {{ .Values.hyperdx.ingress.host | default "localhost" }}
29+
http:
30+
paths:
31+
- path: /(.*)
32+
pathType: Prefix
33+
backend:
34+
service:
35+
name: {{ include "hdx-oss.fullname" . }}-app
36+
port:
37+
number: {{ .Values.hyperdx.appPort }}
38+
{{- end }}

charts/hdx-oss-v2/templates/secrets.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ metadata:
77
type: Opaque
88
data:
99
api-key: {{ "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" | b64enc }}
10+
{{- if .Values.clickhouse.enabled }}
1011
---
1112
apiVersion: v1
1213
kind: Secret
@@ -18,3 +19,4 @@ type: Opaque
1819
data:
1920
appUserPassword: {{ .Values.clickhouse.config.users.appUserPassword | toString | b64enc }}
2021
otelUserPassword: {{ .Values.clickhouse.config.users.otelUserPassword | toString | b64enc }}
22+
{{- end }}

charts/hdx-oss-v2/values.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,20 @@ hyperdx:
1010
appUrl: "http://localhost"
1111
logLevel: "info"
1212
usageStatsEnabled: true
13+
annotations: {}
14+
# myAnnotation: "myValue"
15+
labels: {}
16+
# myLabel: "myValue"
17+
env: []
18+
# - name: CLICKHOUSE_USER
19+
# value: abc
20+
# - name: test
21+
# valueFrom:
22+
# secretKeyRef:
23+
# name: some-secret
24+
# key: some-key
1325
ingress:
26+
enabled: false
1427
host: "localhost" # Production domain
1528
proxyBodySize: "100m"
1629
proxyConnectTimeout: "60"

0 commit comments

Comments
 (0)