shutdown.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/usr/bin/env bash
  2. # Copyright 2018 The Kubernetes Authors.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. # Script that destroys the clusters used, namespace, and deployment.
  16. KUBECTL=kubectl
  17. KUBEMARK_DIRECTORY="${KUBE_ROOT}/test/kubemark"
  18. RESOURCE_DIRECTORY="${KUBEMARK_DIRECTORY}/resources"
  19. # Login to cloud services
  20. complete-login
  21. # Remove resources created for kubemark
  22. # shellcheck disable=SC2154 # Color defined in sourced script
  23. echo -e "${color_yellow}REMOVING RESOURCES${color_norm}"
  24. spawn-config
  25. "${KUBECTL}" delete -f "${RESOURCE_DIRECTORY}/addons" &> /dev/null || true
  26. "${KUBECTL}" delete -f "${RESOURCE_DIRECTORY}/hollow-node.yaml" &> /dev/null || true
  27. "${KUBECTL}" delete -f "${RESOURCE_DIRECTORY}/kubemark-ns.json" &> /dev/null || true
  28. rm -rf "${RESOURCE_DIRECTORY}/addons"
  29. "${RESOURCE_DIRECTORY}/hollow-node.yaml" &> /dev/null || true
  30. # Remove clusters, namespaces, and deployments
  31. delete-clusters
  32. if [[ -f "${RESOURCE_DIRECTORY}/iks-namespacelist.sh" ]] ; then
  33. bash "${RESOURCE_DIRECTORY}/iks-namespacelist.sh"
  34. rm -f "${RESOURCE_DIRECTORY}/iks-namespacelist.sh"
  35. fi
  36. # shellcheck disable=SC2154 # Color defined in sourced script
  37. echo -e "${color_blue}EXECUTION COMPLETE${color_norm}"
  38. exit 0