Skip to content

Conversation

BabisK
Copy link

@BabisK BabisK commented Jun 27, 2025

Fixes: #9837
Related: #7284
Merge before/after: Dependent or prerequisite PRs

Description

Respect the dependency graph between helm releases during clean up. Levels of the graph are cleaned on reverse order compared to installation. Releases in the same level are cleaned up in reverse order too.

User facing changes (remove if N/A)

Before
Releases are undeployed in the order they are mentioned in Config.

^CCleaning up...
release "postgres-operator" uninstalled
release "postgres" uninstalled

After
Releases are undeployed in the reverse order they were deployed, respecting the dependsOn values.

^CCleaning up...
release "postgres" uninstalled
release "postgres-operator" uninstalled

@BabisK BabisK requested a review from a team as a code owner June 27, 2025 18:35
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @BabisK, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical issue in Helm release cleanup by introducing a dependency-aware uninstallation process. Previously, releases were cleaned up in an arbitrary order, which could lead to errors if a dependent release was removed before its dependencies. The changes ensure that Helm releases are now uninstalled in the reverse order of their deployment, respecting defined dependencies, thereby providing a more robust and reliable cleanup mechanism.

Highlights

  • Helm Cleanup Logic: The core Helm cleanup function (Cleanup) has been refactored to first construct a dependency graph of all configured Helm releases.
  • Ordered Uninstallation: Releases are now uninstalled level by level, starting from the highest dependency level (most dependent releases) down to the lowest (least dependent releases). Within each level, releases are also uninstalled in reverse order of their definition, ensuring that dependencies are respected during teardown.
  • Go slices Package Adoption: The new slices package (Go 1.21+) is utilized to facilitate backward iteration over release levels and releases within each level, ensuring the correct cleanup order.
  • Improved Testing: A new comprehensive test case has been added to helm_test.go to explicitly validate the new ordered cleanup behavior, ensuring that releases are deleted in the correct sequence based on their dependencies.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces an important fix for Helm release cleanup, ensuring that dependencies are respected by deleting releases in the reverse order of their deployment. The implementation correctly uses a dependency graph to determine the cleanup order, handling different dependency levels and the order of releases within each level. I've added comments to improve error handling and logging.

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.

Releases in the Helm deployer should be cleaned up in reverse order
1 participant