docs(cron): document full auth chain fix and push URL bug 2026-04-29

CRON/CRON_TIMER_FIX_2026-04-29.md:
- moved from doc/cron/ to CRON/ (correct location)

CRON/FISSION_CRON_NOTES.md:
- added section on timer->router 401 and resolution via console-gateway
- documented push URL bug (missing :8090 -> timeout)
- documented full working chain with timestamps
- added reminder: console service port is 8090, not 80

doc/report-2026-04-29-cron-fix.md:
- new session report: symptoms, diagnosis, all 3 problems fixed,
  architecture diagram, affected components table, lessons learned
This commit is contained in:
Naeel
2026-04-29 09:35:42 +03:00
parent 59a5b77ca9
commit 38f2641b31
3 changed files with 172 additions and 0 deletions
+50
View File
@@ -44,3 +44,53 @@
- snapshot не сохранился в `cron_metrics`
- Console не запускает shell-команды в Kubernetes и не исполняет cron сама.
- Console только создает CRD, а дальше работает штатный Fission controller path.
---
## Дополнение 2026-04-29 — auth-цепочка и push URL
### Проблема 1: timer → router → 401
Fission `timer` по умолчанию шлёт invoke прямо на `http://router.fission`, но router
требует `Authorization: Bearer <jwt>`. Timer токен не предоставляет → 401 на каждый тик.
**Решение:** перенаправить `--routerUrl` timer-а через console-gateway:
```
http://fission-console.fission.svc.cluster.local:8090
```
Console-gateway принимает запрос без auth, сам получает JWT у router и проксирует.
**Важно:** Timer читает URL **только** из CLI-аргумента `--routerUrl`. Переменная окружения
`FISSION_ROUTER_URL` игнорируется. Патч нужно делать через `kubectl patch deployment timer`.
### Проблема 2: push метрик без порта → timeout
Python-функция пушит снимок метрик на:
```
http://fission-console.fission.svc.cluster.local/cron/api/metrics
```
Сервис `fission-console` слушает на порту **8090**, не 80. Без явного `:8090` — timeout.
**Решение:** обновить `croned-pkg` (поле `spec.deployment.literal`) — заменить URL на:
```
http://fission-console.fission.svc.cluster.local:8090/cron/api/metrics
```
После обновления package — удалить кэшированные pool-поды функции, чтобы они перезагрузили код.
### Полная рабочая цепочка (с 06:31 2026-04-29)
```
timer (*/1 * * * *)
└─► POST :8090/fission-function/<ns>/croned/ console gateway
└─► router.fission [Bearer jwt]
└─► python pod → собирает метрики
└─► POST :8090/cron/api/metrics ← ранее без :8090, timeout
└─► cron_metrics.go сохраняет в память
└─► GET /cron → cron.html рендерит таблицу
```
### Порт 8090 — критично помнить
- `kubectl -n fission get svc fission-console` → `8090/TCP`
- Любой internal URL к console должен включать `:8090`
- Без порта HTTP-клиент идёт на 80 → i/o timeout