-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make rsync's `-z` flag configurable. Also some CI improvements: dirtiness checks, auto-generation of USAGE.md. Signed-off-by: Utku Ozdemir <[email protected]>
- Loading branch information
1 parent
3c92973
commit 5115026
Showing
20 changed files
with
139 additions
and
71 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ jobs: | |
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | ||
uses: actions/[email protected] | ||
- name: Set up QEMU | ||
uses: docker/[email protected] | ||
- name: Set up Docker Buildx | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ jobs: | |
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | ||
uses: actions/[email protected] | ||
- name: Set up QEMU | ||
uses: docker/[email protected] | ||
- name: Set up Docker Buildx | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,13 +37,18 @@ jobs: | |
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | ||
uses: actions/[email protected] | ||
- name: Install go | ||
uses: actions/[email protected] | ||
with: | ||
go-version-file: go.mod | ||
- name: Ensure go.mod is already tidied | ||
run: go mod tidy && git diff --no-patch --exit-code | ||
- name: Install Task | ||
uses: arduino/[email protected] | ||
with: | ||
# renovate: depName=go-task/task datasource=github-releases | ||
version: 3.37.1 | ||
- name: Tidy go.mod | ||
run: go mod tidy | ||
- name: Run linters | ||
uses: golangci/[email protected] | ||
with: | ||
|
@@ -58,11 +63,15 @@ jobs: | |
# renovate: depName=goreleaser/goreleaser datasource=github-releases | ||
version: v1.25.1 | ||
args: build --snapshot --clean --single-target | ||
- name: Update usage | ||
run: task update-usage | ||
- name: Check for dirty files | ||
run: git diff --exit-code | ||
test: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | ||
uses: actions/[email protected] | ||
- name: Install go | ||
uses: actions/[email protected] | ||
with: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ jobs: | |
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | ||
uses: actions/[email protected] | ||
- name: Set up QEMU | ||
uses: docker/[email protected] | ||
- name: Set up Docker Buildx | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ jobs: | |
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | ||
uses: actions/[email protected] | ||
- name: Set up QEMU | ||
uses: docker/[email protected] | ||
- name: Set up Docker Buildx | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ jobs: | |
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | ||
uses: actions/[email protected] | ||
with: | ||
# to be able to generate the full changelog: | ||
# https://github.com/goreleaser/goreleaser-action/issues/56#issuecomment-568718162 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,6 @@ builds: | |
|
||
archives: | ||
- id: pv-migrate-archive | ||
rlcp: true | ||
# default name template except we use .Tag instead of .Version to keep the "v" prefix | ||
name_template: >- | ||
{{ .ProjectName }}_ | ||
|
@@ -107,14 +106,14 @@ docker_manifests: | |
# disable: true | ||
|
||
brews: | ||
- tap: | ||
- repository: | ||
owner: utkuozdemir | ||
name: homebrew-pv-migrate | ||
token: "{{ .Env.PRIVATE_ACCESS_TOKEN }}" | ||
commit_author: | ||
name: Utku Ozdemir | ||
email: [email protected] | ||
folder: Formula | ||
directory: Formula | ||
goarm: "7" | ||
homepage: https://github.com/utkuozdemir/pv-migrate | ||
description: Persistent volume migration plugin for Kubernetes | ||
|
@@ -128,7 +127,7 @@ brews: | |
fish_completion.install "completions/pv-migrate.fish" | ||
scoops: | ||
- bucket: | ||
- repository: | ||
owner: utkuozdemir | ||
name: scoop-pv-migrate | ||
token: "{{ .Env.PRIVATE_ACCESS_TOKEN }}" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
# Usage | ||
|
||
Root command: | ||
|
||
``` | ||
{{ .Env.USAGE }} | ||
``` | ||
|
||
The Kubernetes resources created by pv-migrate are sourced from a [Helm chart](helm/pv-migrate). | ||
|
||
You can pass raw values to the backing Helm chart | ||
using the `--helm-*` flags for further customization: container images, | ||
resources, serviceacccounts, additional annotations etc. | ||
|
||
## Strategies | ||
|
||
`pv-migrate` has multiple strategies implemented to carry out the migration operation. Those are the following: | ||
|
||
| Name | Description | | ||
|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| `mnt2` | **Mount both** - Mounts both PVCs in a single pod and runs a regular rsync, without using SSH or the network. Only applicable if source and destination PVCs are in the same namespace and both can be mounted from a single pod. | | ||
| `svc` | **Service** - Runs rsync+ssh over a Kubernetes Service (`ClusterIP`). Only applicable when source and destination PVCs are in the same Kubernetes cluster. | | ||
| `lbsvc` | **Load Balancer Service** - Runs rsync+ssh over a Kubernetes Service of type `LoadBalancer`. Always applicable (will fail if `LoadBalancer` IP is not assigned for a long period). | | ||
| `local` | **Local Transfer** - Runs sshd on both source and destination, then uses a combination of `kubectl port-forward` logic and an SSH reverse proxy to tunnel all the traffic over the client device (the device which runs pv-migrate, e.g. your laptop). Requires `ssh` command to be available on the client device. <br/><br/>Note that this strategy is **experimental** (and not enabled by default), potentially can put heavy load on both apiservers and is not as resilient as others. It is recommended for small amounts of data and/or when the only access to both clusters seems to be through `kubectl` (e.g. for air-gapped clusters, on jump hosts etc.). | | ||
|
||
## Examples | ||
|
||
See the various examples below which copy the contents of the `old-pvc` into the `new-pvc`. | ||
|
||
### Example 1: In a single namespace (minimal example) | ||
|
||
```bash | ||
$ pv-migrate --source old-pvc --dest new-pvc | ||
``` | ||
|
||
### Example 2: Between namespaces | ||
|
||
```bash | ||
$ pv-migrate \ | ||
--source-namespace source-ns --source old-pvc \ | ||
--dest-namespace dest-ns --dest new-pvc | ||
``` | ||
|
||
### Example 3: Between different clusters | ||
|
||
```bash | ||
pv-migrate \ | ||
--source-kubeconfig /path/to/source/kubeconfig \ | ||
--source-context some-context \ | ||
--source-namespace source-ns \ | ||
--source old-pvc \ | ||
--dest-kubeconfig /path/to/dest/kubeconfig \ | ||
--dest-context some-other-context \ | ||
--dest-namespace dest-ns \ | ||
--dest-delete-extraneous-files \ | ||
--dest new-pvc | ||
``` | ||
|
||
### Example 4: Using custom container images from custom repository | ||
|
||
```bash | ||
$ pv-migrate \ | ||
--helm-set rsync.image.repository=mycustomrepo/rsync \ | ||
--helm-set rsync.image.tag=v1.2.3 \ | ||
--helm-set sshd.image.repository=mycustomrepo/sshd \ | ||
--helm-set sshd.image.tag=v1.2.3 \ | ||
--source old-pvc \ | ||
--dest new-pvc | ||
``` | ||
|
||
### Example 5: Enabling network policies (on clusters with deny-all traffic rules) | ||
|
||
```bash | ||
$ pv-migrate \ | ||
--helm-set sshd.networkPolicy.enabled=true \ | ||
--helm-set rsync.networkPolicy.enabled=true \ | ||
--source-namespace source-ns --source old-pvc \ | ||
--dest-namespace dest-ns --dest new-pvc | ||
``` | ||
|
||
### Example 6: Passing additional rsync arguments | ||
|
||
```bash | ||
$ pv-migrate \ | ||
--helm-set rsync.extraArgs="--partial --inplace" \ | ||
--source old-pvc --dest new-pvc | ||
``` | ||
|
||
**For further customization on the rendered manifests** (custom labels, annotations etc.), see the [Helm chart values](helm/pv-migrate). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.