You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This script should take the following inputs (via commandline, parsed with argparse):
Name of the filestore instance to create a backup of
Name of the share inside the filestore instance to create a backup of (ours is called 'homes' I think)
Region (and / or) zone the filestore instance is in
Number of days to retain backups for
1-3 are based on what is needed to create backups and 4 is so we can figure out which backup to delete
Control Loop
We should design this script using some principles from kubernetes, so that it's easy to maintain and monitor. The fundamental piece is to think of this as a control loop. So the script should do the following:
List all existing backups (gcloud filestore backups list --format json)
Find all the backups that match the filestore and fileshare we care about (by filtering based on inputs 1,2, 3)
If there has been no successful backup in the last 24h, create one (with gcloud filestore backups create). We pick 24h because these are 'daily' backups
If there are backups older than now - input#4 (number of days), delete those backups.
Sleep for a period of time (maybe 10min?), go back to step#1
This allows us to run this script multiple times, interrupt it, etc without too much worry. If there are extra backups, they will simply get deleted at the end of the retention period. If creating a backup fails, step (3) picks it up when running again.
Scope
This task is scoped to writing this script in such a way that any engineer with their local credentials will be able to run it from their computer after authenticating with gcloud and it would work. Deployment of this script and monitoring will be dealt with as further tasks under #4391
Client Library Use
Whoever does this task can either choose to parse the output of gcloud (with --format=json), or use the appropriate python client library. It's fairly minimal so the choice doesn't matter - do whatever feels comfortable to you, and don't spend too much time picking one or the other! If you have no opinions, pick using gcloud.
The text was updated successfully, but these errors were encountered:
yuvipanda
changed the title
Create a python script to perform backups and retention of filestore instances
Create a python script (gcp-filestore-backups) to perform backups and retention of filestore instances
Jul 8, 2024
Inputs
This script should take the following inputs (via commandline, parsed with
argparse
):1-3 are based on what is needed to create backups and 4 is so we can figure out which backup to delete
Control Loop
We should design this script using some principles from kubernetes, so that it's easy to maintain and monitor. The fundamental piece is to think of this as a control loop. So the script should do the following:
gcloud filestore backups list --format json
)gcloud filestore backups create
). We pick 24h because these are 'daily' backupsThis allows us to run this script multiple times, interrupt it, etc without too much worry. If there are extra backups, they will simply get deleted at the end of the retention period. If creating a backup fails, step (3) picks it up when running again.
Scope
This task is scoped to writing this script in such a way that any engineer with their local credentials will be able to run it from their computer after authenticating with
gcloud
and it would work. Deployment of this script and monitoring will be dealt with as further tasks under #4391Client Library Use
Whoever does this task can either choose to parse the output of
gcloud
(with--format=json
), or use the appropriate python client library. It's fairly minimal so the choice doesn't matter - do whatever feels comfortable to you, and don't spend too much time picking one or the other! If you have no opinions, pick usinggcloud
.The text was updated successfully, but these errors were encountered: