Skip to content

Conversation

@trispera
Copy link
Member

@trispera trispera commented Oct 28, 2025

  • Update mongodb image
    • Add init-script js
  • Update OKD Route/Ingress condition
  • Add resources

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

Improve Helm chart by making ingress behavior configurable, adding resource limits, introducing a MongoDB init script, and enabling dynamic database naming.

New Features:

  • Support toggling between OpenShift Route and Kubernetes Ingress via a new ingress.enabled flag
  • Add a ConfigMap-based initialization script to pre-create MongoDB collections and indexes
  • Expose MONGO_DBNAME as an environment variable for custom database naming

Enhancements:

  • Update MongoDB image tag to 'noble'
  • Add CPU and memory resource requests and limits for both trs-filer and MongoDB deployments
  • Refactor route and ingress templates by splitting them based on the new ingress settings

- Update mongodb image
  - Add init-script js
- Update OKD Route/Ingress condition
- Add resources
@sourcery-ai
Copy link

sourcery-ai bot commented Oct 28, 2025

Reviewer's Guide

This PR enhances the Helm chart by introducing a unified ingress toggle for OKD Route or Kubernetes Ingress, adding resource requests/limits, updating MongoDB configuration and image, and embedding an initialization script to bootstrap MongoDB collections.

Entity relationship diagram for MongoDB collections initialized by init-script

erDiagram
  TOOLS {
    string id PK
  }
  SERVICE_INFO {
    string id PK
  }
  TOOLCLASSES {
    string id PK
  }
  TOOLS ||--|| SERVICE_INFO : "related"
  TOOLS ||--|| TOOLCLASSES : "classified by"
Loading

Class diagram for updated Helm values structure

classDiagram
  class TrsFiler {
    +string image
    +string appName
    +Ingress ingress
    +Resources resources
  }
  class Ingress {
    +bool enabled
    +Https https
  }
  class Https {
    +bool enabled
    +string issuer
  }
  class Resources {
    +string cpu
    +string memory
  }
  class MongoDB {
    +string image
    +string dbName
    +string volumeSize
    +Resources resources
  }
  TrsFiler o-- Ingress
  Ingress o-- Https
  TrsFiler o-- Resources
  MongoDB o-- Resources
Loading

File-Level Changes

Change Details Files
Unified ingress/route configuration under a single flag
  • Added .Values.trs_filer.ingress block in values.yaml
  • Updated route template to respect new ingress toggle
  • Removed legacy kubernetes.ingress section
  • Introduced new Kubernetes Ingress template for trs-filer
deployment/values.yaml
deployment/templates/trs-filer-route.yaml
deployment/templates/trs-filer-ingress.yaml
Applied resource requests and limits to deployments
  • Defined CPU/memory requests and limits for trs-filer
  • Defined CPU/memory requests and limits for MongoDB
  • Injected resource values into container specs
deployment/values.yaml
deployment/templates/trs-filer-deploy.yaml
deployment/templates/mongo-deploy.yaml
Parameterized and updated MongoDB image and database name
  • Upgraded MongoDB image to docker.io/library/mongo:noble
  • Added dbName field in values.yaml
  • Set MONGO_DBNAME env var in trs-filer deployment
deployment/values.yaml
deployment/templates/trs-filer-deploy.yaml
Added MongoDB initialization script via ConfigMap
  • Created mongo-init-script ConfigMap with init-script.js
  • Mounted init-script into MongoDB container entrypoint
deployment/templates/mongo-init-script.yaml
deployment/templates/mongo-deploy.yaml
Minor formatting adjustment in PVC spec
  • Corrected indentation for accessModes in PVC
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

@codecov
Copy link

codecov bot commented Oct 28, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.93%. Comparing base (9116b70) to head (bfc756f).

Additional details and impacted files
@@           Coverage Diff           @@
##              dev     #121   +/-   ##
=======================================
  Coverage   92.93%   92.93%           
=======================================
  Files          12       12           
  Lines         623      623           
=======================================
  Hits          579      579           
  Misses         44       44           

☔ 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.

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 they look great!

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location> `deployment/templates/mongo-init-script.yaml:14` </location>
<code_context>
+
+    // Create the 'tools', 'service_info' and 'toolclasses' collections
+    // Database configuration from https://github.com/elixir-cloud-aai/trs-filer/blob/9116b702bce2ef5b2e04130a6fe5db2a89d465f3/trs_filer/config.yaml#L9
+    db.createCollection('tools');
+    db.tools.createIndex(
+      { id: 1 },
</code_context>

<issue_to_address>
**issue (bug_risk):** Repeated collection/index creation may cause errors if collections already exist.

Consider adding checks to ensure collections and indexes are only created if they do not already exist, or handle errors to prevent failures on repeated deployments.
</issue_to_address>

### Comment 2
<location> `deployment/templates/trs-filer-ingress.yaml:18` </location>
<code_context>
+      http:
+        paths:
+          - path: /
+            pathType: prefix
+            backend:
+              service:
</code_context>

<issue_to_address>
**issue (bug_risk):** Ingress pathType should be 'Prefix' (capitalized) for Kubernetes compatibility.

Update pathType to 'Prefix' to avoid validation errors and ensure compatibility with Kubernetes.
</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.


// Create the 'tools', 'service_info' and 'toolclasses' collections
// Database configuration from https://github.com/elixir-cloud-aai/trs-filer/blob/9116b702bce2ef5b2e04130a6fe5db2a89d465f3/trs_filer/config.yaml#L9
db.createCollection('tools');
Copy link

Choose a reason for hiding this comment

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

issue (bug_risk): Repeated collection/index creation may cause errors if collections already exist.

Consider adding checks to ensure collections and indexes are only created if they do not already exist, or handle errors to prevent failures on repeated deployments.

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