Skip to content

Conversation

@omrozowicz-splunk
Copy link
Contributor

Description

This PR removes the Bitnami MongoDB chart dependency and replaces it with fully internal MongoDB templates that support both Standalone and ReplicaSet modes.
The redesign improves startup reliability, simplifies configuration, supports PVC migration, and provides full control over authentication handling.

Key Changes:

New MongoDB StatefulSet Architecture
Separate templates for:

  • standalone mode (single pod)
  • replicaset mode (multi‑pod headless)

Clearer structure with no large conditional templates.

PVC Migration for Standalone

  • If a Bitnami PVC (datadir--mongodb-0) exists, it is reused automatically.
  • Enables seamless migration without data copy.
  • ReplicaSet always uses fresh PVCs.

Authentication Simplified

Users may:

  • Provide credentials directly in values.yaml, or
  • Supply an existingUserSecret.
  • The chart automatically generates the replicaKey (secure, 64‑char).

Improved ReplicaSet Initialization Job

Uses official kubectl image.
Waits for:

  • All pods to be Ready
  • DNS + network reachability (nc -z)
  • Runs rs.initiate() via kubectl exec on pod 0.
  • Idempotent: safe to rerun; skips if RS already initialized.

Application Wait Logic Updated

  • Waits for PRIMARY using no‑auth first (MongoDB topology discovery).
  • Then uses credentials once available.
  • Avoids failures during early startup when the root user does not exist yet.

Clean Secret Model

  • One secret for user credentials (user‑managed or chart‑generated).
  • One secret for replicaKey (chart‑generated only).
  • No Bitnami env vars or secret formats.

Bitnami Removed Completely

No Bitnami containers, init scripts, env vars, or PVC names (except migration detection).

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • Dependency update
  • New feature
  • Refactor/improvement
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

Checklist

  • My commit message is conventional
  • I have run pre-commit on all files before creating the PR
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have checked my code and corrected any misspellings

@omrozowicz-splunk omrozowicz-splunk changed the title fix: replace bitnami mongodb with own templates fix: replace Bitnami MongoDB chart with custom MongoDB templates (standalone + replicaset) Dec 8, 2025
@omrozowicz-splunk omrozowicz-splunk marked this pull request as ready for review December 9, 2025 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants