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 Bucket Lock immutable object support for Google Cloud Storage. #776

Merged
merged 15 commits into from
Sep 30, 2024

Conversation

renormalize
Copy link
Member

@renormalize renormalize commented Sep 10, 2024

What this PR does / why we need it:

Enables etcd-backup-restore to handle immutable objects as provided by bucket lock in Google Cloud Storage.

  • A new method IsDeletable() is added to the Snapshot struct. This method returns a bool which informs the caller whether the Snapshot instance can be deleted from the object store. It internally checks the immutability expiration time of the object and returns true if it has expired.

  • Custom metadata can be added to objects in Google Cloud Storage. In case any particular object (snapshot) is to be excluded during restoration, custom metadata can be added to that object with the key x-etcd-snapshot-exclude and value true.

  • The List() method of SnapStore interface is now enhanced. It takes a bool.

    • false: List() will only return the objects in the object store that do not have the custom metadata x-etcd-snapshot-exclude added to it.
    • true: List() will return all objects present in the object store. This variant is used in garbage collection.

Which issue(s) this PR fixes:
Fixes # #777 only for GCS

Special notes for your reviewer:

This PR only adds support for GCS. Identical PRs adding support for other providers will be raised separately.

Release note:

etcd-backup-restore now supports immutable objects for storage provider: Google Cloud Storage, provided by the [Bucket Lock](https://cloud.google.com/storage/docs/bucket-lock) feature.
Snapshots garbage collection performed by etcd-backup-restore (if enabled) for GCS is performed only when the objects' immutability period expires.
Support for Bucket lock (GCS) in etcd-backup-restore is backward compatible. For more info please refer to this doc: https://github.com/gardener/etcd-backup-restore/blob/master/docs/usage/immutable_snapshots.md

seshachalam-yv and others added 4 commits September 10, 2024 10:09
- Added `RetentionExpiry` field to Snapshot struct to store retention expiry time.
- Added `IsDeletable` method to `Snapshot` struct to determine if a snapshot is deletable based on `RetentionExpiry`.
- Introduced `ExcludeSnapshotMetadataKey` constant for marking snapshots to be ignored.
- Modified garbage collection logic to skip immutable snapshots.
- Updated GCS snapstore list function to exclude objects with `x-etcd-snapshot-exclude` metadata.
@renormalize renormalize added platform/gcp Google cloud platform/infrastructure area/robustness Robustness, reliability, resilience related area/backup Backup related area/storage Storage related labels Sep 10, 2024
@renormalize renormalize added this to the 2024-Q3 milestone Sep 10, 2024
@renormalize renormalize self-assigned this Sep 10, 2024
@renormalize renormalize requested a review from a team as a code owner September 10, 2024 04:45
@gardener-robot gardener-robot added the needs/review Needs review label Sep 10, 2024
@gardener-robot-ci-1 gardener-robot-ci-1 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Sep 10, 2024
@gardener-robot gardener-robot added the size/m Size of pull request is medium (see gardener-robot robot/bots/size.py) label Sep 10, 2024
@gardener-robot-ci-2 gardener-robot-ci-2 added needs/ok-to-test Needs approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Sep 10, 2024
@gardener-robot-ci-2 gardener-robot-ci-2 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Sep 10, 2024
@gardener-robot-ci-1 gardener-robot-ci-1 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Sep 10, 2024
@gardener-robot-ci-1 gardener-robot-ci-1 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Sep 10, 2024
@gardener-robot-ci-3 gardener-robot-ci-3 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Sep 11, 2024
@ishan16696 ishan16696 self-assigned this Sep 12, 2024
@gardener-robot-ci-3 gardener-robot-ci-3 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Sep 12, 2024
@gardener-robot-ci-1 gardener-robot-ci-1 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Sep 12, 2024
@gardener-robot gardener-robot added size/l Size of pull request is large (see gardener-robot robot/bots/size.py) needs/second-opinion Needs second review by someone else and removed size/m Size of pull request is medium (see gardener-robot robot/bots/size.py) labels Sep 18, 2024
@gardener-robot-ci-2 gardener-robot-ci-2 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Sep 18, 2024
pkg/types/snapstore.go Outdated Show resolved Hide resolved
pkg/types/snapstore.go Outdated Show resolved Hide resolved
* This rename makes the distinction clearer between retention expiry
  which is used for delta snapshots typically, and the immutability
  expiry time of a snapshot.
@gardener-robot-ci-3 gardener-robot-ci-3 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Sep 20, 2024
@gardener-robot-ci-1 gardener-robot-ci-1 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Sep 20, 2024
@renormalize
Copy link
Member Author

@ishan16696 @seshachalam-yv I've added docs/usage/immutable_snapshots.md. Please take a look.

@gardener-robot-ci-3 gardener-robot-ci-3 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Sep 23, 2024
@gardener-robot-ci-1 gardener-robot-ci-1 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Sep 23, 2024
Copy link
Member

@ishan16696 ishan16696 left a comment

Choose a reason for hiding this comment

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

Thanks @renormalize for making changes and adding a doc. I have added few nits:

docs/usage/immutable_snapshots.md Outdated Show resolved Hide resolved
docs/usage/immutable_snapshots.md Outdated Show resolved Hide resolved
docs/usage/immutable_snapshots.md Outdated Show resolved Hide resolved
Copy link
Contributor

@anveshreddy18 anveshreddy18 left a comment

Choose a reason for hiding this comment

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

Overall looks good to me, just couple of nits.

pkg/snapstore/snapshot_test.go Outdated Show resolved Hide resolved
pkg/snapstore/gcs_snapstore.go Outdated Show resolved Hide resolved
@gardener-robot-ci-1 gardener-robot-ci-1 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Sep 24, 2024
Copy link
Contributor

@anveshreddy18 anveshreddy18 left a comment

Choose a reason for hiding this comment

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

Thanks for the PR.
LGTM

@ishan16696
Copy link
Member

ishan16696 commented Sep 25, 2024

@renormalize can you please update the release notes as requested here: #776 (comment)

etcd-backup-restore now supports immutable objects for storage provider: Google Cloud Storage, provided by the [Bucket Lock](https://cloud.google.com/storage/docs/bucket-lock) feature.
Snapshots garbage collection performed by etcd-backup-restore(if enabled) is performed only when the objects immutability period expires.
Support for Bucket lock in etcd-backup-restore is backward compatible. For more info please refer to this doc: https://github.com/gardener/etcd-backup-restore/blob/master/docs/usage/immutable_snapshots.md

@ishan16696 ishan16696 added the merge/squash Should be merged via 'Squash and merge' label Sep 25, 2024
Copy link
Member

@ishan16696 ishan16696 left a comment

Choose a reason for hiding this comment

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

Thanks @renormalize for PR and addressing the review comments.
LGMT!!

@renormalize renormalize merged commit a754925 into gardener:master Sep 30, 2024
9 checks passed
@gardener-robot gardener-robot added the status/closed Issue is closed (either delivered or triaged) label Sep 30, 2024
@shreyas-s-rao shreyas-s-rao modified the milestones: 2024-Q3, v0.31.0 Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/backup Backup related area/robustness Robustness, reliability, resilience related area/storage Storage related merge/squash Should be merged via 'Squash and merge' needs/changes Needs (more) changes needs/ok-to-test Needs approval for testing (check PR in detail before setting this label because PR is run on CI/CD) needs/review Needs review needs/second-opinion Needs second review by someone else platform/gcp Google cloud platform/infrastructure size/l Size of pull request is large (see gardener-robot robot/bots/size.py) status/closed Issue is closed (either delivered or triaged)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants