-
Notifications
You must be signed in to change notification settings - Fork 136
[backups] Stub the Job backup strategy controller #1720
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
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. ✨ Finishing touches🧪 Generate unit tests (beta)
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 @lllamnyp, 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 lays the groundwork for a new backup strategy mechanism within the Cozystack project. It establishes a new Kubernetes API type for defining Job-based backup strategies and sets up the essential boilerplate for a dedicated controller to manage these resources. The changes also include the necessary infrastructure for building, deploying, and configuring this new controller via a Helm chart, preparing the system for future implementation of the backup logic. Highlights
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This PR introduces the basic scaffolding for a new Job backup strategy controller. The changes include new API types, a stubbed controller, and the necessary Helm chart and build configurations. The overall structure is sound and follows established patterns. I've identified a few issues: a missing scheme registration in the controller's main entrypoint which could lead to runtime errors, an inconsistent name in the Helm chart, and an unnecessary RBAC permission. Addressing these points will improve the correctness and maintainability of the new controller.
| func init() { | ||
| utilruntime.Must(clientgoscheme.AddToScheme(scheme)) | ||
|
|
||
| utilruntime.Must(backupsv1alpha1.AddToScheme(scheme)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The scheme for the new strategy.backups.cozystack.io API group is not being registered. The controller will need to interact with Job custom resources from this group. Without registering the scheme, the manager's client won't know how to handle these types, which will likely cause runtime errors.
Please add the scheme registration. You'll also need to add the corresponding import:
import (
// ...
backupstrategyv1alpha1 "github.com/cozystack/cozystack/api/backups/strategy/v1alpha1"
// ...
)| utilruntime.Must(backupsv1alpha1.AddToScheme(scheme)) | |
| utilruntime.Must(backupsv1alpha1.AddToScheme(scheme)) | |
| utilruntime.Must(backupstrategyv1alpha1.AddToScheme(scheme)) |
| @@ -0,0 +1,3 @@ | |||
| apiVersion: v2 | |||
| name: cozy-backup-controller | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| resources: ["*"] | ||
| verbs: ["get", "list", "watch"] | ||
| - apiGroups: ["backups.cozystack.io"] | ||
| resources: ["backupjobs", "restorejobs"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ClusterRole grants permissions for restorejobs. However, the controller being introduced only reconciles BackupJob objects and doesn't seem to interact with restorejobs. To adhere to the principle of least privilege, it's best to remove permissions that are not currently required.
resources: ["backupjobs"]## What this PR does This PR introduces a bare-bones Job backup strategy API type and stubs out all the boilerplate for a new controller that will handle this strategy, as well as any others in the `strategy.backups.cozystack.io` API group. ### Release note ```release-note [backups] Create stubs and minimal implmentations for controllers for the strategy.backups.cozystack.io API group. ``` Signed-off-by: Timofei Larkin <lllamnyp@gmail.com>
0bdf25a to
ee2a34c
Compare
## What this PR does This PR introduces a bare-bones Job backup strategy API type and stubs out all the boilerplate for a new controller that will handle this strategy, as well as any others in the `strategy.backups.cozystack.io` API group. ### Release note ```release-note [backups] Create stubs and minimal implmentations for controllers for the strategy.backups.cozystack.io API group. ``` (cherry picked from commit 1f0b5ff) Signed-off-by: Timofei Larkin <lllamnyp@gmail.com>
…d backup system (#1867) ## What this PR does Update changelog for v1.0.0-alpha.1 to include missing features: - **Cozystack Operator**: New operator for Package and PackageSource management (#1740, #1741, #1755, #1756, #1760, #1761) - **Backup System**: Comprehensive backup functionality with Velero integration (#1640, #1685, #1687, #1708, #1719, #1720, #1737, #1762) - Add @androndo to contributors - Update Full Changelog link to v0.38.0...v1.0.0-alpha.1 ### Release note ```release-note [docs] Update changelog for v1.0.0-alpha.1: add cozystack-operator and backup system ```
What this PR does
This PR introduces a bare-bones Job backup strategy API type and stubs out all the boilerplate for a new controller that will handle this strategy, as well as any others in the
strategy.backups.cozystack.ioAPI group.Release note