Skip to content

Commit 172f2ff

Browse files
authored
Merge pull request #3046 from replicatedhq/119825
Add step for rewriting image names in backup and restore resources
2 parents a82ddbb + 53e00f6 commit 172f2ff

File tree

1 file changed

+48
-2
lines changed

1 file changed

+48
-2
lines changed

docs/vendor/embedded-disaster-recovery.mdx

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,55 @@ To configure Velero Backup and Restore custom resources for Embedded Cluster dis
9595
- '*'
9696
```
9797

98-
1. (Optional) You can use Velero functionality like [backup](https://velero.io/docs/main/backup-hooks/) and [restore](https://velero.io/docs/main/restore-hooks/) hooks to customize the backup and restore process as needed.
98+
1. For any image names that you include in your Backup and Restore resources, rewrite the image name using the Replicated KOTS [HasLocalRegistry](/reference/template-functions-config-context#haslocalregistry), [LocalRegistryHost](/reference/template-functions-config-context#localregistryhost), and [LocalRegistryNamespace](/reference/template-functions-config-context#localregistrynamespace) template functions. This ensures that the image name is rendered correctly during deployment, allowing the image to be pulled from the user's local image registry (such as in air gap installations) or through the Replicated proxy registry.
99+
100+
**Example:**
101+
102+
```yaml
103+
apiVersion: velero.io/v1
104+
kind: Restore
105+
metadata:
106+
name: restore
107+
spec:
108+
hooks:
109+
resources:
110+
- name: restore-hook-1
111+
includedNamespaces:
112+
- kotsadm
113+
labelSelector:
114+
matchLabels:
115+
app: example
116+
postHooks:
117+
- init:
118+
initContainers:
119+
- name: restore-hook-init1
120+
image:
121+
# Use HasLocalRegistry, LocalRegistryHost, and LocalRegistryNamespace
122+
# to template the image name
123+
registry: '{{repl HasLocalRegistry | ternary LocalRegistryHost "proxy.replicated.com" }}'
124+
repository: '{{repl HasLocalRegistry | ternary LocalRegistryNamespace "proxy/my-app/quay.io/my-org" }}/nginx'
125+
tag: 1.24-alpine
126+
```
127+
For more information about how to rewrite image names using the KOTS [HasLocalRegistry](/reference/template-functions-config-context#haslocalregistry), [LocalRegistryHost](/reference/template-functions-config-context#localregistryhost), and [LocalRegistryNamespace](/reference/template-functions-config-context#localregistrynamespace) template functions, including additional examples, see [Task 1: Rewrite Image Names](helm-native-v2-using#rewrite-image-names) in _Configuring the HelmChart v2 Custom Resource_.
128+
129+
1. If you support air gap installations, add any images that are referenced in your Backup and Restore resources to the `additionalImages` field of the KOTS Application custom resource. This ensures that the images are included in the air gap bundle for the release so they can be used during the backup and restore process in environments with limited or no outbound internet access. For more information, see [additionalImages](/reference/custom-resource-application#additionalimages) in _Application_.
99130

100-
**Example**:
131+
**Example:**
132+
133+
```yaml
134+
apiVersion: kots.io/v1beta1
135+
kind: Application
136+
metadata:
137+
name: my-app
138+
spec:
139+
additionalImages:
140+
- elasticsearch:7.6.0
141+
- quay.io/orgname/private-image:v1.2.3
142+
```
143+
144+
1. (Optional) Use Velero functionality like [backup](https://velero.io/docs/main/backup-hooks/) and [restore](https://velero.io/docs/main/restore-hooks/) hooks to customize the backup and restore process as needed.
145+
146+
**Example:**
101147

102148
For example, a Postgres database might be backed up using pg_dump to extract the database into a file as part of a backup hook. It can then be restored using the file in a restore hook:
103149

0 commit comments

Comments
 (0)