Skip to content

Commit f9c8a4c

Browse files
authored
feat: improve availability of HyperDX pods (#75)
This PR introduces several optional configurations aimed at improving the availability and resilience of HyperDX pods. Additions: • PodDisruptionBudget (disabled by default): Ensures a minimum number of replicas remain available during voluntary disruptions. Defaults to a minimum of 1 replica but is configurable. • Optional priorityClassName support: Enables better control over pod scheduling and preemption by allowing assignment of a custom priority class. • Optional resource requests and limits: Defines resources for the app container to: – Guarantee the pod receives the required CPU/memory. – Prevent resource-hungry containers from affecting node stability. • Optional topologySpreadConstraints: Allows pods to be distributed across different nodes (using a specified topology key), reducing the impact of node-level failures. All features are disabled or conservative by default to maintain backward compatibility and allow for gradual opt-in.
1 parent 8befc0f commit f9c8a4c

File tree

6 files changed

+118
-1
lines changed

6 files changed

+118
-1
lines changed

.changeset/nine-dingos-lead.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: improve availability of HyperDX pods

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ spec:
3636
tolerations:
3737
{{- toYaml .Values.hyperdx.tolerations | nindent 8 }}
3838
{{- end }}
39+
{{- if .Values.hyperdx.topologySpreadConstraints }}
40+
topologySpreadConstraints:
41+
{{- toYaml .Values.hyperdx.topologySpreadConstraints | nindent 8 }}
42+
{{- end }}
43+
{{- if .Values.hyperdx.priorityClassName }}
44+
priorityClassName: {{ .Values.hyperdx.priorityClassName | quote }}
45+
{{- end }}
3946
{{- if .Values.mongodb.enabled }}
4047
initContainers:
4148
- name: wait-for-mongodb
@@ -53,6 +60,10 @@ spec:
5360
containerPort: {{ .Values.hyperdx.apiPort }}
5461
- name: opamp-port
5562
containerPort: {{ .Values.hyperdx.opampPort }}
63+
{{- if .Values.hyperdx.resources }}
64+
resources:
65+
{{- toYaml .Values.hyperdx.resources | nindent 12 }}
66+
{{- end }}
5667
envFrom:
5768
- configMapRef:
5869
name: {{ include "hdx-oss.fullname" . }}-app-config
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{{- if .Values.hyperdx.podDisruptionBudget.enabled }}
2+
apiVersion: policy/v1
3+
kind: PodDisruptionBudget
4+
metadata:
5+
name: {{ include "hdx-oss.fullname" . }}-pdb
6+
labels:
7+
{{- include "hdx-oss.labels" . | nindent 4 }}
8+
app: {{ include "hdx-oss.fullname" . }}
9+
{{- if .Values.hyperdx.labels }}
10+
{{- with .Values.hyperdx.labels }}
11+
{{- toYaml . | nindent 4 }}
12+
{{- end -}}
13+
{{- end }}
14+
spec:
15+
minAvailable: {{ .Values.hyperdx.podDisruptionBudget.minAvailable | default 1 }}
16+
selector:
17+
matchLabels:
18+
{{- include "hdx-oss.selectorLabels" . | nindent 6 }}
19+
app: {{ include "hdx-oss.fullname" . }}
20+
{{- end }}

charts/hdx-oss-v2/tests/app-deployment_test.yaml

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,53 @@ tests:
4747
asserts:
4848
- equal:
4949
path: spec.replicas
50-
value: 3
50+
value: 3
51+
52+
- it: should set topology spread constraints when specified
53+
set:
54+
hyperdx:
55+
topologySpreadConstraints:
56+
- maxSkew: 1
57+
topologyKey: topology.kubernetes.io/zone
58+
whenUnsatisfiable: DoNotSchedule
59+
labelSelector:
60+
matchLabels:
61+
foo: bar
62+
asserts:
63+
- contains:
64+
path: spec.template.spec.topologySpreadConstraints
65+
content:
66+
maxSkew: 1
67+
topologyKey: topology.kubernetes.io/zone
68+
whenUnsatisfiable: DoNotSchedule
69+
labelSelector:
70+
matchLabels:
71+
foo: bar
72+
73+
- it: should set priority class name when specified
74+
set:
75+
hyperdx:
76+
priorityClassName: system-node-critical
77+
asserts:
78+
- equal:
79+
path: spec.template.spec.priorityClassName
80+
value: system-node-critical
81+
82+
- it: should set container resources when specified
83+
set:
84+
hyperdx:
85+
resources:
86+
limits:
87+
memory: 1Gi
88+
requests:
89+
cpu: 100m
90+
memory: 256Mi
91+
asserts:
92+
- equal:
93+
path: spec.template.spec.containers[0].resources
94+
value:
95+
limits:
96+
memory: 1Gi
97+
requests:
98+
cpu: 100m
99+
memory: 256Mi
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
suite: Test HyperDX App PodDisruptionBudget
2+
templates:
3+
- hyperdx-pdb.yaml
4+
tests:
5+
- it: should render the app pdb when enabled
6+
set:
7+
hyperdx:
8+
podDisruptionBudget:
9+
enabled: true
10+
asserts:
11+
- isKind:
12+
of: PodDisruptionBudget
13+
- equal:
14+
path: spec.minAvailable
15+
value: 1
16+
- matchRegex:
17+
path: metadata.name
18+
pattern: -pdb$
19+
20+
- it: should override minimum available replicas when specified
21+
set:
22+
hyperdx:
23+
podDisruptionBudget:
24+
enabled: true
25+
minAvailable: 5
26+
asserts:
27+
- equal:
28+
path: spec.minAvailable
29+
value: 5

charts/hdx-oss-v2/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,9 @@ hyperdx:
191191

192192
replicas: 1
193193

194+
podDisruptionBudget:
195+
enabled: false
196+
194197
# Service configuration
195198
service:
196199
type: ClusterIP # Use ClusterIP for security. For external access, use ingress with proper TLS and authentication

0 commit comments

Comments
 (0)