Skip to content

Conversation

panagiotisbellias
Copy link

This PR introduces a new MongoDB resource type schema and an associated Kubernetes recipe using Terraform. It fully implements the requirements from GitHub Issue #21.

Changes included:

  • Resource Schema: schemas/databases/mongodb.yaml defines required and optional properties, defaults, validation rules, and enums.
  • Kubernetes Recipe: Terraform files provision MongoDB with:
    • Secret for credentials
    • Service
    • StatefulSet with optional PVC (controlled by persistence variable)
    • Resource requests/limits
  • README.md: Complete documentation including inputs/outputs, manual testing steps, ephemeral testing snippet, and CI/GitHub Actions workflow description.
  • GitHub Actions workflow: .github/workflows/test-mongodb-recipe.yml automatically tests the recipe on PRs and branch pushes, creating a temporary Kind cluster and cleaning up resources afterwards.

Manual Testing Results:

  • Applied Terraform with persistence=false for CI-style testing.
  • Pod test-mongodb-0 reached READY=1/1.
  • Service created and accessible internally.
  • Verified database operations.

Usage in Real Environments:

  • Set persistence=true to enable PVC-backed storage.
  • Configure storage_class according to the target Kubernetes environment.
  • Provide secure and unique credentials for username and password.
  • Optionally configure backup_enabled and backup_schedule for production backup requirements.
  • Adjust resources (CPU/memory requests and limits) based on workload requirements.
  • Apply Terraform against a production-ready cluster instead of a Kind cluster.

Closes #21

@panagiotisbellias panagiotisbellias requested review from a team as code owners September 16, 2025 11:53
…etes Recipe (radius-project#21)

Signed-off-by: Panagiotis Bellias <belliaspan@gmail.com>
)

Signed-off-by: Panagiotis Bellias <belliaspan@gmail.com>
Signed-off-by: Panagiotis Bellias <belliaspan@gmail.com>
Signed-off-by: Panagiotis Bellias <belliaspan@gmail.com>
Signed-off-by: Panagiotis Bellias <belliaspan@gmail.com>
Signed-off-by: Panagiotis Bellias <belliaspan@gmail.com>
Signed-off-by: Panagiotis Bellias <belliaspan@gmail.com>
Signed-off-by: Panagiotis Bellias <belliaspan@gmail.com>
Signed-off-by: Panagiotis Bellias <belliaspan@gmail.com>
Signed-off-by: Panagiotis Bellias <belliaspan@gmail.com>
…ject#21)

Signed-off-by: Panagiotis Bellias <belliaspan@gmail.com>
…ject#21)

- mongodb.yaml schema
- Terraform recipe (main.tf, variables.tf, outputs.tf)
- README.md with usage instructions and manual testing notes

Signed-off-by: Panagiotis Bellias <belliaspan@gmail.com>
@panagiotisbellias panagiotisbellias force-pushed the 21-add-k8s-mongodb-recipe-terraform branch from 02f02f0 to 2b85e6c Compare September 16, 2025 11:58
Copy link
Contributor

@Reshrahim Reshrahim left a comment

Choose a reason for hiding this comment

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

@panagiotisbellias - Thanks for your interest in contributing!

Some high level thoughts:

Let me know if you need help with this. Would be happy to chat 1:1 as well in Discord.

@@ -0,0 +1,68 @@
name: Test MongoDB Recipe
Copy link
Contributor

Choose a reason for hiding this comment

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

A GH workflow to test only the mongo type is not required and a manual evidence of testing is enough for alpha level contribution. Please review the testing guidelines.

Copy link
Author

Choose a reason for hiding this comment

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

So I remove it but have no available environment to run terraform right now and I won't test

Copy link
Contributor

@Reshrahim Reshrahim left a comment

Choose a reason for hiding this comment

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

Thanks for iterating on the feedback here. I’ve reviewed the schema definition and added a few suggestions.

Think of the schema as the interface that developers will use in their application definitions, and the Recipes as the implementation of that interface. The schema should remain as generic as possible, without Kubernetes-specific properties, while the Recipes handle the platform-specific details.

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.

Add Kubernetes MongoDB Recipe - Terraform

2 participants