From 0b8dec12c1ae10fe9aacd3656ade922db46efe6f Mon Sep 17 00:00:00 2001 From: Austin Macdonald Date: Tue, 16 Jul 2024 14:46:09 -0500 Subject: [PATCH 1/2] hackout efs report generator --- scripts/efs-cron-pod.yml | 17 +++++++++++++++++ scripts/efs-cron-script.sh | 10 ++++++++++ 2 files changed, 27 insertions(+) create mode 100644 scripts/efs-cron-pod.yml create mode 100755 scripts/efs-cron-script.sh diff --git a/scripts/efs-cron-pod.yml b/scripts/efs-cron-pod.yml new file mode 100644 index 0000000..15078de --- /dev/null +++ b/scripts/efs-cron-pod.yml @@ -0,0 +1,17 @@ +--- +apiVersion: v1 +kind: Pod +metadata: + name: inspect-pvc-pod +spec: + containers: + - name: inspect-pvc-container + image: busybox + command: ["/bin/sh", "-c", "sleep 3600"] + volumeMounts: + - name: efs-storage + mountPath: /mnt/efs + volumes: + - name: efs-storage + persistentVolumeClaim: + claimName: efs-persist diff --git a/scripts/efs-cron-script.sh b/scripts/efs-cron-script.sh new file mode 100755 index 0000000..81d6ef1 --- /dev/null +++ b/scripts/efs-cron-script.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +set -eux + +# EFS_PERSIST_MNT = "/mnt/efs-persist" +EFS_PERSIST_MNT="/tmp/efs-script-dump" +EFS_HOME="$EFS_PERSIST_MNT/home" + +du -sh $EFS_HOME/* | awk '{print $1, $2}' > $EFS_HOME/size_report.txt +cat $EFS_HOME/size_report.txt From baed5949cc05c4842291e26efd6810200e5bcd0a Mon Sep 17 00:00:00 2001 From: Austin Macdonald Date: Wed, 17 Jul 2024 15:02:06 -0500 Subject: [PATCH 2/2] execute job, no interactive necessary --- scripts/efs-cron-pod.yml | 40 +++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/scripts/efs-cron-pod.yml b/scripts/efs-cron-pod.yml index 15078de..392f254 100644 --- a/scripts/efs-cron-pod.yml +++ b/scripts/efs-cron-pod.yml @@ -1,17 +1,35 @@ ---- apiVersion: v1 kind: Pod metadata: name: inspect-pvc-pod spec: containers: - - name: inspect-pvc-container - image: busybox - command: ["/bin/sh", "-c", "sleep 3600"] - volumeMounts: - - name: efs-storage - mountPath: /mnt/efs - volumes: - - name: efs-storage - persistentVolumeClaim: - claimName: efs-persist + - name: inspect-pvc-container + image: busybox + command: + - /bin/sh + - -c + - | + #!/bin/sh + set -eux + + # EFS_PERSIST_MNT is the mount point for the PVC + EFS_PERSIST_MNT="/mnt/efs-persist" + EFS_HOME="$EFS_PERSIST_MNT/home" + + # Generate the size report + du -sh $EFS_HOME/* | awk '{print $1, $2}' > $EFS_HOME/size_report.txt + + # Display the size report + cat "$EFS_HOME/size_report.txt" + + # Keep the container running + sleep 3600 + volumeMounts: + - name: efs-storage + mountPath: /mnt/efs-persist + volumes: + - name: efs-storage + persistentVolumeClaim: + claimName: efs-persist +