Skip to content

Conversation

@trispera
Copy link
Member

@trispera trispera commented Oct 15, 2025

  • Add resources
  • Add a key to change the storage mode
    • if RWO, the protes pods will be deployed on the same nodes
  • Update mongo to noble
    • Add init-script.js configMap
    • Update secrets
    • Update env
  • Update rabbitMQ to 4.1.4-management

IMPORTANT: Please create an issue before filing a pull request! Changes need to be discussed before proceeding. Please read the contribution guidelines.

Details

Please provide enough information so that others can review your pull request. Give a brief summary of the motivation. Refer to the corresponding issue/s with #XXXX for more information.

Testing

Write the appropriate unit and integration tests, if applicable. Make sure these and all other tests pass.

Documentation

Please document your changes and test cases in the appropriate places, if applicable.

Style

Make sure your changes adhere to the coding/documentation style used throughout the project.

Closing issues

If your changes fix any issue/s, put closes #XXXX in your comment to auto-close it/them.

Credit

Add your credentials to the list of contributors once your pull request was merged.

Summary by Sourcery

Update Helm chart to version 2.0.0 with enhanced resource management, configurable storage modes, and updated database and message broker images

New Features:

  • Add storageAccessMode parameter to toggle between ReadWriteOnce and ReadWriteMany and apply pod affinity for RWO
  • Introduce MongoDB init-script.js ConfigMap to automate user creation and collection setup
  • Add initResources settings for initContainers in protes and celery deployments

Enhancements:

  • Define resource requests and limits for Flower, protes, celeryWorker, and RabbitMQ containers
  • Bump MongoDB image to mongo:noble and RabbitMQ to 4.1.4-management
  • Refactor MongoDB secret template to iterate over secret keys and update env var names for mongosh compatibility
  • Replace fixed accessModes in PVC templates with storageAccessMode variable and increase MongoDB probe delay

Build:

  • Increment Helm chart version and appVersion to 2.0.0

- Add resources
- Add a key to change the storage mode
  - if RWO, the protes pods will be deployed on the same nodes
- Update mongo to noble
  - Add init-script.js configMap
  - Update secrets
  - Update env
- Update rabbitMQ to 4.1.4-management
@sourcery-ai
Copy link

sourcery-ai bot commented Oct 15, 2025

Reviewer's Guide

This PR enhances the Helm chart by adding resource quotas, making PVC access modes configurable (with conditional pod affinity for RWO), upgrading MongoDB to the 'noble' image with revamped secret management and init scripting, bumping RabbitMQ and chart versions, and refactoring environment variable mappings across deployments.

Entity relationship diagram for updated MongoDB secret and init script

erDiagram
  MONGODB_SECRET {
    string databaseRootUsername
    string databaseRootPassword
    string databaseUser
    string databasePassword
    string databaseName
  }
  CONFIGMAP_INIT_SCRIPT {
    string init_script_js
  }
  MONGODB ||--|| MONGODB_SECRET : uses
  MONGODB ||--|| CONFIGMAP_INIT_SCRIPT : uses
Loading

Class diagram for updated values.yaml resource and storage configuration

classDiagram
  class Flower {
    +string appName
    +string basicAuth
    +string image
    +Resources resources
  }
  class ProTES {
    +string appName
    +string image
    +Resources initResources
    +Resources resources
  }
  class CeleryWorker {
    +string appName
    +string image
    +Resources initResources
    +Resources resources
  }
  class MongoDB {
    +string appName
    +Secret secret
    +string volumeSize
    +string image
    +Resources resources
  }
  class RabbitMQ {
    +string appName
    +string volumeSize
    +string image
    +Resources resources
  }
  class Resources {
    +map limits
    +map requests
  }
  class Secret {
    +string databaseRootUsername
    +string databaseRootPassword
    +string databaseUser
    +string databasePassword
    +string databaseName
  }
  Flower --> Resources
  ProTES --> Resources
  ProTES --> Resources : initResources
  CeleryWorker --> Resources
  CeleryWorker --> Resources : initResources
  MongoDB --> Secret
  MongoDB --> Resources
  RabbitMQ --> Resources
Loading

Flow diagram for conditional pod affinity based on storage access mode

flowchart TD
  A["storageAccessMode = ReadWriteOnce?"] -->|Yes| B["Apply podAffinity: proTES pods scheduled with celery-worker on same node"]
  A -->|No| C["No affinity: pods scheduled freely"]
Loading

File-Level Changes

Change Details Files
Add CPU/memory resource requests and limits for workloads
  • Define resources for flower container
  • Add initResources and resources for protes init and main containers
  • Add initResources and resources for celeryWorker
  • Define resources for rabbitmq container
deployment/values.yaml
deployment/templates/flower/flower-deployment.yaml
deployment/templates/protes/protes-deployment.yaml
deployment/templates/protes/celery-deployment.yaml
deployment/templates/rabbitmq/rabbitmq-deployment.yaml
Make PVC access mode configurable with optional podAffinity for RWO
  • Introduce storageAccessMode key in values.yaml
  • Parameterize accessModes in protes, MongoDB and RabbitMQ PVC templates
  • Add podAffinity block in protes deployment when storageAccessMode is RWO
deployment/values.yaml
deployment/templates/protes/protes-volume.yaml
deployment/templates/mongodb/mongodb-pvc.yaml
deployment/templates/rabbitmq/rabbitmq-pvc.yaml
deployment/templates/protes/protes-deployment.yaml
Upgrade MongoDB to 'noble' with secret restructuring and init script
  • Switch MongoDB image to docker.io/library/mongo:noble
  • Move all DB credentials under .Values.mongodb.secret and update secret template
  • Rename env vars to MONGO_INITDB_ROOT_/MONGO_APP_ and update liveness probe to use mongosh
  • Mount init-script.js via new ConfigMap and include mongo-init-script.yaml template
deployment/values.yaml
deployment/templates/mongodb/mongodb-secret.yaml
deployment/templates/mongodb/mongodb-deployment.yaml
deployment/templates/mongodb/mongo-init-script.yaml
Bump RabbitMQ image and chart version
  • Update rabbitmq image to 4.1.4-management
  • Increment Chart.yaml version and appVersion to 2.0.0
deployment/values.yaml
deployment/Chart.yaml
Refactor environment variable mappings in protes and celery deployments
  • Update secretKeyRef keys for MONGO_USERNAME, MONGO_PASSWORD, MONGO_DBNAME to new secret structure
  • Update resource blocks to use templated resource definitions
deployment/templates/protes/protes-deployment.yaml
deployment/templates/protes/celery-deployment.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

@trispera trispera requested a review from lvarin October 15, 2025 07:25
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 - here's some feedback:

  • The mongo-init-script ConfigMap references dbproWES in the last section but earlier uses dbproTES—please correct the variable names for consistency.
  • This PR doesn’t reference a GitHub issue as required by the contribution guidelines—please create or link the issue that tracks these Helm chart updates.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The mongo-init-script ConfigMap references dbproWES in the last section but earlier uses dbproTES—please correct the variable names for consistency.
- This PR doesn’t reference a GitHub issue as required by the contribution guidelines—please create or link the issue that tracks these Helm chart updates.

## Individual Comments

### Comment 1
<location> `deployment/templates/mongodb/mongo-init-script.yaml:7-8` </location>
<code_context>
+  name: mongo-init-script
+data:
+  init-script.js: |
+    db = db.getSiblingDB('taskStore');
+    dbproTES = db.getSiblingDB('{{ tpl .Values.mongodb.secret.databaseName . }}')
+
+    dbproTES.createUser({
</code_context>

<issue_to_address>
**issue (bug_risk):** Potential confusion with database variable assignments in init script.

Please ensure all database variables, such as 'dbproWES', are assigned before use to prevent runtime errors.
</issue_to_address>

### Comment 2
<location> `deployment/templates/mongodb/mongo-init-script.yaml:23-29` </location>
<code_context>
+
+    // Create the 'tasks' and 'service_info' collections
+    // Database configuration from https://github.com/elixir-cloud-aai/proTES/blob/2f2d88915d9948b0d2ffbe6799af01bbc413b00a/pro_tes/config.yaml#L30
+    db.createCollection('tasks');
+    db.runs.createIndex(
+      { task_id: 1, worker_id: 1 },
+      { unique: true, sparse: true }
+    );
+    db.createCollection('service_info');
+    db.service_info.createIndex(
+      { id: 1 }
+    );
</code_context>

<issue_to_address>
**issue (bug_risk):** Collections and indexes are created in both 'db' and 'dbproWES', but 'dbproWES' is not defined.

'dbproWES' must be defined before use to prevent a ReferenceError. Please assign it as done for 'dbproTES'.
</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.

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.

1 participant