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

feat(backup): multiple backup stores support #2182

Open
wants to merge 28 commits into
base: master
Choose a base branch
from

Conversation

mantissahz
Copy link
Contributor

Support multiple backup stores to create, delete and update them.
Remove the default backup target instead using Default flag in BackupTarget CR spec.
Adding a flag ReadOnly in BackupTarget CR spec prevent backups from being created and storing on this remote backup target.
And provide HTTP endpoints to create, delete, update and list secrets.

Ref: longhorn/longhorn#5411

@mergify
Copy link

mergify bot commented Oct 25, 2023

This pull request is now in conflicts. Could you fix it @mantissahz? 🙏

@mergify
Copy link

mergify bot commented Oct 27, 2023

This pull request is now in conflicts. Could you fix it @mantissahz? 🙏

@innobead
Copy link
Member

Is this ready for review?

@mantissahz
Copy link
Contributor Author

Is this ready for review?

@innobead Yes, but LEP longhorn/longhorn#6630 is still in review.

@mantissahz mantissahz marked this pull request as ready for review November 22, 2023 01:23
@mantissahz mantissahz requested a review from a team as a code owner November 22, 2023 01:23
@mantissahz mantissahz force-pushed the issue5411 branch 3 times, most recently from c1e1178 to 4cdb679 Compare November 23, 2023 16:48
@mantissahz mantissahz marked this pull request as draft November 30, 2023 02:10
@mantissahz mantissahz marked this pull request as ready for review December 4, 2023 03:19
Copy link
Contributor

@james-munson james-munson left a comment

Choose a reason for hiding this comment

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

Still reviewing, but one question already.

api/model.go Outdated Show resolved Hide resolved
api/model.go Outdated Show resolved Hide resolved
Copy link
Contributor

@james-munson james-munson left a comment

Choose a reason for hiding this comment

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

Just a couple of minor things.

controller/backup_target_controller.go Outdated Show resolved Hide resolved
controller/backup_target_controller.go Outdated Show resolved Hide resolved
controller/backup_target_controller.go Outdated Show resolved Hide resolved
controller/backup_target_controller.go Outdated Show resolved Hide resolved
webhook/resources/backuptarget/validator.go Show resolved Hide resolved
webhook/resources/backuptarget/validator.go Show resolved Hide resolved
@mantissahz mantissahz requested review from ChanYiLin and a team December 12, 2023 09:08
Introduce new fields `BackupTargetURL` and `BackupTargetName` in
`Spec` of Backup CRD to support multiple backup targets.

Ref: 5411

Signed-off-by: James Lu <james.lu@suse.com>
Introduce new fields `BackupTargetURL`, `BackupTargetName` and
`VolumeName` in `Spec` of BackupVolume CRD to support multiple
backup targets.

Ref: 5411

Signed-off-by: James Lu <james.lu@suse.com>
Introduce new fields `Default` and `ReadOnly` in `Status` of
BackupTarget CRD to support multiple backup targets.

Ref: 5411

Signed-off-by: James Lu <james.lu@suse.com>
List backup volume CRs by the label `backup-target` that is a backup
target name and get last updated backup volume CR by a volume name.

Ref: 5411

Signed-off-by: James Lu <james.lu@suse.com>
Add the backup target mutator and add the finalizer into
the backupTarget CR when mutating.

Ref: 5411

Signed-off-by: James Lu <james.lu@suse.com>
Ref: 5411

Signed-off-by: James Lu <james.lu@suse.com>
Remove the default backup target from setting controller and add
the timer for each backup target for polling interval.

Ref:5411

Signed-off-by: James Lu <james.lu@suse.com>
Remove global settings `backup-target`,
`backup-target-credential-secret` and `backupstore-poll-interval`.

Ref:5411

Signed-off-by: James Lu <james.lu@suse.com>
Modify backup volume controller to support multiple backup stores
support. Synchronize and handle the backup volumes information from
different backup targets with the same backup volume name or not.

Ref: 5411

Signed-off-by: James Lu <james.lu@suse.com>
Modify backup controller to support multiple backup stores support.
Synchronize and handle the backup information from different backup
targets with the same backup volume name or not.

Ref: 5411

Signed-off-by: James Lu <james.lu@suse.com>
Replace the value of the field `BackupTargetURL` of Backup CR spec
by the default backup target URL if it is empty when mutating.

Ref: 5411

Signed-off-by: James Lu <james.lu@suse.com>
For restoration, the BackupVolume CR name will not be the same to
the backup volume name in the `fromBackup` URL in Volume spec.
Set engine.Spec.BackupVolume as BackupVolume CR name.

Introduce a new field `BackupTargetName` in Engine Spec to get the
backup target status when creating a volume by restoring a backup.

Ref: 5411

Signed-off-by: James Lu <james.lu@suse.com>
Add a new filed `BackupTargetName` in RecurringJob spec and related
data strucurtes of APIs and recurring job app.

Ref: 5411

Signed-off-by: James Lu <james.lu@suse.com>
The first backup target will become the default backup target
whether the `Default` in `Spec` is set `true` or not. If it is not
the first backup target with the `Default` in `Spec` set `true`,
backup target controller will set `Default` false both in `Spec`
and `Status` for previous default backup target and then setup new
backup target as a default one.

Ref: 5411

Signed-off-by: James Lu <james.lu@suse.com>
Get the default backup target by `Status.Default` instead of
gettting backup target by `types.DefaultBackupTargetName`.

Ref:5411

Signed-off-by: James Lu <james.lu@suse.com>
Check if creating backup is on a read-only backup target or not.

Ref: 5411

Signed-off-by: James Lu <james.lu@suse.com>
Add secret HTTP apis: "SecretCreate", "SecretGet", "SecretList",
"SecretUpdate" and "SecretDelete".

Ref: 5411

Signed-off-by: James Lu <james.lu@suse.com>
Add more parameters in creating BackupVolume for testing
volume_controller.go

Ref: 5411

Signed-off-by: James Lu <james.lu@suse.com>
Support multiple backup stores.

Ref: 5411

Signed-off-by: James Lu <james.lu@suse.com>
Ref: 5411

Signed-off-by: James Lu <james.lu@suse.com>
Move AWS IAM Role Annotation implementations to
datastore/kubernetes.go and trigger it by backup target validator.

Ref: 5411, 6947

Signed-off-by: James Lu <james.lu@suse.com>
Upgrade CRs for Engine, BackupTarget, BackupVolume, Backup, and
RecurringJob.

Ref: 5411

Signed-off-by: James Lu <james.lu@suse.com>
sets.String is deprecated: use generic Set instead

Ref: longhorn/longhorn 5411

Signed-off-by: James Lu <james.lu@suse.com>
Ref: 5411

Signed-off-by: James Lu <james.lu@suse.com>
Ref: longhorn/longhorn 5411

Signed-off-by: James Lu <james.lu@suse.com>
Ref: longhorn/longhorn 5411

Signed-off-by: James Lu <james.lu@suse.com>
Ref: longhorn/longhorn 5411

Signed-off-by: James Lu <james.lu@suse.com>
Ref: longhorn/longhorn 5411

Signed-off-by: James Lu <james.lu@suse.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants