feat: operator v0.1.16 — job stdout -> status.Message (feature B)
- 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
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
# Создано: 2026-03-09
|
||||
# time-display.tf — постоянная HTTP-функция, получающая данные от джоба.
|
||||
|
||||
# Упаковываем код функции в zip
|
||||
data "archive_file" "time_display_zip" {
|
||||
type = "zip"
|
||||
source_dir = "${path.module}/code/time_display"
|
||||
output_path = "${path.module}/dist/time_display.zip"
|
||||
}
|
||||
|
||||
# HTTP-функция: постоянный Deployment, читает JOB_TIME из env
|
||||
resource "sless_function" "time_display" {
|
||||
namespace = "default"
|
||||
name = "simple-node-time-display"
|
||||
runtime = "nodejs20"
|
||||
entrypoint = "time_display.showTime"
|
||||
memory_mb = 64
|
||||
|
||||
# Значение вычислено джобом при apply и зафиксировано в state
|
||||
env_vars = {
|
||||
JOB_TIME = sless_job.run_getter.message
|
||||
}
|
||||
|
||||
code_path = data.archive_file.time_display_zip.output_path
|
||||
code_hash = filesha256("${path.module}/code/time_display/time_display.js")
|
||||
|
||||
depends_on = [sless_job.run_getter]
|
||||
}
|
||||
|
||||
# HTTP-триггер — публикует функцию по URL
|
||||
resource "sless_trigger" "display_http" {
|
||||
namespace = "default"
|
||||
name = "simple-node-display-http"
|
||||
type = "http"
|
||||
function = sless_function.time_display.name
|
||||
}
|
||||
Reference in New Issue
Block a user