Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions scripts/devspace-cluster-backend.sh
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,6 @@ ensure_gke_external() {

destroy_cluster() {
load_devspace_vars
require_tool devspace
require_tool gcloud
require_tool kubectl
require_tool terraform
Expand Down Expand Up @@ -870,7 +869,7 @@ destroy_cluster() {
ensure_gcloud_auth "${project_id}"

echo >&2 "I: Resetting host DNS integration if configured..."
devspace run reset-cluster-dns >/dev/null 2>&1 || true
reset_destroy_host_dns || true

destroy_cluster_kubernetes_cleanup "${project_id}" "${region}" "${cluster_name}" "${managed_context}"
cleanup_gke_dns_records "${project_id}" "${dns_zone}"
Expand All @@ -886,6 +885,20 @@ destroy_cluster() {
echo >&2 "I: Managed GKE cluster destroyed."
}

reset_destroy_host_dns() {
case "$(uname -s)" in
Darwin)
./scripts/cluster-dns.sh reset-darwin cloud-dns "${DNS_SERVICE_ID:-gcp-kube}" "${GKE_DNS_DOMAIN:-gcp.kube}" "${GKE_DNS_NAMESERVERS:-}" ""
;;
Linux)
./scripts/cluster-dns.sh reset-linux cloud-dns "${DNS_SERVICE_ID:-gcp-kube}" "${GKE_DNS_DOMAIN:-gcp.kube}" "${GKE_DNS_NAMESERVERS:-}" ""
;;
*)
echo >&2 "I: Skipping host DNS reset on unsupported OS $(uname -s)."
;;
esac
}

cleanup_destroyed_kube_context() {
local context="$1"
local current
Expand Down