#!/bin/bash # Copyright 2015 The Kubernetes Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # Script that destroys Kubemark cluster and deletes all master resources. global KUBE_ROOT := "$[dirname $(BASH_SOURCE)]/../.." source "$(KUBE_ROOT)/test/kubemark/skeleton/util.sh" source "$(KUBE_ROOT)/test/kubemark/cloud-provider-config.sh" source "$(KUBE_ROOT)/test/kubemark/$(CLOUD_PROVIDER)/util.sh" source "$(KUBE_ROOT)/cluster/kubemark/$(CLOUD_PROVIDER)/config-default.sh" source "$(KUBE_ROOT)/cluster/kubemark/util.sh" global KUBECTL := ""$(KUBE_ROOT)/cluster/kubectl.sh"" global KUBEMARK_DIRECTORY := ""$(KUBE_ROOT)/test/kubemark"" global RESOURCE_DIRECTORY := ""$(KUBEMARK_DIRECTORY)/resources"" detect-project &> /dev/null $(KUBECTL) delete -f "$(RESOURCE_DIRECTORY)/addons" &> /dev/null || true $(KUBECTL) delete -f "$(RESOURCE_DIRECTORY)/hollow-node.yaml" &> /dev/null || true $(KUBECTL) delete -f "$(RESOURCE_DIRECTORY)/kubemark-ns.json" &> /dev/null || true rm -rf "$(RESOURCE_DIRECTORY)/addons" \ "$(RESOURCE_DIRECTORY)/kubeconfig.kubemark" \ "$(RESOURCE_DIRECTORY)/hollow-node.yaml" \ "$(RESOURCE_DIRECTORY)/kubemark-master-env.sh" &> /dev/null || true delete-master-instance-and-resources (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:KUBE_ROOT) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(dirname)} {(DQ (${ VSub_Name BASH_SOURCE))})] ) left_token: spids: [49 57] ) (/../..) } spids: [48] ) ] spids: [48] ) (C {(source)} {(DQ (${ VSub_Name KUBE_ROOT) (/test/kubemark/skeleton/util.sh))}) (C {(source)} {(DQ (${ VSub_Name KUBE_ROOT) (/test/kubemark/cloud-provider-config.sh))}) (C {(source)} {(DQ (${ VSub_Name KUBE_ROOT) (/test/kubemark/) (${ VSub_Name CLOUD_PROVIDER) (/util.sh))} ) (C {(source)} { (DQ (${ VSub_Name KUBE_ROOT) (/cluster/kubemark/) (${ VSub_Name CLOUD_PROVIDER) (/config-default.sh) ) } ) (C {(source)} {(DQ (${ VSub_Name KUBE_ROOT) (/cluster/kubemark/util.sh))}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:KUBECTL) op: Equal rhs: {(DQ (${ VSub_Name KUBE_ROOT) (/cluster/kubectl.sh))} spids: [115] ) ] spids: [115] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:KUBEMARK_DIRECTORY) op: Equal rhs: {(DQ (${ VSub_Name KUBE_ROOT) (/test/kubemark))} spids: [123] ) ] spids: [123] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:RESOURCE_DIRECTORY) op: Equal rhs: {(DQ (${ VSub_Name KUBEMARK_DIRECTORY) (/resources))} spids: [131] ) ] spids: [131] ) (Sentence child:(C {(detect-project)}) terminator:) (SimpleCommand redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[143])] ) (Sentence child: (C {(DQ (${ VSub_Name KUBECTL))} {(delete)} {(-f)} {(DQ (${ VSub_Name RESOURCE_DIRECTORY) (/addons))} ) terminator: ) (AndOr children: [ (SimpleCommand redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[166])] ) (C {(true)}) ] op_id: Op_DPipe ) (Sentence child: (C {(DQ (${ VSub_Name KUBECTL))} {(delete)} {(-f)} {(DQ (${ VSub_Name RESOURCE_DIRECTORY) (/hollow-node.yaml))} ) terminator: ) (AndOr children: [ (SimpleCommand redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[192])] ) (C {(true)}) ] op_id: Op_DPipe ) (Sentence child: (C {(DQ (${ VSub_Name KUBECTL))} {(delete)} {(-f)} {(DQ (${ VSub_Name RESOURCE_DIRECTORY) (/kubemark-ns.json))} ) terminator: ) (AndOr children: [ (SimpleCommand redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[218])] ) (C {(true)}) ] op_id: Op_DPipe ) (Sentence child: (C {(rm)} {(-rf)} {(DQ (${ VSub_Name RESOURCE_DIRECTORY) (/addons))} {(DQ (${ VSub_Name RESOURCE_DIRECTORY) (/kubeconfig.kubemark))} {(DQ (${ VSub_Name RESOURCE_DIRECTORY) (/hollow-node.yaml))} {(DQ (${ VSub_Name RESOURCE_DIRECTORY) (/kubemark-master-env.sh))} ) terminator: ) (AndOr children: [ (SimpleCommand redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[266])] ) (C {(true)}) ] op_id: Op_DPipe ) (C {(delete-master-instance-and-resources)}) ] )