Skip to content

Conversation

@haorenfsa
Copy link
Collaborator

@haorenfsa haorenfsa commented Dec 26, 2025

This pull request introduces logic to automatically clean up cluster-mode component deployments when switching a Milvus instance to standalone mode, ensuring a smooth transition and resource cleanup. It adds a new method for this cleanup, comprehensive tests for various scenarios, and integrates the cleanup step into the deployment reconciliation process.

Cluster-to-Standalone Cleanup Logic:

  • Added the CleanupDeploymentClusterToStandalone method in deployment_cluster_to_standalone.go to:
    • Identify and delete all non-standalone component deployments when the Milvus instance is in standalone mode, but only after confirming all standalone deployments are ready.
    • Handle cases where standalone deployments are not yet ready or present, ensuring safe and idempotent cleanup.

Testing Enhancements:

  • Introduced deployment_cluster_to_standalone_test.go with comprehensive test cases covering:
    • Skipping cleanup in cluster mode.
    • Handling scenarios with no non-standalone deployments.
    • Ensuring non-standalone deployments are only deleted when all standalone deployments are ready.
    • Supporting multiple deployments per component and two-deployment standalone modes.

Integration with Reconciliation Flow:

  • Integrated the new cleanup logic into the main deployment reconciliation process by invoking CleanupDeploymentClusterToStandalone in ReconcileDeployments.

@sre-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: haorenfsa

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@codecov
Copy link

codecov bot commented Dec 26, 2025

Codecov Report

❌ Patch coverage is 84.00000% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.68%. Comparing base (2c7fc8f) to head (050e307).

Files with missing lines Patch % Lines
...kg/controllers/deployment_cluster_to_standalone.go 87.23% 3 Missing and 3 partials ⚠️
pkg/controllers/deployments.go 33.33% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #456      +/-   ##
==========================================
+ Coverage   76.62%   76.68%   +0.06%     
==========================================
  Files          65       66       +1     
  Lines        6044     6094      +50     
==========================================
+ Hits         4631     4673      +42     
- Misses       1160     1164       +4     
- Partials      253      257       +4     

☔ 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

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds functionality to automatically clean up cluster-mode deployments when a Milvus instance is transitioned to standalone mode. The implementation ensures that cluster components are only deleted after the standalone deployment is ready, preventing service disruption during the transition.

Key changes:

  • Adds ReconcileDeploymentClusterToStandalone function to detect and delete non-standalone deployments when in standalone mode
  • Waits for standalone deployment readiness before deleting cluster components
  • Includes comprehensive test coverage for various scenarios including multiple deployment modes and edge cases

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
pkg/controllers/deployment_cluster_to_standalone.go New implementation that filters cluster deployments, checks standalone readiness, and deletes cluster components
pkg/controllers/deployment_cluster_to_standalone_test.go Comprehensive test suite covering cluster mode skip, no cleanup scenarios, readiness checks, and multi-deployment deletion
pkg/controllers/deployments.go Integration point that calls the new cleanup function during deployment reconciliation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@haorenfsa haorenfsa changed the title add ReconcileDeploymentClusterToStandalone add CleanupDeploymentClusterToStandalone Dec 26, 2025
Signed-off-by: haorenfsa <haorenfsa@gmail.com>
Signed-off-by: haorenfsa <haorenfsa@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants