Skip to content

Commit 8816a4a

Browse files
committed
Make claim name more generic, add "provisioning" status
1 parent 082ca72 commit 8816a4a

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

generate-status/collect_info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
)
1515

1616
def getAnarchySubject(project_id):
17-
subject = list(filter(lambda x: x["metadata"]["annotations"]["poolboy.gpte.redhat.com/resource-claim-name"] == f"labs.ocp4.na-{project_id}", anarchy_subject_list["items"]))
17+
subject = list(filter(lambda x: project_id in x["metadata"]["annotations"]["poolboy.gpte.redhat.com/resource-claim-name"], anarchy_subject_list["items"]))
1818
if len(subject) > 0:
1919
return subject[0]
2020
else:

generate-status/write_status.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@
2424
current_state = subject["anarchy_subject"]["spec"]["vars"]["current_state"]
2525
desired_state = subject["anarchy_subject"]["spec"]["vars"]["desired_state"]
2626

27-
ocp_subsystem["status"] = "green" if current_state == desired_state else "yellow"
2827
ocp_subsystem["state"] = current_state
29-
ocp_subsystem["info"] = "Working as expected" if current_state == desired_state else "Contact SRE team"
3028
ocp_subsystem["updated"] = str(datetime.datetime.utcnow().replace(tzinfo=datetime.timezone.utc, microsecond=0).isoformat())
3129
ocp_subsystem["access_urls"] = [
3230
{
@@ -37,6 +35,16 @@
3735
}
3836
]
3937

38+
if current_state == "provisioning":
39+
ocp_subsystem["status"] = "yellow"
40+
ocp_subsystem["info"] = "Building cluster"
41+
elif current_state == desired_state :
42+
ocp_subsystem["status"] = "green"
43+
ocp_subsystem["info"] = "Working as expected"
44+
else:
45+
ocp_subsystem["status"] = "yellow"
46+
ocp_subsystem["info"] = "Contact SRE team"
47+
4048
status["overall_status"] = ocp_subsystem["status"]
4149
status["subsystems"].append(ocp_subsystem)
4250

0 commit comments

Comments
 (0)