Skip to content

Commit

Permalink
Included bulk scalability test
Browse files Browse the repository at this point in the history
Signed-off-by: Chandrakala Subramanyam <[email protected]>
  • Loading branch information
chandrams committed Nov 26, 2024
1 parent 6143696 commit d5d5555
Show file tree
Hide file tree
Showing 5 changed files with 611 additions and 5 deletions.
40 changes: 35 additions & 5 deletions tests/scripts/helpers/kruize.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

def form_kruize_url(cluster_type, SERVER_IP=None):
global URL
KIND_IP="127.0.0.1"
KRUIZE_PORT=8080

if SERVER_IP != None:
URL = "http://" + str(SERVER_IP)
Expand All @@ -38,7 +40,8 @@ def form_kruize_url(cluster_type, SERVER_IP=None):
ip = subprocess.run(['minikube ip'], shell=True, stdout=subprocess.PIPE)
SERVER_IP = ip.stdout.decode('utf-8').strip('\n')
URL = "http://" + str(SERVER_IP) + ":" + str(AUTOTUNE_PORT)

elif (cluster_type == "kind"):
URL = "http://" + KIND_IP + ":" + str(KRUIZE_PORT)
elif (cluster_type == "openshift"):

subprocess.run(['oc expose svc/kruize -n openshift-tuning'], shell=True, stdout=subprocess.PIPE)
Expand All @@ -50,6 +53,33 @@ def form_kruize_url(cluster_type, SERVER_IP=None):
URL = "http://" + str(SERVER_IP)
print("\nKRUIZE AUTOTUNE URL = ", URL)

# Description: This function invokes the Kruize bulk service API
# Input Parameters: bulk json
def bulk(bulk_json_file):
json_file = open(bulk_json_file, "r")
bulk_json = json.loads(json_file.read())

#print("\nInvoking bulk service...")
url = URL + "/bulk"
print("URL = ", url)

response = requests.post(url, json=bulk_json)
return response

# Description: This function invokes the Kruize bulk service API
# Input Parameters: job id returned from bulk service
def get_bulk_job_status(job_id, verbose = None):
#print("\nGet the bulk job status for job id %s " % (job_id))
queryString = "?"
if job_id:
queryString = queryString + "job_id=%s" % (job_id)
if verbose:
queryString = queryString + "&verbose=%s" % (verbose)

url = URL + "/bulk%s" % (queryString)
#print("URL = ", url)
response = requests.get(url, )
return response

# Description: This function validates the input json and posts the experiment using createExperiment API to Kruize Autotune
# Input Parameters: experiment input json
Expand Down Expand Up @@ -164,10 +194,10 @@ def list_recommendations(experiment_name=None, latest=None, monitoring_end_time=
print("PARAMS = ", PARAMS)
response = requests.get(url=url, params=PARAMS)

print("Response status code = ", response.status_code)
print("\n************************************************************")
print(response.text)
print("\n************************************************************")
#print("Response status code = ", response.status_code)
#print("\n************************************************************")
#print(response.text)
#print("\n************************************************************")
return response


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"filter": {
"exclude": {
"namespace": [],
"workload": [],
"containers": [],
"labels": {}
},
"include": {
"namespace": [],
"workload": [],
"containers": [],
"labels": {}
}
},
"datasource": "thanos",
"time_range": {
"start": "2024-09-01T00:00:00.000Z",
"end": "2024-09-11T00:00:00.000Z"
}
}

Loading

0 comments on commit d5d5555

Please sign in to comment.