From 9ee620082da94f6da8fd5056ab44468e0cf56f87 Mon Sep 17 00:00:00 2001 From: jessebot Date: Wed, 23 Oct 2024 22:30:04 +0200 Subject: [PATCH] valkey-primary and valkey-replica pvcs added to mastodon restore individually --- smol_k8s_lab/k8s_apps/social/mastodon.py | 31 ++++++++++++------------ 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/smol_k8s_lab/k8s_apps/social/mastodon.py b/smol_k8s_lab/k8s_apps/social/mastodon.py index d224e1335..9150abf6e 100644 --- a/smol_k8s_lab/k8s_apps/social/mastodon.py +++ b/smol_k8s_lab/k8s_apps/social/mastodon.py @@ -547,21 +547,22 @@ def restore_mastodon(argocd: ArgoCD, argocd.k8s.apply_manifests(podconfig_yaml, argocd.namespace) # then we begin the restic restore of all the mastodon PVCs we lost - pvc_enabled = secrets.get('valkey_pvc_enabled', 'false') - if pvc_enabled and pvc_enabled.lower() != 'false': - # restores the mastodon pvc - k8up_restore_pvc(argocd.k8s, - 'mastodon', - 'mastodon-valkey', - 'mastodon', - s3_backup_endpoint, - s3_backup_bucket, - access_key_id, - secret_access_key, - restic_repo_password, - snapshot_ids['mastodon_valkey'], - "file-backups-podconfig" - ) + for pvc in ['valkey-primary', 'valkey-replica']: + pvc_enabled = secrets.get('valkey_pvc_enabled', 'false') + if pvc_enabled and pvc_enabled.lower() != 'false': + # restores the mastodon pvc + k8up_restore_pvc(k8s_obj=argocd.k8s, + app='mastodon', + pvc=f'mastodon-{pvc}', + namespace='mastodon', + s3_endpoint=s3_backup_endpoint, + s3_bucket=s3_backup_bucket, + access_key_id=access_key_id, + secret_access_key=secret_access_key, + restic_repo_password=restic_repo_password, + snapshot_id=snapshot_ids[f'mastodon_{pvc}'], + pod_config="file-backups-podconfig" + ) # todo: from here on out, this could be async to start on other tasks # install mastodon as usual, but wait on it this time