chore: Update manifests after change

This commit is contained in:
2025-12-20 21:36:47 +00:00
parent 726e2ac4ce
commit b6059cb508

View File

@@ -9,77 +9,83 @@ metadata:
app.kubernetes.io/part-of: talos app.kubernetes.io/part-of: talos
data: data:
prune.sh: | prune.sh: |
export DATE_RANGE=$(date -d @$(( $(date +%s) - ${DATE_RANGE_SECONDS} )) +%Y-%m-%dT%H:%M:%SZ); DATE_RANGE=$(date -d @$(( $(date +%s) - $DATE_RANGE_SECONDS )) +%Y-%m-%dT%H:%M:%SZ);
export FILE_MATCH="${BUCKET}/cl01tl/etcd/cl01tl-${DATE_RANGE}.snap.age" FILE_MATCH="${BUCKET}/cl01tl/etcd/cl01tl-${DATE_RANGE}.snap.age";
echo ">> Running S3 prune for Talos backup repository ${TARGET} ..." echo " "
echo ">> Running S3 prune for Talos backup repository ${TARGET} ...";
echo ">> Backups prior to '$DATE_RANGE' will be removed" echo " "
echo ">> Backups to be removed:" echo ">> Configured Date Range is $(date -u -d @${DATE_RANGE_SECONDS} +"%j days, %H hours, %M minutes")"
echo ">> Date Range Seconds is ${DATE_RANGE_SECONDS}"
echo ">> Backups prior to '$DATE_RANGE' will be removed";
echo ">> Backups to be removed:";
s3cmd ls --no-check-certificate ${BUCKET}/cl01tl/etcd/ | s3cmd ls --no-check-certificate ${BUCKET}/cl01tl/etcd/ |
awk -v file_match="$FILE_MATCH" '$4 < file_match {print $4}' awk -v file_match="$FILE_MATCH" '$4 < file_match {print $4}'
echo ">> Deleting ..." echo ">> Deleting ..."
s3cmd ls --no-check-certificate ${BUCKET}/cl01tl/etcd/ | s3cmd ls --no-check-certificate ${BUCKET}/cl01tl/etcd/ |
awk -v file_match="$FILE_MATCH" '$4 < file_match {print $4}' | awk -v file_match="$FILE_MATCH" '$4 < file_match {print $4}' |
while read file; do while read file; do
s3cmd del --no-check-certificate -v "$file"; s3cmd del --no-check-certificate -v "$file";
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
ERROR=true ERROR=true
echo ">> Detected error, will send message to ntfy" echo ">> Detected error, will send message to ntfy"
fi fi
done; done;
if [ "$ERROR" = true ]; then if [ "$ERROR" = true ]; then
MAX_RETRIES=5 MAX_RETRIES=5
SUCCESS=false SUCCESS=false
echo " " echo " "
echo ">> Sending message to ntfy using curl ..." echo ">> Sending message to ntfy using curl ..."
echo " " echo " "
echo ">> Verifying required commands ..." echo ">> Verifying required commands ..."
for i in $(seq 1 "$MAX_RETRIES"); do for i in $(seq 1 "$MAX_RETRIES"); do
if apk update 2>&1 >/dev/null; then if apk update 2>&1 >/dev/null; then
echo ">> Attempt $i: Repositories are reachable"; echo ">> Attempt $i: Repositories are reachable";
SUCCESS=true; SUCCESS=true;
break; break;
else else
echo ">> Attempt $i: Connection failed, retrying in 5 seconds ..."; echo ">> Attempt $i: Connection failed, retrying in 5 seconds ...";
sleep 5; sleep 5;
fi; fi;
done; done;
if [ "$SUCCESS" = false ]; then if [ "$SUCCESS" = false ]; then
echo ">> ERROR: Could not connect to apk repositories after $MAX_RETRIES attempts, exiting ..."; echo ">> ERROR: Could not connect to apk repositories after $MAX_RETRIES attempts, exiting ...";
exit 1; exit 1;
fi fi
if ! command -v curl 2>&1 >/dev/null; then if ! command -v curl 2>&1 >/dev/null; then
echo ">> Command curl could not be found, installing"; echo ">> Command curl could not be found, installing";
apk add --no-cache -q curl; apk add --no-cache -q curl;
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo ">> Installation successful"; echo ">> Installation successful";
else else
echo ">> Installation failed with exit code $?"; echo ">> Installation failed with exit code $?";
exit 1; exit 1;
fi; fi;
fi; fi;
echo " " echo " "
echo ">> Sending to NTFY ..." echo ">> Sending to NTFY ..."
HTTP_STATUS=$(curl \ HTTP_STATUS=$(curl \
--silent \ --silent \
--write-out '%{http_code}' \ --write-out '%{http_code}' \
-H "Authorization: Bearer ${NTFY_TOKEN}" \ -H "Authorization: Bearer ${NTFY_TOKEN}" \
-H "X-Priority: 5" \ -H "X-Priority: 5" \
-H "X-Tags: warning" \ -H "X-Tags: warning" \
-H "X-Title: Talos Backup Failed for ${TARGET}" \ -H "X-Title: Talos Backup Failed for ${TARGET}" \
-d "$MESSAGE" \ -d "$MESSAGE" \
${NTFY_ENDPOINT}/${NTFY_TOPIC} ${NTFY_ENDPOINT}/${NTFY_TOPIC}
) )
echo ">> HTTP Status Code: $HTTP_STATUS" echo ">> HTTP Status Code: $HTTP_STATUS"
fi;
echo ">> Completed S3 prune for Talos backup repository ${TARGET}" echo ">> Completed S3 prune for Talos backup repository ${TARGET}"