Commit Graph
250 Commits
Author SHA1 Message Date
Naeel 657fc33119 sqs-operator v0.1.8: fix UI assets ingress (/_next/ path-based routing)
- ensureIngressUIAssets: Prefix ingress /_next/ без rewrite -> UI port 3000
- Next.js basePath="" захардкожен — static assets идут без тенантного префикса
- Решение через отдельный ingress объект (один на тенант, контент идентичен)
2026-04-08 19:40:42 +03:00
Naeel 64626659a9 sqs-operator v0.1.7: web UI sidecar, auto-create-queues, fix A06 long polling
- api/v1alpha1: добавлены поля EnableUI, AutoCreateQueues в QueueServiceSpec
- elasticmq_config.go: GenerateConfig принимает autoCreateQueues, добавляет HOCON блок
- controller.go: sidecar elasticmq-ui (port 3000), ensureIngressUI, ensureService UI port
- test_v2_suite.sh: A06 теперь PASS — PurgeQueue перед long polling тестом
- CRD обновлён: make install применён в кластере

Test run v0.1.7: 35 PASS / 3 FAIL / 4 WARN / 2 SKIP(WONTFIX)
2026-04-08 19:11:26 +03:00
Naeel c4efc5c960 sqs-operator: docs + third test results (41 PASS, 0 OOM, 0 infra errors) 2026-04-07 20:44:56 +03:00
Naeel c132c68d74 sqs-operator v0.1.6: SH02/SH03/SH04 fix + test_v2_suite + v2 test results
- v0.1.5: ensureHealthy checks all 4 resources (Deployment/Service/ConfigMap/Ingress)
  Service/ConfigMap/Ingress now auto-recreate in 2-4s when manually deleted
- v0.1.6: revert MT03 configuration-snippet (nginx blocks risky annotations by default)
  Tenant isolation deferred to Keycloak JWT in production
- test_v2_suite.sh: 8 phases, 52 tests, timing/resources/concurrent/30min marathon
- Results: 40 PASS / 4 FAIL / 7 WARN (known: OOM restart under burst load)
  SH recovery: Deployment=48s Service=2s ConfigMap=4s Ingress=2s All3=2s
  Marathon: 11815 iter, 10830 sent, 2 pod restarts (OOM under load)
2026-04-07 19:14:00 +03:00
Naeel 18e57cadc7 test(sqs-operator): полный тест-сьют 30мин — результаты + 2 новых бага (MT03, SH02) 2026-04-07 16:54:42 +03:00
Naeel 336ee7b869 fix(sqs-operator): persistence, OOM, Ingress routing (v0.1.2→v0.1.4)
Problem 1: elasticmq-native does not support H2 JDBC persistence
- GraalVM native build excludes H2 driver
- Fix: switch to softwaremill/elasticmq:1.7.1 (JVM image)

Problem 2: OOMKilled — JVM requires >150MB, spec.MemoryMB=64 too low
- Fix: enforce minimum 256Mi for JVM; add -Xmx (75% of limit)

Problem 3: AccessDeniedException on /data — PVC mounted as root:root
- JVM image runs as uid=999 (elasticmq)
- Fix: add fsGroup=999 to PodSecurityContext

Problem 4: 404 through HTTPS — nginx rewrite stripped context-path
- ElasticMQ JVM listens at context-path (/sqs/{tenantId})
- Native image tolerated /, JVM does not
- Fix: remove rewrite-target annotation, use plain Prefix path

Result: S6 PASS — 8 queues + messages survived graceful pod kill
2026-04-07 15:34:15 +03:00
Naeel f8be5c8af1 feat(sqs-operator): v0.1.0 deployed and tested
- Fix Dockerfile: COPY internal/config/ and internal/elasticmq/, Go 1.22
- config/manager/manager.yaml: add SQS_EXTERNAL_HOST env, imagePullSecrets
- config/default/kustomization.yaml: disable kube-rbac-proxy (gcr.io N/A)
- config/samples/sqs_v1alpha1_queueservice.yaml: real test CR (test001)
- doc/progress.md: updated with deployment results

Smoke test: QueueService test-tenant-001 Phase=Ready in 27s
ElasticMQ pod 1/1 Running in sless-fn-test001
SQS CreateQueue via https://sqs.kube5s.ru/sqs/test001 OK
2026-04-07 14:43:41 +03:00
Naeel 52e9511d50 doc: план для Sonnet (sqs-operator deploy), обновлён progress.md 2026-04-07 14:30:34 +03:00
Naeel 66dcd99465 refactor(sqs-operator): переделка через Operator SDK v1.37.0
- operator-sdk init + create api (QueueService kind, group sqs, v1alpha1)
- Стандартная kubebuilder структура: cmd/, internal/controller/, config/
- CRD types с kubebuilder маркерами (validation, defaults, printcolumns)
- Reconciler перенесён из ручного кода в internal/controller/
- controller-gen v0.17.0 (совместимость с Go 1.26.1)
- Автогенерация: deepcopy, CRD YAML, RBAC ClusterRole
- Удалены все ручные файлы (controllers/, main.go, deployments/)
2026-04-07 14:25:14 +03:00
Naeel cbe61d9f62 feat: sqs-operator — CRD QueueService, контроллер, ElasticMQ per-tenant 2026-04-07 13:56:53 +03:00
Naeel a22a37bef3 doc: SQS Operator plan — ElasticMQ per-tenant, 10 этапов 2026-04-07 13:24:40 +03:00
Naeel 7220fe5b8b feat: IoT Admin Stats page — /iot-admin (v0.1.70)
- GET /iot-admin — HTML страница администратора (go:embed)
- GET /iot-admin/stats — JSON API с данными (Bearer ADMIN_STATS_TOKEN)
- Источники: Kafka consumer lag, K8s pod statuses, PostgreSQL per-tenant stats
- Авторизация: ADMIN_STATS_TOKEN env var
- Auto-refresh каждые 30 секунд
- Nubes brand style
2026-04-06 19:14:57 +03:00
Naeel 69451007f6 test: re-test v0.1.69 — все 8 тестов PASS, 1000/1000 при нагрузке 2026-04-06 18:45:57 +03:00
Naeel 387932ce10 fix: bridge Kafka write async (v0.1.69) — MQTT callback не блокируется 2026-04-06 18:26:03 +03:00
Naeel c0a08ae78d test: полное суровое тестирование IoT pipeline — 7 сценариев, 4 критических находки 2026-04-06 18:14:50 +03:00
Naeel 815b861417 docs: Kafka pipeline v0.1.68 — полная документация, race condition fix, тесты 2026-04-06 17:42:44 +03:00
Naeel 07ada8e362 fix: kafka race condition — ensureKafkaTopic in consumer before group join (v0.1.68) 2026-04-06 17:31:19 +03:00
Naeel 63f834da2b feat: Kafka pipeline v0.1.67 (mqtt-bridge→kafka→consumer→postgres) 2026-04-06 16:41:31 +03:00
Naeel e46a8bb3e3 doc: 2026-04-06 thinking log + kafka integration plan 2026-04-06 16:03:57 +03:00
Naeel 184f5ceb91 doc: session 2026-04-05 thinking log + progress update (v0.1.66, incident) 2026-04-05 17:37:38 +03:00
Naeel 7e16dd0e0b v0.1.66: token input visible, display name in navbar 2026-04-05 17:31:02 +03:00
Naeel 69dc023bf7 fix: make MQTTX Web visually a button-link, not plain text
Image: v0.1.65
2026-04-05 16:43:49 +03:00
Naeel d2460ac988 fix: improve credentials tab readability
- cred-label: 11px→13px, убран uppercase, цвет #7eb8e0 (читаемый на тёмном)
- cred-value: 13px→14px, фон #0a1e30, текст #e2f0ff (светлый, контрастный)
- hint: 12px→14px, цвет #a0bcd8
- MQTTX-блок: заголовок 15px жирный #c8dff0, текст 14px #c8dff0,
  code-теги со своим фоном и цветом #7dd3fc,
  предупреждение ⚠️ жёлтым #fcd34d

Image: v0.1.64
2026-04-05 16:39:16 +03:00
Naeel 20846297af fix: EnsureNamespace in doCreate + sanitize API errors in UI
- doCreate() calls EnsureNamespace before creating device (idempotent)
  Fixes namespace-not-found when session was cached before v0.1.62
- Added sanitizeApiError() — hides internal details (namespace names,
  k8s paths) from user, shows friendly Russian messages instead
- Patterns handled: namespace not found, already exists, HTTP 5xx

Image: v0.1.63
2026-04-05 11:11:50 +03:00
Naeel 11bc86d2c9 fix: call EnsureNamespace on login to auto-create k8s namespace
doLogin() now calls POST /v1/namespaces/{ns}/ensure before apiListDevices().
Prevents namespace not found error when user logs in for the first time
with a new token (test mode or real JWT).
Image: v0.1.62
2026-04-05 11:06:27 +03:00
Naeel 354fded5b9 fix: remove copyAll button, add MQTTX Web link in creds tab
- Removed 📋 Скопировать всё button and Подключение физического устройства block
- Added MQTTX Web link (https://mqttx.app/web-client) with brief instructions:
  Host, Port 443, Protocol wss, Path /mqtt — copy username/password above
- Warning: check port is 443 not 8084/1883 if connection fails
- Updated help step 1: removed mention of copyAll, added port 443 note
- Removed unused copyAll() function

Image: v0.1.61
2026-04-05 10:52:38 +03:00
Naeel 3bf1dd604c feat: test auth mode — accept any plain token without JWT validation
authTestMode=true in middleware/auth.go:
- any non-whitespace, non-JWT string is accepted as Bearer token
- string is used as sub for namespace derivation (SHA256)
- JWT validation still runs for actual JWT strings (xxx.yyy.zzz)
- revert to strict mode: authTestMode = false

iot-console.html:
- namespaceFromToken: plain tokens use the string itself as sub
- login form: updated placeholder + hint explaining test mode

Image: v0.1.60
2026-04-05 10:46:29 +03:00
Naeel 763dca8653 fix(ux): credentials tab — copy button for password, port 443 in broker URL 2026-04-05 10:35:51 +03:00
Naeel 36789d6da2 doc: MQTTX Web подключение работает через wss://iot.kube5s.ru/mqtt 2026-04-05 10:14:18 +03:00
Naeel 661218bb73 doc: session 2026-04-05 — autoTimer fix deploy, progress и thinking log 2026-04-05 09:53:11 +03:00
Naeel 5e3c82d12a fix: autoTimer runs as background process, not killed on tab switch 2026-04-05 09:50:48 +03:00
Naeel 911f2bdafe fix: auto-send continues when switching to Telemetry tab, uses random payload 2026-04-05 09:17:54 +03:00
Naeel 233e28579d fix: MQTT ACL — allow bridge subscribe +/telemetry/+, fix device topic {ns}/telemetry/{deviceId} 2026-04-05 09:06:31 +03:00
Naeel b902e136ed fix: QueryTelemetry returns empty array when tenant DB not yet created 2026-04-05 08:55:54 +03:00
Naeel 2bdd753f4e v0.1.59: IoT telemetry pipeline — Postgres storage + REST API + UI table 2026-04-05 08:46:17 +03:00
Naeel d51e33d876 doc: detailed telemetry pipeline plan for Sonnet (Postgres + REST API + UI) 2026-04-05 08:27:53 +03:00
Naeel d078d3156f doc(thinking): лог сессии 2026-04-04 — TLS, UX, Nubes rebrand
- Разбор проблемы crypto.subtle (HTTP → HTTPS)
- Проблема 404 после apply (Docker layer cache)
- Убраны поля API/MQTT из формы входа
- Ребрендинг Nubes: палитра #001C34, логотип SVG, favicon
- Таблица версий v0.1.54–v0.1.58 с коммитами
2026-04-04 20:39:51 +03:00
Naeel 93e87a3b30 fix(iot-console): favicon Nubes, v0.1.58 2026-04-04 20:37:44 +03:00
Naeel 0400f97eb6 design(iot-console): Nubes brand rebrand v0.1.57
- Палитра: #001C34 (Nubes navy) как фоновая карточек/navbar
- Логотип Nubes SVG в navbar и на экране входа (filter:invert → белый)
- Убраны эмодзи из brand-элементов
- Accent: #1a7fd4 (корпоративный синий на тёмном фоне)
- Badges: прямоугольные, UPPERCASE, строгие
- Кнопки/формы/таблицы: Nubes-спецификация
2026-04-04 20:34:23 +03:00
Naeel e54787177b fix(iot-console): убрать поля API/MQTT из формы входа, добавить Help блок
- Форма входа: только токен, без полей API адреса и MQTT broker
- Адреса zardcoded: https://sless.kube5s.ru и wss://iot.kube5s.ru/mqtt
- Страница устройства: блок «Как это работает» — 5 шагов с инструкцией
- operator.yaml: v0.1.55 → v0.1.56
2026-04-04 20:25:06 +03:00
Naeel fb6f9d48cd feat(tls): HTTPS + wss:// для iot.kube5s.ru
- emqx-ws-ingress.yaml: TLS секция + cert-manager letsencrypt-prod, ssl-redirect=true
- router.go: CORS Allow-Origin: http → https://iot.kube5s.ru
- iot-console.html: дефолт MQTT брокера ws:// → wss://
- operator.yaml: v0.1.53 → v0.1.54
- crypto.subtle теперь работает (HTTPS страница)
2026-04-04 19:56:31 +03:00
Naeel 017312f35c fix(iot-console): убрать namespace из UI полностью
- Поле Namespace удалено из формы входа
- namespace вычисляется из токена: SHA256(sub) → sless-{hex}
- navbar: убран badge с ns
- Телеметрия: убрана техническая подсказка про namespace
- Пользователь не видит и не вводит namespace нигде
2026-04-04 19:38:32 +03:00
Naeel b48c300ac5 feat(iot-console): IoT управляющий UI v0.1.53
- Добавлен HTML SPA: internal/api/ui/iot-console.html
  Ванильный JS + mqtt.js (CDN), без фреймворков.
  Страницы: вход, список устройств, credentials, эмулятор MQTT, заглушка телеметрии.
- Добавлен go:embed: internal/api/console_embed.go, GET /console
- Добавлен CORS middleware в router.go для http://iot.kube5s.ru
- Ingress emqx-ws-ingress.yaml: /console → sless-operator:9090
- Версия образа v0.1.53, задеплоен

Доступно: http://iot.kube5s.ru/console
2026-04-04 19:28:30 +03:00
Naeel d57558c798 docs: IoT telemetry storage architecture decisions and thinking log 2026-04-04 18:41:29 +03:00
Naeel b23ae40975 security(iot): MQTT ACL isolation via EMQX HTTP authorization
Each IoT device can only pub/sub to its own topics: {namespace}/{deviceId}/#
Any attempt to access foreign topics → EMQX denies and disconnects.

Changes:
- internal/api/handler: add MQTTAcl handler (POST /internal/mqtt/acl)
- internal/api/router: register /internal/mqtt/acl route
- deployments/k8s/emqx.yaml: add HTTP authorization backend, no_match=deny
- Operator v0.1.52 deployed

Tested: own topic ALLOWED, foreign topic → authorization_permission_denied + disconnect
2026-04-04 17:51:51 +03:00
Naeel 6e3e473551 feat(iot): MQTT over WebSocket workaround via nginx-ingress
Port 1883 blocked by NSX-T Edge firewall (DevOps to open on Monday).
Temporary solution: EMQX WebSocket listener (8083) via nginx-ingress.

- Service emqx-ws: selector app=emqx, port 8083
- Ingress emqx-mqtt-websocket: iot.kube5s.ru/mqtt → emqx-ws:8083
- pathType: Exact (prevents trailing slash redirect breaking WS handshake)
- ssl-redirect: false (IoT devices cannot follow HTTP 301 redirects)
- DNS A record iot.kube5s.ru → 185.247.187.147 created by user

Tested: Connected rc=0 via paho-mqtt WebSocket from inside cluster.
2026-04-04 14:06:17 +03:00
Naeel 857d057af9 feat(iot): деплой IoT MVP — Dockerfile, RBAC, EMQX fix, operator v0.1.50, mqtt-bridge, doc/iot 2026-04-04 10:29:47 +03:00
Naeel b920dc5c9d feat(iot): Этап 6 — Terraform ресурс sless_iot_device (провайдер v0.1.2) 2026-04-04 09:56:18 +03:00
Naeel 1e53766c46 feat(iot): Этапы 2-7 — MQTT auth, IoT API, EMQX, mqtt-bridge, E2E demo
Этап 2+4: internal/api/handler/iot_device_handler.go
  - MQTTAuth: POST /internal/mqtt/auth (без JWT, для EMQX)
  - CreateIoTDevice, ListIoTDevices, GetIoTDevice (c password), DeleteIoTDevice, UpdateIoTDevice
  - crypto/subtle.ConstantTimeCompare против timing attacks

Этап 4: internal/api/router.go
  - /v1/namespaces/{ns}/iot/devices CRUD
  - /internal/mqtt/auth (без JWT middleware)

Этап 3: deployments/k8s/emqx.yaml
  - EMQX 5.5.1, emqx.conf (HOCON) с HTTP auth backend
  - Сервис exposure: 1883 (MQTT), 8083 (WS), 18083 (Dashboard)

Этап 3: iot/cmd/mqtt-bridge/main.go
  - paho.mqtt.golang: подписка на +/telemetry/+
  - amqp091-go: publish в iot.{namespace}.telemetry
  - deployments/k8s/iot-mqtt-bridge.yaml

Этап 7: examples/IOT/ — E2E demo (main.tf, handler.py, README.md)

go.mod: добавлен github.com/eclipse/paho.mqtt.golang v1.5.1
go build ./... — ошибок нет
2026-04-04 09:45:23 +03:00
Naeel 716efafda8 feat(iot): Этап 1 — CRD IoTDevice + контроллер credentials
- iot/api/v1alpha1/device_types.go — CRD IoTDevice
- iot/api/v1alpha1/groupversion_info.go — API group iot.kube5s.ru/v1alpha1
- iot/api/v1alpha1/zz_generated.deepcopy.go — deepcopy (controller-gen)
- iot/config/crd/bases/iot.kube5s.ru_iotdevices.yaml — CRD манифест
- iot/controllers/iotdevice_controller.go — Reconcile: Secret с MQTT credentials
- main.go — регистрация IoT схемы и IoTDeviceReconciler

go build ./... — ошибок нет
2026-04-04 09:32:47 +03:00