Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/waitformongodb-resources.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"helm-charts": minor
---

Allow resources to be specified for the wait-for-mongodb init container via `hyperdx.deployment.waitForMongodb.resources` (empty by default). Required in clusters that enforce namespace resource quotas, where containers without requests/limits are rejected. Also documents how to set MongoDB container resources through the MongoDBCommunity `statefulSet` spec override. Ports ClickHouse/ClickStack-helm-charts#187 to the current chart layout.
4 changes: 4 additions & 0 deletions charts/clickstack/templates/hyperdx/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ spec:
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.hyperdx.deployment.waitForMongodb.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
command: ['sh', '-c', 'until nc -z {{ include "clickstack.mongodb.svc" . }} 27017; do echo waiting for mongodb; sleep 2; done;']
{{- end }}
{{- with .Values.hyperdx.deployment.initContainers }}
Expand Down
36 changes: 36 additions & 0 deletions charts/clickstack/tests/hyperdx-deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,42 @@ tests:
path: spec.template.spec.initContainers[0].imagePullPolicy
value: Always

- it: should not set resources on the wait-for-mongodb initContainer by default
set:
mongodb:
enabled: true
asserts:
- isNull:
path: spec.template.spec.initContainers[0].resources

- it: should render resources on the wait-for-mongodb initContainer when set
set:
mongodb:
enabled: true
hyperdx:
deployment:
waitForMongodb:
resources:
requests:
memory: 100Mi
cpu: 100m
limits:
memory: 200Mi
cpu: 500m
asserts:
- equal:
path: spec.template.spec.initContainers[0].resources.requests.memory
value: 100Mi
- equal:
path: spec.template.spec.initContainers[0].resources.requests.cpu
value: 100m
- equal:
path: spec.template.spec.initContainers[0].resources.limits.memory
value: 200Mi
- equal:
path: spec.template.spec.initContainers[0].resources.limits.cpu
value: 500m

- it: should not include initContainers when mongodb is disabled and no user init containers are provided
set:
mongodb:
Expand Down
20 changes: 20 additions & 0 deletions charts/clickstack/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,16 @@ hyperdx:
waitForMongodb:
image: "busybox@sha256:1fcf5df59121b92d61e066df1788e8df0cc35623f5d62d9679a41e163b6a0cdb"
pullPolicy: IfNotPresent
# Resources for the wait-for-mongodb init container. Useful in clusters
# that enforce namespace resource quotas.
resources: {}
# Example:
# requests:
# memory: "100Mi"
# cpu: "100m"
# limits:
# memory: "200Mi"
# cpu: "500m"
# Default connections and sources (ENABLED BY DEFAULT)
# Set to empty string to disable: defaultConnections: "" or defaultSources: ""
# To use an existing secret, set useExistingConfigSecret: true
Expand Down Expand Up @@ -334,6 +344,16 @@ mongodb:
# Full MongoDBCommunity CRD spec -- rendered verbatim into the CR.
# See https://github.com/mongodb/mongodb-kubernetes/tree/master/docs/mongodbcommunity
# for all available fields. Add persistence, nodeSelector, tolerations, etc. here.
# Container resources can be set via the operator's statefulset override, e.g.:
# statefulSet:
# spec:
# template:
# spec:
# containers:
# - name: mongod
# resources:
# requests: { memory: "512Mi", cpu: "500m" }
# limits: { memory: "2Gi", cpu: "2" }
spec:
members: 1
type: ReplicaSet
Expand Down
Loading