Commit 17de6861 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #38645 from zmerlynn/clean-dhcp-options

Automatic merge from submit-queue cluster/aws: Clean up dhcp-options **What this PR does / why we need it**: After adding the aws janitor, the thing we're consistently sweeping is the DhcpOptionSets created by cluster/aws/util.sh (and there were thousands on the first run). Fix it! **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: **Special notes for your reviewer**: **Release note**: ```release-note Fix an issue where AWS tear-down leaks an DHCP Option Set. ```
parents d5055d49 3e859837
...@@ -1489,6 +1489,21 @@ function kube-down { ...@@ -1489,6 +1489,21 @@ function kube-down {
echo "has a name other than '${CLUSTER_ID}'." >&2 echo "has a name other than '${CLUSTER_ID}'." >&2
fi fi
if [[ -z "${DHCP_OPTION_SET_ID:-}" ]]; then
dhcp_option_ids=$($AWS_CMD describe-dhcp-options \
--output text \
--filters Name=tag:Name,Values=kubernetes-dhcp-option-set \
Name=tag:KubernetesCluster,Values=${CLUSTER_ID} \
--query DhcpOptions[].DhcpOptionsId \
| tr "\t" "\n")
for dhcp_option_id in ${dhcp_option_ids}; do
echo "Deleting DHCP option set: ${dhcp_option_id}"
$AWS_CMD delete-dhcp-options --dhcp-options-id $dhcp_option_id > $LOG
done
else
echo "Skipping deletion of pre-existing DHCP option set: ${DHCP_OPTION_SET_ID}"
fi
echo "Deleting IAM Instance profiles" echo "Deleting IAM Instance profiles"
delete-iam-profiles delete-iam-profiles
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment