fix(ai): админский ключ LiteLLM читается из кластера, а не из runtime.env #41

Merged
pxc1984 merged 1 commit from fix/litellm-key-from-cluster into master 2026-10-29 19:09:40 +00:00
Owner

Зачем

Сейчас для выдачи ключей сервисам (ai:) нужна ручная строка TF_VAR_litellm_master_key в /etc/cu3rd-self-service/runtime.env на nxs. Это лишнее действие на ВМ: тот же ключ уже лежит в кластере, его доставляет PR доставки ai-gateway.

Что

  • main.tf: data source kubernetes_secret_v1.litellm читает LITELLM_MASTER_KEY из Secret cu3rd-ai-gateway-prod/ai-gateway-prod-litellm-env; включается только если какое-то окружение заказало ai: (иначе count = 0, как раньше «переменная не нужна»)
  • providers.tf/variables.tf: провайдер litellm берёт ключ оттуда; переменная litellm_master_key заменена на litellm_key_secret (с дефолтом)
  • docs/operations.md: ручной шаг убран

Для SRE

На ВМ делать ничего не нужно. Обычный review/merge.

Проверено

  • tofu fmt -check, tofu init -lockfile=readonly, tofu validate: OK (opentofu 1.10)
  • тесты: 45 OK

Не проверено

  • имя Secret выведено из шаблона чарта (<release>-env, release = ai-gateway-prod-litellm); реальный plan на nxs не запускался. Если имя другое — поправить litellm_key_secret.

🤖 Generated with Claude Code

## Зачем Сейчас для выдачи ключей сервисам (`ai:`) нужна ручная строка `TF_VAR_litellm_master_key` в `/etc/cu3rd-self-service/runtime.env` на nxs. Это лишнее действие на ВМ: тот же ключ уже лежит в кластере, его доставляет PR доставки ai-gateway. ## Что - `main.tf`: data source `kubernetes_secret_v1.litellm` читает `LITELLM_MASTER_KEY` из Secret `cu3rd-ai-gateway-prod/ai-gateway-prod-litellm-env`; включается только если какое-то окружение заказало `ai:` (иначе `count = 0`, как раньше «переменная не нужна») - `providers.tf`/`variables.tf`: провайдер litellm берёт ключ оттуда; переменная `litellm_master_key` заменена на `litellm_key_secret` (с дефолтом) - `docs/operations.md`: ручной шаг убран ## Для SRE На ВМ делать ничего не нужно. Обычный review/merge. ## Проверено - `tofu fmt -check`, `tofu init -lockfile=readonly`, `tofu validate`: OK (opentofu 1.10) - тесты: 45 OK ## Не проверено - имя Secret выведено из шаблона чарта (`<release>-env`, release = `ai-gateway-prod-litellm`); реальный plan на nxs не запускался. Если имя другое — поправить `litellm_key_secret`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fix(ai): read the LiteLLM admin key from the cluster instead of runtime.env
All checks were successful
Validate self-service / check (pull_request) Successful in 40s
6641f79d68
No manual step on nxs: apply reads LITELLM_MASTER_KEY from the Secret delivered with ai-gateway, only while a project enables ai.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
xfx1337 requested review from sre 2026-10-29 19:08:38 +00:00
pxc1984 merged commit 55b6b39371 into master 2026-10-29 19:09:40 +00:00
pxc1984 deleted branch fix/litellm-key-from-cluster 2026-10-29 19:09:40 +00:00
Sign in to join this conversation.
No reviewers
cu3rd/sre
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
cu3rd/self-service!41
No description provided.