podname logs for log service

This commit is contained in:
Frostebite 2023-08-02 00:28:14 +01:00
parent a275c2ec4a
commit 7d2704c3e4
4 changed files with 13 additions and 1 deletions

BIN
dist/index.js generated vendored

Binary file not shown.

BIN
dist/index.js.map generated vendored

Binary file not shown.

View File

@ -113,6 +113,17 @@ status: {}
true,
);
// if status of pod is not running, then continue
const podStatus = await CloudRunnerSystem.Run(
`kubectl get pods -n ${namespace} ${podname} -o jsonpath='{.status.phase}'`,
false,
true,
);
if (podStatus !== 'Running') {
CloudRunnerLogger.log(`Pod status: ${podStatus}`);
continue;
}
const logs = await CloudRunnerSystem.Run(`kubectl logs ${podname} -f --timestamps`, false, true);
CloudRunnerLogger.log(`Logs: ${logs}`);

View File

@ -44,8 +44,9 @@ describe('Cloud Runner Kubernetes', () => {
const kubeConfig = new k8s.KubeConfig();
kubeConfig.loadFromDefault();
const kubeClient = kubeConfig.makeApiClient(k8s.CoreV1Api);
const kubeClientApps = kubeConfig.makeApiClient(k8s.AppsV1Api);
await KubernetesLogService.createLogService('test', 'default', kubeClient);
await KubernetesLogService.createLogDeployment('test', kubeClientApps, kubeClient);
CloudRunnerLogger.log(`run 1 succeeded`);
}, 1_000_000_000);