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

GCP filestore restore procedure to also update terraform config #4657

Merged
merged 3 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
32 changes: 24 additions & 8 deletions docs/howto/filesystem-backups/restore-filesystem.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,32 @@ Due to the length of the steps listed in that document, we will not repeat them
## GCP

```{note}
We follow GCP's guidance for [restoring fileshares from a backup](https://cloud.google.com/filestore/docs/backup-restore#restore)
We follow GCP's guidance for [restoring fileshares from a backup](https://cloud.google.com/filestore/docs/backup-restore#restore).
```

To restore a share on a Filestore instance on GCP, we follow the documentation
linked above. In short, this involves:
To restore a share on a Filestore instance on GCP, we start by following the
documentation linked above. In short, this involves:

1. [Go to the Filestore instances page](https://console.cloud.google.com/filestore/instances) in the GCP console
1. Click the instance ID of the Filestore you want to restore and click the "Backups" tab
1. Locate the backup you want to restore from (most likely the most recently created), and click (...) "More actions"
1. Click "Restore backup" and then select "Source instance"
1. Click "Restore" and complete the dialog box that appears
2. Click the instance ID of the Filestore you want to restore and click the "Backups" tab
3. Locate the backup you want to restore from (most likely the most recently created), and click (...) "More actions"
4. Click "Restore backup" and then select "Source instance"
5. Click "Restore" and complete the dialog box that appears

This should successfully restore the Filestore instance to its last backed-up state
This should successfully restore the Filestore instance to its last backed-up state.

Once this is done, you should also set the terraform variable `source_backup` to
reference this web console change. Practically, you should configure something
like below in the `terraform/gcp/projects/$CLUSTER_NAME.tfvars` file:

```
filestores = {
"filestore" : {
# ...
source_backup : "projects/<gcp project name>/locations/<filestore region>/backups/<backup name>",
},
}
```

You can determine the value of `source_backup` by trying a `terraform plan`
which should present the value in an associated error.
5 changes: 4 additions & 1 deletion terraform/gcp/projects/pilot-hubs.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ core_node_machine_type = "n2-highmem-4"
enable_network_policy = true

filestores = {
"filestore" : { capacity_gb : 5120 }
"filestore" : {
capacity_gb : 5120,
source_backup : "projects/two-eye-two-see/locations/us-central1/backups/test",
},
}
enable_filestore_backups = true

Expand Down
5 changes: 3 additions & 2 deletions terraform/gcp/storage.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ resource "google_filestore_instance" "homedirs" {
}

file_shares {
capacity_gb = each.value.capacity_gb
name = "homes"
capacity_gb = each.value.capacity_gb
name = "homes"
source_backup = each.value.source_backup
}

networks {
Expand Down
5 changes: 5 additions & 0 deletions terraform/gcp/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ variable "filestores" {
name_suffix : optional(string, null),
capacity_gb : optional(number, 1024),
tier : optional(string, "BASIC_HDD"),
source_backup : optional(string, null),
}))
default = {
"filestore" : {}
Expand All @@ -341,6 +342,10 @@ variable "filestores" {
- tier: Google FileStore service tier to use. Most likely BASIC_HDD
(for slower home directories, min $204 / month) or BASIC_SSD (for
faster home directories, min $768 / month). Default: BASIC_HDD.
- source_backup: To restore from a backup, this can be set. If a
backup has been done from the web console, this must be updated
to match retroactively as terraform apply will otherwise lead to
a blocked re-creation attempt.
EOT
}

Expand Down