Skip to content

feat: allow TTL to be a duration in days, weeks, etc..#9345

Open
iTrooz wants to merge 19 commits intovelero-io:mainfrom
iTrooz:day_duration
Open

feat: allow TTL to be a duration in days, weeks, etc..#9345
iTrooz wants to merge 19 commits intovelero-io:mainfrom
iTrooz:day_duration

Conversation

@iTrooz
Copy link
Copy Markdown

@iTrooz iTrooz commented Oct 17, 2025

Thank you for contributing to Velero!

Please add a summary of your change

This PR changes the type used to parse TTLs, allowing parsing types largers than hours. The most obvious benefit is to allow days, but I also added weeks, months, and years

Does your change fix a particular issue?

No

Please indicate you've done the following:

Notes

For now, this feature has the following limitations:

  • Only applies to the TTL parameter, and not other Duration-based parameters
  • Only apply to the CLI flag, and not the CRD fields

I would be glad to add these changes, if there is an interest for it

Signed-off-by: iTrooz <hey@itrooz.fr>
Signed-off-by: iTrooz <hey@itrooz.fr>
Signed-off-by: iTrooz <hey@itrooz.fr>
Signed-off-by: iTrooz <hey@itrooz.fr>
Comment thread pkg/apis/velero/v1/backup_types.go Outdated
Comment thread pkg/cmd/util/flag/duration.go Outdated
@reasonerjt
Copy link
Copy Markdown
Contributor

Is this really needed?

Signed-off-by: iTrooz <hey@itrooz.fr>
Signed-off-by: iTrooz <hey@itrooz.fr>
Signed-off-by: iTrooz <hey@itrooz.fr>
Signed-off-by: iTrooz <hey@itrooz.fr>
Signed-off-by: iTrooz <hey@itrooz.fr>
@iTrooz
Copy link
Copy Markdown
Author

iTrooz commented Oct 23, 2025

Is this really needed?

I believe so, entering backup TTL in hours can be annoying/error prone. For example, I wanted to create a 30d backup TTL for my personal cluster, and "30d" is more readable than "720h"

But this is clearly a quality-of-life addition, it doesn't allow new things

Signed-off-by: iTrooz <hey@itrooz.fr>
Comment thread pkg/apis/velero/v1/backup_types.go Outdated
Co-authored-by: Tiger Kaovilai <passawit.kaovilai@gmail.com>
Signed-off-by: iTrooz <hey@itrooz.fr>
@kaovilai
Copy link
Copy Markdown
Collaborator

don't forget to regenerate crd :)

Signed-off-by: iTrooz <hey@itrooz.fr>
@iTrooz
Copy link
Copy Markdown
Author

iTrooz commented Oct 24, 2025

Whoops, thank you

@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 24, 2025

Codecov Report

❌ Patch coverage is 75.55556% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.91%. Comparing base (e6aab8c) to head (b3e0744).
⚠️ Report is 64 commits behind head on main.

Files with missing lines Patch % Lines
pkg/cmd/util/flag/duration.go 76.19% 9 Missing and 1 partial ⚠️
pkg/cmd/cli/schedule/create.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9345      +/-   ##
==========================================
+ Coverage   59.67%   59.91%   +0.23%     
==========================================
  Files         383      384       +1     
  Lines       44079    34991    -9088     
==========================================
- Hits        26306    20966    -5340     
+ Misses      16223    12479    -3744     
+ Partials     1550     1546       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Collaborator

@kaovilai kaovilai left a comment

Choose a reason for hiding this comment

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

some further doc or implementation changes I think are needed.

Comment thread pkg/cmd/util/flag/duration.go Outdated
Comment thread pkg/cmd/util/flag/duration.go Outdated
Signed-off-by: iTrooz <hey@itrooz.fr>
Signed-off-by: iTrooz <hey@itrooz.fr>
Signed-off-by: iTrooz <hey@itrooz.fr>
Signed-off-by: iTrooz <hey@itrooz.fr>
Signed-off-by: iTrooz <hey@itrooz.fr>
Signed-off-by: iTrooz <hey@itrooz.fr>
Comment thread pkg/apis/velero/v1/backup_types.go Outdated
Signed-off-by: iTrooz <hey@itrooz.fr>
@iTrooz
Copy link
Copy Markdown
Author

iTrooz commented Nov 6, 2025

Hello ! Could someone else please review this PR ?
@sseago @ywk253100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants