fix(status): correct history snapshot fields for helm-controller compatibility#10
Conversation
📝 WalkthroughWalkthroughHistory entry creation was changed to compute the next version from existing entries, set Snapshot Name/Namespace from the HelmRelease, populate Version, FirstDeployed, LastDeployed, and Status, and prepend new snapshots to Status.History (latest-first ordering). Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of ChangesHello @kvaps, 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 bug that caused Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe 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 by creating a comment using either
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 Limitations & Feedback Gemini Code Assist 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. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. 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
|
There was a problem hiding this comment.
Code Review
This pull request addresses a critical bug that caused helm-controller to unexpectedly uninstall HelmReleases after a cozyhr apply. The changes correctly update the status.history snapshot fields, including Name, Namespace, and Version, to be compatible with helm-controller's expectations. Additionally, the history update logic is corrected to prepend new entries, ensuring History.Latest() works as intended. The fix appears solid and directly addresses the issues outlined in the pull request description. I have added one suggestion for a minor refactoring to improve efficiency by avoiding a redundant function call.
…atibility The newHistoryEntry function was incorrectly setting several fields in the status.history Snapshot, causing helm-controller v0.37.0+ to trigger uninstall due to ReleaseTargetChanged detection: - Name: was set to chartName instead of release name - Namespace: was set to hr.Namespace instead of release namespace - Version: was always 1 instead of incrementing from previous - History order: was appended to end instead of prepended When helm-controller compares obj.GetReleaseName() with cur.Name from status.history, a mismatch triggers an uninstall of the "old" release before installing the "new" one. This caused tenant HelmReleases to be deleted unexpectedly. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
770c178 to
d83d0f1
Compare
Summary
Fix critical bug causing helm-controller v0.37.0+ to unexpectedly uninstall HelmReleases after cozyhr apply.
The
newHistoryEntryfunction was incorrectly setting several fields instatus.historySnapshot:chartName(e.g., "tenant") instead of release name (e.g., "tenant-root")hr.Namespaceinstead ofhr.GetReleaseNamespace()1instead of incrementing from previous history entryHistory.Latest()returns first element)Root Cause
When helm-controller reconciles, it calls
ReleaseTargetChanged()which compares:obj.GetReleaseName()(from spec)cur.Name(fromstatus.history[0])If these don't match, helm-controller triggers an uninstall of the "old" release before installing the "new" one. This caused tenant HelmReleases to be deleted unexpectedly.
Test plan
namematchingspec.releaseNameormetadata.nameSummary by CodeRabbit
Bug Fixes
Improvements
✏️ Tip: You can customize this high-level summary in your review settings.