Skip to content

Commit

Permalink
Make number of attempts configurable for rsync job (#239)
Browse files Browse the repository at this point in the history
* feat: make number of attempts configurable for rsync job

* feat: add retryPeriodSeconds, rename to maxRetries

* chore: bump chart version, update chart archive

Signed-off-by: Utku Ozdemir <uoz@protonmail.com>
Co-authored-by: Utku Özdemir <uoz@protonmail.com>
  • Loading branch information
fl42 and utkuozdemir committed Sep 26, 2023
1 parent c7966d4 commit a0b2487
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions helm/pv-migrate/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ apiVersion: v2
name: pv-migrate
description: The helm chart of pv-migrate
type: application
version: 0.3.0
appVersion: 0.3.0
version: 0.4.0
appVersion: 0.4.0
home: https://github.com/utkuozdemir/pv-migrate
keywords:
- pv-migrate
Expand Down
6 changes: 4 additions & 2 deletions helm/pv-migrate/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# pv-migrate

![Version: 0.3.0](https://img.shields.io/badge/Version-0.3.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.3.0](https://img.shields.io/badge/AppVersion-0.3.0-informational?style=flat-square)
![Version: 0.4.0](https://img.shields.io/badge/Version-0.4.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.4.0](https://img.shields.io/badge/AppVersion-0.4.0-informational?style=flat-square)

The helm chart of pv-migrate

Expand Down Expand Up @@ -31,6 +31,7 @@ The helm chart of pv-migrate
| rsync.image.repository | string | `"docker.io/utkuozdemir/pv-migrate-rsync"` | Rsync image repository |
| rsync.image.tag | string | `"1.0.0"` | Rsync image tag |
| rsync.imagePullSecrets | list | `[]` | Rsync image pull secrets |
| rsync.maxRetries | int | `10` | Number of retries to run rsync command |
| rsync.namespace | string | `""` | Namespace to run Rsync pod in |
| rsync.networkPolicy.enabled | bool | `false` | Enable Rsync network policy |
| rsync.nodeName | string | `""` | The node name to schedule Rsync pod on |
Expand All @@ -43,6 +44,7 @@ The helm chart of pv-migrate
| rsync.pvcMounts | list | `[]` | PVC mounts into the Rsync pod. For examples, see [values.yaml](values.yaml) |
| rsync.resources | object | `{}` | Rsync pod resources |
| rsync.restartPolicy | string | `"Never"` | |
| rsync.retryPeriodSeconds | int | `5` | Waiting time between retries |
| rsync.securityContext | object | `{}` | Rsync deployment security context |
| rsync.serviceAccount.annotations | object | `{}` | Rsync service account annotations |
| rsync.serviceAccount.create | bool | `true` | Create a service account for Rsync |
Expand Down Expand Up @@ -79,4 +81,4 @@ The helm chart of pv-migrate
| sshd.tolerations | list | see [values.yaml](values.yaml) | SSHD pod tolerations |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.11.0](https://github.com/norwoodj/helm-docs/releases/v1.11.0)
Autogenerated from chart metadata using [helm-docs v1.11.2](https://github.com/norwoodj/helm-docs/releases/v1.11.2)
7 changes: 4 additions & 3 deletions helm/pv-migrate/templates/rsync/job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,14 @@ spec:
set -x
n=0
rc=1
retries=10
retries={{ .Values.rsync.maxRetries }}
period={{ .Values.rsync.retryPeriodSeconds }}
until [ "$n" -ge "$retries" ]
do
{{ required ".Values.rsync.command is required!" .Values.rsync.command }} {{ .Values.rsync.extraArgs }} && rc=0 && break
n=$((n+1))
echo "rsync attempt $n/10 failed, waiting 5 seconds before trying again"
sleep 5
echo "rsync attempt $n/$retries failed, waiting $period seconds before trying again"
sleep $period
done
if [ $rc -ne 0 ]; then
Expand Down
4 changes: 4 additions & 0 deletions helm/pv-migrate/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ rsync:
privateKeyMountPath: /root/.ssh/id_ed25519
# -- The private key content
privateKey: ""
# -- Number of retries to run rsync command
maxRetries: 10
# -- Waiting time between retries
retryPeriodSeconds: 5
# -- Full Rsync command and flags
command: ""
# -- Extra args to be appended to the rsync command. Setting this might cause the tool to not function properly.
Expand Down
Binary file modified migrator/helm-chart.tgz
Binary file not shown.

0 comments on commit a0b2487

Please sign in to comment.