Skip to content

Commit

Permalink
Merge pull request #1117 from mook-as/kube-slow-startup
Browse files Browse the repository at this point in the history
K8s-engine: assert at least one item in list, not nonzero.
  • Loading branch information
mattfarina authored Dec 16, 2021
2 parents 806cdd1 + c767f40 commit 6b82274
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/k8s-engine/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,15 @@ export class KubeClient extends events.EventEmitter {
// the k3s server must be running. But with wsl we've observed that the service
// watcher needs more time to start up. When this call returns at least one
// service, it's ready.
if ((await this.coreV1API.listServiceForAllNamespaces()).body.items.length === 0) {
try {
const { body } = await this.coreV1API.listServiceForAllNamespaces();

if (!(body.items.length > 0)) {
return null;
}
} catch (ex) {
console.debug(`Error fetching services: ${ ex }`);

return null;
}
this.services = new k8s.ListWatch(
Expand Down

0 comments on commit 6b82274

Please sign in to comment.