Skip to content

[platform] Prevent installed packages deletion - #2273

Merged
myasnikovdaniil merged 1 commit into
mainfrom
fix/prevent-package-deletion
Mar 30, 2026
Merged

myasnikovdaniil merged 1 commit into
mainfrom
fix/prevent-package-deletion

Conversation

@myasnikovdaniil

@myasnikovdaniil myasnikovdaniil commented Mar 26, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does

Adds annotation helm.sh/resource-policy: keep to all packages to prevent its automatic deletion when:
1, Package added to disabledPackages parameter in cozystack.cozystack-platform package
2. Package removed form enabledPackages parameter in cozystack.cozystack-platform package

This change bring back docs explained behavior - platform administrator should manually delete package if needed.

Release note

[platform] Prevent installed packages deletion

Summary by CodeRabbit

  • Chores
    • Updated Helm templates to configure resource-policy annotations on package resources, ensuring proper resource lifecycle management and retention policies during cluster deployments.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 introduces a change to prevent the automatic deletion of installed packages when they are no longer enabled or explicitly disabled. By applying the helm.sh/resource-policy: keep annotation, the system now requires manual intervention from a platform administrator to delete these packages, ensuring consistency with the documented operational behavior.

Highlights

  • Package Deletion Prevention: Added the helm.sh/resource-policy: keep annotation to all packages to prevent their automatic deletion when they are disabled or removed from the enabledPackages parameter.

🧠 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 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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 (@gemini-code-assist) Responds in comments when explicitly tagged, both in pull request 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 may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on Gemini (@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.

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. ↩

@dosubot dosubot Bot added the kind/feature Categorizes issue or PR as related to a new feature label Mar 26, 2026
@coderabbitai

coderabbitai Bot commented Mar 26, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c25c1132-a298-4d1e-9feb-b4602d9dc113

📥 Commits

Reviewing files that changed from the base of the PR and between f13e68a and a243f3d.

📒 Files selected for processing (1)
  • packages/core/platform/templates/_helpers.tpl

📝 Walkthrough

Walkthrough

The Helm helper template now adds a metadata.annotations.helm.sh/resource-policy: keep annotation to generated Package resources in both the main and optional package definitions. This ensures Helm retains managed resources during lifecycle operations.

Changes

Cohort / File(s) Summary
Helm Helper Template
packages/core/platform/templates/_helpers.tpl
Added metadata.annotations.helm.sh/resource-policy: keep annotation to both the main cozystack.platform.package and cozystack.platform.package.optional template definitions to preserve resource state during Helm operations.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested labels

size:XS

Suggested reviewers

  • lllamnyp
  • lexfrei
  • androndo
  • IvanHunters
  • sircthulhu
  • kvaps

Poem

🐰 A little annotation, so small yet so keen,
Keeps resources safe in the Helm machine,
With keep in the policy, steady and true,
No more lost packages—we've made something new! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly and specifically describes the main change: preventing installed packages from being deleted when disabled or removed.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/prevent-package-deletion

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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

Copy link
Copy Markdown
Contributor

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 adds the helm.sh/resource-policy: keep annotation to the metadata section of Package kind resources within the _helpers.tpl file, specifically to two different Package templates. A review comment suggests refactoring the duplicated Package resource definition into a separate helper template to improve maintainability and reduce redundancy across these templates.

Comment on lines +16 to +17
annotations:
helm.sh/resource-policy: keep

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The annotations block, including helm.sh/resource-policy: keep, is duplicated across the cozystack.platform.package and cozystack.platform.package.optional templates. To improve maintainability and reduce redundancy, consider extracting the common Package resource definition (up to spec.variant) into a separate helper template. This would allow both cozystack.platform.package and cozystack.platform.package.optional to include this common base, ensuring consistency and simplifying future modifications.

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Mar 30, 2026
@myasnikovdaniil myasnikovdaniil added kind/backport Categorizes issue or PR as requiring a backport to the current release line kind/backport-previous Categorizes issue or PR as requiring a backport to the previous release line kind/bug Categorizes issue or PR as related to a bug and removed kind/feature Categorizes issue or PR as related to a new feature labels Mar 30, 2026
@myasnikovdaniil
myasnikovdaniil merged commit 3646535 into main Mar 30, 2026
18 of 19 checks passed
@myasnikovdaniil
myasnikovdaniil deleted the fix/prevent-package-deletion branch March 30, 2026 16:36
@github-actions

Copy link
Copy Markdown

Successfully created backport PR for release-1.2:

@github-actions

Copy link
Copy Markdown

Successfully created backport PR for release-1.1:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/backport Categorizes issue or PR as requiring a backport to the current release line kind/backport-previous Categorizes issue or PR as requiring a backport to the previous release line kind/bug Categorizes issue or PR as related to a bug lgtm This PR has been approved by a maintainer size/XS This PR changes 0-9 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants