- FunctionJobReconciler: added KubeClient field (kubernetes.Interface) - getJobPodOutput(): reads pod logs via typed client after job succeeds - main.go: inject kubernetes.NewForConfigOrDie into FunctionJobReconciler - rbac.yaml: add pods/pods/log get/list/watch permissions - examples/simple-python/: job->function chain demo (Python) - examples/simple-node/: job->function chain demo (Node.js) sless_job.X.message now contains the return value of the function
21 lines
824 B
JavaScript
21 lines
824 B
JavaScript
// Создано: 2026-03-09
|
|
// time_display.js — HTTP-функция (постоянный Deployment + Trigger).
|
|
// Читает env JOB_TIME, которую terraform передаёт из sless_job.run_getter.message.
|
|
// Демонстрирует цепочку: Job вычисляет данные → Function использует их через env.
|
|
|
|
exports.showTime = function(event) {
|
|
// JOB_TIME устанавливается terraform из статуса джоба (JSON строка)
|
|
const jobTimeRaw = process.env.JOB_TIME || '{}';
|
|
let jobTime;
|
|
try {
|
|
const parsed = JSON.parse(jobTimeRaw);
|
|
jobTime = parsed.time || jobTimeRaw;
|
|
} catch (e) {
|
|
jobTime = jobTimeRaw;
|
|
}
|
|
return {
|
|
message: `Сервис запустился в: ${jobTime}`,
|
|
path: event._path || '/',
|
|
};
|
|
};
|