Skip to content

feat: Upload core dumps to S3 storage#202

Merged
as51340 merged 3 commits intomainfrom
feat/s3-core-dumps-upload
Feb 24, 2026
Merged

feat: Upload core dumps to S3 storage#202
as51340 merged 3 commits intomainfrom
feat/s3-core-dumps-upload

Conversation

@as51340
Copy link
Collaborator

@as51340 as51340 commented Feb 23, 2026

User should create a secret with:

kubectl create secret generic aws-s3-credentials --from-literal=AWS_ACCESS_KEY_ID=test--from-literal=AWS_SECRET_ACCESS_KEY=test+cXGP9ZOG8Fi1qC

What

Add a built-in core dump S3 uploader sidecar to the HA chart. A new coreDumpUploader values section in values.yaml configures an amazon/aws-cli sidecar container that polls
the core dumps directory and uploads new files to S3. The sidecar is rendered via a shared memgraph.coreDumpUploader helper template in _helpers.tpl and injected into both
templates/data.yaml and templates/coordinators.yaml StatefulSets.

Why

The existing createCoreDumpsClaim feature creates per-instance PVCs for core dumps but provides no built-in way to get those dumps off the cluster. Raw userContainers can't
solve this because they're rendered as static YAML applied identically to all StatefulSets, while the core dump PVC volume names are instance-specific (e.g.,
memgraph-data-0-core-dumps-storage vs memgraph-data-1-core-dumps-storage). A templated sidecar inside the range loop has access to each instance's ID and can reference the
correct volume name.

How

The sidecar is gated by coreDumpUploader.enabled && storage.<role>.createCoreDumpsClaim — it only activates when both the uploader is enabled and a core dumps PVC exists for
that role. This avoids rendering a sidecar with no volume to mount.

  • _helpers.tpl: New memgraph.coreDumpUploader named template accepting a dict with volumeName, mountPath, and values. Renders a full container spec with a polling
    shell script, AWS credentials from a Secret via secretKeyRef, a read-only volumeMount for the instance-specific PVC, and hardened securityContext matching chart conventions.
  • data.yaml / coordinators.yaml: 3-line insertion after the main container block (before userContainers), passing the instance-specific volume name (e.g., printf "memgraph-data-%s-core-dumps-storage" $data.id) to the helper.
  • values.yaml: New coreDumpUploader block with image config, S3 destination, poll interval, Secret name and key references, and resource requests/limits. Disabled by
    default.

The uploader script polls for core.* files, waits 5s for write completion, uploads to s3://<bucket>/<prefix>/<hostname>/<filename>, and tracks uploaded files in
/tmp/uploaded_files to avoid re-uploads.

Testing

  • helm template rendering verified with the feature disabled (default): zero core-dump-uploader containers rendered.
  • helm template rendering verified with the feature enabled (coreDumpUploader.enabled=true, createCoreDumpsClaim=true): sidecar rendered in all 5 StatefulSets (2 data +
    3 coordinators) with correct instance-specific volume names.
  • Verified edge case: coreDumpUploader.enabled=true with createCoreDumpsClaim=false produces no sidecar (correct — no volume to mount).
  • No new helm tests added; the sidecar is a standard container spec and existing helm template validation covers rendering correctness.

@as51340 as51340 self-assigned this Feb 23, 2026
@as51340 as51340 added the memgraph-ha Memgraph HA chart issue label Feb 23, 2026
@as51340 as51340 requested a review from mattkjames7 February 23, 2026 21:23
Copy link
Collaborator

@antejavor antejavor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea.

Copy link
Contributor

@mattkjames7 mattkjames7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, nice idea, I shall approve!

@as51340 as51340 merged commit b5ce6b3 into main Feb 24, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

memgraph-ha Memgraph HA chart issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants