Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

Use env vars to customize backup retention #322

Merged
merged 1 commit into from
May 27, 2020

Conversation

hakman
Copy link
Contributor

@hakman hakman commented May 5, 2020

At the moment backup retention is hardcoded.
Hourly backups are kept for 7 days and daily backups are kept for 1 year.

Env vars could be used to customise backup retention:

ETCD_MANAGER_HOURLY_BACKUPS_RETENTION=7d
ETCD_MANAGER_DAILY_BACKUPS_RETENTION=1y

Fixes #225
Fixes #308

// ParseHumanDuration parses a go-style duration string, but
// recognizes additional suffixes: d means "day" and is interpreted as
// 24 hours; y means "year" and is interpreted as 365 days.
func ParseHumanDuration(s string) (time.Duration, error) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was shamelessly copied from certs.go. I couldn't find some good common utils place for it.

func ParseHumanDuration(s string) (time.Duration, error) {

@johngmyers
Copy link
Contributor

Why would we use env vars instead of flags or a config file?

@hakman
Copy link
Contributor Author

hakman commented May 25, 2020

Why would we use env vars instead of flags or a config file?

No special reason, just followed the approach from f4b782c.

At the moment Kops has the option of setting env vars to control etcd-manager.

@justinsb
Copy link
Contributor

I wouldn't mind also adding flags, but let's get this going as-is. If we start specifying these values directly in the etcd struct in kops, we'll have to deal with the fact that they can be specified in both env and directly, but we have to deal with that anyway for the metrics-url. (cc @granular-ryanbonham )

Thanks for this @hakman !

/approve
/lgtm

@caiohasouza
Copy link

Thank you @hakman, great job!

@hakman hakman deleted the backup-duration branch May 28, 2020 04:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove old backups Default backup retention period
4 participants