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

Conversation

salmon111
Copy link
Contributor

Describe what this PR does
This PR addresses #359 by adding OwnerReferences to VolumeSnapshot objects created by SnapshotSchedule.
This ensures that VolumeSnapshots are automatically tracked and cleaned up when their parent SnapshotSchedule is deleted.
The addition improves resource management and simplifies dependency handling.

Is there anything that requires special attention?
This feature can be enabled by setting enableOwnerReferences to true in values.yaml.
The default behavior remains unchanged even after the update.

Related issues:

@salmon111 salmon111 force-pushed the feat/ownerReferences branch from bf1657e to 3513f2e Compare January 9, 2025 06:14
@salmon111
Copy link
Contributor Author

Hi @JohnStrunk,
Would you mind taking a look at this PR when you have some time?
Let me know if there's anything you'd like me to address or clarify. Thanks!

@JohnStrunk
Copy link
Member

Thank you for taking the initiative to put something together.
I do plan to take a look. I'm a bit backed up w/ other items atm. I'm hoping to get to it this week.

@salmon111
Copy link
Contributor Author

Thank you for letting me know! I completely understand you're busy.
Please take your time, and let me know if there's anything I can do to make the review easier. I appreciate it!

Comment on lines +56 to +58
{{- if .Values.enableOwnerReferences }}
- --enable-owner-references
{{- end }}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I’ve currently set this up to pass values via command arguments, but I’m thinking of refactoring this to use a ConfigMap instead.
The main reason is that ConfigMaps would allow more flexibility in managing configurations, especially when changes are needed dynamically.

I’d appreciate your feedback on whether this change would align better with best practices or if the current implementation is sufficient.

Copy link
Member

Choose a reason for hiding this comment

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

I'd prefer to keep it as-is. Since we don't have a CM currently, I'd rather not add one.

Copy link

codecov bot commented Jan 27, 2025

Codecov Report

Attention: Patch coverage is 75.00000% with 5 lines in your changes missing coverage. Please review.

Project coverage is 55.0%. Comparing base (e02dec0) to head (b2697a1).
Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
internal/controller/snapshotschedule_controller.go 75.0% 5 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           master    #697     +/-   ##
========================================
+ Coverage    53.3%   55.0%   +1.7%     
========================================
  Files           2       2             
  Lines         313     325     +12     
========================================
+ Hits          167     179     +12     
  Misses        139     139             
  Partials        7       7             
Files with missing lines Coverage Δ
internal/controller/snapshotschedule_controller.go 41.9% <75.0%> (+3.4%) ⬆️

Copy link
Member

@JohnStrunk JohnStrunk left a comment

Choose a reason for hiding this comment

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

This is a nicely done patch. Thank you!
It just needs the formatting on the README fixed, then it's good to go.

@@ -156,6 +156,8 @@ case, the defaults, shown below, should be sufficient.
- `manageCRDs`: `true`
- 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.
Copy link
Member

Choose a reason for hiding this comment

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

Looks like a line-length issue from the lint/pre-commit job:

helm/snapscheduler/README.md:160: MD013 Line length

@salmon111
Copy link
Contributor Author

@JohnStrunk
Thank you for the feedback and kind words!
I’ve fixed the formatting on the README as suggested.
Please let me know if there’s anything else that needs adjustment.
Looking forward to your approval!

@salmon111 salmon111 requested a review from JohnStrunk January 28, 2025 04:10
Copy link
Contributor

mergify bot commented Jan 28, 2025

This pull request has been removed from the queue for the following reason: pull request branch update failed.

The pull request can't be updated

You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it.

If you want to requeue this pull request, you need to post a comment with the text: @mergifyio requeue

@mergify mergify bot merged commit 939e222 into backube:master Jan 28, 2025
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants