Skip to content

Commit 45185b3

Browse files
committed
Add step for rewriting image names in backup and restore resources
1 parent a82ddbb commit 45185b3

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

docs/vendor/embedded-disaster-recovery.mdx

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,40 @@ 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 service. If an image name is not templated, then the image is not automatically rewritten by KOTS and cannot be pulled, causing the application to fail to deploy after a restore.
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+
:::note
128+
For more information about and additional examples of 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, see [Task 1: Rewrite Image Names](helm-native-v2-using#rewrite-image-names) in _Configuring the HelmChart v2 Custom Resource_.
129+
:::
130+
131+
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.
99132

100133
**Example**:
101134

0 commit comments

Comments
 (0)