Skip to content

CLOUDP-321075: fail to reconcile mongo db search for version 1.47.0 #244

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

Open
wants to merge 3 commits into
base: search/public-preview
Choose a base branch
from

Conversation

anandsyncs
Copy link
Contributor

@anandsyncs anandsyncs commented Jul 9, 2025

Summary

This pull request introduces validation for unsupported MongoDBSearch image versions and adds a corresponding test case. The key changes include implementing a new validation method, updating the reconciliation logic, and adding constants for unsupported versions.

Validation for unsupported MongoDBSearch image versions:

  • New validation method: Added ValidateSearchImageVersion to MongoDBSearchReconcileHelper to check if the specified or container image version matches an unsupported version (1.47.0). If so, it returns an error.

  • Integration into reconciliation workflow: Updated the reconcile method to invoke ValidateSearchImageVersion before proceeding with other validations.

  • Constants for unsupported version: Introduced unsupportedSearchVersion and unsupportedSearchVersionErrorFmt constants to centralize the unsupported version logic and error formatting.

Test case for validation:

  • New test: Added TestMongoDBSearchReconcile_InvalidSearchImageVersion to validate the error handling for unsupported MongoDBSearch versions. This ensures the reconciliation fails with the appropriate error message.

Proof of Work

Test pass

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

@anandsyncs anandsyncs changed the base branch from master to search/public-preview July 10, 2025 14:04
@anandsyncs anandsyncs marked this pull request as ready for review July 14, 2025 12:46
@anandsyncs anandsyncs requested a review from a team as a code owner July 14, 2025 12:46
@anandsyncs anandsyncs requested review from fealebenpae, lucian-tosa and lsierant and removed request for a team and lucian-tosa July 14, 2025 12:46
}

for _, container := range r.mdbSearch.Spec.StatefulSetConfiguration.SpecWrapper.Spec.Template.Spec.Containers {
if strings.Contains(container.Image, unsupportedSearchVersion) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This could trigger on any sidecar containers users add. Perhaps the if check should also test whether the container name equals the MongotContainerName constant in search_construction.go?


func (r *MongoDBSearchReconcileHelper) ValidateSearchImageVersion() error {
version := strings.TrimSpace(r.mdbSearch.Spec.Version)
if version != "" {
Copy link
Contributor

Choose a reason for hiding this comment

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

If the version field in the spec is empty, you should check r.operatorSearchConfig.SearchVersion (see the createOrUpdateStatefulSet() method on MongoDBSearchReconcileHelper and perhaps extract a helper to calculate the version).

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