Skip to content

Commit

Permalink
feat: added display of DB snapshot in table when booting nodes (#990)
Browse files Browse the repository at this point in the history
* feat: added display of DB snapshot in table when booting nodes

* chore: made table first column width uniform across providers

* chore: fix linting issues
  • Loading branch information
l0r1s authored May 2, 2023
1 parent 5e16cbc commit 8d17a44
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 10 deletions.
12 changes: 8 additions & 4 deletions javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@ export class KubeClient extends Client {
writeLocalJsonFile(this.tmpDir, `${name}.json`, podDef);

let logTable = new CreateLogTable({
colWidths: [20, 100],
colWidths: [25, 100],
});

logTable.pushTo([
const logs = [
[decorators.cyan("Pod"), decorators.green(name)],
[decorators.cyan("Status"), decorators.green("Launching")],
[
Expand All @@ -131,9 +131,13 @@ export class KubeClient extends Client {
decorators.cyan("Command"),
decorators.white(podDef.spec.containers[0].command.join(" ")),
],
]);
];

logTable.print();
if (dbSnapshot) {
logs.push([decorators.cyan("DB Snapshot"), decorators.green(dbSnapshot)]);
}

logTable.pushToPrint(logs);

await this.createResource(podDef, true);
if (podDef.metadata.labels["zombie-role"] !== ZombieRole.Temp) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,17 +272,23 @@ export class NativeClient extends Client {
};

let logTable = new CreateLogTable({
colWidths: [20, 100],
colWidths: [25, 100],
});

logTable.pushToPrint([
const logs = [
[decorators.cyan("Pod"), decorators.green(name)],
[decorators.cyan("Status"), decorators.green("Launching")],
[
decorators.cyan("Command"),
decorators.white(podDef.spec.command.join(" ")),
],
]);
];

if (dbSnapshot) {
logs.push([decorators.cyan("DB Snapshot"), decorators.green(dbSnapshot)]);
}

logTable.pushToPrint(logs);

if (dbSnapshot) {
// we need to get the snapshot from a public access
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,17 +353,23 @@ export class PodmanClient extends Client {
const name = podDef.metadata.name;

let logTable = new CreateLogTable({
colWidths: [20, 100],
colWidths: [25, 100],
});

logTable.pushToPrint([
const logs = [
[decorators.cyan("Pod"), decorators.green(podDef.metadata.name)],
[decorators.cyan("Status"), decorators.green("Launching")],
[
decorators.cyan("Command"),
decorators.white(podDef.spec.containers[0].command.join(" ")),
],
]);
];

if (dbSnapshot) {
logs.push([decorators.cyan("DB Snapshot"), decorators.green(dbSnapshot)]);
}

logTable.pushToPrint(logs);

// initialize keystore
const dataPath = podDef.spec.volumes.find(
Expand Down

0 comments on commit 8d17a44

Please sign in to comment.