Skip to content

Conversation

@trispera
Copy link
Member

@trispera trispera commented Nov 28, 2025

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • 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 not reduced the existing code coverage
  • I have added docstrings following the Python style guidelines of this project to all new modules, classes, methods and functions are documented with docstrings following; I have updated any previously existing docstrings, if applicable
  • I have updated any sections of the app's documentation that are affected by the proposed changes, if applicable

Summary by Sourcery

Update the Helm chart to use the latest application and MongoDB images, configure resource requests/limits, and add a MongoDB init script for setting up required collections and indexes.

New Features:

  • Add a MongoDB init-script ConfigMap and mount it into the MongoDB pod to initialize the serviceStore database with required collections and indexes.

Enhancements:

  • Make host name configurable by defaulting to an empty value in Helm values.
  • Configure CPU and memory resource requests/limits for the cloud-registry and MongoDB deployments via values.yaml.
  • Update cloud-registry image tag to latest and MongoDB image to a modern tagged image.
  • Update Helm chart and application versions to 2.0.0 and remove status stubs from rendered Kubernetes manifests.
  • Simplify MongoDB service discovery by setting the MONGO_HOST environment variable to the mongodb service name.

@sourcery-ai
Copy link

sourcery-ai bot commented Nov 28, 2025

Reviewer's Guide

Helm chart is updated to v2 with new image tags, configurable resource requests/limits, Mongo initialization via ConfigMap, and some cleanup of autogenerated status fields and route/service details.

ER diagram for MongoDB serviceStore schema initialization

erDiagram
  serviceStore ||--o{ services : contains
  serviceStore ||--o{ service_info : contains

  services {
    string id
  }

  service_info {
    string id
  }
Loading

File-Level Changes

Change Details Files
Make deployment configuration more generic and resource-aware.
  • Set host_name default to empty string to force explicit configuration per environment.
  • Update cloud-registry image tag to latest for the main application container.
  • Add resource requests and limits for the cloud-registry deployment and MongoDB to allow tuning runtime resource consumption.
deployment/values.yaml
deployment/templates/mongo-deploy.yaml
Upgrade chart and application version to 2.0.0.
  • Bump Helm chart version from 0.1.0 to 2.0.0.
  • Align appVersion with chart version at 2.0.0 and remove template comments.
deployment/Chart.yaml
Add MongoDB initialization via ConfigMap-mounted JavaScript script.
  • Create a mongo-init-script ConfigMap defining an init-script.js that creates and indexes required collections.
  • Mount the init-script ConfigMap into the MongoDB pod at /docker-entrypoint-initdb.d/init-script.js so it runs on container startup.
  • Add a ConfigMap volume for the init script to the MongoDB deployment.
deployment/templates/mongo-init-script.yaml
deployment/templates/mongo-deploy.yaml
Update MongoDB image and connection configuration.
  • Change MongoDB image to docker.io/library/mongo:noble to use a more current base.
  • Adjust MONGO_HOST environment variable in the configurer Job from the appName-suffixed service to plain mongodb, matching the mongo Service name.
deployment/values.yaml
deployment/templates/cloud-registry-configmap-job.yaml
deployment/templates/mongo-service.yaml
Clean up Helm/Kubernetes YAML by removing status stubs and unused fields.
  • Remove status sections from various template manifests that should be managed by Kubernetes, not Helm.
  • Drop unnecessary loadBalancer and ingress placeholders from Service and Route templates.
deployment/templates/cloud-registry-configmap-job.yaml
deployment/templates/cloud-registry-route.yaml
deployment/templates/cloud-registry-service.yaml
deployment/templates/mongo-service.yaml
deployment/templates/cloud-registry-deploy.yaml
deployment/templates/mongo-pvc.yaml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and found some issues that need to be addressed.

  • Using the latest tag for cloud-registry.image makes deployments non-reproducible and harder to roll back; consider pinning to an explicit versioned tag and bumping it intentionally in future chart updates.
  • The direct use of .Values.mongodb.resources in mongo-deploy.yaml will fail if the key is omitted in values; consider wrapping it with a default (e.g., {{- toYaml (default dict .Values.mongodb.resources) | nindent 10 }}) to keep the chart robust to partial values files.
  • The new NOTES.txt template is currently empty; either populate it with meaningful installation/usage notes or remove it to avoid generating an empty notes output.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Using the `latest` tag for `cloud-registry.image` makes deployments non-reproducible and harder to roll back; consider pinning to an explicit versioned tag and bumping it intentionally in future chart updates.
- The direct use of `.Values.mongodb.resources` in `mongo-deploy.yaml` will fail if the key is omitted in values; consider wrapping it with a default (e.g., `{{- toYaml (default dict .Values.mongodb.resources) | nindent 10 }}`) to keep the chart robust to partial values files.
- The new `NOTES.txt` template is currently empty; either populate it with meaningful installation/usage notes or remove it to avoid generating an empty notes output.

## Individual Comments

### Comment 1
<location> `deployment/values.yaml:8` </location>
<code_context>

 cloud_registry:
-  image: elixircloud/cloud-registry:0.1.0
+  image: elixircloud/cloud-registry:latest
   appName: cloud-registry
+  resources:
</code_context>

<issue_to_address>
**suggestion (bug_risk):** Using the `latest` image tag can lead to non-deterministic deployments.

Please pin this to a concrete version (e.g. `elixircloud/cloud-registry:2.0.0`) and keep it aligned with the chart’s `appVersion` in `Chart.yaml` so the image and chart metadata stay in sync.

Suggested implementation:

```
cloud_registry:
  # Keep this version aligned with .appVersion in Chart.yaml
  image: elixircloud/cloud-registry:2.0.0

```

1. Open `deployment/Chart.yaml` (or the chart's `Chart.yaml`) and ensure `.appVersion` is set to `2.0.0` (or update the tag here to match whatever `appVersion` you choose).
2. If you change the application version in the future, remember to update both `appVersion` in `Chart.yaml` and the `cloud_registry.image` tag in `values.yaml` to keep them in sync.
</issue_to_address>

### Comment 2
<location> `deployment/templates/mongo-init-script.yaml:11-12` </location>
<code_context>
+
+    // Create the 'services' and 'service_info' collections
+    // Database configuration from https://github.com/elixir-cloud-aai/cloud-registry/blob/fa8a1b0dd1361751574550116150a630035dc199/cloud_registry/config.yaml#L32
+    db.createCollection('services');
+    db.tools.createIndex(
+      { id: 1 },
+      { unique: true }
</code_context>

<issue_to_address>
**issue (bug_risk):** The index is created on `db.tools` instead of the newly created `services` collection.

After creating the `services` collection, the script calls `db.tools.createIndex(...)`. This should likely be `db.services.createIndex(...)`, otherwise the unique index on `id` will be applied to `tools` (or fail) instead of `services`.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@codecov
Copy link

codecov bot commented Nov 28, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (aef5914) to head (b727da1).

Additional details and impacted files
@@            Coverage Diff            @@
##               dev       #53   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            5         5           
  Lines          189       189           
=========================================
  Hits           189       189           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants