diff --git a/cleanup_amis.sh b/cleanup_amis.sh index 32b955a..de8c81e 100755 --- a/cleanup_amis.sh +++ b/cleanup_amis.sh @@ -1,8 +1,7 @@ #!/bin/bash # set -x -TAG_FILTER="Name=tag:Name,Values=*-uefi-*kubezero*" -TAG_FILTER="Name=tag:Name,Values=*3.17*minimal*" +TAG_FILTER="Name=tag:Name,Values=*-uefi-*minimal*r1" # TAG_FILTER="Name=tag:Name,Values=zdt-alpine-3.16.2-x86_64-bios-tiny-kubezero-1.23.10-r0" # TAG_FILTER="Name=tag:Name,Values=zdt-alpine-3.16.2-x86_64-bios-tiny-minimal-r2" @@ -16,13 +15,24 @@ for r in eu-central-1 us-west-2 ap-southeast-2 ca-central-1 us-east-1 us-west-1; aws ec2 deregister-image --region $r --image-id $a && echo "Deleted AMI $a in $r" done + # failed AMIs amis=$(aws ec2 describe-images --region $r --owners self --output json --filters Name=state,Values=failed | jq -r '.Images[].ImageId') for a in $amis; do aws ec2 deregister-image --region $r --image-id $a && echo "Deleted AMI $a in $r" done + amis=$(aws ec2 describe-images --region $r --owners self --output json --query 'Images[? ! not_null(Tags)].{ID:ImageId,Name:Tags[?Key==`Name`]|[0].Value}' | jq -r '.[].ID') + for a in $amis; do + aws ec2 deregister-image --region $r --image-id $a && echo "Deleted AMI $a in $r" + done snapshots=$(aws ec2 describe-snapshots --region $r --owner-ids self --output json --filters $TAG_FILTER | jq -r '.Snapshots[].SnapshotId') for s in $snapshots; do aws ec2 delete-snapshot --snapshot-id $s --region $r && echo "Deleted snapshot $s in $r" done + + # delete orphaned snapshots + snapshots=$(aws ec2 describe-snapshots --region $r --owner-ids self --output json --query 'Snapshots[? ! not_null(Tags)].{ID:SnapshotId,Time:StartTime,Name:Tags[?Key==`Name`]|[0].Value}' | jq -r '.[].ID') + for s in $snapshots; do + aws ec2 delete-snapshot --snapshot-id $s --region $r && echo "Deleted snapshot $s in $r" + done done diff --git a/overlay/zdt/configs/edition/kubezero-packages.conf b/overlay/zdt/configs/edition/kubezero-packages.conf index f0dea42..22ad747 100644 --- a/overlay/zdt/configs/edition/kubezero-packages.conf +++ b/overlay/zdt/configs/edition/kubezero-packages.conf @@ -1,2 +1,3 @@ -curl = true -kubezero = "kubezero=~1.25" +curl = true +kubezero = "kubezero=~1.25" +kubezero-imagecache = "kubezero=~1.25" diff --git a/overlay/zdt/configs/edition/kubezero.conf b/overlay/zdt/configs/edition/kubezero.conf index 2ded8e1..6dcb82d 100644 --- a/overlay/zdt/configs/edition/kubezero.conf +++ b/overlay/zdt/configs/edition/kubezero.conf @@ -7,7 +7,7 @@ services { include required("kubezero-services.conf") } description = [ "- https://kubezero.com" ] name = [ kubezero-1.25.8 ] -# size = 2G +size = 2G WHEN { x86_64 { diff --git a/overlay/zdt/configs/zdt.conf b/overlay/zdt/configs/zdt.conf index d060a84..425fe5b 100644 --- a/overlay/zdt/configs/zdt.conf +++ b/overlay/zdt/configs/zdt.conf @@ -69,7 +69,7 @@ Dimensions { aws.regions { ALL = false ap-southeast-2 = true - #ca-central-1 = true + ca-central-1 = true eu-central-1 = true us-east-1 = true us-west-1 = true