Skip to content

Commit 5d55e7f

Browse files
committed
fix(clusters): Add last_scheduling_status to errors
Signed-off-by: Kyle Squizzato <kyle@replicated.com>
1 parent a3cc399 commit 5d55e7f

File tree

2 files changed

+31
-10
lines changed

2 files changed

+31
-10
lines changed

package-lock.json

Lines changed: 26 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/clusters.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export class Cluster {
44
name: string;
55
id: string;
66
status: string;
7+
last_scheduling_status?: string;
78
}
89

910
export class ClusterVersion {
@@ -177,9 +178,9 @@ export async function pollForStatus(vendorPortalApi: VendorPortalApi, clusterId:
177178
return clusterDetails;
178179
}
179180

180-
// Once state is "error", it will never change. So we can shortcut polling.
181181
if (clusterDetails.status === "error") {
182-
throw new Error(`Cluster has entered error state.`);
182+
const schedulingStatus = clusterDetails.last_scheduling_status ? `, last scheduling status: ${clusterDetails.last_scheduling_status}` : "";
183+
throw new Error(`Cluster has entered error state${schedulingStatus}`);
183184
}
184185

185186
console.debug(`Cluster status is ${clusterDetails.status}, sleeping for ${sleeptimeMs / 1000} seconds`);
@@ -219,7 +220,8 @@ async function getClusterDetails(vendorPortalApi: VendorPortalApi, clusterId: st
219220
return {
220221
name: body.cluster.name,
221222
id: body.cluster.id,
222-
status: body.cluster.status
223+
status: body.cluster.status,
224+
last_scheduling_status: body.cluster.last_scheduling_status
223225
};
224226
}
225227

0 commit comments

Comments
 (0)