Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Gu <[email protected]>
  • Loading branch information
tylergu committed Nov 13, 2023
1 parent 5e36950 commit 3a40a27
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions performance_measurement/measure_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,8 @@ def wait_for_reference_rabbitmq_spec(
logging.info("generation not matched")
continue

break

def wait_for_rabbitmq_spec(
input: dict, apiclient: kubernetes.client.ApiClient, namespace: str) -> bool:
appV1Api = kubernetes.client.AppsV1Api(apiclient)
Expand All @@ -597,69 +599,82 @@ def wait_for_rabbitmq_spec(
# affinity
desired_affinity = input["spec"]["affinity"] if "affinity" in input["spec"] else None
if not check_affinity(desired_affinity, sts_object):
logging.info("affinity not matched")
continue

# annotations
input_annotations = input["spec"]["annotations"] if "annotations" in input["spec"] else None
if not check_annotations(input_annotations, sts_object):
logging.info("annotation not matched")
continue

# image
if sts_object["spec"]["template"]["spec"]["containers"][0]["image"] != input["spec"]["image"]:
logging.info("image not matched")
continue

# labels
input_labels = input["spec"]["labels"] if "labels" in input["spec"] else None
if not check_labels(input_labels, sts_object):
logging.info("label not matched")
continue

# persistence
if "persistence" in input["spec"]:
pvc_template = sts_object["spec"]["volume_claim_templates"][0]
if "storage" in input["spec"]["persistence"]:
if "storage" in input["spec"]["persistence"] and input["spec"]["persistence"]["storage"] is not None:
if pvc_template["spec"]["resources"]["requests"]["storage"] != input["spec"][
"persistence"]["storage"]:
logging.info("storage not matched")
continue

if "storageClassName" in input["spec"]["persistence"]:
if "storageClassName" in input["spec"]["persistence"] and input["spec"]["persistence"]["storageClassName"] is not None:
if pvc_template["spec"]["storage_class_name"] != input["spec"]["persistence"][
"storageClassName"]:
logging.info("storageClassName not matched")
continue

# persistentVolumeClaimRetentionPolicy
desired_persistent_volume_claim_retention_policy = input["spec"][
"persistentVolumeClaimRetentionPolicy"] if "persistentVolumeClaimRetentionPolicy" in input["spec"] else None
if not check_persistent_volume_claim_retention_policy(
desired_persistent_volume_claim_retention_policy, sts_object):
logging.info("persistentVolumeClaimRetentionPolicy not matched")
continue

# podManagementPolicy
if "podManagementPolicy" in input["spec"]:
if sts_object["spec"]["pod_management_policy"] != input["spec"][
"podManagementPolicy"]:
logging.info("podManagementPolicy not matched")
continue

# rabbitmqConfig

# replicas
if sts_object["spec"]["replicas"] != input["spec"]["replicas"]:
logging.info("replicas not matched")
continue

# resources
desired_resources = input["spec"]["resources"] if "resources" in input["spec"] else None
if not check_resources(desired_resources, sts_object):
logging.info("resources not matched")
continue

# tolerations
desired_tolerations = input["spec"]["tolerations"] if "tolerations" in input["spec"] else None
if not check_tolerations(desired_tolerations, sts_object):
logging.info("tolerations not matched")
continue

# make sure the generation is up to date
if sts_object["metadata"]["generation"] != sts_object["status"]["observed_generation"]:
logging.info("generation not matched")
continue

break

def wait_for_pod_ready(
input: dict, apiclient: kubernetes.client.ApiClient, namespace: str) -> bool:
coreV1Api = kubernetes.client.CoreV1Api(apiclient)
Expand Down

0 comments on commit 3a40a27

Please sign in to comment.