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

Associate VolumeSnapshots with SnapshotSchedules via OwnerReferences #697

Merged
merged 4 commits into from
Jan 28, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
docs: Fix line breaks in README
Signed-off-by: salmon111 <[email protected]>
salmon111 committed Jan 28, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 4dab3c3d9bfb915bdceb48dcd59d878843d5f019
3 changes: 2 additions & 1 deletion helm/snapscheduler/README.md
Original file line number Diff line number Diff line change
@@ -157,7 +157,8 @@ case, the defaults, shown below, should be sufficient.
- Whether the chart should automatically install, upgrade, or remove the
SnapshotSchedule CRD
- `enableOwnerReferences`: `false`
- If set to `true`, owner references will be added to the VolumeSnapshot objects created by the operator.
- If set to `true`, owner references will be added to the VolumeSnapshot
objects created by the operator.
- `rbacProxy.image.repository`: `quay.io/brancz/kube-rbac-proxy`
- Specifies the container image used for the RBAC proxy
- `rbacProxy.image.tag`: (see values file for default tag)

Unchanged files with check annotations Beta

return ctrl.Result{}, err
}
result, err := doReconcile(ctx, instance, reqLogger, r.Client, r.EnableOwnerReferences)

Check warning on line 86 in internal/controller/snapshotschedule_controller.go

Codecov / codecov/patch

internal/controller/snapshotschedule_controller.go#L86

Added line #L86 was not covered by tests
// Update result in CR
if err != nil {
}
func doReconcile(ctx context.Context, schedule *snapschedulerv1.SnapshotSchedule,
logger logr.Logger, c client.Client, enableOwnerReferences bool) (ctrl.Result, error) {

Check warning on line 121 in internal/controller/snapshotschedule_controller.go

Codecov / codecov/patch

internal/controller/snapshotschedule_controller.go#L121

Added line #L121 was not covered by tests
// If necessary, initialize time of next snap based on schedule
if schedule.Status.NextSnapshotTime.IsZero() {
// Update nextSnapshot time based on current time and cronspec
// modifying .status will immediately cause an addl reconcile pass
// (which will cover the rest of this reconcile function). We also don't
// want to update nextSnapshot until this round is done.
return handleSnapshotting(ctx, schedule, logger, c, enableOwnerReferences)

Check warning on line 139 in internal/controller/snapshotschedule_controller.go

Codecov / codecov/patch

internal/controller/snapshotschedule_controller.go#L139

Added line #L139 was not covered by tests
}
// We always update nextSnapshot in case the schedule changed
}
func handleSnapshotting(ctx context.Context, schedule *snapschedulerv1.SnapshotSchedule,
logger logr.Logger, c client.Client, enableOwnerReferences bool) (ctrl.Result, error) {

Check warning on line 168 in internal/controller/snapshotschedule_controller.go

Codecov / codecov/patch

internal/controller/snapshotschedule_controller.go#L168

Added line #L168 was not covered by tests
pvcList, err := listPVCsMatchingSelector(ctx, logger, c, schedule.Namespace, &schedule.Spec.ClaimSelector)
if err != nil {
logger.Error(err, "unable to get matching PVCs")
labels = schedule.Spec.SnapshotTemplate.Labels
snapshotClassName = schedule.Spec.SnapshotTemplate.SnapshotClassName
}
snap := newSnapForClaim(snapName, pvc, schedule, snapTime, labels, snapshotClassName, enableOwnerReferences)

Check warning on line 191 in internal/controller/snapshotschedule_controller.go

Codecov / codecov/patch

internal/controller/snapshotschedule_controller.go#L191

Added line #L191 was not covered by tests
if snap != nil {
logger.Info("creating a snapshot", "PVC", pvc.Name, "Snapshot", snapName)
if err = c.Create(ctx, snap); err != nil {