def delete_pod(component_label, settings, custom_yaml_filename=None): deployment_target = settings["DEPLOY_TO"] yaml_filename = custom_yaml_filename or (component_label+".%(DEPLOY_TO_PREFIX)s.yaml") if is_pod_running(component_label, deployment_target): run(" ".join([ "kubectl delete", "-f %(DEPLOYMENT_TEMP_DIR)s/deploy/kubernetes/"+component_label+"/"+yaml_filename, ]) % settings, errors_to_ignore=["not found"]) logger.info("waiting for \"%s\" to exit Running status" % component_label) while is_pod_running(component_label, deployment_target): time.sleep(5)
def delete_component(component, deployment_target=None): """Runs kubectl commands to delete any running deployment, service, or pod objects for the given component(s). Args: component (string): component to delete (eg. 'phenotips' or 'nginx'). deployment_target (string): value from DEPLOYMENT_TARGETS - eg. "minikube", "gcloud-dev", etc. """ if component == "cockpit": run("kubectl delete rc cockpit", errors_to_ignore=["not found"]) elif component == "es-data": run("kubectl delete StatefulSet es-data", errors_to_ignore=["not found"]) elif component == "nginx": run("kubectl delete -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/mandatory.yaml" ) run("kubectl delete deployments %(component)s" % locals(), errors_to_ignore=["not found"]) run("kubectl delete services %(component)s" % locals(), errors_to_ignore=["not found"]) pod_name = get_pod_name(component, deployment_target=deployment_target) if pod_name: run("kubectl delete pods %(pod_name)s" % locals(), errors_to_ignore=["not found"]) logger.info("waiting for \"%s\" to exit Running status" % component) while is_pod_running(component, deployment_target): time.sleep(5) # print services and pods status run("kubectl get services" % locals(), verbose=True) run("kubectl get pods" % locals(), verbose=True)
def delete_component(component, deployment_target=None): """Runs kubectl commands to delete any running deployment, service, or pod objects for the given component(s). Args: component (string): component to delete (eg. 'phenotips' or 'nginx'). deployment_target (string): value from DEPLOYMENT_TARGETS - eg. "minikube", "gcloud-dev", etc. """ if component == "cockpit": run("kubectl delete rc cockpit", errors_to_ignore=["not found"]) elif component == "es-data": run("kubectl delete StatefulSet es-data", errors_to_ignore=["not found"]) elif component == "nginx": run("kubectl delete -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/mandatory.yaml") run("kubectl delete deployments %(component)s" % locals(), errors_to_ignore=["not found"]) run("kubectl delete services %(component)s" % locals(), errors_to_ignore=["not found"]) pod_name = get_pod_name(component, deployment_target=deployment_target) if pod_name: run("kubectl delete pods %(pod_name)s" % locals(), errors_to_ignore=["not found"]) logger.info("waiting for \"%s\" to exit Running status" % component) while is_pod_running(component, deployment_target): time.sleep(5) # print services and pods status run("kubectl get services" % locals(), verbose=True) run("kubectl get pods" % locals(), verbose=True)
if wait_until_pod_is_ready: sleep_until_pod_is_ready(component_label, deployment_target=settings["DEPLOY_TO"]) def delete_pod(component_label, settings, async=False, custom_yaml_filename=None): deployment_target = settings["DEPLOY_TO"] yaml_filename = custom_yaml_filename or (component_label + ".%(DEPLOY_TO_PREFIX)s.yaml") if is_pod_running(component_label, deployment_target): run(" ".join([ "kubectl delete", "-f %(DEPLOYMENT_TEMP_DIR)s/deploy/kubernetes/" + component_label + "/" + yaml_filename, ]) % settings, errors_to_ignore=["not found"]) logger.info("waiting for \"%s\" to exit Running status" % component_label) while is_pod_running(component_label, deployment_target) and not async: time.sleep(5) def create_vpc(gcloud_project, network_name): run( " ".join([
"-f %(DEPLOYMENT_TEMP_DIR)s/deploy/kubernetes/"+component_label+"/"+component_label+".%(DEPLOY_TO_PREFIX)s.yaml" ]) % settings) if wait_until_pod_is_running: sleep_until_pod_is_running(component_label, deployment_target=settings["DEPLOY_TO"]) if wait_until_pod_is_ready: sleep_until_pod_is_ready(component_label, deployment_target=settings["DEPLOY_TO"]) def delete_pod(component_label, settings, async=False, custom_yaml_filename=None): deployment_target = settings["DEPLOY_TO"] yaml_filename = custom_yaml_filename or (component_label+".%(DEPLOY_TO_PREFIX)s.yaml") if is_pod_running(component_label, deployment_target): run(" ".join([ "kubectl delete", "-f %(DEPLOYMENT_TEMP_DIR)s/deploy/kubernetes/"+component_label+"/"+yaml_filename, ]) % settings, errors_to_ignore=["not found"]) logger.info("waiting for \"%s\" to exit Running status" % component_label) while is_pod_running(component_label, deployment_target) and not async: time.sleep(5) def create_vpc(gcloud_project, network_name): run(" ".join([ #"gcloud compute networks create seqr-project-custom-vpc --project=%(GCLOUD_PROJECT)s --mode=custom" "gcloud compute networks create %(network_name)s", "--project=%(gcloud_project)s",