Rewrote k8s handling
This commit is contained in:
parent
dd97d013cb
commit
bb6a6396dc
7 changed files with 100 additions and 95 deletions
16
lib/jobs/k8s/k8s.js
Normal file
16
lib/jobs/k8s/k8s.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
import cp from "node:child_process";
|
||||
import { jobBuilder, createFile, deleteFile } from "./k8s-common.js";
|
||||
|
||||
const applyFile = async (filePath) => {
|
||||
const command = `${kubCmd} ${filePath}`;
|
||||
return new Promise((res, rej) =>
|
||||
cp.exec(command, (err, stdout, stderr) => (err && rej(err)) || res(stdout))
|
||||
);
|
||||
};
|
||||
|
||||
export default async function createJob(jobRequest) {
|
||||
const job = jobBuilder(jobRequest);
|
||||
const filePath = createFile(job);
|
||||
applyFile(filePath);
|
||||
deleteFile(filePath);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue