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
* Issue #1060 - documents disaster-recovery test suite
- details:
- Make target to run
- test cases with links to described scenarios
- disaster-recovery environment setup
- also:
- unifies Markdown bullet-points elsewhere in disaster-recovery
document
- tidies up leftover mentions of CR cache (not in scope)
- tidies up leftover 'set -x' that polluted script output
- removes Docker-over-TLS environment variables from ShellRunner
integration
- mostly unnecessary
* nitpick to retrigger CI
* nitpick to retrigger CI
* nitpick to retrigger CI
* Addresses review comments
* Addresses review comment
Copy file name to clipboardExpand all lines: docs/content/en/docs/9_troubleshooting_and_faq/disaster-recovery/_index.md
+90-17Lines changed: 90 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,32 +11,31 @@ This document describes the impact on Porch when one or more data stores fails.
11
11
12
12
Porch has a relatively complex data storage model, such that it essentially acts as a mediator between sets of data stored
13
13
in several locations:
14
-
* the Kubernetes **cluster control plane** on which Porch is installed, including Porch's **custom resources**
15
-
* the **storage repositories** in which package resources are stored (backing the Porch Repository objects). For more details
14
+
- the Kubernetes **cluster control plane** on which Porch is installed, including Porch's **custom resources**
15
+
- the **storage repositories** in which package resources are stored (backing the Porch Repository objects). For more details
16
16
on how Porch interacts with repositories, see the documentation on Repositories and Repository Adapters
17
17
<!-- TODO: add links to Repositories and Repository Adapters documentation once each is merged -->
18
18
<!-- TODO: Repositories will be ../2_concepts/repositories.md -->
19
19
<!-- TODO: Repository Adapters will be ../2_concepts/repositories.md -->
20
-
***Git** repositories are Porch's primary and fully-supported storage backend
21
-
* and the contents of the **package revision cache** (which, depending on the cache option configured at install-time, may
22
-
be either **incorporated in the cluster's control plane** (with the CR cache) or stored in **a separate SQL database**
23
-
(with the DB cache)).
24
-
A more detailed explanation of the package revision cache and the different cache options can be found in the Architecture
25
-
and Components section: [Cache]({{% relref "/docs/5_architecture_and_components/package-cache/_index.md" %}})
20
+
-**Git** repositories are Porch's primary and fully-supported storage backend
21
+
- the contents of the **package revision cache**. Depending on the cache option configured at install-time, the package
22
+
revision cache may be either **incorporated in the cluster's control plane** (with the CR cache) or stored in **a separate**
23
+
**SQL database** (with the DB cache). A more detailed explanation of the package revision cache and the different cache
24
+
options can be found in the Architecture and Components section: [Cache]({{% relref "/docs/5_architecture_and_components/package-cache/_index.md" %}}).
26
25
27
26
Porch's data storage operations are covered in significantly greater depth in the [Architecture and Components section]({{% relref "/docs/5_architecture_and_components/_index.md" %}}).
28
27
29
28
Each data store serves as the source of truth for different elements of Porch's data structure:
30
-
* custom resource objects on Kubernetes control plane:
31
-
* Porch repositories (Repository objects)
32
-
* package variants (and by extension package variant sets)
33
-
***(if the CR cache is configured)** "work-in-progress" package revisions whose lifecycle stage is "Draft", "Proposed",
29
+
- custom resource objects on the Kubernetes control plane:
30
+
- Porch repositories (Repository objects)
31
+
- package variants (and by extension package variant sets)
32
+
-**if the CR cache is configured:** "work-in-progress" package revisions whose lifecycle stage is "Draft", "Proposed",
34
33
or "DeletionProposed"
35
-
* Git repositories:
36
-
* package revisions (Kpt package file contents and directory structures)
37
-
* Package revision cache:
38
-
* Kubernetes-related metadata for package revisions (e.g. labels and annotations)
39
-
***(if the DB cache is configured)** "work-in-progress" package revisions whose lifecycle stage is "Draft", "Proposed",
34
+
- Git repositories:
35
+
- package revisions (Kpt package file contents and directory structures)
36
+
- Package revision cache:
37
+
- Kubernetes-related metadata for package revisions (e.g. labels and annotations)
38
+
-**if the DB cache is configured:** "work-in-progress" package revisions whose lifecycle stage is "Draft", "Proposed",
40
39
or "DeletionProposed"
41
40
42
41
## Backup strategy
@@ -60,6 +59,7 @@ Their data and metadata are brought together by the Porch API server from separa
60
59
cache.
61
60
62
61
{{% /alert %}}
62
+
63
63
{{% alert title="N.B." color="primary" %}}
64
64
65
65
In the absence of an overarching GitOps solution, the exact mechanism for backing up cluster resources may vary between
@@ -102,6 +102,77 @@ for your specific database!
102
102
103
103
{{% /alert %}}
104
104
105
+
106
+
## Automated disaster recovery testing
107
+
108
+
Porch includes an automated disaster-recovery test suite to allow for regression-testing its behaviour under a selection
109
+
of data-loss conditions. This suite sets up Porch in a specially-configured Kind cluster environment, creates a large
110
+
number of Repository objects and package revisions to provide a representative workload, and verifies
111
+
[the disaster scenarios detailed below]({{% relref "#disaster-scenarios" %}}) against it.
112
+
113
+
### Test suite:
114
+
115
+
{{% alert title="Caution!" color="warning" %}}
116
+
117
+
The test suite was developed on a system with the following specifications:
118
+
- CPU: 11th Gen Intel(R) Core(TM) i5-1145G7 @ 2.60GHz
119
+
- Logical processors: 8
120
+
- RAM: 24 GB
121
+
- Storage: 250 GiB
122
+
123
+
Based on observation, the test suite took **an average of ~1 hour for a full run**. Your results may vary based on your
124
+
specific system resources; a system with too low a specification **may not even be able to run the suite**.
125
+
126
+
{{% /alert %}}
127
+
128
+
#### Prerequisites
129
+
- All prerequisites for installation - see the [Installation]({{% relref "/docs/3_getting_started#prerequisites" %}}) section
130
+
- All prerequisites for local development - see the [Development Environment]({{% relref "/docs/12_contributing/code-contribution/development-environment#prerequisites" %}})
131
+
132
+
#### Running the suite
133
+
134
+
From the root directory of the Porch repository, run:
135
+
136
+
```bash
137
+
make test-disaster-recovery
138
+
```
139
+
140
+
#### Environment details
141
+
142
+
By default, before running the disaster scenarios, the suite creates, installs, and loads the Kind environment as follows:
143
+
144
+
- a local Kind cluster (the "data cluster") containing:
145
+
- a Git server (Gitea)
146
+
- containing several copies of public repositories, each containing a large quantity of sample, test, and catalogued
147
+
Kpt packages
148
+
- to provide a representative workload for Porch when restoring and reconciling package revision data
149
+
- a PostgreSQL instance, set up to allow Porch to connect to and use it for the DB cache
150
+
- to make it possible to wipe and restore the database independently of Porch
151
+
- another local Kind cluster
152
+
- with Porch installed
153
+
- with DB cache connected to the PostgreSQL instance installed on the data cluster
154
+
- with the `porch-server` microservice's memory limits increased to `4GiB`
155
+
-~115 Repository objects created in Porch, each targeted to a different combination of Git repository and directory within
156
+
the repository
157
+
- this is calculated to maximize number of package revisions and provide representative workload
158
+
- a small number of new package revisions in various lifecycle states, set up using Porch's API to allow testing that they
159
+
also will be properly backed up and restored
160
+
161
+
#### Test cases
162
+
163
+
The Go-based suite runs the following test cases, each replicating one of the disaster scenarios below:
-`TestDBCacheLossWithBackup` - [DB cache loss with backup]({{% relref "#4-db-cache-loss-with-backup" %}})
168
+
-`TestDBCacheLossWithoutBackup` - [DB cache loss without backup]({{% relref "#4-db-cache-loss-without-backup" %}})
169
+
170
+
For further test development, the disaster-recovery suite's source can be found in the Porch repository at `test/disaster/api/disaster_test.go`.
171
+
If updating the tests, please follow the [Code Contribution]({{% relref "/docs/12_contributing/code-contribution" %}})
172
+
guide, and, if the updates include changes to this document, the [Documentation Contribution]({{% relref "/docs/12_contributing/docs-contribution" %}})
173
+
guide.
174
+
175
+
105
176
## Disaster scenarios
106
177
107
178
This section gives details of tested scenarios with varying combinations of backup, wipe, and restore routines for different
@@ -299,5 +370,7 @@ All "work in progress" on package revisions lost:
299
370
- a similar effect to the use of `porchctl rpkg reject`
300
371
301
372
{{% alert title="Warning" color="warning" %}}
373
+
302
374
Having a valid backup of the DB cache database avoids this situation. Porch highly recommends making regular backups.
0 commit comments