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:
@@ -113,6 +113,11 @@ func (h *Handler) CreateService(w http.ResponseWriter, r *http.Request) {
|
||||
writeJSON(w, http.StatusBadRequest, errResp("memory_mb must be between 1 and 4096"))
|
||||
return
|
||||
}
|
||||
// timeout_sec: 0 = нет ограничения (допустимо), отрицательное — ошибка.
|
||||
if req.TimeoutSec < 0 || req.TimeoutSec > 900 {
|
||||
writeJSON(w, http.StatusBadRequest, errResp("timeout_sec must be 0 (no limit) or 1–900"))
|
||||
return
|
||||
}
|
||||
|
||||
svc := &slessv1alpha1.Service{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
@@ -202,6 +207,11 @@ func (h *Handler) UpdateService(w http.ResponseWriter, r *http.Request) {
|
||||
writeJSON(w, http.StatusBadRequest, errResp("memory_mb must be between 1 and 4096"))
|
||||
return
|
||||
}
|
||||
// timeout_sec: 0 = нет ограничения (допустимо), отрицательное — ошибка.
|
||||
if req.TimeoutSec < 0 || req.TimeoutSec > 900 {
|
||||
writeJSON(w, http.StatusBadRequest, errResp("timeout_sec must be 0 (no limit) or 1–900"))
|
||||
return
|
||||
}
|
||||
|
||||
svc.Spec.Runtime = req.Runtime
|
||||
svc.Spec.Entrypoint = req.Entrypoint
|
||||
|
||||
Reference in New Issue
Block a user