Skip to content
This repository has been archived by the owner on Aug 25, 2021. It is now read-only.

Update kuttl e2e to work with OCP on AWS #214

Merged
merged 6 commits into from
Jul 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions hack/setup-kind-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,6 @@ fi

# Make VSC the cluster default
kubectl annotate volumesnapshotclass/csi-hostpath-snapclass snapshot.storage.kubernetes.io/is-default-class="true"

# Add a node topology key so that e2e tests can run
kubectl label nodes --all topology.kubernetes.io/zone=z1
1 change: 1 addition & 0 deletions mover-rclone/active.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,6 @@ destination)
error 1 "unknown value for DIRECTION: ${DIRECTION}"
;;
esac
sync
echo "Rclone completed in $(( SECONDS - START_TIME ))s rc=$rc"
exit "$rc"
2 changes: 1 addition & 1 deletion mover-restic/entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,5 @@ for op in "$@"; do
;;
esac
done

sync
echo "=== Done ==="
1 change: 1 addition & 0 deletions mover-rsync/destination.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ if [[ -e /tmp/exit_code ]]; then
CODE="$CODE_IN"
fi
fi
sync
echo "Exiting... Exit code: $CODE"
exit "$CODE"
3 changes: 2 additions & 1 deletion mover-rsync/source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ set +e
while [[ ${rc} -ne 0 && ${RETRY} -lt ${MAX_RETRIES} ]]
do
RETRY=$((RETRY + 1))
rsync -aAhHSxz --delete --itemize-changes --info=stats2,misc2 /data/ "root@${DESTINATION_ADDRESS}":.
rsync -aAhHSxz --delete --itemize-changes --info=stats2,misc2 /data/ "root@${DESTINATION_ADDRESS}":.
rc=$?
if [[ ${rc} -ne 0 ]]; then
echo "Syncronization failed. Retrying in ${DELAY} seconds. Retry ${RETRY}/${MAX_RETRIES}."
Expand All @@ -61,6 +61,7 @@ do
done
set -e
echo "Rsync completed in $(( SECONDS - START_TIME ))s"
sync
if [[ $rc -eq 0 ]]; then
echo "Synchronization completed successfully. Notifying destination..."
ssh "root@${DESTINATION_ADDRESS}" shutdown 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,18 @@ kind: Pod
apiVersion: v1
metadata:
name: source
labels:
affinity: source
spec:
containers:
- name: busybox
image: busybox
command: ["/bin/sh", "-c"]
args: ["echo 'somedata' > /mnt/datafile; sleep 99999"]
args: ["echo 'somedata' > /mnt/datafile; sync; sleep 99999"]
volumeMounts:
- name: data
mountPath: "/mnt"
terminationGracePeriodSeconds: 2
volumes:
- name: data
persistentVolumeClaim:
Expand Down
2 changes: 1 addition & 1 deletion test-kuttl/e2e/restic-with-manual-trigger/10-assert.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
timeout: 120
timeout: 180

---
kind: ReplicationSource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ spec:
hourly: 3
daily: 2
monthly: 1
copyMethod: Clone
copyMethod: Snapshot
cacheCapacity: 1Gi
11 changes: 11 additions & 0 deletions test-kuttl/e2e/restic-with-manual-trigger/13-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
timeout: 90
---
apiVersion: batch/v1
kind: Job
metadata:
name: affinity-setter
status:
succeeded: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: data-dest
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi

---
apiVersion: batch/v1
kind: Job
metadata:
name: affinity-setter
spec:
template:
spec:
affinity:
podAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: affinity
operator: In
values:
- source
topologyKey: topology.kubernetes.io/zone
containers:
- name: busybox
image: busybox
command: ["/bin/true"]
volumeMounts:
- name: data-dest
mountPath: "/mnt"
volumes:
- name: data-dest
persistentVolumeClaim:
claimName: data-dest
restartPolicy: Never
12 changes: 0 additions & 12 deletions test-kuttl/e2e/restic-with-manual-trigger/15-restore.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: data-dest
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi

---
apiVersion: scribe.backube/v1alpha1
kind: ReplicationDestination
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
apiVersion: kuttl.dev/v1beta1
kind: TestStep
delete:
- apiVersion: v1
kind: Pod
name: source
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
- name: busybox
image: busybox
command: ["/bin/sh", "-c"]
args: ["diff -rs /mnt /mnt2"]
args: ["rm -rf /mnt/lost+found; rm -rf /mnt2/lost+found; diff -rs /mnt /mnt2"]
volumeMounts:
- name: data-src
mountPath: "/mnt"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,18 @@ kind: Pod
apiVersion: v1
metadata:
name: source
labels:
affinity: source
spec:
containers:
- name: busybox
image: busybox
command: ["/bin/sh", "-c"]
args: ["echo 'somedata' > /mnt/datafile; sleep 99999"]
args: ["echo 'somedata' > /mnt/datafile; sync; sleep 99999"]
volumeMounts:
- name: data
mountPath: "/mnt"
terminationGracePeriodSeconds: 2
volumes:
- name: data
persistentVolumeClaim:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ spec:
hourly: 3
daily: 2
monthly: 1
copyMethod: Clone
copyMethod: Snapshot
cacheCapacity: 1Gi
5 changes: 4 additions & 1 deletion test-kuttl/e2e/simple-rclone/04-populate-source-volume.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,18 @@ kind: Pod
apiVersion: v1
metadata:
name: source
labels:
affinity: source
spec:
containers:
- name: busybox
image: busybox
command: ["/bin/sh", "-c"]
args: ["echo 'data' > /mnt/datafile; sleep 99999"]
args: ["echo 'data' > /mnt/datafile; sync; sleep 99999"]
volumeMounts:
- name: data
mountPath: "/mnt"
terminationGracePeriodSeconds: 2
volumes:
- name: data
persistentVolumeClaim:
Expand Down
7 changes: 7 additions & 0 deletions test-kuttl/e2e/simple-rclone/11-shutdown-source.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
apiVersion: kuttl.dev/v1beta1
kind: TestStep
delete:
- apiVersion: v1
kind: Pod
name: source
2 changes: 1 addition & 1 deletion test-kuttl/e2e/simple-rclone/16-verify-data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
- name: busybox
image: busybox
command: ["/bin/sh", "-c"]
args: ["diff -rs /mnt /mnt2"]
args: ["rm -rf /mnt/lost+found; rm -rf /mnt2/lost+found; diff -rs /mnt /mnt2"]
volumeMounts:
- name: data-src
mountPath: "/mnt"
Expand Down
3 changes: 2 additions & 1 deletion test-kuttl/e2e/simple-rsync/05-populate-source-volume.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ spec:
- name: busybox
image: busybox
command: ["/bin/sh", "-c"]
args: ["echo 'data' > /mnt/datafile; sleep 99999"]
args: ["echo 'data' > /mnt/datafile; sync; sleep 99999"]
volumeMounts:
- name: data
mountPath: "/mnt"
terminationGracePeriodSeconds: 2
volumes:
- name: data
persistentVolumeClaim:
Expand Down
2 changes: 1 addition & 1 deletion test-kuttl/e2e/simple-rsync/15-create-source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ spec:
rsync:
sshKeys: $KEYNAME
address: $ADDRESS
copyMethod: Clone
copyMethod: Snapshot
EOF
7 changes: 7 additions & 0 deletions test-kuttl/e2e/simple-rsync/22-shutdown-source.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
apiVersion: kuttl.dev/v1beta1
kind: TestStep
delete:
- apiVersion: v1
kind: Pod
name: source
2 changes: 1 addition & 1 deletion test-kuttl/e2e/simple-rsync/30-verify-data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
- name: busybox
image: busybox
command: ["/bin/sh", "-c"]
args: ["diff -rs /mnt /mnt2"]
args: ["rm -rf /mnt/lost+found; rm -rf /mnt2/lost+found; diff -rs /mnt /mnt2"]
volumeMounts:
- name: data-src
mountPath: "/mnt"
Expand Down