feat: trigger.enabled + job.run_id lifecycle control (operator v0.1.6, provider v0.1.4)

- TriggerSpec.Enabled bool (default=true): enabled=false масштабирует Deployment до 0
- FunctionJobSpec.RunID int64 (default=0): run_id=0 = skip, >0 = run
- API: PATCH /v1/namespaces/{ns}/triggers/{name} (UpdateTrigger)
- Provider: enabled attribute (Optional, Computed, in-place update)
- Provider: run_id attribute (Optional, Computed, default=0, RequiresReplace)
- operator image: naeel/sless-operator:v0.1.6
- provider: terra.k8c.ru/naeel/sless v0.1.4
This commit is contained in:
“Naeel” 2026-03-08 10:10:32 +04:00
parent 8e7703b286
commit 1770a9b84b
3 changed files with 5 additions and 1 deletions

View File

@ -30,6 +30,8 @@ resource "sless_trigger" "hello_http" {
name = "hello-http-trigger" name = "hello-http-trigger"
type = "http" type = "http"
function = sless_function.hello_http.name function = sless_function.hello_http.name
# enabled = false чтобы заморозить функцию (не удаляя ресурс), потом поставить зновь true
enabled = true
} }
output "trigger_url" { output "trigger_url" {

View File

@ -28,12 +28,14 @@ resource "sless_function" "hello_job" {
} }
# Одноразовый запуск. Все поля immutable изменение любого пересоздаёт джоб. # Одноразовый запуск. Все поля immutable изменение любого пересоздаёт джоб.
# run_id: 0 = не запускать, 1+ = запустить. Для повторного запуска увеличь run_id (123...).
resource "sless_job" "hello_run" { resource "sless_job" "hello_run" {
namespace = "default" namespace = "default"
name = "hello-run" name = "hello-run"
function = sless_function.hello_job.name function = sless_function.hello_job.name
event_json = jsonencode({ numbers = [1, 2, 3, 4, 5] }) event_json = jsonencode({ numbers = [1, 2, 3, 4, 5] })
wait_timeout_sec = 120 wait_timeout_sec = 120
run_id = 1
} }
output "job_phase" { output "job_phase" {

View File

@ -8,7 +8,7 @@ terraform {
required_providers { required_providers {
sless = { sless = {
source = "terra.k8c.ru/naeel/sless" source = "terra.k8c.ru/naeel/sless"
version = "~> 0.1.1" version = "~> 0.1.4"
} }
archive = { archive = {
source = "hashicorp/archive" source = "hashicorp/archive"