Exemple #1
0
def launch_storage_mon():                                                       
    if kube_env.check_kubernetes_status() != util.EXIT_SUCCESS:                 
        log.error("Kubernetes is not set up."                                   
                  " Did you run the deployment script?")                        
        sys.exit(util.EXIT_FAILURE)                                             
    cmd = "kubectl get pods -lapp=storage-upstream "                            
    cmd += " -o jsonpath={.items[0].metadata.name} -n=storage"                  
    storage_pod_name = util.get_output_from_proc(cmd).decode("utf-8")           
    cmd = f"kubectl -n=storage port-forward {storage_pod_name} 8090:8080"       
    storage_proc = util.start_process(cmd, preexec_fn=os.setsid)                
    # Let settle things in a bit                                                
    time.sleep(2)                                                               
    return storage_proc
def launch_prometheus():
    if kube_env.check_kubernetes_status() != util.EXIT_SUCCESS:
        log.error("Kubernetes is not set up."
                  " Did you run the deployment script?")
        sys.exit(util.EXIT_FAILURE)
    cmd = "kubectl get pods -n istio-system -lapp=prometheus "
    cmd += " -o jsonpath={.items[0].metadata.name}"
    prom_pod_name = util.get_output_from_proc(cmd).decode("utf-8")
    cmd = f"kubectl port-forward -n istio-system {prom_pod_name} 9090"
    prom_proc = util.start_process(cmd, preexec_fn=os.setsid)
    time.sleep(2)
    prom_api = PrometheusConnect(url="http://localhost:9090", disable_ssl=True)

    return prom_proc, prom_api
def start_fortio(gateway_url):
    cmd = f"{FILE_DIR}/bin/fortio "
    cmd += "load -c 50 -qps 300 -jitter -t 0 -loglevel Warning "
    cmd += f"http://{gateway_url}/productpage"
    fortio_proc = util.start_process(cmd, preexec_fn=os.setsid)
    return fortio_proc