Skip to content

Commit

Permalink
Update rclone/restic exmaples for privileged
Browse files Browse the repository at this point in the history
Signed-off-by: Tesshu Flower <[email protected]>
  • Loading branch information
tesshuflower committed Aug 21, 2023
1 parent 19984c8 commit d39520b
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 6 deletions.
38 changes: 38 additions & 0 deletions docs/usage/rclone/database_example.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,19 @@ First, create the source namespace and deploy the source MySQL database.
.. code:: console
$ kubectl create ns source
$ kubectl annotate namespace source volsync.backube/privileged-movers="true"
.. note::
The second command to annotate the namespace is used to enable the rclone data mover to run in privileged mode.
This is because this simple example runs MySQL as root. For your own applications, you can run unprivileged by
setting the ``moverSecurityContext`` in your ReplicationSource/ReplicationDestination to match that of your
application in which case the namespace annotation will not be required. See the
:doc:`permission model documentation </usage/permissionmodel>` for more details.

Deploy the source MySQL database.

.. code:: console
$ kubectl create -f examples/source-database/ -n source
Verify the database is running.
Expand Down Expand Up @@ -41,6 +54,30 @@ Add a new database.
> exit
$ exit
Now edit ``examples/rclone/rclone.conf`` with your rclone configuration, or you can deploy minio as object-storage to use
with the examples.

To start minio in your cluster, run:

.. code:: console
$ hack/run-minio.sh
If using minio then you can edit ``examples/rclone/rclone.conf`` to match the following:

.. code-block:: none
:caption: rclone.conf for use with local minio
[rclone-bucket]
type = s3
provider = Minio
env_auth = false
access_key_id = access
secret_access_key = password
region = us-east-1
endpoint = http://minio.minio.svc.cluster.local:9000
Now, deploy the ``rclone-secret`` followed by ``ReplicationSource`` configuration.

.. code:: console
Expand Down Expand Up @@ -78,6 +115,7 @@ on the destination.
.. code:: console
$ kubectl create ns dest
$ kubectl annotate namespace dest volsync.backube/privileged-movers="true"
$ kubectl create secret generic rclone-secret --from-file=rclone.conf=./examples/rclone/rclone.conf -n dest
$ kubectl create -f examples/rclone/volsync_v1alpha1_replicationdestination.yaml -n dest
Expand Down
16 changes: 15 additions & 1 deletion docs/usage/restic/database_example.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,24 @@ A MySQL database will be used as the example application.
Creating source PVC to be backed up
-----------------------------------

Create a namespace called ``source``, and deploy the source MySQL database.
Create a namespace called ``source``

.. code-block:: console
$ kubectl create ns source
$ kubectl annotate namespace source volsync.backube/privileged-movers="true"
.. note::
The second command to annotate the namespace is used to enable the restic data mover to run in privileged mode.
This is because this simple example runs MySQL as root. For your own applications, you can run unprivileged by
setting the ``moverSecurityContext`` in your ReplicationSource/ReplicationDestination to match that of your
application in which case the namespace annotation will not be required. See the
:doc:`permission model documentation </usage/permissionmodel>` for more details.

Deploy the source MySQL database.

.. code:: console
$ kubectl -n source create -f examples/source-database/
Verify the database is running:
Expand Down Expand Up @@ -205,6 +218,7 @@ To restore from the backup, create a destination, deploy ``restic-config`` and
.. code-block:: console
$ kubectl create ns dest
$ kubectl annotate namespace dest volsync.backube/privileged-movers="true"
$ kubectl -n dest create -f examples/restic/source-restic/
To start the restore, create a empty PVC for the data:
Expand Down
2 changes: 0 additions & 2 deletions docs/usage/volume-populator/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ ReplicationDestination Volume Populator
.. toctree::
:hidden:

volumepopulator_example

.. sidebar:: Contents

.. contents:: ReplicationDestination Volume Populator
Expand Down
2 changes: 1 addition & 1 deletion examples/rclone/rclone.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[aws-s3-bucket]
[rclone-bucket]
type = s3
provider = AWS
env_auth = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ spec:
trigger:
schedule: "*/5 * * * *"
rclone:
rcloneConfigSection: "aws-s3-bucket"
rcloneConfigSection: "rclone-bucket"
rcloneDestPath: "volsync-test-bucket/mysql-pv-claim"
rcloneConfig: "rclone-secret"
copyMethod: Snapshot
Expand Down
2 changes: 1 addition & 1 deletion examples/rclone/volsync_v1alpha1_replicationsource.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spec:
trigger:
schedule: "*/10 * * * *"
rclone:
rcloneConfigSection: "aws-s3-bucket"
rcloneConfigSection: "rclone-bucket"
rcloneDestPath: "volsync-test-bucket/mysql-pv-claim"
rcloneConfig: "rclone-secret"
copyMethod: Snapshot

0 comments on commit d39520b

Please sign in to comment.