Skip to content

Commit 257bfc4

Browse files
committed
configure memory also
1 parent 038edd0 commit 257bfc4

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

scripts/migrate_pvc_data.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ usage() {
1111
printf "\t-t|--target-pvc\t\tName of the target PVC\n"
1212
printf "\t-n|--namespace\t\tNamespace where the PVCs are located\n"
1313
printf "\t-p|--threads\t\tNumber of parallel threads (default: 5)\n"
14-
printf "\t-c|--cpu\t\tNumber of CPU cores to request (default: 1)\n"
14+
printf "\t-c|--cpu\t\tNumber of CPU cores to request in cores (default: 1)\n"
15+
printf "\t-m|--memory\tMemory request and limit in Gigabytes (default: 2)\n"
1516
}
1617

1718
# Parse arguments
@@ -29,14 +30,17 @@ while [[ "$#" -gt 0 ]]; do
2930
-p=*|--threads=*) THREADS="${1#*=}" ;;
3031
-c|--cpu) CPU_REQUEST="$2"; shift ;;
3132
-c=*|--cpu=*) CPU_REQUEST="${1#*=}" ;;
33+
-m|--memory) MEMORY="$2"; shift ;;
34+
-m=*|--memory=*) MEMORY="${1#*=}" ;;
3235
*) echo "Unknown parameter passed: $1"; usage; exit 1 ;;
3336
esac
3437
shift
3538
done
3639

37-
# Set default threads and cpu if not provided
40+
# Set default threads, cpu, and memory if not provided
3841
THREADS="${THREADS:-5}"
3942
CPU_REQUEST="${CPU_REQUEST:-1}"
43+
MEMORY="${MEMORY:-2}"
4044

4145
# Calculate CPU limit (always 2 more than request)
4246
CPU_LIMIT=$((CPU_REQUEST + 2))
@@ -80,10 +84,10 @@ spec:
8084
while true; do sleep 3600; done
8185
resources:
8286
requests:
83-
memory: "2Gi"
87+
memory: "${MEMORY}Gi"
8488
cpu: "${CPU_REQUEST}"
8589
limits:
86-
memory: "2Gi"
90+
memory: "${MEMORY}Gi"
8791
cpu: '${CPU_LIMIT}'
8892
volumeMounts:
8993
- name: source-pvc

0 commit comments

Comments
 (0)