Skip to content

CLOUDP-331841 - remove the agent matrix work #267

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 39 commits into
base: master
Choose a base branch
from

Conversation

nammn
Copy link
Collaborator

@nammn nammn commented Jul 15, 2025

Summary

Database:

from:

+------------------------------------------------------------+
|                        Pod: rs1                            |
+------------------------------------------------------------+
| Container 1: mongodb-agent (operator suffixed)             |
|   - entry: agent-launcher.sh                               |
|   - livenessProbe                                          |
|   - readinessProbe                                         |
+------------------------------------------------------------+
| Container 2: mongodb-enterprise-database                   |
|   - mongod                                                 |
|   - mongosh                                                |
+------------------------------------------------------------+

to:

+------------------------------------------------------------+
|                        Pod: rs1                            |
+------------------------------------------------------------+
| Container 1: mongodb-agent (not operator suffixed)         |
|   - entry: agent-launcher-shim.sh                          |
|   - dummy-livenessProbe                                    |
|   - dummy-readinessProbe                                   |
+------------------------------------------------------------+
| Container 2: utilities-holder (name tbd)                   |
|   - readinessProbe                                         |
|   - livenessProbe                                          |
|   - agent-launcher.sh                                      |
+------------------------------------------------------------+
| Container 3: mongodb-enterprise-database                   |
|   - mongod                                                 |
|   - mongosh                                                |
+------------------------------------------------------------+

AppDB:

from:

+------------------------------------------------------------+
|                        Pod: rs1                            |
+------------------------------------------------------------+
| Container 1: mongodb-agent (operator suffixed)             |
|   - entry: agent/mongodb-agent                             |
|   - agent-launcher.sh                                      |
|   - livenessProbe                                          |
|   - readinessProbe                                         |
+------------------------------------------------------------+
| Container 2: mongodb-enterprise-database                   |
|   - mongod                                                 |
|   - mongosh                                                |
+------------------------------------------------------------+

to:

+------------------------------------------------------------+
|                        Pod: rs1                            |
+------------------------------------------------------------+
| Container 1: mongodb-agent (not operator suffixed)         |
|   - entry: /usr/local/bin/setup-agent-files.sh &&          |
|            agent/mongodb-agent                             |
|   - agent-launcher-shim.sh (unused)                        |
|   - dummy-livenessProbe                                    |
|   - dummy-readinessProbe                                   |
+------------------------------------------------------------+
| Container 2: utilities-holder (name tbd)                   |
|   - readinessProbe                                         |
|   - livenessProbe                                          |
+------------------------------------------------------------+
| Container 3: mongodb-enterprise-database                   |
|   - mongod                                                 |
|   - mongosh                                                |
+------------------------------------------------------------+

Summary Changes

This pull request introduces significant changes to the MongoDB Kubernetes operator, focusing on refactoring, architecture updates, and bug fixes. The changes include removing unused dependencies, improving the handling of static and non-static architectures, and enhancing test coverage. Below is a categorized summary of the most important changes:

Refactoring and Code Simplification

  • No operator suffixed agent returned by the operator for the agent
  • Consolidated logic for handling static and non-static architectures in the buildDatabaseStatefulSetConfigurationFunction by introducing shared and architecture-specific modifications. [1] [2]
  • Renamed InitDatabaseNonStaticImage to InitDatabaseImage in DatabaseStatefulSetOptions for clarity.

Static and Non-Static Architecture Handling

  • Introduced separate functions (buildStaticArchitecturePodTemplateSpec and buildNonStaticArchitecturePodTemplateSpec) to handle static and non-static architectures, improving modularity and maintainability.
  • Updated the AppDbStatefulSet function to include opts.InitAppDBImage when defining init containers, ensuring proper handling of both architectures.

Enhancements to StatefulSet and Pod Templates

  • Added a new container (automationUtilitiesPodTemplateFunc) to the appDbPodSpec for managing utility scripts and hooks, along with corresponding volume mounts. [1] [2]
  • Adjusted the AutomationAgentCommand to include additional startup parameters for better configuration.

Proof of Work

  • passing ci (old patch)
  • new e2e test: TBA

Checklist

  • Have you linked a jira ticket and/or is the ticket in the title?
  • Have you checked whether your jira ticket required DOCSP changes?
  • Have you checked for release_note changes?

Reminder (Please remove this when merging)

  • Please try to Approve or Reject Changes the PR, keep PRs in review as short as possible
  • Our Short Guide for PRs: Link
  • Remember the following Communication Standards - use comment prefixes for clarity:
    • blocking: Must be addressed before approval.
    • follow-up: Can be addressed in a later PR or ticket.
    • q: Clarifying question.
    • nit: Non-blocking suggestions.
    • note: Side-note, non-actionable. Example: Praise
    • --> no prefix is considered a question

@nammn nammn force-pushed the remove-agent-matrix branch from d76eda3 to 08c2c49 Compare July 16, 2025 09:25
@nammn nammn added the wip label Jul 16, 2025
@nammn nammn changed the title refactor - agent matrix work wip - refactor - agent matrix work Jul 16, 2025
@nammn nammn changed the title wip - refactor - agent matrix work remove the magent matrix work Jul 23, 2025
@nammn nammn changed the title remove the magent matrix work remove the agent matrix work Jul 23, 2025
@nammn nammn changed the title remove the agent matrix work CLOUDP-331841 - remove the agent matrix work Jul 25, 2025
nammn added a commit that referenced this pull request Jul 28, 2025
# Summary

- those scripts are required for agent matrix removal. They are placed
here - since we overwrite the tag and this would race with the images
created in other e2e tests

### Dockerfile updates:
* Updated `docker/mongodb-agent-non-matrix/Dockerfile` to copy new
scripts (`agent-launcher-shim.sh`, `setup-agent-files.sh`,
`dummy-probe.sh`, `dummy-readinessprobe.sh`) into the container at build
time. These scripts are placed in `/usr/local/bin` for execution.
* Updated `docker/mongodb-agent-non-matrix/Dockerfile.builder` to
include the same script files in the build process, ensuring they are
available in the image.

### New scripts added:
*
[`agent-launcher-shim.sh`](diffhunk://#diff-7050c43142cef16fa7268fd7d1356e96bdf5de2c8bc0d050f277babee01a397cR1-R31):
A script to initialize the agent launcher by setting up agent files and
starting the launcher if the required script is found.
*
[`setup-agent-files.sh`](diffhunk://#diff-fbe2cd71b8fc58242e04e18562c58b1085f6b059dce42d94a2f4e5cbdf7a3469R1-R95):
A script to set up dummy probe scripts initially, wait for an init
container to provide real probe and launcher scripts, and replace the
dummy scripts with the real ones.
*
[`dummy-probe.sh`](diffhunk://#diff-ff81b0610fd08dd2d32bcbe72c0d78fb402d5f6dbe8a388bad94c7cdf9b95e3bR1-R5):
A dummy liveness probe script that always returns success to keep the
container alive during the setup process.
*
[`dummy-readinessprobe.sh`](diffhunk://#diff-4378f36df04937eb7473771a47dc6ac5a424ec8ffdb171e201b9fc8052a54c26R1-R5):
A dummy readiness probe script that always returns a "not ready" status
until the real probe script is available.

## Proof of Work

- not used anywhere, ci needs to pass
- used by this pr (that contains more information on how its used):
#267

## Checklist
- [x] Have you linked a jira ticket and/or is the ticket in the title?
- [x] Have you checked whether your jira ticket required DOCSP changes?
- [ ] Have you checked for release_note changes?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant