Skip to content
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

Add Nebula scheduled backup CRD #416

Merged
merged 11 commits into from
Jan 27, 2024
Merged

Add Nebula scheduled backup CRD #416

merged 11 commits into from
Jan 27, 2024

Conversation

kevinliu24
Copy link
Contributor

@kevinliu24 kevinliu24 commented Dec 29, 2023

What type of PR is this?

  • bug
  • feature
  • enhancement

What problem(s) does this PR solve?

Issue(s) number:

#404

Description:

Add Nebula Scheduled backup CRD

How do you solve it?

Added a CRD for a Nebula scheduled backup type

Special notes for your reviewer, ex. impact of this fix, design document, etc:

@kevinliu24 kevinliu24 added do not review Progress: not ready for the code review yet type/feature req Type: feature request wip Progress: work in progress labels Dec 29, 2023
@kevinliu24 kevinliu24 self-assigned this Dec 29, 2023
@CLAassistant
Copy link

CLAassistant commented Dec 29, 2023

CLA assistant check
All committers have signed the CLA.

@kevinliu24 kevinliu24 marked this pull request as ready for review January 11, 2024 08:21
@kevinliu24 kevinliu24 removed the do not review Progress: not ready for the code review yet label Jan 11, 2024
apis/apps/v1alpha1/backupschedule_types.go Show resolved Hide resolved
apis/apps/v1alpha1/backupschedule_types.go Outdated Show resolved Hide resolved
apis/apps/v1alpha1/nebulabackup_types.go Outdated Show resolved Hide resolved
config/rbac/role.yaml Outdated Show resolved Hide resolved
pkg/controller/nebulabackup/nebula_backup_control.go Outdated Show resolved Hide resolved
apis/apps/v1alpha1/backupschedule_types.go Outdated Show resolved Hide resolved
Comment on lines +72 to +74
MaxSuccessfulNebulaBackupJobs *int32 `json:"maxSuccessfulNebulaBackupJobs,omitempty"`
// MaxFailedNebulaBackupJobs specifies the maximum number of failed backup jobs to keep. Default 3
MaxFailedNebulaBackupJobs *int32 `json:"maxFailedNebulaBackupJobs,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are these fields necessary? I believe users aren't particularly concerned with how many NebulaBackups need to be retained. This is precisely the task for NebulaScheduled. It determines retention based on MaxBackups and MaxRetentionTime.

Additionally, I think the lifecycle of NebulaBackup should be responsible for determining when the corresponding storage is deleted. In other words, when NebulaBackup is deleted, the corresponding storage should also be deleted, maintaining a consistent lifecycle.

NebulaScheduled only operates on NebulaBackup, deleting relevant resources when NebulaBackup is removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, MaxBackups and MaxRetentionTime is for determining how many backups to keep in either the S3 bucket or the gcp bucket. These parameters are there to specify how many backup jobs the user wants to keep as the user may want to keep the backup itself but not the actual job that created it. This also allows the user to keep all failed backup logs if needed. @MegaByte875 what do you think?

Comment on lines +63 to +66
// if both MaxBackups and MaxReservedTime are set at the same time, MaxReservedTime will be used
// and MaxBackups is ignored.
MaxBackups *int32 `json:"maxBackups,omitempty"`
// MaxReservedTime is to specify how long backups we want to keep.
MaxReservedTime *string `json:"maxReservedTime,omitempty"`
// BackupTemplate is the specification of the backup structure to get scheduled.
// MaxRetentionTime specifies how long we want the backups in the remote storage bucket to be kept for.
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't it be the case that if either of these two parameters meets the condition, it should be deleted? Instead of setting both parameters and using only one as the basis for judgement.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The current design is to use MaxReservedTime if both are specified as this is simpler understand for the customer and easier to implement. Otherwise we don't know whether the customer means "delete a backup if there are more then MaxBackups and the backup is older than MaxReservedTime" or "delete a backup if there are more then MaxBackups or if the backup if older than MaxReservedTime".

We can definitely think about which version we want to support and change the design to accommodate both parameters in a future version if there's customer demand for this. What do you think @MegaByte875

Copy link
Contributor

Choose a reason for hiding this comment

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

Here's an example for a simple task: a log cleaning function. There are two settings: one for the maximum number of days to be retained, and one for the maximum storage to be kept. If a user configures both, how should we proceed?

I assume that the user wants to keep a certain number of days, but they also don't want to consume too much storage.

Returning to this issue, I think it's similar. By the way, if the user only wants to retain a certain number of days, why would they configure MaxBackups?

@MegaByte875 MegaByte875 merged commit 713742b into backup Jan 27, 2024
1 check passed
@kevinliu24 kevinliu24 deleted the add-scheduled-backup branch March 12, 2024 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/feature req Type: feature request wip Progress: work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants