From e9c83fc46b34ceacc650cf6f8689b9aab97930c4 Mon Sep 17 00:00:00 2001 From: Warren Lee <5959690+wrn14897@users.noreply.github.com> Date: Mon, 24 Aug 2026 10:30:34 -0700 Subject: [PATCH] feat: allow waitForMongodb init container resources to be specified Ports the still-applicable half of #187 to the current chart layout. Adds hyperdx.deployment.waitForMongodb.resources (empty by default) so the wait-for-mongodb init container can carry requests/limits, which is required in clusters enforcing namespace resource quotas. The MongoDB half of #187 is obsolete: MongoDB is now a MongoDBCommunity CR whose spec is rendered verbatim, so container resources are already settable via the operator statefulSet override -- documented in values.yaml instead. Co-authored-by: Robert Gallagher --- .changeset/waitformongodb-resources.md | 5 +++ .../templates/hyperdx/deployment.yaml | 4 +++ .../tests/hyperdx-deployment_test.yaml | 36 +++++++++++++++++++ charts/clickstack/values.yaml | 20 +++++++++++ 4 files changed, 65 insertions(+) create mode 100644 .changeset/waitformongodb-resources.md diff --git a/.changeset/waitformongodb-resources.md b/.changeset/waitformongodb-resources.md new file mode 100644 index 0000000..578cc90 --- /dev/null +++ b/.changeset/waitformongodb-resources.md @@ -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. diff --git a/charts/clickstack/templates/hyperdx/deployment.yaml b/charts/clickstack/templates/hyperdx/deployment.yaml index 9d429d9..d20bf74 100644 --- a/charts/clickstack/templates/hyperdx/deployment.yaml +++ b/charts/clickstack/templates/hyperdx/deployment.yaml @@ -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 }} diff --git a/charts/clickstack/tests/hyperdx-deployment_test.yaml b/charts/clickstack/tests/hyperdx-deployment_test.yaml index 242e3fc..8e7fa4c 100644 --- a/charts/clickstack/tests/hyperdx-deployment_test.yaml +++ b/charts/clickstack/tests/hyperdx-deployment_test.yaml @@ -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: diff --git a/charts/clickstack/values.yaml b/charts/clickstack/values.yaml index 4644937..785cb95 100644 --- a/charts/clickstack/values.yaml +++ b/charts/clickstack/values.yaml @@ -132,6 +132,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 @@ -322,6 +332,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