feat(service): timeout_sec без дефолта; 0=нет таймаута; operator v0.1.48

- api/v1alpha1/service_types.go: убрать +kubebuilder:default=30
- invoke.go: TimeoutSec=0 → &http.Client{} (без таймаута)
- services.go: валидация timeout_sec < 0 || > 900 → HTTP 400
- service_resource.go: TF schema Optional (без Computed); 0 → Int64Null()
- deployments/k8s/operator.yaml: v0.1.47 → v0.1.48
- doc/: progress.md + api/design.md (модель Service) + decisions/log.md
- examples/POSTGRES/: bug_hunter.sh, chaos_marathon.sh, chaos_marathon.tf
This commit is contained in:
Naeel
2026-03-21 16:58:43 +03:00
parent 7f7aa44e59
commit b86ff3a62e
37 changed files with 2493 additions and 50 deletions
@@ -99,11 +99,12 @@ func (r *ServiceResource) Schema(_ context.Context, _ resource.SchemaRequest, re
int64validator.Between(1, 4096),
},
},
// timeout_sec для сервиса = прокси-таймаут invoke (не таймаут Job).
// При длинных операциях (batch) увеличивай.
// timeout_sec — лимит времени выполнения запроса в секундах.
// Если не задан (null) — таймаута нет, запрос может выполняться бесконечно.
// Диапазон 1–900. Для batch-операций задавай явно, например 120.
"timeout_sec": schema.Int64Attribute{
Optional: true,
Computed: true,
Optional: true,
MarkdownDescription: "Таймаут HTTP-вызова в секундах (1–900). Если не задан — нет ограничения.",
Validators: []validator.Int64{
int64validator.Between(1, 900),
},
@@ -355,12 +356,19 @@ func svcToModel(plan ServiceModel, svc *client.ServiceResponse) ServiceModel {
if buildTimeoutSec.IsNull() || buildTimeoutSec.IsUnknown() || buildTimeoutSec.ValueInt64() <= 0 {
buildTimeoutSec = types.Int64Value(defaultBuildTimeoutSec)
}
// TimeoutSec: 0 в API означает «пользователь не установил лимит» → null в state.
var timeoutSec types.Int64
if svc.TimeoutSec > 0 {
timeoutSec = types.Int64Value(int64(svc.TimeoutSec))
} else {
timeoutSec = types.Int64Null()
}
return ServiceModel{
Name: types.StringValue(svc.Name),
Runtime: types.StringValue(svc.Runtime),
Entrypoint: types.StringValue(svc.Entrypoint),
MemoryMB: types.Int64Value(int64(svc.MemoryMB)),
TimeoutSec: types.Int64Value(int64(svc.TimeoutSec)),
TimeoutSec: timeoutSec,
EnvVars: plan.EnvVars,
CodePath: plan.CodePath,
SourceDir: plan.SourceDir,