Compare commits
No commits in common. "master" and "pdm/update-image-api-fix-copy" have entirely different histories.
master
...
pdm/update
38
CLAUDE.md
38
CLAUDE.md
@ -25,13 +25,11 @@
|
|||||||
|
|
||||||
| Путь | Что |
|
| Путь | Что |
|
||||||
|---|---|
|
|---|---|
|
||||||
| `clusters/` | Точки входа Flux + шаблон `contour` — **источник истины «что где раскатано»** |
|
| `clusters/` | 10 точек входа Flux — **источник истины «что где раскатано»** |
|
||||||
| `infrastructure/` | 44 платформенных компонента |
|
| `infrastructure/` | 36 платформенных компонентов |
|
||||||
| `apps/` | 39 прикладных сервисов |
|
| `apps/` | 37 прикладных сервисов |
|
||||||
| `docs/apps/` | 34 mermaid-диаграммы по сервисам + `README.md` с доменной группировкой |
|
| `docs/apps/` | 35 mermaid-диаграмм по сервисам + `README.md` с доменной группировкой |
|
||||||
| `docs/architecture/` | модель контура в ArchiMate + скрипты-сканеры (`scan_calls.py`, `scan_contour.py`) и сборка (`build_archimate.py`); реальные значения инсталляций сюда не кладутся, только `*.example.json` |
|
|
||||||
| `docs/closed-contour-deployment.md` | ранбук поднятия закрытого контура |
|
| `docs/closed-contour-deployment.md` | ранбук поднятия закрытого контура |
|
||||||
| `ci/`, `.gitlab-ci.yml`, `Dockerfile` | на тег `vX.Y.Z`: образ офлайн-зеркала `iac-offline` и публикация «слайсов» контуров (см. ниже) |
|
|
||||||
| `README.md` | mermaid-мегакарта платформы, структура репозитория, инструкции по добавлению app / infra / кластера |
|
| `README.md` | mermaid-мегакарта платформы, структура репозитория, инструкции по добавлению app / infra / кластера |
|
||||||
| `IAC-CATALOG.md` | каталог всего `infra/*`; §5 — про этот репозиторий |
|
| `IAC-CATALOG.md` | каталог всего `infra/*`; §5 — про этот репозиторий |
|
||||||
| `inventory.yaml` | сгенерированный снимок прода: 59 namespace → kind → имена |
|
| `inventory.yaml` | сгенерированный снимок прода: 59 namespace → kind → имена |
|
||||||
@ -40,18 +38,15 @@
|
|||||||
|
|
||||||
**Кластер.** `clusters/<cluster>/kustomization.yaml` — плоский список `../../apps/<app>/<cluster>`. Инфраструктура подключается двумя разными способами:
|
**Кластер.** `clusters/<cluster>/kustomization.yaml` — плоский список `../../apps/<app>/<cluster>`. Инфраструктура подключается двумя разными способами:
|
||||||
|
|
||||||
- `d8-ugmk-prod`, `ugok`, `uralkal`, `vad` — прямо в корневом kustomization как `../../infrastructure/<comp>/<c>`;
|
- `d8-ugmk-prod` — прямо в корневом kustomization как `../../infrastructure/<comp>/d8-ugmk-prod`;
|
||||||
- `brusnika-prod`, `brusnika-stage`, `vk-infra`, `vk-prod` — через `clusters/<c>/infrastructure/kustomization.yaml`, который ссылается на оверлеи `../../../infrastructure/<comp>/<c>` (`base` + патч HelmRelease + сопутствующие манифесты компонента);
|
- `brusnika-prod`, `brusnika-stage` — через `clusters/<c>/infrastructure/kustomization.yaml`, который ссылается на оверлеи `../../../infrastructure/<comp>/<c>` (`base` + патч HelmRelease + сопутствующие манифесты компонента);
|
||||||
- `wb`, `yc-cps-prod`, `yc-infra-prod`, `yc-k8s-test-02` — через `clusters/<c>/infrastructure/kustomization.yaml`, который ссылается на `../../../infrastructure/<comp>` (резолвится в `base`), а различия лежат в `clusters/<c>/infrastructure/patches/*.yaml`;
|
- `wb` — через `clusters/wb/infrastructure/kustomization.yaml`, который ссылается на `../../../infrastructure/<comp>` (резолвится в `base`), а различия лежат в `clusters/wb/infrastructure/patches/*.yaml`.
|
||||||
- `stand` — послойно: `layers.yaml` объявляет Flux-`Kustomization` `00-vault → 10-mesh → 20-data → 30-platform → 40-routing` (каталоги `clusters/stand/<NN>-<layer>/`). Слои ссылаются на оверлеи `infrastructure/<comp>/contour-template`, а значения контура (`${STORAGE_CLASS}`, `${HOST_*}`, `${GATEWAY_REPLICAS}`) Flux подставляет через `postBuild.substituteFrom` из ConfigMap `contour-vars`.
|
|
||||||
|
|
||||||
Кластеры с приложениями: `asterus`, `brusnika-prod`, `brusnika-stage`, `d8-ugmk-prod`, `ugok`, `uralkal`, `vad`, `wb`, `yc-ecp`. Только инфраструктура: `stand`, `vk-infra`, `vk-prod`, `yc-cps-prod`, `yc-infra-prod`, `yc-k8s-test-02`. Шаблон: `contour`.
|
Кластеры: `brusnika-prod`, `brusnika-stage`, `d8-ugmk-prod`, `wb`, `yc-cps-prod`, `yc-ecp`, `yc-infra-prod`, `yc-k8s-test`, `yc-k8s-test-02`, `contour`.
|
||||||
|
|
||||||
**Приложение.** `apps/<app>/base/` — по одному `.yaml` на процесс (`backend.yaml`, `celery.yaml`, `frontend.yaml`) плюс `namespace.yaml`; оверлеи в `apps/<app>/<cluster>/`. Namespace = имя приложения. Рядом с манифестами лежит документация: `CONFIGURATION.md` (все env-переменные и откуда берутся), `ENDPOINTS.md` (исходящие HTTP-вызовы), `openapi.yaml` (входящий контракт), `.env.example`. Если процессов несколько — файлы с префиксом процесса: `api.ENDPOINTS.md`, `pdm.CONFIGURATION.md`, `frontend.CONFIGURATION.md`.
|
**Приложение.** `apps/<app>/base/` — по одному `.yaml` на процесс (`backend.yaml`, `celery.yaml`, `frontend.yaml`) плюс `namespace.yaml`; оверлеи в `apps/<app>/<cluster>/`. Namespace = имя приложения. Рядом с манифестами лежит документация: `CONFIGURATION.md` (все env-переменные и откуда берутся), `ENDPOINTS.md` (исходящие HTTP-вызовы), `openapi.yaml` (входящий контракт), `.env.example`. Если процессов несколько — файлы с префиксом процесса: `api.ENDPOINTS.md`, `pdm.CONFIGURATION.md`, `frontend.CONFIGURATION.md`.
|
||||||
|
|
||||||
**Инфра-компонент.** `infrastructure/<comp>/base/` + оверлеи `<comp>/<cluster>/`. Корневой `infrastructure/<comp>/kustomization.yaml` всегда указывает просто на `base`. Оверлей `contour-template` (есть у vault, istio-*, cert-manager, postgresql, kafka, rabbitmq, zitadel, camunda, istio-config) — параметризованный `${VAR}`, а не привязанный к конкретному кластеру. Чарты идут с суффиксом контура: `vault-contour`, `keycloak-contour`, `postgresql-contour` и — внимание — `idp-contour` это Zitadel.
|
**Инфра-компонент.** `infrastructure/<comp>/base/` + оверлеи `<comp>/<cluster>/`. Корневой `infrastructure/<comp>/kustomization.yaml` всегда указывает просто на `base`. Чарты идут с суффиксом контура: `vault-contour`, `keycloak-contour`, `postgresql-contour` и — внимание — `idp-contour` это Zitadel.
|
||||||
|
|
||||||
**Слайсы.** На тег `vX.Y.Z` `ci/publish-slice.py generate` создаёт child-pipeline с отдельной джобой на каждый `clusters/*/kustomization.yaml`. Джоба вызывает `ci/build-slice.py`: тот обходит дерево Kustomize от `clusters/<c>` и упаковывает только нужные файлы в tar. Результат публикуется как OCI-артефакт `cr.yandex/crpct2b2lsmao4nm0cjk/<c>-iac:<tag>` (media type `application/vnd.sarex.slice.config.v1+json`). Так закрытый контур получает только свой срез. Тесты — `ci/tests/test_build_slice.py`.
|
|
||||||
|
|
||||||
## Где искать конкретное
|
## Где искать конкретное
|
||||||
|
|
||||||
@ -67,23 +62,18 @@
|
|||||||
| Тег образа в контуре | `apps/<app>/<cluster>/*.yaml`, поле `image.tag` |
|
| Тег образа в контуре | `apps/<app>/<cluster>/*.yaml`, поле `image.tag` |
|
||||||
| Что реально в проде по namespace | `inventory.yaml` |
|
| Что реально в проде по namespace | `inventory.yaml` |
|
||||||
| Где лежит исходный код приложения | `IAC-CATALOG.md` §5.3.8 |
|
| Где лежит исходный код приложения | `IAC-CATALOG.md` §5.3.8 |
|
||||||
| Что попадёт в слайс контура | `python3 ci/build-slice.py` по `clusters/<c>` (логика сбора — там же) |
|
|
||||||
| Переменные шаблонного контура | `${...}` в `infrastructure/*/contour-template`; значения — ConfigMap `contour-vars` в кластере, не в репозитории |
|
|
||||||
|
|
||||||
## Ловушки
|
## Ловушки
|
||||||
|
|
||||||
- **`dsinv/`** — оверлей есть у 25 приложений, но `clusters/dsinv/` не существует. Это материализованный снимок живого контура WB, а не источник деплоя. Развёрнутым не считать.
|
- **`dsinv/`** — оверлей есть у 25 приложений, но `clusters/dsinv/` не существует. Это материализованный снимок живого контура WB, а не источник деплоя. Развёрнутым не считать.
|
||||||
- **Две несовместимые конвенции оверлеев** (`IAC-CATALOG.md` §5.3.4). `d8-ugmk-prod`, `vad`, `uralkal`, `dsinv` наследуют `base` и патчат его. `brusnika-prod`, `brusnika-stage`, `yc-ecp`, `asterus` — полные копии HelmRelease, которые молча дрейфуют от base. Правка `base` на них не влияет. **`wb` (4 из 27) и `ugok` (9 из 33) смешанные** — проверяйте `resources:` конкретного оверлея; в `ugok` причина обычно указана комментарием в его `kustomization.yaml`.
|
- **Две несовместимые конвенции оверлеев** (`IAC-CATALOG.md` §5.3.4). `d8-ugmk-prod`, `yc-k8s-test`, `dsinv` наследуют `base` и патчат его. `brusnika-prod`, `brusnika-stage`, `yc-ecp` — полные копии HelmRelease, которые молча дрейфуют от base. Правка `base` на них не влияет.
|
||||||
- **`asterus` подключён почти пустым**: оверлеи есть у 26 приложений, но в `clusters/asterus/kustomization.yaml` активен только `auth-flow`, остальные закомментированы. Инфраструктуры в кластере нет.
|
|
||||||
- **Слайс публикуется для каждого `clusters/*/kustomization.yaml`** — в том числе для тестовых и инфраструктурных кластеров. Новая папка в `clusters/` с этим файлом автоматически станет слайсом на следующем теге. У `contour` такого файла нет, поэтому для него слайс не собирается.
|
|
||||||
- **`IAC-CATALOG.md` — снимок на 05.08.2026** и по составу приложений на контур уже расходится с реальностью (там у `wb` ноль приложений, фактически 26 оверлеев). Всегда сверяться с `clusters/*/kustomization.yaml`.
|
- **`IAC-CATALOG.md` — снимок на 05.08.2026** и по составу приложений на контур уже расходится с реальностью (там у `wb` ноль приложений, фактически 26 оверлеев). Всегда сверяться с `clusters/*/kustomization.yaml`.
|
||||||
- **Мегадиаграмма в `README.md` идеализирована** — рисована руками, показывает все приложения на одной Postgres и все фронтенды за `control-interface`. Проверяемые источники — env-переменные и istio-config.
|
- **Мегадиаграмма в `README.md` идеализирована** — рисована руками, показывает все приложения на одной Postgres и все фронтенды за `control-interface`. Проверяемые источники — env-переменные и istio-config.
|
||||||
- **`clusters/contour/` — не кластер, а шаблон**: в нём нет `flux-system`, только `apps.yaml`, `infrastructure.yaml`, `helm-repositories.yaml`.
|
- **`clusters/contour/` — не кластер, а шаблон**: в нём нет `flux-system`, только `apps.yaml`, `infrastructure.yaml`, `helm-repositories.yaml`.
|
||||||
- **Path-роутинг лежит в `infrastructure/istio-config/<c>/` у большинства контуров, но не у WB.** В `clusters/wb/infrastructure/patches/istio-config.yaml` через Istio публикуются только платформенные UI (Gitea, Grafana, OpenObserve, Superset, Vault, GoAlert), а прикладной трафик разводится вне репозитория. В Brusnika схема смешанная: часть путей идёт напрямую в сервисы, остальное — одним правилом в `yet-another-nginx-service.global-ingress`.
|
- **Path-роутинг виден в репозитории только у `d8-ugmk-prod` и `yc-ecp`.** В Brusnika и WB весь прикладной трафик уходит одним правилом в `nginx-service.global-ingress` / `yet-another-nginx-service.global-ingress`, а разводка по путям происходит вне репозитория. Через Istio там публикуются только платформенные UI (Gitea, Grafana, OpenObserve, Superset, Vault, Zitadel, Camunda, MinIO).
|
||||||
- **`vk-prod` маршрутизирует в namespace с суффиксом `-prod`** (`eav-prod`, `pm-prod`, `inspections-prod`), а приложений из `apps/` в этом кластере нет: сервисы раскатываются не этим репозиторием.
|
- **Имена namespace расходятся между источниками**: `inventory.yaml` использует суффикс (`flows-prod`), `apps/` — голое имя (`flows`).
|
||||||
- **Имена namespace расходятся между источниками**: `inventory.yaml` и `vk-prod` используют суффикс (`flows-prod`), `apps/` — голое имя (`flows`).
|
- **17 оверлеев приложений не подключены ни к одному кластеру** — мёртвый код.
|
||||||
- Некоторые оверлеи приложений не подключены к кластерам: например, `dsinv`, закомментированные приложения `asterus` и отдельные оверлеи других контуров. Наличие оверлея само по себе не означает развёртывание.
|
- **Нет диаграмм** в `docs/apps/` для `iam`, `auth-flow`, `ams-sync`.
|
||||||
- **Нет диаграмм** в `docs/apps/` для `ams-sync`, `auth-flow`, `bi`, `iam`, `premises`.
|
|
||||||
- **Чистые фронтенды без бэкенда в этом репозитории**: `auth-flow`, `control-interface`, `cross-section`, `document-link`, `prescriptions`, `projects`, `remarks`, `reviews`, `stamp-verification`. Бэкенд `projects` живёт в `planning/projects-backend`.
|
- **Чистые фронтенды без бэкенда в этом репозитории**: `auth-flow`, `control-interface`, `cross-section`, `document-link`, `prescriptions`, `projects`, `remarks`, `reviews`, `stamp-verification`. Бэкенд `projects` живёт в `planning/projects-backend`.
|
||||||
- Самые центральные сервисы по числу входящих ссылок: `documentations` (~85), `processing` / `workflow` (~76), `django` (~53), `eav` (~47), `resources` (~44), `bim` (~39), `flows` (~38). Менять их конфигурацию — дороже всего.
|
- Самые центральные сервисы по числу входящих ссылок: `documentations` (~85), `processing` / `workflow` (~76), `django` (~53), `eav` (~47), `resources` (~44), `bim` (~39), `flows` (~38). Менять их конфигурацию — дороже всего.
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
- Источники: GitLab-группа `infra` (209 проектов, включая подгруппы) + содержимое `infra/iac`.
|
- Источники: GitLab-группа `infra` (209 проектов, включая подгруппы) + содержимое `infra/iac`.
|
||||||
- Дата среза: **2026-08-05**.
|
- Дата среза: **2026-08-05**.
|
||||||
- Обновление 2026-11-25: контуры `sarex-contour` и `yc-k8s-test` выведены из эксплуатации, их конфигурации удалены. Упоминания ниже относятся к историческому срезу; `yc-k8s-test-02` сохранён.
|
|
||||||
- Все ссылки — на `https://gitlab.sarex.io`.
|
- Все ссылки — на `https://gitlab.sarex.io`.
|
||||||
|
|
||||||
Пометки достоверности:
|
Пометки достоверности:
|
||||||
|
|||||||
@ -1,181 +0,0 @@
|
|||||||
apiVersion: helm.toolkit.fluxcd.io/v2
|
|
||||||
kind: HelmRelease
|
|
||||||
metadata:
|
|
||||||
name: ams-sync
|
|
||||||
namespace: ams-sync
|
|
||||||
spec:
|
|
||||||
chart:
|
|
||||||
spec:
|
|
||||||
version: 0.1.9
|
|
||||||
values:
|
|
||||||
services:
|
|
||||||
backend:
|
|
||||||
serviceAccount:
|
|
||||||
enabled:
|
|
||||||
_default: true
|
|
||||||
name:
|
|
||||||
_default: ams-sync-vault
|
|
||||||
secretEnvs: []
|
|
||||||
volumes:
|
|
||||||
_default: []
|
|
||||||
podAnnotations:
|
|
||||||
_default:
|
|
||||||
sidecar.istio.io/proxyCPU: 25m
|
|
||||||
sidecar.istio.io/proxyMemory: 128Mi
|
|
||||||
sidecar.istio.io/proxyCPULimit: '2'
|
|
||||||
sidecar.istio.io/proxyMemoryLimit: 1Gi
|
|
||||||
proxy.istio.io/config: '{"holdApplicationUntilProxyStarts":true}'
|
|
||||||
traffic.sidecar.istio.io/excludeOutboundPorts: 4317,4318,9411,8200,9092
|
|
||||||
vault.hashicorp.com/agent-inject: 'true'
|
|
||||||
vault.hashicorp.com/agent-init-first: 'true'
|
|
||||||
vault.hashicorp.com/agent-pre-populate-only: 'true'
|
|
||||||
vault.hashicorp.com/agent-requests-cpu: 25m
|
|
||||||
vault.hashicorp.com/auth-path: auth/kubernetes
|
|
||||||
vault.hashicorp.com/role: ams-sync
|
|
||||||
vault.hashicorp.com/agent-inject-secret-ams-sync-kafka: secrets/data/kafka/apps/ams-sync
|
|
||||||
vault.hashicorp.com/agent-inject-template-ams-sync-kafka: '{{- with secret
|
|
||||||
"secrets/data/kafka/apps/ams-sync" -}}
|
|
||||||
|
|
||||||
KAFKA_BOOTSTRAP_SERVERS=''["{{ index .Data.data "bootstrap_servers"
|
|
||||||
}}"]''
|
|
||||||
|
|
||||||
KAFKA_SASL_PLAIN_USERNAME=''{{ index .Data.data "username" }}''
|
|
||||||
|
|
||||||
KAFKA_SASL_PLAIN_PASSWORD=''{{ index .Data.data "password" }}''
|
|
||||||
|
|
||||||
{{- end -}}'
|
|
||||||
vault.hashicorp.com/agent-inject-secret-ams-sync-zitadel: secrets/data/zitadel/setup
|
|
||||||
vault.hashicorp.com/agent-inject-template-ams-sync-zitadel: '{{- with
|
|
||||||
secret "secrets/data/zitadel/setup" -}}
|
|
||||||
|
|
||||||
ZITADEL_SERVICE_ACCESS_TOKEN=''{{ index .Data.data "django_zitadel_access_token"
|
|
||||||
}}''
|
|
||||||
|
|
||||||
{{- end -}}'
|
|
||||||
vault.hashicorp.com/agent-inject-secret-ams-sync-auth: secrets/data/vault/common/django_auth
|
|
||||||
vault.hashicorp.com/agent-inject-template-ams-sync-auth: '{{- with secret
|
|
||||||
"secrets/data/vault/common/django_auth" -}}
|
|
||||||
|
|
||||||
AUTH_ADMIN_USERNAME=''{{ index .Data.data "username" }}''
|
|
||||||
|
|
||||||
AUTH_ADMIN_PASSWORD=''{{ index .Data.data "password" }}''
|
|
||||||
|
|
||||||
{{- end -}}'
|
|
||||||
vault.hashicorp.com/agent-inject-secret-ams-sync-db: secrets/data/apps/django/postgres
|
|
||||||
vault.hashicorp.com/agent-inject-template-ams-sync-db: '{{- with secret
|
|
||||||
"secrets/data/apps/django/postgres" -}}
|
|
||||||
|
|
||||||
USER_DB_NAME=''{{ index .Data.data "database" }}''
|
|
||||||
|
|
||||||
USER_DB_USER=''{{ index .Data.data "username" }}''
|
|
||||||
|
|
||||||
USER_DB_PASSWORD=''{{ index .Data.data "password" }}''
|
|
||||||
|
|
||||||
USER_DB_HOST=''{{ index .Data.data "host" }}''
|
|
||||||
|
|
||||||
USER_DB_PORT=''{{ index .Data.data "port" }}''
|
|
||||||
|
|
||||||
{{- end -}}'
|
|
||||||
sidecar.istio.io/inject: 'true'
|
|
||||||
envs:
|
|
||||||
- name: AMS_SYNC_TOPIC
|
|
||||||
value:
|
|
||||||
_default: ams-sync
|
|
||||||
- name: ENVIRONMENT
|
|
||||||
value:
|
|
||||||
_default: PRODUCTION
|
|
||||||
- name: HOST_ORGANIZATION_ID
|
|
||||||
value:
|
|
||||||
_default: ${ZITADEL_ORG_ID}
|
|
||||||
- name: ALERT_ENABLED
|
|
||||||
value:
|
|
||||||
_default: 'False'
|
|
||||||
- name: VERIFY_USERS
|
|
||||||
value:
|
|
||||||
_default: 'True'
|
|
||||||
- name: USER_SERVER_HOST
|
|
||||||
value:
|
|
||||||
_default: https://${HOST_PLATFORM}
|
|
||||||
- name: AUTH_HOST
|
|
||||||
value:
|
|
||||||
_default: http://backend-svc.django.svc.cluster.local:80
|
|
||||||
- name: RESOURCES_INTERNAL_HOST
|
|
||||||
value:
|
|
||||||
_default: http://iam-backend.iam.svc.cluster.local:8000
|
|
||||||
- name: ZITADEL_HOST
|
|
||||||
value:
|
|
||||||
_default: https://${HOST_LOGIN}
|
|
||||||
- name: KAFKA_SECURITY_PROTOCOL
|
|
||||||
value:
|
|
||||||
_default: SASL_PLAINTEXT
|
|
||||||
- name: KAFKA_SASL_MECHANISM
|
|
||||||
value:
|
|
||||||
_default: SCRAM-SHA-512
|
|
||||||
- name: KAFKA_SSL_CAFILE
|
|
||||||
value:
|
|
||||||
_default: ''
|
|
||||||
- name: TELEGRAM_TOKEN
|
|
||||||
value:
|
|
||||||
_default: 000000:disabled
|
|
||||||
- name: TELEGRAM_GROUP_ID
|
|
||||||
value:
|
|
||||||
_default: '0'
|
|
||||||
- name: PYTHONUNBUFFERED
|
|
||||||
value:
|
|
||||||
_default: '1'
|
|
||||||
- name: HEALTHCHECK_PORT
|
|
||||||
value:
|
|
||||||
_default: '8008'
|
|
||||||
service:
|
|
||||||
enabled: false
|
|
||||||
deployment:
|
|
||||||
port:
|
|
||||||
_default: 8008
|
|
||||||
command:
|
|
||||||
_default:
|
|
||||||
- /bin/sh
|
|
||||||
- -ec
|
|
||||||
args:
|
|
||||||
_default:
|
|
||||||
- 'set -a
|
|
||||||
|
|
||||||
. /vault/secrets/ams-sync-kafka
|
|
||||||
|
|
||||||
. /vault/secrets/ams-sync-zitadel
|
|
||||||
|
|
||||||
. /vault/secrets/ams-sync-auth
|
|
||||||
|
|
||||||
. /vault/secrets/ams-sync-db
|
|
||||||
|
|
||||||
set +a
|
|
||||||
|
|
||||||
exec python3 cmd.py run
|
|
||||||
|
|
||||||
'
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
cpu:
|
|
||||||
_default: 25m
|
|
||||||
memory:
|
|
||||||
_default: 128Mi
|
|
||||||
probes:
|
|
||||||
readiness:
|
|
||||||
enabled: true
|
|
||||||
type: &id001
|
|
||||||
_default: tcpSocket
|
|
||||||
tcpSocket: &id002
|
|
||||||
port:
|
|
||||||
_default: 8008
|
|
||||||
periodSeconds:
|
|
||||||
_default: 5
|
|
||||||
timeoutSeconds: &id003
|
|
||||||
_default: 2
|
|
||||||
liveness:
|
|
||||||
enabled: true
|
|
||||||
type: *id001
|
|
||||||
tcpSocket: *id002
|
|
||||||
periodSeconds:
|
|
||||||
_default: 30
|
|
||||||
timeoutSeconds: *id003
|
|
||||||
initialDelaySeconds:
|
|
||||||
_default: 30
|
|
||||||
@ -1,36 +0,0 @@
|
|||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
|
||||||
kind: Kustomization
|
|
||||||
resources:
|
|
||||||
- ../base
|
|
||||||
configMapGenerator:
|
|
||||||
- name: ams-sync-contour-env
|
|
||||||
literals:
|
|
||||||
- USER_SERVER_HOST=https://${HOST_PLATFORM}
|
|
||||||
- AUTH_HOST=http://backend-svc.django.svc.cluster.local:80
|
|
||||||
options:
|
|
||||||
disableNameSuffixHash: true
|
|
||||||
annotations:
|
|
||||||
config.kubernetes.io/local-config: "true"
|
|
||||||
replacements:
|
|
||||||
- source:
|
|
||||||
kind: ConfigMap
|
|
||||||
name: ams-sync-contour-env
|
|
||||||
fieldPath: data.USER_SERVER_HOST
|
|
||||||
targets:
|
|
||||||
- select:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: ams-sync
|
|
||||||
fieldPaths:
|
|
||||||
- spec.values.services.backend.envs.[name=USER_SERVER_HOST].value._default
|
|
||||||
- source:
|
|
||||||
kind: ConfigMap
|
|
||||||
name: ams-sync-contour-env
|
|
||||||
fieldPath: data.AUTH_HOST
|
|
||||||
targets:
|
|
||||||
- select:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: ams-sync
|
|
||||||
fieldPaths:
|
|
||||||
- spec.values.services.backend.envs.[name=AUTH_HOST].value._default
|
|
||||||
patches:
|
|
||||||
- path: helmrelease.yaml
|
|
||||||
@ -1,181 +0,0 @@
|
|||||||
apiVersion: helm.toolkit.fluxcd.io/v2
|
|
||||||
kind: HelmRelease
|
|
||||||
metadata:
|
|
||||||
name: ams-sync
|
|
||||||
namespace: ams-sync
|
|
||||||
spec:
|
|
||||||
chart:
|
|
||||||
spec:
|
|
||||||
version: 0.1.9
|
|
||||||
values:
|
|
||||||
services:
|
|
||||||
backend:
|
|
||||||
serviceAccount:
|
|
||||||
enabled:
|
|
||||||
_default: true
|
|
||||||
name:
|
|
||||||
_default: ams-sync-vault
|
|
||||||
secretEnvs: []
|
|
||||||
volumes:
|
|
||||||
_default: []
|
|
||||||
podAnnotations:
|
|
||||||
_default:
|
|
||||||
sidecar.istio.io/proxyCPU: 25m
|
|
||||||
sidecar.istio.io/proxyMemory: 128Mi
|
|
||||||
sidecar.istio.io/proxyCPULimit: '2'
|
|
||||||
sidecar.istio.io/proxyMemoryLimit: 1Gi
|
|
||||||
proxy.istio.io/config: '{"holdApplicationUntilProxyStarts":true}'
|
|
||||||
traffic.sidecar.istio.io/excludeOutboundPorts: 4317,4318,9411,8200,9092
|
|
||||||
vault.hashicorp.com/agent-inject: 'true'
|
|
||||||
vault.hashicorp.com/agent-init-first: 'true'
|
|
||||||
vault.hashicorp.com/agent-pre-populate-only: 'true'
|
|
||||||
vault.hashicorp.com/agent-requests-cpu: 25m
|
|
||||||
vault.hashicorp.com/auth-path: auth/kubernetes
|
|
||||||
vault.hashicorp.com/role: ams-sync
|
|
||||||
vault.hashicorp.com/agent-inject-secret-ams-sync-kafka: secrets/data/kafka/apps/ams-sync
|
|
||||||
vault.hashicorp.com/agent-inject-template-ams-sync-kafka: '{{- with secret
|
|
||||||
"secrets/data/kafka/apps/ams-sync" -}}
|
|
||||||
|
|
||||||
KAFKA_BOOTSTRAP_SERVERS=''["{{ index .Data.data "bootstrap_servers"
|
|
||||||
}}"]''
|
|
||||||
|
|
||||||
KAFKA_SASL_PLAIN_USERNAME=''{{ index .Data.data "username" }}''
|
|
||||||
|
|
||||||
KAFKA_SASL_PLAIN_PASSWORD=''{{ index .Data.data "password" }}''
|
|
||||||
|
|
||||||
{{- end -}}'
|
|
||||||
vault.hashicorp.com/agent-inject-secret-ams-sync-zitadel: secrets/data/zitadel/setup
|
|
||||||
vault.hashicorp.com/agent-inject-template-ams-sync-zitadel: '{{- with
|
|
||||||
secret "secrets/data/zitadel/setup" -}}
|
|
||||||
|
|
||||||
ZITADEL_SERVICE_ACCESS_TOKEN=''{{ index .Data.data "django_zitadel_access_token"
|
|
||||||
}}''
|
|
||||||
|
|
||||||
{{- end -}}'
|
|
||||||
vault.hashicorp.com/agent-inject-secret-ams-sync-auth: secrets/data/vault/common/django_auth
|
|
||||||
vault.hashicorp.com/agent-inject-template-ams-sync-auth: '{{- with secret
|
|
||||||
"secrets/data/vault/common/django_auth" -}}
|
|
||||||
|
|
||||||
AUTH_ADMIN_USERNAME=''{{ index .Data.data "username" }}''
|
|
||||||
|
|
||||||
AUTH_ADMIN_PASSWORD=''{{ index .Data.data "password" }}''
|
|
||||||
|
|
||||||
{{- end -}}'
|
|
||||||
vault.hashicorp.com/agent-inject-secret-ams-sync-db: secrets/data/apps/django/postgres
|
|
||||||
vault.hashicorp.com/agent-inject-template-ams-sync-db: '{{- with secret
|
|
||||||
"secrets/data/apps/django/postgres" -}}
|
|
||||||
|
|
||||||
USER_DB_NAME=''{{ index .Data.data "database" }}''
|
|
||||||
|
|
||||||
USER_DB_USER=''{{ index .Data.data "username" }}''
|
|
||||||
|
|
||||||
USER_DB_PASSWORD=''{{ index .Data.data "password" }}''
|
|
||||||
|
|
||||||
USER_DB_HOST=''{{ index .Data.data "host" }}''
|
|
||||||
|
|
||||||
USER_DB_PORT=''{{ index .Data.data "port" }}''
|
|
||||||
|
|
||||||
{{- end -}}'
|
|
||||||
sidecar.istio.io/inject: 'true'
|
|
||||||
envs:
|
|
||||||
- name: AMS_SYNC_TOPIC
|
|
||||||
value:
|
|
||||||
_default: ams-sync
|
|
||||||
- name: ENVIRONMENT
|
|
||||||
value:
|
|
||||||
_default: PRODUCTION
|
|
||||||
- name: HOST_ORGANIZATION_ID
|
|
||||||
value:
|
|
||||||
_default: '397401610885551249'
|
|
||||||
- name: ALERT_ENABLED
|
|
||||||
value:
|
|
||||||
_default: 'False'
|
|
||||||
- name: VERIFY_USERS
|
|
||||||
value:
|
|
||||||
_default: 'True'
|
|
||||||
- name: USER_SERVER_HOST
|
|
||||||
value:
|
|
||||||
_default: https://sarex.${CONTOUR_DOMAIN}
|
|
||||||
- name: AUTH_HOST
|
|
||||||
value:
|
|
||||||
_default: http://backend-svc.django.svc.cluster.local:80
|
|
||||||
- name: RESOURCES_INTERNAL_HOST
|
|
||||||
value:
|
|
||||||
_default: http://iam-backend.iam.svc.cluster.local:8000
|
|
||||||
- name: ZITADEL_HOST
|
|
||||||
value:
|
|
||||||
_default: https://${HOST_LOGIN}
|
|
||||||
- name: KAFKA_SECURITY_PROTOCOL
|
|
||||||
value:
|
|
||||||
_default: SASL_PLAINTEXT
|
|
||||||
- name: KAFKA_SASL_MECHANISM
|
|
||||||
value:
|
|
||||||
_default: SCRAM-SHA-512
|
|
||||||
- name: KAFKA_SSL_CAFILE
|
|
||||||
value:
|
|
||||||
_default: ''
|
|
||||||
- name: TELEGRAM_TOKEN
|
|
||||||
value:
|
|
||||||
_default: 000000:disabled
|
|
||||||
- name: TELEGRAM_GROUP_ID
|
|
||||||
value:
|
|
||||||
_default: '0'
|
|
||||||
- name: PYTHONUNBUFFERED
|
|
||||||
value:
|
|
||||||
_default: '1'
|
|
||||||
- name: HEALTHCHECK_PORT
|
|
||||||
value:
|
|
||||||
_default: '8008'
|
|
||||||
service:
|
|
||||||
enabled: false
|
|
||||||
deployment:
|
|
||||||
port:
|
|
||||||
_default: 8008
|
|
||||||
command:
|
|
||||||
_default:
|
|
||||||
- /bin/sh
|
|
||||||
- -ec
|
|
||||||
args:
|
|
||||||
_default:
|
|
||||||
- 'set -a
|
|
||||||
|
|
||||||
. /vault/secrets/ams-sync-kafka
|
|
||||||
|
|
||||||
. /vault/secrets/ams-sync-zitadel
|
|
||||||
|
|
||||||
. /vault/secrets/ams-sync-auth
|
|
||||||
|
|
||||||
. /vault/secrets/ams-sync-db
|
|
||||||
|
|
||||||
set +a
|
|
||||||
|
|
||||||
exec python3 cmd.py run
|
|
||||||
|
|
||||||
'
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
cpu:
|
|
||||||
_default: 25m
|
|
||||||
memory:
|
|
||||||
_default: 128Mi
|
|
||||||
probes:
|
|
||||||
readiness:
|
|
||||||
enabled: true
|
|
||||||
type: &id001
|
|
||||||
_default: tcpSocket
|
|
||||||
tcpSocket: &id002
|
|
||||||
port:
|
|
||||||
_default: 8008
|
|
||||||
periodSeconds:
|
|
||||||
_default: 5
|
|
||||||
timeoutSeconds: &id003
|
|
||||||
_default: 2
|
|
||||||
liveness:
|
|
||||||
enabled: true
|
|
||||||
type: *id001
|
|
||||||
tcpSocket: *id002
|
|
||||||
periodSeconds:
|
|
||||||
_default: 30
|
|
||||||
timeoutSeconds: *id003
|
|
||||||
initialDelaySeconds:
|
|
||||||
_default: 30
|
|
||||||
@ -1,36 +0,0 @@
|
|||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
|
||||||
kind: Kustomization
|
|
||||||
resources:
|
|
||||||
- ../base
|
|
||||||
configMapGenerator:
|
|
||||||
- name: ams-sync-contour-env
|
|
||||||
literals:
|
|
||||||
- USER_SERVER_HOST=https://sarex.${CONTOUR_DOMAIN}
|
|
||||||
- AUTH_HOST=http://backend-svc.django.svc.cluster.local:80
|
|
||||||
options:
|
|
||||||
disableNameSuffixHash: true
|
|
||||||
annotations:
|
|
||||||
config.kubernetes.io/local-config: "true"
|
|
||||||
replacements:
|
|
||||||
- source:
|
|
||||||
kind: ConfigMap
|
|
||||||
name: ams-sync-contour-env
|
|
||||||
fieldPath: data.USER_SERVER_HOST
|
|
||||||
targets:
|
|
||||||
- select:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: ams-sync
|
|
||||||
fieldPaths:
|
|
||||||
- spec.values.services.backend.envs.[name=USER_SERVER_HOST].value._default
|
|
||||||
- source:
|
|
||||||
kind: ConfigMap
|
|
||||||
name: ams-sync-contour-env
|
|
||||||
fieldPath: data.AUTH_HOST
|
|
||||||
targets:
|
|
||||||
- select:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: ams-sync
|
|
||||||
fieldPaths:
|
|
||||||
- spec.values.services.backend.envs.[name=AUTH_HOST].value._default
|
|
||||||
patches:
|
|
||||||
- path: helmrelease.yaml
|
|
||||||
@ -113,8 +113,8 @@ spec:
|
|||||||
vault.hashicorp.com/agent-inject-template-attachments-s3: |-
|
vault.hashicorp.com/agent-inject-template-attachments-s3: |-
|
||||||
{{- with secret "secrets/data/minio/apps/attachments" -}}
|
{{- with secret "secrets/data/minio/apps/attachments" -}}
|
||||||
YANDEX_S3_ENDPOINT_URL=minio.minio:9000
|
YANDEX_S3_ENDPOINT_URL=minio.minio:9000
|
||||||
YANDEX_S3_ACCESS_KEY_ID={{ or (index .Data.data "access_key") (index .Data.data "access_key_id") }}
|
YANDEX_S3_ACCESS_KEY_ID={{ index .Data.data "access_key" }}
|
||||||
YANDEX_S3_SECRET_ACCESS_KEY={{ or (index .Data.data "secret_key") (index .Data.data "secret_access_key") }}
|
YANDEX_S3_SECRET_ACCESS_KEY={{ index .Data.data "secret_key" }}
|
||||||
YANDEX_S3_USE_SSL=true
|
YANDEX_S3_USE_SSL=true
|
||||||
YANDEX_S3_REGION=ru-central
|
YANDEX_S3_REGION=ru-central
|
||||||
YANDEX_S3_VERIFY=false
|
YANDEX_S3_VERIFY=false
|
||||||
|
|||||||
@ -30,22 +30,12 @@ spec:
|
|||||||
env: _default
|
env: _default
|
||||||
|
|
||||||
services:
|
services:
|
||||||
attachments:
|
backend:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
||||||
tolerations:
|
|
||||||
- key:
|
|
||||||
_default: dedicated
|
|
||||||
operator:
|
|
||||||
_default: Equal
|
|
||||||
value:
|
|
||||||
_default: processing-light
|
|
||||||
effect:
|
|
||||||
_default: NoSchedule
|
|
||||||
|
|
||||||
image:
|
image:
|
||||||
name:
|
name:
|
||||||
_default: cr.yandex/crp3ccidau046kdj8g9q/attachments:production_6dbb4dce
|
_default: cr.yandex/crp3ccidau046kdj8g9q/att9:dev
|
||||||
pullPolicy:
|
pullPolicy:
|
||||||
_default: IfNotPresent
|
_default: IfNotPresent
|
||||||
|
|
||||||
@ -64,30 +54,11 @@ spec:
|
|||||||
port:
|
port:
|
||||||
_default: 8000
|
_default: 8000
|
||||||
|
|
||||||
command:
|
|
||||||
_default: ["/bin/bash", "/opt/attachments/entrypoint.sh"]
|
|
||||||
|
|
||||||
probes:
|
probes:
|
||||||
liveness:
|
liveness:
|
||||||
enabled: false
|
enabled: false
|
||||||
readiness:
|
readiness:
|
||||||
enabled: true
|
enabled: false
|
||||||
httpGet:
|
|
||||||
path:
|
|
||||||
_default: /openapi.json
|
|
||||||
port:
|
|
||||||
_default: 8000
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
_default:
|
|
||||||
- name: yc-s3
|
|
||||||
mountPath:
|
|
||||||
_default: /etc/sarex/yc-s3-storage
|
|
||||||
readOnly:
|
|
||||||
_default: true
|
|
||||||
secret:
|
|
||||||
secretName:
|
|
||||||
_default: yc-s3
|
|
||||||
|
|
||||||
service:
|
service:
|
||||||
enabled: true
|
enabled: true
|
||||||
@ -172,4 +143,4 @@ spec:
|
|||||||
commitSha: ""
|
commitSha: ""
|
||||||
gitlabUri: ""
|
gitlabUri: ""
|
||||||
gitlabJobUrl: ""
|
gitlabJobUrl: ""
|
||||||
owner: ""
|
owner: ""
|
||||||
@ -1,23 +0,0 @@
|
|||||||
apiVersion: helm.toolkit.fluxcd.io/v2
|
|
||||||
kind: HelmRelease
|
|
||||||
metadata:
|
|
||||||
name: attachments
|
|
||||||
namespace: attachments
|
|
||||||
annotations:
|
|
||||||
kustomize.toolkit.fluxcd.io/substitute: disabled
|
|
||||||
spec:
|
|
||||||
values:
|
|
||||||
services:
|
|
||||||
attachments:
|
|
||||||
podAnnotations:
|
|
||||||
_default:
|
|
||||||
vault.hashicorp.com/agent-inject-template-attachments-s3: |-
|
|
||||||
{{- with secret "secrets/data/minio/apps/attachments" -}}
|
|
||||||
YANDEX_S3_ENDPOINT_URL=minio.storage.svc.cluster.local:9000
|
|
||||||
YANDEX_S3_ACCESS_KEY_ID={{ or (index .Data.data "access_key") (index .Data.data "access_key_id") }}
|
|
||||||
YANDEX_S3_SECRET_ACCESS_KEY={{ or (index .Data.data "secret_key") (index .Data.data "secret_access_key") }}
|
|
||||||
YANDEX_S3_USE_SSL=false
|
|
||||||
YANDEX_S3_REGION=ru-central
|
|
||||||
YANDEX_S3_VERIFY=false
|
|
||||||
BUCKET_NAME=attachments
|
|
||||||
{{- end -}}
|
|
||||||
@ -1,23 +0,0 @@
|
|||||||
apiVersion: helm.toolkit.fluxcd.io/v2
|
|
||||||
kind: HelmRelease
|
|
||||||
metadata:
|
|
||||||
name: attachments
|
|
||||||
namespace: attachments
|
|
||||||
annotations:
|
|
||||||
kustomize.toolkit.fluxcd.io/substitute: disabled
|
|
||||||
spec:
|
|
||||||
values:
|
|
||||||
services:
|
|
||||||
attachments:
|
|
||||||
podAnnotations:
|
|
||||||
_default:
|
|
||||||
vault.hashicorp.com/agent-inject-template-attachments-s3: |-
|
|
||||||
{{- with secret "secrets/data/minio/apps/attachments" -}}
|
|
||||||
YANDEX_S3_ENDPOINT_URL=minio.storage.svc.cluster.local:9000
|
|
||||||
YANDEX_S3_ACCESS_KEY_ID={{ or (index .Data.data "access_key") (index .Data.data "access_key_id") }}
|
|
||||||
YANDEX_S3_SECRET_ACCESS_KEY={{ or (index .Data.data "secret_key") (index .Data.data "secret_access_key") }}
|
|
||||||
YANDEX_S3_USE_SSL=false
|
|
||||||
YANDEX_S3_REGION=ru-central
|
|
||||||
YANDEX_S3_VERIFY=false
|
|
||||||
BUCKET_NAME=attachments
|
|
||||||
{{- end -}}
|
|
||||||
11
apps/attachments/yc-k8s-test/kustomization.yaml
Normal file
11
apps/attachments/yc-k8s-test/kustomization.yaml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
resources:
|
||||||
|
- ../base
|
||||||
|
- postgresql.yaml
|
||||||
|
patches: []
|
||||||
|
# - path: replicas.yaml
|
||||||
|
# target:
|
||||||
|
# kind: HelmRelease
|
||||||
|
# name: attachments
|
||||||
122
apps/attachments/yc-k8s-test/postgresql.yaml
Normal file
122
apps/attachments/yc-k8s-test/postgresql.yaml
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
apiVersion: helm.toolkit.fluxcd.io/v2
|
||||||
|
kind: HelmRelease
|
||||||
|
metadata:
|
||||||
|
name: postgresql
|
||||||
|
namespace: attachments
|
||||||
|
spec:
|
||||||
|
interval: 5m
|
||||||
|
timeout: 2h
|
||||||
|
chart:
|
||||||
|
spec:
|
||||||
|
chart: postgresql-contour
|
||||||
|
version: "13.0.15"
|
||||||
|
sourceRef:
|
||||||
|
kind: HelmRepository
|
||||||
|
name: yc-oci-charts
|
||||||
|
namespace: flux-system
|
||||||
|
|
||||||
|
install:
|
||||||
|
timeout: 2h
|
||||||
|
remediation:
|
||||||
|
retries: 3
|
||||||
|
|
||||||
|
upgrade:
|
||||||
|
timeout: 2h
|
||||||
|
remediation:
|
||||||
|
retries: 3
|
||||||
|
|
||||||
|
values:
|
||||||
|
global:
|
||||||
|
security:
|
||||||
|
allowInsecureImages: true
|
||||||
|
defaultStorageClass: local-path
|
||||||
|
postgresql:
|
||||||
|
auth:
|
||||||
|
username: ""
|
||||||
|
database: ""
|
||||||
|
secretKeys:
|
||||||
|
userPasswordKey: "postgres-password"
|
||||||
|
auth:
|
||||||
|
username: ""
|
||||||
|
database: ""
|
||||||
|
secretKeys:
|
||||||
|
userPasswordKey: "postgres-password"
|
||||||
|
image:
|
||||||
|
registry: cr.yandex/crp3ccidau046kdj8g9q
|
||||||
|
repository: contour/postgresql
|
||||||
|
tag: 13.0.15
|
||||||
|
pullPolicy: Always
|
||||||
|
metrics:
|
||||||
|
enabled: false
|
||||||
|
prometheusRule:
|
||||||
|
enabled: false
|
||||||
|
primary:
|
||||||
|
containerSecurityContext:
|
||||||
|
readOnlyRootFilesystem: false
|
||||||
|
persistence:
|
||||||
|
storageClass: local-path
|
||||||
|
size: 20Gi
|
||||||
|
customLivenessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- exec pg_isready -U "postgres" -d postgres -h 127.0.0.1 -p 5432
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
periodSeconds: 10
|
||||||
|
timeoutSeconds: 5
|
||||||
|
successThreshold: 1
|
||||||
|
failureThreshold: 6
|
||||||
|
customReadinessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- exec pg_isready -U "postgres" -d postgres -h 127.0.0.1 -p 5432
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
periodSeconds: 10
|
||||||
|
timeoutSeconds: 5
|
||||||
|
successThreshold: 1
|
||||||
|
failureThreshold: 6
|
||||||
|
customStartupProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- exec pg_isready -U "postgres" -d postgres -h 127.0.0.1 -p 5432
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
periodSeconds: 10
|
||||||
|
timeoutSeconds: 5
|
||||||
|
successThreshold: 1
|
||||||
|
failureThreshold: 6
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 50m
|
||||||
|
memory: 128Mi
|
||||||
|
nodeSelector:
|
||||||
|
dedicated: db
|
||||||
|
tolerations:
|
||||||
|
- key: dedicated
|
||||||
|
operator: Equal
|
||||||
|
value: db
|
||||||
|
effect: NoSchedule
|
||||||
|
contour:
|
||||||
|
enabled: true
|
||||||
|
adminUser: "postgres"
|
||||||
|
sharedPreloadLibraries: ""
|
||||||
|
vault:
|
||||||
|
enabled: true
|
||||||
|
role: postgresql
|
||||||
|
authPath: auth/kubernetes
|
||||||
|
secretPath: secrets/data/postgresql/admin
|
||||||
|
secretKey: postgres-password
|
||||||
|
usersSecretPath: secrets/data/postgresql/users
|
||||||
|
databases:
|
||||||
|
- name: attachments_db
|
||||||
|
user: attachments
|
||||||
|
passwordKey: attachments
|
||||||
|
extensions: []
|
||||||
|
restoreFromDump: true
|
||||||
|
dumpKey: "sanitized_dumps_multi/attachments/288/attachments_company288_20260626T202844Z.tar.gz"
|
||||||
|
s3-proxy:
|
||||||
|
endpointUrl: "s3-proxy-service.postgresql.svc.cluster.local"
|
||||||
13
apps/attachments/yc-k8s-test/replicas.yaml
Normal file
13
apps/attachments/yc-k8s-test/replicas.yaml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
---
|
||||||
|
apiVersion: helm.toolkit.fluxcd.io/v2
|
||||||
|
kind: HelmRelease
|
||||||
|
metadata:
|
||||||
|
name: attachments
|
||||||
|
namespace: attachments
|
||||||
|
spec:
|
||||||
|
values:
|
||||||
|
services:
|
||||||
|
attachments:
|
||||||
|
deployment:
|
||||||
|
replicaCount:
|
||||||
|
_default: 2
|
||||||
10
apps/auth-flow/yc-k8s-test/kustomization.yaml
Normal file
10
apps/auth-flow/yc-k8s-test/kustomization.yaml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
resources:
|
||||||
|
- ../base
|
||||||
|
patches: []
|
||||||
|
# - path: replicas.yaml
|
||||||
|
# target:
|
||||||
|
# kind: HelmRelease
|
||||||
|
# name: frontend
|
||||||
13
apps/auth-flow/yc-k8s-test/replicas.yaml
Normal file
13
apps/auth-flow/yc-k8s-test/replicas.yaml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
---
|
||||||
|
apiVersion: helm.toolkit.fluxcd.io/v2
|
||||||
|
kind: HelmRelease
|
||||||
|
metadata:
|
||||||
|
name: frontend
|
||||||
|
namespace: auth-flow
|
||||||
|
spec:
|
||||||
|
values:
|
||||||
|
services:
|
||||||
|
frontend:
|
||||||
|
deployment:
|
||||||
|
replicaCount:
|
||||||
|
_default: 1
|
||||||
@ -1,78 +0,0 @@
|
|||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
|
||||||
kind: Kustomization
|
|
||||||
resources:
|
|
||||||
- ../base
|
|
||||||
configMapGenerator:
|
|
||||||
- name: bi-contour-env
|
|
||||||
literals:
|
|
||||||
- AUTH_HOST=http://backend-svc.django.svc.cluster.local
|
|
||||||
- ISSUES_SERVICE_HOST=http://backend-svc.issues.svc.cluster.local
|
|
||||||
- EAV_SERVICE_HOST=http://backend-svc.eav.svc.cluster.local
|
|
||||||
- PM_SERVICE_HOST=http://backend-svc.pm.svc.cluster.local:8000
|
|
||||||
- SUPERSET_DOCUMENTATION_URL=https://${HOST_PLATFORM}/documentations/
|
|
||||||
- 'KAFKA_BOOTSTRAP_SERVERS=["kafka-kafka-contour.kafka.svc.cluster.local:9092"]'
|
|
||||||
options:
|
|
||||||
disableNameSuffixHash: true
|
|
||||||
annotations:
|
|
||||||
config.kubernetes.io/local-config: "true"
|
|
||||||
replacements:
|
|
||||||
- source:
|
|
||||||
kind: ConfigMap
|
|
||||||
name: bi-contour-env
|
|
||||||
fieldPath: data.AUTH_HOST
|
|
||||||
targets:
|
|
||||||
- select:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: bi-backend
|
|
||||||
fieldPaths:
|
|
||||||
- spec.values.services.main.envs.[name=AUTH_HOST].value._default
|
|
||||||
- source:
|
|
||||||
kind: ConfigMap
|
|
||||||
name: bi-contour-env
|
|
||||||
fieldPath: data.ISSUES_SERVICE_HOST
|
|
||||||
targets:
|
|
||||||
- select:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: bi-backend
|
|
||||||
fieldPaths:
|
|
||||||
- spec.values.services.main.envs.[name=ISSUES_SERVICE_HOST].value._default
|
|
||||||
- source:
|
|
||||||
kind: ConfigMap
|
|
||||||
name: bi-contour-env
|
|
||||||
fieldPath: data.EAV_SERVICE_HOST
|
|
||||||
targets:
|
|
||||||
- select:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: bi-backend
|
|
||||||
fieldPaths:
|
|
||||||
- spec.values.services.main.envs.[name=EAV_SERVICE_HOST].value._default
|
|
||||||
- source:
|
|
||||||
kind: ConfigMap
|
|
||||||
name: bi-contour-env
|
|
||||||
fieldPath: data.PM_SERVICE_HOST
|
|
||||||
targets:
|
|
||||||
- select:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: bi-backend
|
|
||||||
fieldPaths:
|
|
||||||
- spec.values.services.main.envs.[name=PM_SERVICE_HOST].value._default
|
|
||||||
- source:
|
|
||||||
kind: ConfigMap
|
|
||||||
name: bi-contour-env
|
|
||||||
fieldPath: data.SUPERSET_DOCUMENTATION_URL
|
|
||||||
targets:
|
|
||||||
- select:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: bi-backend
|
|
||||||
fieldPaths:
|
|
||||||
- spec.values.services.main.envs.[name=SUPERSET_DOCUMENTATION_URL].value._default
|
|
||||||
- source:
|
|
||||||
kind: ConfigMap
|
|
||||||
name: bi-contour-env
|
|
||||||
fieldPath: data.KAFKA_BOOTSTRAP_SERVERS
|
|
||||||
targets:
|
|
||||||
- select:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: bi-backend
|
|
||||||
fieldPaths:
|
|
||||||
- spec.values.services.main.envs.[name=KAFKA_BOOTSTRAP_SERVERS].value._default
|
|
||||||
@ -1,78 +0,0 @@
|
|||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
|
||||||
kind: Kustomization
|
|
||||||
resources:
|
|
||||||
- ../base
|
|
||||||
configMapGenerator:
|
|
||||||
- name: bi-contour-env
|
|
||||||
literals:
|
|
||||||
- AUTH_HOST=http://backend-svc.django.svc.cluster.local
|
|
||||||
- ISSUES_SERVICE_HOST=http://backend-svc.issues.svc.cluster.local
|
|
||||||
- EAV_SERVICE_HOST=http://backend-svc.eav.svc.cluster.local
|
|
||||||
- PM_SERVICE_HOST=http://backend-svc.pm.svc.cluster.local:8000
|
|
||||||
- SUPERSET_DOCUMENTATION_URL=https://sarex.${CONTOUR_DOMAIN}/documentations/
|
|
||||||
- 'KAFKA_BOOTSTRAP_SERVERS=["kafka-kafka-contour.kafka.svc.cluster.local:9092"]'
|
|
||||||
options:
|
|
||||||
disableNameSuffixHash: true
|
|
||||||
annotations:
|
|
||||||
config.kubernetes.io/local-config: "true"
|
|
||||||
replacements:
|
|
||||||
- source:
|
|
||||||
kind: ConfigMap
|
|
||||||
name: bi-contour-env
|
|
||||||
fieldPath: data.AUTH_HOST
|
|
||||||
targets:
|
|
||||||
- select:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: bi-backend
|
|
||||||
fieldPaths:
|
|
||||||
- spec.values.services.main.envs.[name=AUTH_HOST].value._default
|
|
||||||
- source:
|
|
||||||
kind: ConfigMap
|
|
||||||
name: bi-contour-env
|
|
||||||
fieldPath: data.ISSUES_SERVICE_HOST
|
|
||||||
targets:
|
|
||||||
- select:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: bi-backend
|
|
||||||
fieldPaths:
|
|
||||||
- spec.values.services.main.envs.[name=ISSUES_SERVICE_HOST].value._default
|
|
||||||
- source:
|
|
||||||
kind: ConfigMap
|
|
||||||
name: bi-contour-env
|
|
||||||
fieldPath: data.EAV_SERVICE_HOST
|
|
||||||
targets:
|
|
||||||
- select:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: bi-backend
|
|
||||||
fieldPaths:
|
|
||||||
- spec.values.services.main.envs.[name=EAV_SERVICE_HOST].value._default
|
|
||||||
- source:
|
|
||||||
kind: ConfigMap
|
|
||||||
name: bi-contour-env
|
|
||||||
fieldPath: data.PM_SERVICE_HOST
|
|
||||||
targets:
|
|
||||||
- select:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: bi-backend
|
|
||||||
fieldPaths:
|
|
||||||
- spec.values.services.main.envs.[name=PM_SERVICE_HOST].value._default
|
|
||||||
- source:
|
|
||||||
kind: ConfigMap
|
|
||||||
name: bi-contour-env
|
|
||||||
fieldPath: data.SUPERSET_DOCUMENTATION_URL
|
|
||||||
targets:
|
|
||||||
- select:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: bi-backend
|
|
||||||
fieldPaths:
|
|
||||||
- spec.values.services.main.envs.[name=SUPERSET_DOCUMENTATION_URL].value._default
|
|
||||||
- source:
|
|
||||||
kind: ConfigMap
|
|
||||||
name: bi-contour-env
|
|
||||||
fieldPath: data.KAFKA_BOOTSTRAP_SERVERS
|
|
||||||
targets:
|
|
||||||
- select:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: bi-backend
|
|
||||||
fieldPaths:
|
|
||||||
- spec.values.services.main.envs.[name=KAFKA_BOOTSTRAP_SERVERS].value._default
|
|
||||||
@ -154,7 +154,7 @@ Slave-2 кластер — те же поля с суффиксом `_3`:
|
|||||||
- `base/backend-deployment.yaml` — Deployment `backend` в namespace `bim`, образ `bim-api`, `containerPort: 8000`, `API_ADDRESS=0.0.0.0:8000`, health-проба `GET /ping`.
|
- `base/backend-deployment.yaml` — Deployment `backend` в namespace `bim`, образ `bim-api`, `containerPort: 8000`, `API_ADDRESS=0.0.0.0:8000`, health-проба `GET /ping`.
|
||||||
- Секреты PostgreSQL инъектируются **из Vault** (аннотации `vault.hashicorp.com/*`, роль `bim`, путь `secrets/data/postgresql/apps/bim`) в файл `/vault/secrets/bim-postgresql`, который экспортируется в окружение перед запуском (`set -a; . /vault/secrets/bim-postgresql; set +a; exec ./httpserver`). Шаблон Vault задаёт `POSTGRES_ADDRESS[_2../_4]`, `POSTGRES_PORT*`, `POSTGRES_DB*` (все указывают на `postgresql.bim.svc.cluster.local:5432`, БД `bim_db`) и `POSTGRES_USER*`/`POSTGRES_PASSWORD*` из Vault.
|
- Секреты PostgreSQL инъектируются **из Vault** (аннотации `vault.hashicorp.com/*`, роль `bim`, путь `secrets/data/postgresql/apps/bim`) в файл `/vault/secrets/bim-postgresql`, который экспортируется в окружение перед запуском (`set -a; . /vault/secrets/bim-postgresql; set +a; exec ./httpserver`). Шаблон Vault задаёт `POSTGRES_ADDRESS[_2../_4]`, `POSTGRES_PORT*`, `POSTGRES_DB*` (все указывают на `postgresql.bim.svc.cluster.local:5432`, БД `bim_db`) и `POSTGRES_USER*`/`POSTGRES_PASSWORD*` из Vault.
|
||||||
- Прочие env заданы прямо в манифесте: `LAST_MASTER_BIM`, `LAST_MASTER_BIM_V3`, `LAST_SLAVE_1_BIM`, `POSTGRES_POOL_SIZE`, `DB_CERT_PATH_2/3/4`, `DJANGO_HOST` (`http://backend.django.svc.cluster.local:8000`), `ENABLE_SQL_QUERY=0`, `ENABLE_SSL=0`.
|
- Прочие env заданы прямо в манифесте: `LAST_MASTER_BIM`, `LAST_MASTER_BIM_V3`, `LAST_SLAVE_1_BIM`, `POSTGRES_POOL_SIZE`, `DB_CERT_PATH_2/3/4`, `DJANGO_HOST` (`http://backend.django.svc.cluster.local:8000`), `ENABLE_SQL_QUERY=0`, `ENABLE_SSL=0`.
|
||||||
- Оверлеи `brusnika-prod`, `brusnika-stage` патчат base (реплики, образ, postgresql).
|
- Оверлеи `brusnika-prod`, `brusnika-stage`, `yc-k8s-test` патчат base (реплики, образ, postgresql).
|
||||||
|
|
||||||
## Переменные в CI (`.gitlab-ci.yml`)
|
## Переменные в CI (`.gitlab-ci.yml`)
|
||||||
|
|
||||||
|
|||||||
@ -1,23 +0,0 @@
|
|||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
|
||||||
kind: Kustomization
|
|
||||||
resources:
|
|
||||||
- ../base
|
|
||||||
configMapGenerator:
|
|
||||||
- name: bim-contour-env
|
|
||||||
literals:
|
|
||||||
- POSTGRES_POOL_SIZE=5
|
|
||||||
options:
|
|
||||||
disableNameSuffixHash: true
|
|
||||||
annotations:
|
|
||||||
config.kubernetes.io/local-config: "true"
|
|
||||||
replacements:
|
|
||||||
- source:
|
|
||||||
kind: ConfigMap
|
|
||||||
name: bim-contour-env
|
|
||||||
fieldPath: data.POSTGRES_POOL_SIZE
|
|
||||||
targets:
|
|
||||||
- select:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: backend
|
|
||||||
fieldPaths:
|
|
||||||
- spec.values.services.backend.envs.[name=POSTGRES_POOL_SIZE].value._default
|
|
||||||
@ -1,23 +0,0 @@
|
|||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
|
||||||
kind: Kustomization
|
|
||||||
resources:
|
|
||||||
- ../base
|
|
||||||
configMapGenerator:
|
|
||||||
- name: bim-contour-env
|
|
||||||
literals:
|
|
||||||
- POSTGRES_POOL_SIZE=5
|
|
||||||
options:
|
|
||||||
disableNameSuffixHash: true
|
|
||||||
annotations:
|
|
||||||
config.kubernetes.io/local-config: "true"
|
|
||||||
replacements:
|
|
||||||
- source:
|
|
||||||
kind: ConfigMap
|
|
||||||
name: bim-contour-env
|
|
||||||
fieldPath: data.POSTGRES_POOL_SIZE
|
|
||||||
targets:
|
|
||||||
- select:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: backend
|
|
||||||
fieldPaths:
|
|
||||||
- spec.values.services.backend.envs.[name=POSTGRES_POOL_SIZE].value._default
|
|
||||||
@ -1,12 +1,11 @@
|
|||||||
|
---
|
||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
resources:
|
resources:
|
||||||
- ../base
|
- ../base
|
||||||
|
- postgresql.yaml
|
||||||
patches:
|
patches:
|
||||||
- path: ./vmstack.yaml
|
- path: replicas.yaml
|
||||||
target:
|
target:
|
||||||
group: helm.toolkit.fluxcd.io
|
|
||||||
version: v2
|
|
||||||
kind: HelmRelease
|
kind: HelmRelease
|
||||||
name: vmstack
|
name: backend
|
||||||
namespace: vmstack
|
|
||||||
126
apps/bim/yc-k8s-test/postgresql.yaml
Normal file
126
apps/bim/yc-k8s-test/postgresql.yaml
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
apiVersion: helm.toolkit.fluxcd.io/v2
|
||||||
|
kind: HelmRelease
|
||||||
|
metadata:
|
||||||
|
name: postgresql
|
||||||
|
namespace: bim
|
||||||
|
spec:
|
||||||
|
interval: 5m
|
||||||
|
timeout: 2h
|
||||||
|
chart:
|
||||||
|
spec:
|
||||||
|
chart: postgresql-contour
|
||||||
|
version: "13.0.15"
|
||||||
|
sourceRef:
|
||||||
|
kind: HelmRepository
|
||||||
|
name: yc-oci-charts
|
||||||
|
namespace: flux-system
|
||||||
|
|
||||||
|
install:
|
||||||
|
timeout: 2h
|
||||||
|
remediation:
|
||||||
|
retries: 3
|
||||||
|
|
||||||
|
upgrade:
|
||||||
|
timeout: 2h
|
||||||
|
remediation:
|
||||||
|
retries: 3
|
||||||
|
strategy: uninstall
|
||||||
|
|
||||||
|
values:
|
||||||
|
global:
|
||||||
|
security:
|
||||||
|
allowInsecureImages: true
|
||||||
|
defaultStorageClass: local-path
|
||||||
|
postgresql:
|
||||||
|
auth:
|
||||||
|
username: ""
|
||||||
|
database: ""
|
||||||
|
secretKeys:
|
||||||
|
userPasswordKey: "postgres-password"
|
||||||
|
auth:
|
||||||
|
username: ""
|
||||||
|
database: ""
|
||||||
|
secretKeys:
|
||||||
|
userPasswordKey: "postgres-password"
|
||||||
|
image:
|
||||||
|
registry: cr.yandex/crp3ccidau046kdj8g9q
|
||||||
|
repository: contour/postgresql
|
||||||
|
tag: 13.0.15
|
||||||
|
pullPolicy: Always
|
||||||
|
metrics:
|
||||||
|
enabled: false
|
||||||
|
prometheusRule:
|
||||||
|
enabled: false
|
||||||
|
primary:
|
||||||
|
containerSecurityContext:
|
||||||
|
readOnlyRootFilesystem: false
|
||||||
|
persistence:
|
||||||
|
storageClass: local-path
|
||||||
|
size: 20Gi
|
||||||
|
customLivenessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- exec pg_isready -U "postgres" -d postgres -h 127.0.0.1 -p 5432
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
periodSeconds: 10
|
||||||
|
timeoutSeconds: 5
|
||||||
|
successThreshold: 1
|
||||||
|
failureThreshold: 6
|
||||||
|
customReadinessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- exec pg_isready -U "postgres" -d postgres -h 127.0.0.1 -p 5432
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
periodSeconds: 10
|
||||||
|
timeoutSeconds: 5
|
||||||
|
successThreshold: 1
|
||||||
|
failureThreshold: 6
|
||||||
|
customStartupProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- exec pg_isready -U "postgres" -d postgres -h 127.0.0.1 -p 5432
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
periodSeconds: 10
|
||||||
|
timeoutSeconds: 5
|
||||||
|
successThreshold: 1
|
||||||
|
failureThreshold: 6
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 50m
|
||||||
|
memory: 128Mi
|
||||||
|
nodeSelector:
|
||||||
|
dedicated: db
|
||||||
|
tolerations:
|
||||||
|
- key: dedicated
|
||||||
|
operator: Equal
|
||||||
|
value: db
|
||||||
|
effect: NoSchedule
|
||||||
|
contour:
|
||||||
|
enabled: true
|
||||||
|
adminUser: "postgres"
|
||||||
|
sharedPreloadLibraries: ""
|
||||||
|
vault:
|
||||||
|
enabled: true
|
||||||
|
role: postgresql
|
||||||
|
authPath: auth/kubernetes
|
||||||
|
secretPath: secrets/data/postgresql/admin
|
||||||
|
secretKey: postgres-password
|
||||||
|
usersSecretPath: secrets/data/postgresql/users
|
||||||
|
databases:
|
||||||
|
- name: bim_db
|
||||||
|
user: bim
|
||||||
|
passwordKey: bim
|
||||||
|
extensions:
|
||||||
|
- ltree
|
||||||
|
- timescaledb
|
||||||
|
- uuid-ossp
|
||||||
|
- pg_partman
|
||||||
|
restoreFromDump: false
|
||||||
|
s3-proxy:
|
||||||
|
endpointUrl: "s3-proxy-service.postgresql.svc.cluster.local"
|
||||||
13
apps/bim/yc-k8s-test/replicas.yaml
Normal file
13
apps/bim/yc-k8s-test/replicas.yaml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
---
|
||||||
|
apiVersion: helm.toolkit.fluxcd.io/v2
|
||||||
|
kind: HelmRelease
|
||||||
|
metadata:
|
||||||
|
name: backend
|
||||||
|
namespace: bim
|
||||||
|
spec:
|
||||||
|
values:
|
||||||
|
services:
|
||||||
|
backend:
|
||||||
|
deployment:
|
||||||
|
replicaCount:
|
||||||
|
_default: 1
|
||||||
@ -202,7 +202,7 @@
|
|||||||
|
|
||||||
В `iac/apps/cde` секреты доставляются не через `secretEnvs` чарта, а через **Vault Agent Injector**: аннотации подов монтируют секрет `secrets/data/vault/apps/cde` в файл `/vault/secrets/cde-env`, который экспортируется перед запуском (`source /vault/secrets/cde-env`, затем `exec /http` или `/worker`). Дополнительно контейнерам задаётся `S3_IS_CONTOUR=true` (примечание: в коде используется переменная `IS_CONTOUR`).
|
В `iac/apps/cde` секреты доставляются не через `secretEnvs` чарта, а через **Vault Agent Injector**: аннотации подов монтируют секрет `secrets/data/vault/apps/cde` в файл `/vault/secrets/cde-env`, который экспортируется перед запуском (`source /vault/secrets/cde-env`, затем `exec /http` или `/worker`). Дополнительно контейнерам задаётся `S3_IS_CONTOUR=true` (примечание: в коде используется переменная `IS_CONTOUR`).
|
||||||
|
|
||||||
Оверлеи: `base` (общие манифесты), `brusnika-stage`, `brusnika-prod`.
|
Оверлеи: `base` (общие манифесты), `brusnika-stage`, `brusnika-prod`, `yc-k8s-test`.
|
||||||
|
|
||||||
## Замечания и потенциальные проблемы
|
## Замечания и потенциальные проблемы
|
||||||
|
|
||||||
|
|||||||
@ -1,139 +0,0 @@
|
|||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
|
||||||
kind: Kustomization
|
|
||||||
resources:
|
|
||||||
- ../base
|
|
||||||
- serviceaccount.yaml
|
|
||||||
patches:
|
|
||||||
- target:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: cde
|
|
||||||
patch: |
|
|
||||||
- op: remove
|
|
||||||
path: /spec/values/services/cde/deployment/resources
|
|
||||||
- target:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: cde-flowscallback
|
|
||||||
patch: |
|
|
||||||
- op: remove
|
|
||||||
path: /spec/values/services/cde-flowscallback/deployment/resources
|
|
||||||
- op: replace
|
|
||||||
path: /spec/values/services/cde-flowscallback/serviceAccount/enabled/_default
|
|
||||||
value: false
|
|
||||||
- target:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: cde-splitpdf
|
|
||||||
patch: |
|
|
||||||
- op: remove
|
|
||||||
path: /spec/values/services/cde-splitpdf/deployment/resources
|
|
||||||
- op: replace
|
|
||||||
path: /spec/values/services/cde-splitpdf/serviceAccount/enabled/_default
|
|
||||||
value: false
|
|
||||||
- target:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: cde-worker-alert
|
|
||||||
patch: |
|
|
||||||
- op: remove
|
|
||||||
path: /spec/values/services/cde-worker-alert/deployment/resources
|
|
||||||
- op: replace
|
|
||||||
path: /spec/values/services/cde-worker-alert/serviceAccount/enabled/_default
|
|
||||||
value: false
|
|
||||||
- target:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: cde-worker-copy
|
|
||||||
patch: |
|
|
||||||
- op: remove
|
|
||||||
path: /spec/values/services/cde-worker-copy/deployment/resources
|
|
||||||
- op: replace
|
|
||||||
path: /spec/values/services/cde-worker-copy/serviceAccount/enabled/_default
|
|
||||||
value: false
|
|
||||||
- target:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: cde-worker-copyv2
|
|
||||||
patch: |
|
|
||||||
- op: remove
|
|
||||||
path: /spec/values/services/cde-worker-copyv2/deployment/resources
|
|
||||||
- op: replace
|
|
||||||
path: /spec/values/services/cde-worker-copyv2/serviceAccount/enabled/_default
|
|
||||||
value: false
|
|
||||||
- target:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: cde-worker-create-versions
|
|
||||||
patch: |
|
|
||||||
- op: remove
|
|
||||||
path: /spec/values/services/cde-worker-create-versions/deployment/resources
|
|
||||||
- op: replace
|
|
||||||
path: /spec/values/services/cde-worker-create-versions/serviceAccount/enabled/_default
|
|
||||||
value: false
|
|
||||||
- target:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: cde-worker-create-versionsv2
|
|
||||||
patch: |
|
|
||||||
- op: remove
|
|
||||||
path: /spec/values/services/cde-worker-create-versionsv2/deployment/resources
|
|
||||||
- op: replace
|
|
||||||
path: /spec/values/services/cde-worker-create-versionsv2/serviceAccount/enabled/_default
|
|
||||||
value: false
|
|
||||||
- target:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: cde-worker-markings
|
|
||||||
patch: |
|
|
||||||
- op: remove
|
|
||||||
path: /spec/values/services/cde-worker-markings/deployment/resources
|
|
||||||
- op: replace
|
|
||||||
path: /spec/values/services/cde-worker-markings/serviceAccount/enabled/_default
|
|
||||||
value: false
|
|
||||||
- target:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: cde-worker-markingsv2
|
|
||||||
patch: |
|
|
||||||
- op: remove
|
|
||||||
path: /spec/values/services/cde-worker-markingsv2/deployment/resources
|
|
||||||
- op: replace
|
|
||||||
path: /spec/values/services/cde-worker-markingsv2/serviceAccount/enabled/_default
|
|
||||||
value: false
|
|
||||||
- target:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: cde-worker-sign
|
|
||||||
patch: |
|
|
||||||
- op: remove
|
|
||||||
path: /spec/values/services/cde-worker-sign/deployment/resources
|
|
||||||
- op: replace
|
|
||||||
path: /spec/values/services/cde-worker-sign/serviceAccount/enabled/_default
|
|
||||||
value: false
|
|
||||||
- target:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: cde-worker-signv2
|
|
||||||
patch: |
|
|
||||||
- op: remove
|
|
||||||
path: /spec/values/services/cde-worker-signv2/deployment/resources
|
|
||||||
- op: replace
|
|
||||||
path: /spec/values/services/cde-worker-signv2/serviceAccount/enabled/_default
|
|
||||||
value: false
|
|
||||||
- target:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: cde-worker-update-bundles
|
|
||||||
patch: |
|
|
||||||
- op: remove
|
|
||||||
path: /spec/values/services/cde-worker-update-bundles/deployment/resources
|
|
||||||
- op: replace
|
|
||||||
path: /spec/values/services/cde-worker-update-bundles/serviceAccount/enabled/_default
|
|
||||||
value: false
|
|
||||||
configMapGenerator:
|
|
||||||
- name: cde-contour-env
|
|
||||||
literals:
|
|
||||||
- SAREX_BACKEND_BASE_URL=http://backend-svc.django.svc.cluster.local:80
|
|
||||||
options:
|
|
||||||
disableNameSuffixHash: true
|
|
||||||
annotations:
|
|
||||||
config.kubernetes.io/local-config: "true"
|
|
||||||
replacements:
|
|
||||||
- source:
|
|
||||||
kind: ConfigMap
|
|
||||||
name: cde-contour-env
|
|
||||||
fieldPath: data.SAREX_BACKEND_BASE_URL
|
|
||||||
targets:
|
|
||||||
- select:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: cde
|
|
||||||
fieldPaths:
|
|
||||||
- spec.values.services.cde.envs.[name=SAREX_BACKEND_BASE_URL].value._default
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: ServiceAccount
|
|
||||||
metadata:
|
|
||||||
name: cde-vault
|
|
||||||
namespace: cde
|
|
||||||
@ -1,139 +0,0 @@
|
|||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
|
||||||
kind: Kustomization
|
|
||||||
resources:
|
|
||||||
- ../base
|
|
||||||
- serviceaccount.yaml
|
|
||||||
patches:
|
|
||||||
- target:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: cde
|
|
||||||
patch: |
|
|
||||||
- op: remove
|
|
||||||
path: /spec/values/services/cde/deployment/resources
|
|
||||||
- target:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: cde-flowscallback
|
|
||||||
patch: |
|
|
||||||
- op: remove
|
|
||||||
path: /spec/values/services/cde-flowscallback/deployment/resources
|
|
||||||
- op: replace
|
|
||||||
path: /spec/values/services/cde-flowscallback/serviceAccount/enabled/_default
|
|
||||||
value: false
|
|
||||||
- target:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: cde-splitpdf
|
|
||||||
patch: |
|
|
||||||
- op: remove
|
|
||||||
path: /spec/values/services/cde-splitpdf/deployment/resources
|
|
||||||
- op: replace
|
|
||||||
path: /spec/values/services/cde-splitpdf/serviceAccount/enabled/_default
|
|
||||||
value: false
|
|
||||||
- target:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: cde-worker-alert
|
|
||||||
patch: |
|
|
||||||
- op: remove
|
|
||||||
path: /spec/values/services/cde-worker-alert/deployment/resources
|
|
||||||
- op: replace
|
|
||||||
path: /spec/values/services/cde-worker-alert/serviceAccount/enabled/_default
|
|
||||||
value: false
|
|
||||||
- target:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: cde-worker-copy
|
|
||||||
patch: |
|
|
||||||
- op: remove
|
|
||||||
path: /spec/values/services/cde-worker-copy/deployment/resources
|
|
||||||
- op: replace
|
|
||||||
path: /spec/values/services/cde-worker-copy/serviceAccount/enabled/_default
|
|
||||||
value: false
|
|
||||||
- target:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: cde-worker-copyv2
|
|
||||||
patch: |
|
|
||||||
- op: remove
|
|
||||||
path: /spec/values/services/cde-worker-copyv2/deployment/resources
|
|
||||||
- op: replace
|
|
||||||
path: /spec/values/services/cde-worker-copyv2/serviceAccount/enabled/_default
|
|
||||||
value: false
|
|
||||||
- target:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: cde-worker-create-versions
|
|
||||||
patch: |
|
|
||||||
- op: remove
|
|
||||||
path: /spec/values/services/cde-worker-create-versions/deployment/resources
|
|
||||||
- op: replace
|
|
||||||
path: /spec/values/services/cde-worker-create-versions/serviceAccount/enabled/_default
|
|
||||||
value: false
|
|
||||||
- target:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: cde-worker-create-versionsv2
|
|
||||||
patch: |
|
|
||||||
- op: remove
|
|
||||||
path: /spec/values/services/cde-worker-create-versionsv2/deployment/resources
|
|
||||||
- op: replace
|
|
||||||
path: /spec/values/services/cde-worker-create-versionsv2/serviceAccount/enabled/_default
|
|
||||||
value: false
|
|
||||||
- target:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: cde-worker-markings
|
|
||||||
patch: |
|
|
||||||
- op: remove
|
|
||||||
path: /spec/values/services/cde-worker-markings/deployment/resources
|
|
||||||
- op: replace
|
|
||||||
path: /spec/values/services/cde-worker-markings/serviceAccount/enabled/_default
|
|
||||||
value: false
|
|
||||||
- target:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: cde-worker-markingsv2
|
|
||||||
patch: |
|
|
||||||
- op: remove
|
|
||||||
path: /spec/values/services/cde-worker-markingsv2/deployment/resources
|
|
||||||
- op: replace
|
|
||||||
path: /spec/values/services/cde-worker-markingsv2/serviceAccount/enabled/_default
|
|
||||||
value: false
|
|
||||||
- target:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: cde-worker-sign
|
|
||||||
patch: |
|
|
||||||
- op: remove
|
|
||||||
path: /spec/values/services/cde-worker-sign/deployment/resources
|
|
||||||
- op: replace
|
|
||||||
path: /spec/values/services/cde-worker-sign/serviceAccount/enabled/_default
|
|
||||||
value: false
|
|
||||||
- target:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: cde-worker-signv2
|
|
||||||
patch: |
|
|
||||||
- op: remove
|
|
||||||
path: /spec/values/services/cde-worker-signv2/deployment/resources
|
|
||||||
- op: replace
|
|
||||||
path: /spec/values/services/cde-worker-signv2/serviceAccount/enabled/_default
|
|
||||||
value: false
|
|
||||||
- target:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: cde-worker-update-bundles
|
|
||||||
patch: |
|
|
||||||
- op: remove
|
|
||||||
path: /spec/values/services/cde-worker-update-bundles/deployment/resources
|
|
||||||
- op: replace
|
|
||||||
path: /spec/values/services/cde-worker-update-bundles/serviceAccount/enabled/_default
|
|
||||||
value: false
|
|
||||||
configMapGenerator:
|
|
||||||
- name: cde-contour-env
|
|
||||||
literals:
|
|
||||||
- SAREX_BACKEND_BASE_URL=http://backend-svc.django.svc.cluster.local:80
|
|
||||||
options:
|
|
||||||
disableNameSuffixHash: true
|
|
||||||
annotations:
|
|
||||||
config.kubernetes.io/local-config: "true"
|
|
||||||
replacements:
|
|
||||||
- source:
|
|
||||||
kind: ConfigMap
|
|
||||||
name: cde-contour-env
|
|
||||||
fieldPath: data.SAREX_BACKEND_BASE_URL
|
|
||||||
targets:
|
|
||||||
- select:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: cde
|
|
||||||
fieldPaths:
|
|
||||||
- spec.values.services.cde.envs.[name=SAREX_BACKEND_BASE_URL].value._default
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: ServiceAccount
|
|
||||||
metadata:
|
|
||||||
name: cde-vault
|
|
||||||
namespace: cde
|
|
||||||
@ -55,20 +55,3 @@ patches:
|
|||||||
target:
|
target:
|
||||||
kind: HelmRelease
|
kind: HelmRelease
|
||||||
name: cde
|
name: cde
|
||||||
- target:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: cde-(worker-.*|flowscallback|splitpdf)
|
|
||||||
patch: |-
|
|
||||||
- op: add
|
|
||||||
path: /spec/postRenderers
|
|
||||||
value:
|
|
||||||
- kustomize:
|
|
||||||
patches:
|
|
||||||
- target:
|
|
||||||
group: apps
|
|
||||||
version: v1
|
|
||||||
kind: Deployment|StatefulSet
|
|
||||||
patch: |-
|
|
||||||
- op: add
|
|
||||||
path: /spec/replicas
|
|
||||||
value: 0
|
|
||||||
|
|||||||
10
apps/cde/yc-k8s-test/kustomization.yaml
Normal file
10
apps/cde/yc-k8s-test/kustomization.yaml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
resources:
|
||||||
|
- ../base
|
||||||
|
patches: []
|
||||||
|
# - path: replicas.yaml
|
||||||
|
# target:
|
||||||
|
# kind: Deployment
|
||||||
|
# name: frontend
|
||||||
8
apps/cde/yc-k8s-test/replicas.yaml
Normal file
8
apps/cde/yc-k8s-test/replicas.yaml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: backend
|
||||||
|
namespace: cde
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
@ -1,33 +0,0 @@
|
|||||||
apiVersion: helm.toolkit.fluxcd.io/v2
|
|
||||||
kind: HelmRelease
|
|
||||||
metadata:
|
|
||||||
name: checklists
|
|
||||||
namespace: checklists
|
|
||||||
spec:
|
|
||||||
values:
|
|
||||||
services:
|
|
||||||
checklists:
|
|
||||||
podAnnotations:
|
|
||||||
_default:
|
|
||||||
vault.hashicorp.com/agent-inject-secret-checklists-jwt-public: secrets/data/vault/common/jwt_public
|
|
||||||
vault.hashicorp.com/agent-inject-template-checklists-jwt-public: '{{-
|
|
||||||
with secret "secrets/data/vault/common/jwt_public" -}}
|
|
||||||
|
|
||||||
{{ index .Data.data "public_key" }}
|
|
||||||
|
|
||||||
{{- end -}}'
|
|
||||||
deployment:
|
|
||||||
args:
|
|
||||||
_default:
|
|
||||||
- 'set -a
|
|
||||||
|
|
||||||
[ -f /vault/secrets/checklists-db ] && . /vault/secrets/checklists-db
|
|
||||||
|
|
||||||
[ -f /vault/secrets/checklists-jwt-public ] && export JWT_AUTH_PUBLIC_KEY="$(cat
|
|
||||||
/vault/secrets/checklists-jwt-public)"
|
|
||||||
|
|
||||||
set +a
|
|
||||||
|
|
||||||
exec ./entrypoint.sh
|
|
||||||
|
|
||||||
'
|
|
||||||
@ -1,33 +0,0 @@
|
|||||||
apiVersion: helm.toolkit.fluxcd.io/v2
|
|
||||||
kind: HelmRelease
|
|
||||||
metadata:
|
|
||||||
name: checklists
|
|
||||||
namespace: checklists
|
|
||||||
spec:
|
|
||||||
values:
|
|
||||||
services:
|
|
||||||
checklists:
|
|
||||||
podAnnotations:
|
|
||||||
_default:
|
|
||||||
vault.hashicorp.com/agent-inject-secret-checklists-jwt-public: secrets/data/vault/common/jwt_public
|
|
||||||
vault.hashicorp.com/agent-inject-template-checklists-jwt-public: '{{-
|
|
||||||
with secret "secrets/data/vault/common/jwt_public" -}}
|
|
||||||
|
|
||||||
{{ index .Data.data "public_key" }}
|
|
||||||
|
|
||||||
{{- end -}}'
|
|
||||||
deployment:
|
|
||||||
args:
|
|
||||||
_default:
|
|
||||||
- 'set -a
|
|
||||||
|
|
||||||
[ -f /vault/secrets/checklists-db ] && . /vault/secrets/checklists-db
|
|
||||||
|
|
||||||
[ -f /vault/secrets/checklists-jwt-public ] && export JWT_AUTH_PUBLIC_KEY="$(cat
|
|
||||||
/vault/secrets/checklists-jwt-public)"
|
|
||||||
|
|
||||||
set +a
|
|
||||||
|
|
||||||
exec ./entrypoint.sh
|
|
||||||
|
|
||||||
'
|
|
||||||
@ -1,6 +1,7 @@
|
|||||||
|
---
|
||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
resources:
|
resources:
|
||||||
- namespace.yaml
|
- ../base
|
||||||
- postgresql.yaml
|
- postgresql.yaml
|
||||||
- notes-tls.yaml
|
patches: []
|
||||||
124
apps/checklists/yc-k8s-test/postgresql.yaml
Normal file
124
apps/checklists/yc-k8s-test/postgresql.yaml
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
apiVersion: helm.toolkit.fluxcd.io/v2
|
||||||
|
kind: HelmRelease
|
||||||
|
metadata:
|
||||||
|
name: postgresql
|
||||||
|
namespace: checklists
|
||||||
|
spec:
|
||||||
|
interval: 5m
|
||||||
|
timeout: 2h
|
||||||
|
chart:
|
||||||
|
spec:
|
||||||
|
chart: postgresql-contour
|
||||||
|
version: "13.0.15"
|
||||||
|
sourceRef:
|
||||||
|
kind: HelmRepository
|
||||||
|
name: yc-oci-charts
|
||||||
|
namespace: flux-system
|
||||||
|
|
||||||
|
install:
|
||||||
|
timeout: 2h
|
||||||
|
remediation:
|
||||||
|
retries: 3
|
||||||
|
|
||||||
|
upgrade:
|
||||||
|
timeout: 2h
|
||||||
|
remediation:
|
||||||
|
retries: 3
|
||||||
|
|
||||||
|
values:
|
||||||
|
global:
|
||||||
|
security:
|
||||||
|
allowInsecureImages: true
|
||||||
|
defaultStorageClass: local-path
|
||||||
|
postgresql:
|
||||||
|
auth:
|
||||||
|
username: ""
|
||||||
|
database: ""
|
||||||
|
secretKeys:
|
||||||
|
userPasswordKey: "postgres-password"
|
||||||
|
auth:
|
||||||
|
username: ""
|
||||||
|
database: ""
|
||||||
|
secretKeys:
|
||||||
|
userPasswordKey: "postgres-password"
|
||||||
|
image:
|
||||||
|
registry: cr.yandex/crp3ccidau046kdj8g9q
|
||||||
|
repository: contour/postgresql
|
||||||
|
tag: 13.0.15
|
||||||
|
pullPolicy: Always
|
||||||
|
metrics:
|
||||||
|
enabled: false
|
||||||
|
prometheusRule:
|
||||||
|
enabled: false
|
||||||
|
primary:
|
||||||
|
containerSecurityContext:
|
||||||
|
readOnlyRootFilesystem: false
|
||||||
|
persistence:
|
||||||
|
storageClass: local-path
|
||||||
|
size: 20Gi
|
||||||
|
customLivenessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- exec pg_isready -U "postgres" -d postgres -h 127.0.0.1 -p 5432
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
periodSeconds: 10
|
||||||
|
timeoutSeconds: 5
|
||||||
|
successThreshold: 1
|
||||||
|
failureThreshold: 6
|
||||||
|
customReadinessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- exec pg_isready -U "postgres" -d postgres -h 127.0.0.1 -p 5432
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
periodSeconds: 10
|
||||||
|
timeoutSeconds: 5
|
||||||
|
successThreshold: 1
|
||||||
|
failureThreshold: 6
|
||||||
|
customStartupProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- exec pg_isready -U "postgres" -d postgres -h 127.0.0.1 -p 5432
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
periodSeconds: 10
|
||||||
|
timeoutSeconds: 5
|
||||||
|
successThreshold: 1
|
||||||
|
failureThreshold: 6
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 50m
|
||||||
|
memory: 128Mi
|
||||||
|
nodeSelector:
|
||||||
|
dedicated: db
|
||||||
|
tolerations:
|
||||||
|
- key: dedicated
|
||||||
|
operator: Equal
|
||||||
|
value: db
|
||||||
|
effect: NoSchedule
|
||||||
|
contour:
|
||||||
|
enabled: true
|
||||||
|
adminUser: "postgres"
|
||||||
|
sharedPreloadLibraries: ""
|
||||||
|
vault:
|
||||||
|
enabled: true
|
||||||
|
role: postgresql
|
||||||
|
authPath: auth/kubernetes
|
||||||
|
secretPath: secrets/data/postgresql/admin
|
||||||
|
secretKey: postgres-password
|
||||||
|
usersSecretPath: secrets/data/postgresql/users
|
||||||
|
databases:
|
||||||
|
- name: checklists_db
|
||||||
|
user: checklists
|
||||||
|
passwordKey: checklists
|
||||||
|
extensions:
|
||||||
|
- pg_stat_statements
|
||||||
|
- uuid-ossp
|
||||||
|
restoreFromDump: true
|
||||||
|
dumpKey: "sanitized_dumps_multi/checklists/288/checklists_company288_20260626T202844Z.tar.gz"
|
||||||
|
s3-proxy:
|
||||||
|
endpointUrl: "s3-proxy-service.postgresql.svc.cluster.local"
|
||||||
@ -117,7 +117,7 @@
|
|||||||
|
|
||||||
## Развёртывание через Kustomize (этот репозиторий, `apps/comparisons`)
|
## Развёртывание через Kustomize (этот репозиторий, `apps/comparisons`)
|
||||||
|
|
||||||
Структура: `base` (общие манифесты) и оверлеи `brusnika-stage`, `brusnika-prod`. Секреты БД и публичный JWT-ключ подтягиваются из **HashiCorp Vault** (аннотации `vault.hashicorp.com/*` в `base/backend-deployment.yaml`), а не из k8s-секретов.
|
Структура: `base` (общие манифесты) и оверлеи `brusnika-stage`, `brusnika-prod`, `yc-k8s-test`. Секреты БД и публичный JWT-ключ подтягиваются из **HashiCorp Vault** (аннотации `vault.hashicorp.com/*` в `base/backend-deployment.yaml`), а не из k8s-секретов.
|
||||||
|
|
||||||
> **Важно: расхождение схем переменных.** Манифест `base/backend-deployment.yaml` использует другой (более новый) набор имён переменных, чем Go-код из `comparisons-backend` (`config/config.go`): напр. `HTTP_PORT`, `LOGGER_LOG_LEVEL`, `DATABASE_NAME`, `DOCUMENTATIONS_INTERNAL_HOST`, `DOCUMENTATIONS_EXTERNAL_HOST`, `WORKFLOWS_HOST`, `WORKFLOWS_DJANGO_HOST`, `WORKFLOWS_BIMV2_INTERNAL_HOST`, `WORKSPACES_HOST`, `EAV_HOST`, `APP_NAME`, `AUTH_PUBLIC_KEY`, `WORKFLOWS_CONFIG_FILEPATH` и др., а также `/ping` в health-проверках и образ `comparisons_backend_prod`. Такой схемы нет в Go-репозитории. Перед использованием этих файлов стоит убедиться, какой именно образ бэкенда деплоится оверлеем: если это Go-сервис из `comparisons-backend`, набор env нужно привести к именам из таблиц выше.
|
> **Важно: расхождение схем переменных.** Манифест `base/backend-deployment.yaml` использует другой (более новый) набор имён переменных, чем Go-код из `comparisons-backend` (`config/config.go`): напр. `HTTP_PORT`, `LOGGER_LOG_LEVEL`, `DATABASE_NAME`, `DOCUMENTATIONS_INTERNAL_HOST`, `DOCUMENTATIONS_EXTERNAL_HOST`, `WORKFLOWS_HOST`, `WORKFLOWS_DJANGO_HOST`, `WORKFLOWS_BIMV2_INTERNAL_HOST`, `WORKSPACES_HOST`, `EAV_HOST`, `APP_NAME`, `AUTH_PUBLIC_KEY`, `WORKFLOWS_CONFIG_FILEPATH` и др., а также `/ping` в health-проверках и образ `comparisons_backend_prod`. Такой схемы нет в Go-репозитории. Перед использованием этих файлов стоит убедиться, какой именно образ бэкенда деплоится оверлеем: если это Go-сервис из `comparisons-backend`, набор env нужно привести к именам из таблиц выше.
|
||||||
|
|
||||||
|
|||||||
@ -1,89 +0,0 @@
|
|||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
|
||||||
kind: Kustomization
|
|
||||||
resources:
|
|
||||||
- ../base
|
|
||||||
configMapGenerator:
|
|
||||||
- name: comparisons-contour-env
|
|
||||||
literals:
|
|
||||||
- DOCUMENTATIONS_INTERNAL_HOST=http://backend-api-svc.documentations.svc.cluster.local
|
|
||||||
- DOCUMENTATIONS_EXTERNAL_HOST=http://backend-api-svc.documentations.svc.cluster.local
|
|
||||||
- WORKFLOWS_HOST=http://backend-svc.processing.svc.cluster.local
|
|
||||||
- WORKFLOWS_DJANGO_HOST=https://sarex.${CONTOUR_DOMAIN}
|
|
||||||
- WORKFLOWS_BIMV2_INTERNAL_HOST=http://backend-svc.bim.svc.cluster.local
|
|
||||||
- WORKSPACES_HOST=http://backend-svc.workspaces.svc.cluster.local
|
|
||||||
- EAV_HOST=http://backend-svc.eav.svc.cluster.local
|
|
||||||
options:
|
|
||||||
disableNameSuffixHash: true
|
|
||||||
annotations:
|
|
||||||
config.kubernetes.io/local-config: "true"
|
|
||||||
replacements:
|
|
||||||
- source:
|
|
||||||
kind: ConfigMap
|
|
||||||
name: comparisons-contour-env
|
|
||||||
fieldPath: data.DOCUMENTATIONS_INTERNAL_HOST
|
|
||||||
targets:
|
|
||||||
- select:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: backend
|
|
||||||
fieldPaths:
|
|
||||||
- spec.values.services.backend.envs.[name=DOCUMENTATIONS_INTERNAL_HOST].value._default
|
|
||||||
- source:
|
|
||||||
kind: ConfigMap
|
|
||||||
name: comparisons-contour-env
|
|
||||||
fieldPath: data.DOCUMENTATIONS_EXTERNAL_HOST
|
|
||||||
targets:
|
|
||||||
- select:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: backend
|
|
||||||
fieldPaths:
|
|
||||||
- spec.values.services.backend.envs.[name=DOCUMENTATIONS_EXTERNAL_HOST].value._default
|
|
||||||
- source:
|
|
||||||
kind: ConfigMap
|
|
||||||
name: comparisons-contour-env
|
|
||||||
fieldPath: data.WORKFLOWS_HOST
|
|
||||||
targets:
|
|
||||||
- select:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: backend
|
|
||||||
fieldPaths:
|
|
||||||
- spec.values.services.backend.envs.[name=WORKFLOWS_HOST].value._default
|
|
||||||
- source:
|
|
||||||
kind: ConfigMap
|
|
||||||
name: comparisons-contour-env
|
|
||||||
fieldPath: data.WORKFLOWS_DJANGO_HOST
|
|
||||||
targets:
|
|
||||||
- select:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: backend
|
|
||||||
fieldPaths:
|
|
||||||
- spec.values.services.backend.envs.[name=WORKFLOWS_DJANGO_HOST].value._default
|
|
||||||
- source:
|
|
||||||
kind: ConfigMap
|
|
||||||
name: comparisons-contour-env
|
|
||||||
fieldPath: data.WORKFLOWS_BIMV2_INTERNAL_HOST
|
|
||||||
targets:
|
|
||||||
- select:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: backend
|
|
||||||
fieldPaths:
|
|
||||||
- spec.values.services.backend.envs.[name=WORKFLOWS_BIMV2_INTERNAL_HOST].value._default
|
|
||||||
- source:
|
|
||||||
kind: ConfigMap
|
|
||||||
name: comparisons-contour-env
|
|
||||||
fieldPath: data.WORKSPACES_HOST
|
|
||||||
targets:
|
|
||||||
- select:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: backend
|
|
||||||
fieldPaths:
|
|
||||||
- spec.values.services.backend.envs.[name=WORKSPACES_HOST].value._default
|
|
||||||
- source:
|
|
||||||
kind: ConfigMap
|
|
||||||
name: comparisons-contour-env
|
|
||||||
fieldPath: data.EAV_HOST
|
|
||||||
targets:
|
|
||||||
- select:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: backend
|
|
||||||
fieldPaths:
|
|
||||||
- spec.values.services.backend.envs.[name=EAV_HOST].value._default
|
|
||||||
11
apps/comparisons/yc-k8s-test/kustomization.yaml
Normal file
11
apps/comparisons/yc-k8s-test/kustomization.yaml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
resources:
|
||||||
|
- ../base
|
||||||
|
- postgresql.yaml
|
||||||
|
patches:
|
||||||
|
- path: replicas.yaml
|
||||||
|
target:
|
||||||
|
kind: HelmRelease
|
||||||
|
name: backend
|
||||||
122
apps/comparisons/yc-k8s-test/postgresql.yaml
Normal file
122
apps/comparisons/yc-k8s-test/postgresql.yaml
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
apiVersion: helm.toolkit.fluxcd.io/v2
|
||||||
|
kind: HelmRelease
|
||||||
|
metadata:
|
||||||
|
name: postgresql
|
||||||
|
namespace: comparisons
|
||||||
|
spec:
|
||||||
|
interval: 5m
|
||||||
|
timeout: 2h
|
||||||
|
chart:
|
||||||
|
spec:
|
||||||
|
chart: postgresql-contour
|
||||||
|
version: "13.0.15"
|
||||||
|
sourceRef:
|
||||||
|
kind: HelmRepository
|
||||||
|
name: yc-oci-charts
|
||||||
|
namespace: flux-system
|
||||||
|
|
||||||
|
install:
|
||||||
|
timeout: 2h
|
||||||
|
remediation:
|
||||||
|
retries: 3
|
||||||
|
|
||||||
|
upgrade:
|
||||||
|
timeout: 2h
|
||||||
|
remediation:
|
||||||
|
retries: 3
|
||||||
|
|
||||||
|
values:
|
||||||
|
global:
|
||||||
|
security:
|
||||||
|
allowInsecureImages: true
|
||||||
|
defaultStorageClass: local-path
|
||||||
|
postgresql:
|
||||||
|
auth:
|
||||||
|
username: ""
|
||||||
|
database: ""
|
||||||
|
secretKeys:
|
||||||
|
userPasswordKey: "postgres-password"
|
||||||
|
auth:
|
||||||
|
username: ""
|
||||||
|
database: ""
|
||||||
|
secretKeys:
|
||||||
|
userPasswordKey: "postgres-password"
|
||||||
|
image:
|
||||||
|
registry: cr.yandex/crp3ccidau046kdj8g9q
|
||||||
|
repository: contour/postgresql
|
||||||
|
tag: 13.0.15
|
||||||
|
pullPolicy: Always
|
||||||
|
metrics:
|
||||||
|
enabled: false
|
||||||
|
prometheusRule:
|
||||||
|
enabled: false
|
||||||
|
primary:
|
||||||
|
containerSecurityContext:
|
||||||
|
readOnlyRootFilesystem: false
|
||||||
|
persistence:
|
||||||
|
storageClass: local-path
|
||||||
|
size: 20Gi
|
||||||
|
customLivenessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- exec pg_isready -U "postgres" -d postgres -h 127.0.0.1 -p 5432
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
periodSeconds: 10
|
||||||
|
timeoutSeconds: 5
|
||||||
|
successThreshold: 1
|
||||||
|
failureThreshold: 6
|
||||||
|
customReadinessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- exec pg_isready -U "postgres" -d postgres -h 127.0.0.1 -p 5432
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
periodSeconds: 10
|
||||||
|
timeoutSeconds: 5
|
||||||
|
successThreshold: 1
|
||||||
|
failureThreshold: 6
|
||||||
|
customStartupProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- exec pg_isready -U "postgres" -d postgres -h 127.0.0.1 -p 5432
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
periodSeconds: 10
|
||||||
|
timeoutSeconds: 5
|
||||||
|
successThreshold: 1
|
||||||
|
failureThreshold: 6
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 50m
|
||||||
|
memory: 128Mi
|
||||||
|
nodeSelector:
|
||||||
|
dedicated: db
|
||||||
|
tolerations:
|
||||||
|
- key: dedicated
|
||||||
|
operator: Equal
|
||||||
|
value: db
|
||||||
|
effect: NoSchedule
|
||||||
|
contour:
|
||||||
|
enabled: true
|
||||||
|
adminUser: "postgres"
|
||||||
|
sharedPreloadLibraries: ""
|
||||||
|
vault:
|
||||||
|
enabled: true
|
||||||
|
role: postgresql
|
||||||
|
authPath: auth/kubernetes
|
||||||
|
secretPath: secrets/data/postgresql/admin
|
||||||
|
secretKey: postgres-password
|
||||||
|
usersSecretPath: secrets/data/postgresql/users
|
||||||
|
databases:
|
||||||
|
- name: comparisons_db
|
||||||
|
user: comparisons
|
||||||
|
passwordKey: comparisons
|
||||||
|
extensions: []
|
||||||
|
restoreFromDump: true
|
||||||
|
dumpKey: "sanitized_dumps_multi/comparisons/288/comparisons_company288_20260626T202844Z.tar.gz"
|
||||||
|
s3-proxy:
|
||||||
|
endpointUrl: "s3-proxy-service.postgresql.svc.cluster.local"
|
||||||
13
apps/comparisons/yc-k8s-test/replicas.yaml
Normal file
13
apps/comparisons/yc-k8s-test/replicas.yaml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
---
|
||||||
|
apiVersion: helm.toolkit.fluxcd.io/v2
|
||||||
|
kind: HelmRelease
|
||||||
|
metadata:
|
||||||
|
name: backend
|
||||||
|
namespace: comparisons
|
||||||
|
spec:
|
||||||
|
values:
|
||||||
|
services:
|
||||||
|
backend:
|
||||||
|
deployment:
|
||||||
|
replicaCount:
|
||||||
|
_default: 1
|
||||||
@ -112,18 +112,18 @@ spec:
|
|||||||
vault.hashicorp.com/agent-inject-secret-contracts-s3: secrets/data/minio/apps/contracts
|
vault.hashicorp.com/agent-inject-secret-contracts-s3: secrets/data/minio/apps/contracts
|
||||||
vault.hashicorp.com/agent-inject-template-contracts-s3: |-
|
vault.hashicorp.com/agent-inject-template-contracts-s3: |-
|
||||||
{{- with secret "secrets/data/minio/apps/contracts" -}}
|
{{- with secret "secrets/data/minio/apps/contracts" -}}
|
||||||
CONTRACTS_S3_ENDPOINT={{ with index .Data.data "client" }}{{ index . "endpoint" }}{{ else }}{{ index .Data.data "endpoint" }}{{ end }}
|
CONTRACTS_S3_ENDPOINT={{ index .Data.data.client "endpoint" }}
|
||||||
CONTRACTS_S3_REGION={{ with index .Data.data "client" }}{{ index . "region" }}{{ else }}{{ index .Data.data "region" }}{{ end }}
|
CONTRACTS_S3_REGION={{ index .Data.data.client "region" }}
|
||||||
CONTRACTS_S3_BUCKET=contracts
|
CONTRACTS_S3_BUCKET=contracts
|
||||||
CONTRACTS_S3_ACCESS_KEY_ID={{ or (index .Data.data "access_key") (index .Data.data "access_key_id") }}
|
CONTRACTS_S3_ACCESS_KEY_ID={{ index .Data.data "access_key" }}
|
||||||
CONTRACTS_S3_SECRET_ACCESS_KEY={{ or (index .Data.data "secret_key") (index .Data.data "secret_access_key") }}
|
CONTRACTS_S3_SECRET_ACCESS_KEY={{ index .Data.data "secret_key" }}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
vault.hashicorp.com/agent-inject-secret-contracts-kafka: secrets/data/kafka/apps/contracts
|
vault.hashicorp.com/agent-inject-secret-contracts-kafka: secrets/data/kafka/apps/contracts
|
||||||
vault.hashicorp.com/agent-inject-template-contracts-kafka: |-
|
vault.hashicorp.com/agent-inject-template-contracts-kafka: |-
|
||||||
{{- with secret "secrets/data/kafka/apps/contracts" -}}
|
{{- with secret "secrets/data/kafka/apps/contracts" -}}
|
||||||
CONTRACTS_KAFKA_BOOTSTRAP_SERVERS={{ with index .Data.data "auth" }}{{ index . "bootstrap_servers" }}{{ else }}{{ index .Data.data "bootstrap_servers" }}{{ end }}
|
CONTRACTS_KAFKA_BOOTSTRAP_SERVERS={{ index .Data.data.auth "bootstrap_servers" }}
|
||||||
CONTRACTS_KAFKA_SECURITY_PROTOCOL={{ with index .Data.data "auth" }}{{ index . "security_protocol" }}{{ else }}{{ index .Data.data "security_protocol" }}{{ end }}
|
CONTRACTS_KAFKA_SECURITY_PROTOCOL={{ index .Data.data.auth "security_protocol" }}
|
||||||
CONTRACTS_KAFKA_SASL_MECHANISM={{ with index .Data.data "auth" }}{{ index . "sasl_mechanism" }}{{ else }}{{ index .Data.data "sasl_mechanism" }}{{ end }}
|
CONTRACTS_KAFKA_SASL_MECHANISM={{ index .Data.data.auth "sasl_mechanism" }}
|
||||||
CONTRACTS_KAFKA_USERNAME={{ index .Data.data "username" }}
|
CONTRACTS_KAFKA_USERNAME={{ index .Data.data "username" }}
|
||||||
CONTRACTS_KAFKA_PASSWORD={{ index .Data.data "password" }}
|
CONTRACTS_KAFKA_PASSWORD={{ index .Data.data "password" }}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|||||||
@ -1,39 +0,0 @@
|
|||||||
apiVersion: helm.toolkit.fluxcd.io/v2
|
|
||||||
kind: HelmRelease
|
|
||||||
metadata:
|
|
||||||
name: contracts
|
|
||||||
namespace: contracts
|
|
||||||
spec:
|
|
||||||
values:
|
|
||||||
services:
|
|
||||||
contracts:
|
|
||||||
podAnnotations:
|
|
||||||
_default:
|
|
||||||
vault.hashicorp.com/agent-inject-secret-contracts-jwt-public: secrets/data/vault/common/jwt_public
|
|
||||||
vault.hashicorp.com/agent-inject-template-contracts-jwt-public: '{{- with
|
|
||||||
secret "secrets/data/vault/common/jwt_public" -}}
|
|
||||||
|
|
||||||
{{ index .Data.data "public_key" }}
|
|
||||||
|
|
||||||
{{- end -}}'
|
|
||||||
deployment:
|
|
||||||
args:
|
|
||||||
_default:
|
|
||||||
- 'set -a
|
|
||||||
|
|
||||||
[ -f /vault/secrets/contracts-db ] && . /vault/secrets/contracts-db
|
|
||||||
|
|
||||||
[ -f /vault/secrets/contracts-jwt-public ] && export PUBLIC_KEY="$(cat
|
|
||||||
/vault/secrets/contracts-jwt-public)"
|
|
||||||
|
|
||||||
[ -f /vault/secrets/contracts-rabbitmq ] && . /vault/secrets/contracts-rabbitmq
|
|
||||||
|
|
||||||
[ -f /vault/secrets/contracts-s3 ] && . /vault/secrets/contracts-s3
|
|
||||||
|
|
||||||
[ -f /vault/secrets/contracts-kafka ] && . /vault/secrets/contracts-kafka
|
|
||||||
|
|
||||||
set +a
|
|
||||||
|
|
||||||
exec /usr/local/bin/http
|
|
||||||
|
|
||||||
'
|
|
||||||
@ -1,39 +0,0 @@
|
|||||||
apiVersion: helm.toolkit.fluxcd.io/v2
|
|
||||||
kind: HelmRelease
|
|
||||||
metadata:
|
|
||||||
name: contracts
|
|
||||||
namespace: contracts
|
|
||||||
spec:
|
|
||||||
values:
|
|
||||||
services:
|
|
||||||
contracts:
|
|
||||||
podAnnotations:
|
|
||||||
_default:
|
|
||||||
vault.hashicorp.com/agent-inject-secret-contracts-jwt-public: secrets/data/vault/common/jwt_public
|
|
||||||
vault.hashicorp.com/agent-inject-template-contracts-jwt-public: '{{- with
|
|
||||||
secret "secrets/data/vault/common/jwt_public" -}}
|
|
||||||
|
|
||||||
{{ index .Data.data "public_key" }}
|
|
||||||
|
|
||||||
{{- end -}}'
|
|
||||||
deployment:
|
|
||||||
args:
|
|
||||||
_default:
|
|
||||||
- 'set -a
|
|
||||||
|
|
||||||
[ -f /vault/secrets/contracts-db ] && . /vault/secrets/contracts-db
|
|
||||||
|
|
||||||
[ -f /vault/secrets/contracts-jwt-public ] && export PUBLIC_KEY="$(cat
|
|
||||||
/vault/secrets/contracts-jwt-public)"
|
|
||||||
|
|
||||||
[ -f /vault/secrets/contracts-rabbitmq ] && . /vault/secrets/contracts-rabbitmq
|
|
||||||
|
|
||||||
[ -f /vault/secrets/contracts-s3 ] && . /vault/secrets/contracts-s3
|
|
||||||
|
|
||||||
[ -f /vault/secrets/contracts-kafka ] && . /vault/secrets/contracts-kafka
|
|
||||||
|
|
||||||
set +a
|
|
||||||
|
|
||||||
exec /usr/local/bin/http
|
|
||||||
|
|
||||||
'
|
|
||||||
11
apps/contracts/yc-k8s-test/kustomization.yaml
Normal file
11
apps/contracts/yc-k8s-test/kustomization.yaml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
resources:
|
||||||
|
- ../base
|
||||||
|
- postgresql.yaml
|
||||||
|
patches: []
|
||||||
|
# - path: replicas.yaml
|
||||||
|
# target:
|
||||||
|
# kind: Deployment
|
||||||
|
# name: backend
|
||||||
126
apps/contracts/yc-k8s-test/postgresql.yaml
Normal file
126
apps/contracts/yc-k8s-test/postgresql.yaml
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
apiVersion: helm.toolkit.fluxcd.io/v2
|
||||||
|
kind: HelmRelease
|
||||||
|
metadata:
|
||||||
|
name: postgresql
|
||||||
|
namespace: contracts
|
||||||
|
spec:
|
||||||
|
interval: 5m
|
||||||
|
timeout: 2h
|
||||||
|
chart:
|
||||||
|
spec:
|
||||||
|
chart: postgresql-contour
|
||||||
|
version: "13.0.15"
|
||||||
|
sourceRef:
|
||||||
|
kind: HelmRepository
|
||||||
|
name: yc-oci-charts
|
||||||
|
namespace: flux-system
|
||||||
|
|
||||||
|
install:
|
||||||
|
timeout: 2h
|
||||||
|
remediation:
|
||||||
|
retries: 3
|
||||||
|
|
||||||
|
upgrade:
|
||||||
|
timeout: 2h
|
||||||
|
remediation:
|
||||||
|
retries: 3
|
||||||
|
|
||||||
|
values:
|
||||||
|
global:
|
||||||
|
security:
|
||||||
|
allowInsecureImages: true
|
||||||
|
defaultStorageClass: local-path
|
||||||
|
postgresql:
|
||||||
|
auth:
|
||||||
|
username: ""
|
||||||
|
database: ""
|
||||||
|
secretKeys:
|
||||||
|
userPasswordKey: "postgres-password"
|
||||||
|
auth:
|
||||||
|
username: ""
|
||||||
|
database: ""
|
||||||
|
secretKeys:
|
||||||
|
userPasswordKey: "postgres-password"
|
||||||
|
image:
|
||||||
|
registry: cr.yandex/crp3ccidau046kdj8g9q
|
||||||
|
repository: contour/postgresql
|
||||||
|
tag: 13.0.15
|
||||||
|
pullPolicy: Always
|
||||||
|
metrics:
|
||||||
|
enabled: false
|
||||||
|
prometheusRule:
|
||||||
|
enabled: false
|
||||||
|
primary:
|
||||||
|
containerSecurityContext:
|
||||||
|
readOnlyRootFilesystem: false
|
||||||
|
persistence:
|
||||||
|
storageClass: local-path
|
||||||
|
size: 20Gi
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 50m
|
||||||
|
memory: 128Mi
|
||||||
|
customLivenessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- exec pg_isready -U "postgres" -d postgres -h 127.0.0.1 -p 5432
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
periodSeconds: 10
|
||||||
|
timeoutSeconds: 5
|
||||||
|
successThreshold: 1
|
||||||
|
failureThreshold: 6
|
||||||
|
customReadinessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- exec pg_isready -U "postgres" -d postgres -h 127.0.0.1 -p 5432
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
periodSeconds: 10
|
||||||
|
timeoutSeconds: 5
|
||||||
|
successThreshold: 1
|
||||||
|
failureThreshold: 6
|
||||||
|
customStartupProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- exec pg_isready -U "postgres" -d postgres -h 127.0.0.1 -p 5432
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
periodSeconds: 10
|
||||||
|
timeoutSeconds: 5
|
||||||
|
successThreshold: 1
|
||||||
|
failureThreshold: 6
|
||||||
|
nodeSelector:
|
||||||
|
dedicated: db
|
||||||
|
tolerations:
|
||||||
|
- key: dedicated
|
||||||
|
operator: Equal
|
||||||
|
value: db
|
||||||
|
effect: NoSchedule
|
||||||
|
contour:
|
||||||
|
enabled: true
|
||||||
|
adminUser: "postgres"
|
||||||
|
sharedPreloadLibraries: ""
|
||||||
|
vault:
|
||||||
|
enabled: true
|
||||||
|
role: postgresql
|
||||||
|
authPath: auth/kubernetes
|
||||||
|
secretPath: secrets/data/postgresql/admin
|
||||||
|
secretKey: postgres-password
|
||||||
|
usersSecretPath: secrets/data/postgresql/users
|
||||||
|
databases:
|
||||||
|
- name: contracts_db
|
||||||
|
user: contracts
|
||||||
|
passwordKey: contracts
|
||||||
|
extensions:
|
||||||
|
- btree_gist
|
||||||
|
- ltree
|
||||||
|
- pg_stat_statements
|
||||||
|
- uuid-ossp
|
||||||
|
restoreFromDump: true
|
||||||
|
dumpKey: "sanitized_dumps_multi/contracts/288/contracts_company288_20260626T202844Z.tar.gz"
|
||||||
|
s3-proxy:
|
||||||
|
endpointUrl: "s3-proxy-service.postgresql.svc.cluster.local"
|
||||||
7
apps/contracts/yc-k8s-test/replicas.yaml
Normal file
7
apps/contracts/yc-k8s-test/replicas.yaml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: backend
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
@ -19,11 +19,11 @@ spec:
|
|||||||
|
|
||||||
install:
|
install:
|
||||||
remediation:
|
remediation:
|
||||||
retries: 1
|
retries: 3
|
||||||
|
|
||||||
upgrade:
|
upgrade:
|
||||||
remediation:
|
remediation:
|
||||||
retries: 1
|
retries: 3
|
||||||
|
|
||||||
values:
|
values:
|
||||||
global:
|
global:
|
||||||
@ -35,7 +35,7 @@ spec:
|
|||||||
|
|
||||||
image:
|
image:
|
||||||
name:
|
name:
|
||||||
_default: cr.yandex/crp3ccidau046kdj8g9q/admin-frontend:uralkal_4d0a3684
|
_default: cr.yandex/crp3ccidau046kdj8g9q/admin-frontend:contour_9dc27b40
|
||||||
pullPolicy:
|
pullPolicy:
|
||||||
_default: IfNotPresent
|
_default: IfNotPresent
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ spec:
|
|||||||
|
|
||||||
image:
|
image:
|
||||||
name:
|
name:
|
||||||
_default: cr.yandex/crp3ccidau046kdj8g9q/srx-admin:prod_6526c293
|
_default: cr.yandex/crp3ccidau046kdj8g9q/srx-admin:prod_638c3442
|
||||||
pullPolicy:
|
pullPolicy:
|
||||||
_default: IfNotPresent
|
_default: IfNotPresent
|
||||||
|
|
||||||
|
|||||||
@ -4,5 +4,5 @@ kind: Kustomization
|
|||||||
namespace: control-interface
|
namespace: control-interface
|
||||||
resources:
|
resources:
|
||||||
- helmrelease.yaml
|
- helmrelease.yaml
|
||||||
# - admin-frontend.yaml
|
- admin-frontend.yaml
|
||||||
|
|
||||||
|
|||||||
@ -1,94 +0,0 @@
|
|||||||
apiVersion: helm.toolkit.fluxcd.io/v2
|
|
||||||
kind: HelmRelease
|
|
||||||
metadata:
|
|
||||||
name: admin-frontend
|
|
||||||
namespace: django
|
|
||||||
|
|
||||||
spec:
|
|
||||||
interval: 10m
|
|
||||||
|
|
||||||
chart:
|
|
||||||
spec:
|
|
||||||
chart: universal-chart
|
|
||||||
version: "0.1.7"
|
|
||||||
sourceRef:
|
|
||||||
kind: HelmRepository
|
|
||||||
name: yc-oci-charts
|
|
||||||
namespace: flux-system
|
|
||||||
interval: 10m
|
|
||||||
|
|
||||||
install:
|
|
||||||
remediation:
|
|
||||||
retries: 1
|
|
||||||
|
|
||||||
upgrade:
|
|
||||||
remediation:
|
|
||||||
retries: 1
|
|
||||||
|
|
||||||
values:
|
|
||||||
global:
|
|
||||||
env: _default
|
|
||||||
|
|
||||||
services:
|
|
||||||
admin-frontend:
|
|
||||||
enabled: true
|
|
||||||
|
|
||||||
image:
|
|
||||||
name:
|
|
||||||
_default: cr.yandex/crp3ccidau046kdj8g9q/admin-frontend:uralkal_4d0a3684
|
|
||||||
pullPolicy:
|
|
||||||
_default: IfNotPresent
|
|
||||||
|
|
||||||
deployment:
|
|
||||||
enabled: true
|
|
||||||
|
|
||||||
name:
|
|
||||||
_default: admin-frontend
|
|
||||||
|
|
||||||
replicaCount:
|
|
||||||
_default: 1
|
|
||||||
|
|
||||||
port:
|
|
||||||
_default: 80
|
|
||||||
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
cpu:
|
|
||||||
_default: 100m
|
|
||||||
memory:
|
|
||||||
_default: 100Mi
|
|
||||||
|
|
||||||
probes:
|
|
||||||
liveness:
|
|
||||||
enabled: false
|
|
||||||
readiness:
|
|
||||||
enabled: false
|
|
||||||
|
|
||||||
service:
|
|
||||||
enabled: true
|
|
||||||
|
|
||||||
name:
|
|
||||||
_default: admin-frontend-svc
|
|
||||||
|
|
||||||
type:
|
|
||||||
_default: ClusterIP
|
|
||||||
|
|
||||||
port:
|
|
||||||
_default: 8080
|
|
||||||
|
|
||||||
targetPort:
|
|
||||||
_default: 80
|
|
||||||
|
|
||||||
portName:
|
|
||||||
_default: http
|
|
||||||
|
|
||||||
imagePullSecrets:
|
|
||||||
enabled:
|
|
||||||
_default: true
|
|
||||||
name:
|
|
||||||
_default: regcred
|
|
||||||
|
|
||||||
commitSha: ""
|
|
||||||
gitlabUri: ""
|
|
||||||
gitlabJobUrl: ""
|
|
||||||
owner: ""
|
|
||||||
@ -35,7 +35,7 @@ spec:
|
|||||||
|
|
||||||
image:
|
image:
|
||||||
name:
|
name:
|
||||||
_default: cr.yandex/crp3ccidau046kdj8g9q/srx-admin:prod_6526c293
|
_default: cr.yandex/crp3ccidau046kdj8g9q/srx-admin:prod_feb59026
|
||||||
pullPolicy:
|
pullPolicy:
|
||||||
_default: IfNotPresent
|
_default: IfNotPresent
|
||||||
|
|
||||||
|
|||||||
@ -4,4 +4,3 @@ kind: Kustomization
|
|||||||
namespace: django
|
namespace: django
|
||||||
resources:
|
resources:
|
||||||
- helmrelease.yaml
|
- helmrelease.yaml
|
||||||
- admin-frontend.yaml
|
|
||||||
|
|||||||
@ -1,79 +0,0 @@
|
|||||||
apiVersion: helm.toolkit.fluxcd.io/v2
|
|
||||||
kind: HelmRelease
|
|
||||||
metadata:
|
|
||||||
name: admin-frontend
|
|
||||||
namespace: django
|
|
||||||
spec:
|
|
||||||
interval: 10m
|
|
||||||
chart:
|
|
||||||
spec:
|
|
||||||
chart: universal-chart
|
|
||||||
version: 0.1.9
|
|
||||||
sourceRef:
|
|
||||||
kind: HelmRepository
|
|
||||||
name: yc-oci-charts
|
|
||||||
namespace: flux-system
|
|
||||||
interval: 10m
|
|
||||||
install:
|
|
||||||
remediation:
|
|
||||||
retries: 1
|
|
||||||
upgrade:
|
|
||||||
remediation:
|
|
||||||
retries: 1
|
|
||||||
values:
|
|
||||||
global:
|
|
||||||
env: _default
|
|
||||||
services:
|
|
||||||
admin-frontend:
|
|
||||||
enabled: true
|
|
||||||
image:
|
|
||||||
name:
|
|
||||||
_default: cr.yandex/crp3ccidau046kdj8g9q/admin-frontend:uralkal_4d0a3684
|
|
||||||
pullPolicy:
|
|
||||||
_default: IfNotPresent
|
|
||||||
deployment:
|
|
||||||
enabled: true
|
|
||||||
name:
|
|
||||||
_default: admin-frontend
|
|
||||||
replicaCount:
|
|
||||||
_default: 1
|
|
||||||
port:
|
|
||||||
_default: 80
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
cpu:
|
|
||||||
_default: 25m
|
|
||||||
memory:
|
|
||||||
_default: 128Mi
|
|
||||||
probes:
|
|
||||||
liveness:
|
|
||||||
enabled: false
|
|
||||||
readiness:
|
|
||||||
enabled: false
|
|
||||||
service:
|
|
||||||
enabled: true
|
|
||||||
name:
|
|
||||||
_default: admin-frontend-svc
|
|
||||||
type:
|
|
||||||
_default: ClusterIP
|
|
||||||
port:
|
|
||||||
_default: 8080
|
|
||||||
targetPort:
|
|
||||||
_default: 80
|
|
||||||
portName:
|
|
||||||
_default: http
|
|
||||||
imagePullSecrets:
|
|
||||||
enabled:
|
|
||||||
_default: true
|
|
||||||
name:
|
|
||||||
_default: regcred
|
|
||||||
commitSha: ''
|
|
||||||
gitlabUri: ''
|
|
||||||
gitlabJobUrl: ''
|
|
||||||
owner: ''
|
|
||||||
podAnnotations:
|
|
||||||
_default:
|
|
||||||
sidecar.istio.io/proxyCPU: 25m
|
|
||||||
sidecar.istio.io/proxyMemory: 128Mi
|
|
||||||
sidecar.istio.io/proxyCPULimit: '2'
|
|
||||||
sidecar.istio.io/proxyMemoryLimit: 1Gi
|
|
||||||
@ -1,6 +1,7 @@
|
|||||||
|
---
|
||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
namespace: control-interface
|
namespace: control-interface
|
||||||
resources:
|
resources:
|
||||||
|
- ../base
|
||||||
- namespace.yaml
|
- namespace.yaml
|
||||||
- admin-frontend.yaml
|
|
||||||
@ -2,3 +2,5 @@ apiVersion: v1
|
|||||||
kind: Namespace
|
kind: Namespace
|
||||||
metadata:
|
metadata:
|
||||||
name: control-interface
|
name: control-interface
|
||||||
|
labels:
|
||||||
|
istio-injection: enabled
|
||||||
@ -1,79 +0,0 @@
|
|||||||
apiVersion: helm.toolkit.fluxcd.io/v2
|
|
||||||
kind: HelmRelease
|
|
||||||
metadata:
|
|
||||||
name: admin-frontend
|
|
||||||
namespace: django
|
|
||||||
spec:
|
|
||||||
interval: 10m
|
|
||||||
chart:
|
|
||||||
spec:
|
|
||||||
chart: universal-chart
|
|
||||||
version: 0.1.9
|
|
||||||
sourceRef:
|
|
||||||
kind: HelmRepository
|
|
||||||
name: yc-oci-charts
|
|
||||||
namespace: flux-system
|
|
||||||
interval: 10m
|
|
||||||
install:
|
|
||||||
remediation:
|
|
||||||
retries: 1
|
|
||||||
upgrade:
|
|
||||||
remediation:
|
|
||||||
retries: 1
|
|
||||||
values:
|
|
||||||
global:
|
|
||||||
env: _default
|
|
||||||
services:
|
|
||||||
admin-frontend:
|
|
||||||
enabled: true
|
|
||||||
image:
|
|
||||||
name:
|
|
||||||
_default: cr.yandex/crp3ccidau046kdj8g9q/admin-frontend:uralkal_4d0a3684
|
|
||||||
pullPolicy:
|
|
||||||
_default: IfNotPresent
|
|
||||||
deployment:
|
|
||||||
enabled: true
|
|
||||||
name:
|
|
||||||
_default: admin-frontend
|
|
||||||
replicaCount:
|
|
||||||
_default: 1
|
|
||||||
port:
|
|
||||||
_default: 80
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
cpu:
|
|
||||||
_default: 25m
|
|
||||||
memory:
|
|
||||||
_default: 128Mi
|
|
||||||
probes:
|
|
||||||
liveness:
|
|
||||||
enabled: false
|
|
||||||
readiness:
|
|
||||||
enabled: false
|
|
||||||
service:
|
|
||||||
enabled: true
|
|
||||||
name:
|
|
||||||
_default: admin-frontend-svc
|
|
||||||
type:
|
|
||||||
_default: ClusterIP
|
|
||||||
port:
|
|
||||||
_default: 8080
|
|
||||||
targetPort:
|
|
||||||
_default: 80
|
|
||||||
portName:
|
|
||||||
_default: http
|
|
||||||
imagePullSecrets:
|
|
||||||
enabled:
|
|
||||||
_default: true
|
|
||||||
name:
|
|
||||||
_default: regcred
|
|
||||||
commitSha: ''
|
|
||||||
gitlabUri: ''
|
|
||||||
gitlabJobUrl: ''
|
|
||||||
owner: ''
|
|
||||||
podAnnotations:
|
|
||||||
_default:
|
|
||||||
sidecar.istio.io/proxyCPU: 25m
|
|
||||||
sidecar.istio.io/proxyMemory: 128Mi
|
|
||||||
sidecar.istio.io/proxyCPULimit: '2'
|
|
||||||
sidecar.istio.io/proxyMemoryLimit: 1Gi
|
|
||||||
@ -10,4 +10,4 @@ spec:
|
|||||||
frontend:
|
frontend:
|
||||||
image:
|
image:
|
||||||
name:
|
name:
|
||||||
_default: 10.4.10.187:80/library/srx-admin:prod_6526c293
|
_default: 10.4.10.187:80/library/srx-admin:prod_638c3442
|
||||||
|
|||||||
@ -1,183 +0,0 @@
|
|||||||
---
|
|
||||||
apiVersion: apps/v1
|
|
||||||
kind: Deployment
|
|
||||||
metadata:
|
|
||||||
name: ams-sync
|
|
||||||
namespace: control-interface
|
|
||||||
labels:
|
|
||||||
app: ams-sync
|
|
||||||
service: backend
|
|
||||||
spec:
|
|
||||||
replicas: 1
|
|
||||||
selector:
|
|
||||||
matchLabels:
|
|
||||||
app: ams-sync
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
app: ams-sync
|
|
||||||
service: backend
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: backend
|
|
||||||
image: cr.yandex/crp3ccidau046kdj8g9q/ams-sync:ugok
|
|
||||||
command: ["sleep", "999999999999"]
|
|
||||||
imagePullPolicy: IfNotPresent
|
|
||||||
ports:
|
|
||||||
- name: http
|
|
||||||
containerPort: 8000
|
|
||||||
protocol: TCP
|
|
||||||
env:
|
|
||||||
- name: AMS_SYNC_TOPIC
|
|
||||||
value: ams-sync
|
|
||||||
- name: ENVIRONMENT
|
|
||||||
value: PRODUCTION
|
|
||||||
- name: HOST_ORGANIZATION_ID
|
|
||||||
value: '392748423989716183'
|
|
||||||
- name: ALERT_ENABLED
|
|
||||||
value: 'False'
|
|
||||||
- name: USER_SERVER_HOST
|
|
||||||
value: https://sarex.local.uralkali.com
|
|
||||||
- name: AUTH_HOST
|
|
||||||
value: https://sarex.local.uralkali.com
|
|
||||||
- name: VERIFY_USERS
|
|
||||||
value: 'True'
|
|
||||||
- name: KAFKA_SECURITY_PROTOCOL
|
|
||||||
value: SSL
|
|
||||||
- name: KAFKA_SASL_MECHANISM
|
|
||||||
value: SCRAM-SHA-512
|
|
||||||
- name: RESOURCES_INTERNAL_HOST
|
|
||||||
value: http://iams.iam.svc.cluster.local:8080
|
|
||||||
- name: TELEGRAM_TOKEN
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: telegram-secret
|
|
||||||
key: telegram-token
|
|
||||||
- name: TELEGRAM_GROUP_ID
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: telegram-secret
|
|
||||||
key: telegram-group-id
|
|
||||||
- name: ZITADEL_HOST
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: zitadel-token-secret
|
|
||||||
key: zitadel-host
|
|
||||||
- name: ZITADEL_SERVICE_ACCESS_TOKEN
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: zitadel-token-secret
|
|
||||||
key: zitadel-access-token
|
|
||||||
- name: KAFKA_BOOTSTRAP_SERVERS
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: ams-kafka-secret
|
|
||||||
key: kafka-bootstrap-servers
|
|
||||||
- name: KAFKA_SASL_PLAIN_USERNAME
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: ams-kafka-secret
|
|
||||||
key: kafka-username
|
|
||||||
- name: KAFKA_SASL_PLAIN_PASSWORD
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: ams-kafka-secret
|
|
||||||
key: kafka-password
|
|
||||||
- name: KAFKA_SSL_CAFILE
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: ams-kafka-secret
|
|
||||||
key: kafka-ca-file
|
|
||||||
- name: AUTH_ADMIN_USERNAME
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: auth-secret
|
|
||||||
key: admin-username
|
|
||||||
- name: AUTH_ADMIN_PASSWORD
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: auth-secret
|
|
||||||
key: admin-password
|
|
||||||
- name: USER_DB_NAME
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: user-db-secret
|
|
||||||
key: user-db-name
|
|
||||||
- name: USER_DB_USER
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: user-db-secret
|
|
||||||
key: user-db-user
|
|
||||||
- name: USER_DB_PASSWORD
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: user-db-secret
|
|
||||||
key: user-db-password
|
|
||||||
- name: USER_DB_HOST
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: user-db-secret
|
|
||||||
key: user-db-host
|
|
||||||
- name: USER_DB_PORT
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: user-db-secret
|
|
||||||
key: user-db-port
|
|
||||||
imagePullSecrets:
|
|
||||||
- name: regcred
|
|
||||||
---
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Secret
|
|
||||||
metadata:
|
|
||||||
name: ams-kafka-secret
|
|
||||||
namespace: control-interface
|
|
||||||
type: Opaque
|
|
||||||
data:
|
|
||||||
kafka-bootstrap-servers: WyJicnVzbmlrYS1zdGFnZS1rYWZrYS1ib290c3RyYXAua2Fma2Euc3ZjLmNsdXN0ZXIubG9jYWw6OTA5MyJd
|
|
||||||
kafka-ca-file: L2V0Yy9jYS1jZXJ0aWZpY2F0ZXMvWWFuZGV4L1lhbmRleEludGVybmFsUm9vdENBLmNydA==
|
|
||||||
kafka-password: bkszNnNhc3ZTZm9JdEpuWFE0cXhhdjJPVVdJUFg1WkM=
|
|
||||||
kafka-username: c2FyZXg=
|
|
||||||
---
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Secret
|
|
||||||
metadata:
|
|
||||||
name: auth-secret
|
|
||||||
namespace: control-interface
|
|
||||||
type: Opaque
|
|
||||||
data:
|
|
||||||
admin-password: emVhbG90MDk2
|
|
||||||
admin-username: aGFnZW4wMTM=
|
|
||||||
host: aHR0cHM6Ly9zYXJleC5sb2NhbC51cmFsa2FsaS5jb20=
|
|
||||||
---
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Secret
|
|
||||||
metadata:
|
|
||||||
name: telegram-secret
|
|
||||||
namespace: control-interface
|
|
||||||
type: Opaque
|
|
||||||
data:
|
|
||||||
telegram-group-id: LTEwMDIzNTAyNzE=
|
|
||||||
telegram-token: NzAyOTgxMDQ2ODpBQUZBUUI1X0Y5TV92R2RndGlXOVBDRzVTUndIcFg2SnNUZw==
|
|
||||||
---
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Secret
|
|
||||||
metadata:
|
|
||||||
name: user-db-secret
|
|
||||||
namespace: control-interface
|
|
||||||
type: Opaque
|
|
||||||
data:
|
|
||||||
user-db-host: MTAuMTMzLjAuMjQ5
|
|
||||||
user-db-name: c2FyZXhfZGI=
|
|
||||||
user-db-password: QXNOUkE3WUhoUVlIWnNCRXFRUVBxRUUwdEU0ZmtwTTU=
|
|
||||||
user-db-port: NTQzMg==
|
|
||||||
user-db-user: ZGphbmdv
|
|
||||||
---
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Secret
|
|
||||||
metadata:
|
|
||||||
name: zitadel-token-secret
|
|
||||||
namespace: control-interface
|
|
||||||
type: Opaque
|
|
||||||
data:
|
|
||||||
zitadel-access-token: SHBKVjljeUxNM3ZJWXJOVklUbVdNMDE4QnJUV3kzVmVyM3JLc0EwSlFzZFJOT01oUnpzbVdxTk1MeF9kUDlkZ0ZVUnoxZm8=
|
|
||||||
zitadel-host: aHR0cHM6Ly9sb2dpbi5zYXJleC5sb2NhbC51cmFsa2FsaS5jb20=
|
|
||||||
@ -3,6 +3,4 @@ kind: Kustomization
|
|||||||
resources:
|
resources:
|
||||||
- ../base
|
- ../base
|
||||||
- namespace.yaml
|
- namespace.yaml
|
||||||
- admin-frontend.yaml
|
|
||||||
- psql-tools-debug.yaml
|
- psql-tools-debug.yaml
|
||||||
- ams-sync.yaml
|
|
||||||
|
|||||||
@ -1,94 +0,0 @@
|
|||||||
apiVersion: helm.toolkit.fluxcd.io/v2
|
|
||||||
kind: HelmRelease
|
|
||||||
metadata:
|
|
||||||
name: admin-frontend
|
|
||||||
namespace: control-interface
|
|
||||||
|
|
||||||
spec:
|
|
||||||
interval: 10m
|
|
||||||
|
|
||||||
chart:
|
|
||||||
spec:
|
|
||||||
chart: universal-chart
|
|
||||||
version: "0.1.7"
|
|
||||||
sourceRef:
|
|
||||||
kind: HelmRepository
|
|
||||||
name: yc-oci-charts
|
|
||||||
namespace: flux-system
|
|
||||||
interval: 10m
|
|
||||||
|
|
||||||
install:
|
|
||||||
remediation:
|
|
||||||
retries: 1
|
|
||||||
|
|
||||||
upgrade:
|
|
||||||
remediation:
|
|
||||||
retries: 1
|
|
||||||
|
|
||||||
values:
|
|
||||||
global:
|
|
||||||
env: _default
|
|
||||||
|
|
||||||
services:
|
|
||||||
admin-frontend:
|
|
||||||
enabled: true
|
|
||||||
|
|
||||||
image:
|
|
||||||
name:
|
|
||||||
_default: cr.yandex/crp3ccidau046kdj8g9q/admin-frontend:uralkal_4d0a3684
|
|
||||||
pullPolicy:
|
|
||||||
_default: IfNotPresent
|
|
||||||
|
|
||||||
deployment:
|
|
||||||
enabled: true
|
|
||||||
|
|
||||||
name:
|
|
||||||
_default: admin-frontend
|
|
||||||
|
|
||||||
replicaCount:
|
|
||||||
_default: 1
|
|
||||||
|
|
||||||
port:
|
|
||||||
_default: 80
|
|
||||||
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
cpu:
|
|
||||||
_default: 100m
|
|
||||||
memory:
|
|
||||||
_default: 100Mi
|
|
||||||
|
|
||||||
probes:
|
|
||||||
liveness:
|
|
||||||
enabled: false
|
|
||||||
readiness:
|
|
||||||
enabled: false
|
|
||||||
|
|
||||||
service:
|
|
||||||
enabled: true
|
|
||||||
|
|
||||||
name:
|
|
||||||
_default: admin-frontend-svc
|
|
||||||
|
|
||||||
type:
|
|
||||||
_default: ClusterIP
|
|
||||||
|
|
||||||
port:
|
|
||||||
_default: 8080
|
|
||||||
|
|
||||||
targetPort:
|
|
||||||
_default: 80
|
|
||||||
|
|
||||||
portName:
|
|
||||||
_default: http
|
|
||||||
|
|
||||||
imagePullSecrets:
|
|
||||||
enabled:
|
|
||||||
_default: true
|
|
||||||
name:
|
|
||||||
_default: dockerhub
|
|
||||||
|
|
||||||
commitSha: ""
|
|
||||||
gitlabUri: ""
|
|
||||||
gitlabJobUrl: ""
|
|
||||||
owner: ""
|
|
||||||
11
apps/control-interface/yc-k8s-test/kustomization.yaml
Normal file
11
apps/control-interface/yc-k8s-test/kustomization.yaml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
namespace: django
|
||||||
|
resources:
|
||||||
|
- ../base
|
||||||
|
patches:
|
||||||
|
- path: replicas.yaml
|
||||||
|
target:
|
||||||
|
kind: HelmRelease
|
||||||
|
name: srx-admin
|
||||||
13
apps/control-interface/yc-k8s-test/replicas.yaml
Normal file
13
apps/control-interface/yc-k8s-test/replicas.yaml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
---
|
||||||
|
apiVersion: helm.toolkit.fluxcd.io/v2
|
||||||
|
kind: HelmRelease
|
||||||
|
metadata:
|
||||||
|
name: srx-admin
|
||||||
|
namespace: django
|
||||||
|
spec:
|
||||||
|
values:
|
||||||
|
services:
|
||||||
|
frontend:
|
||||||
|
deployment:
|
||||||
|
replicaCount:
|
||||||
|
_default: 1
|
||||||
@ -8,9 +8,6 @@ spec:
|
|||||||
values:
|
values:
|
||||||
services:
|
services:
|
||||||
frontend:
|
frontend:
|
||||||
image:
|
|
||||||
name:
|
|
||||||
_default: cr.yandex/crp3ccidau046kdj8g9q/cross-section-app:contour_c5e5d476@sha256:04e0eb23df7138eb6c0dad6d790c7229607cb70eb7a4d7448aa70a236caa7d52
|
|
||||||
deployment:
|
deployment:
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
|
|||||||
10
apps/cross-section/yc-k8s-test/kustomization.yaml
Normal file
10
apps/cross-section/yc-k8s-test/kustomization.yaml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
resources:
|
||||||
|
- ../base
|
||||||
|
patches:
|
||||||
|
- path: replicas.yaml
|
||||||
|
target:
|
||||||
|
kind: HelmRelease
|
||||||
|
name: cross-section-static
|
||||||
13
apps/cross-section/yc-k8s-test/replicas.yaml
Normal file
13
apps/cross-section/yc-k8s-test/replicas.yaml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
---
|
||||||
|
apiVersion: helm.toolkit.fluxcd.io/v2
|
||||||
|
kind: HelmRelease
|
||||||
|
metadata:
|
||||||
|
name: cross-section-static
|
||||||
|
namespace: cross-section
|
||||||
|
spec:
|
||||||
|
values:
|
||||||
|
services:
|
||||||
|
frontend:
|
||||||
|
deployment:
|
||||||
|
replicaCount:
|
||||||
|
_default: 1
|
||||||
@ -288,7 +288,7 @@ Module Federation) конфигурируется отдельно на этап
|
|||||||
## Конфигурация в кластере (Kubernetes)
|
## Конфигурация в кластере (Kubernetes)
|
||||||
|
|
||||||
Манифесты приложения — в этом же каталоге (`base/`, оверлеи `brusnika-stage`,
|
Манифесты приложения — в этом же каталоге (`base/`, оверлеи `brusnika-stage`,
|
||||||
`brusnika-prod`). Секреты монтируются через **Vault Agent Injector**
|
`brusnika-prod`, `yc-k8s-test`). Секреты монтируются через **Vault Agent Injector**
|
||||||
(аннотации `vault.hashicorp.com/*` на Deployment `backend` и `celery`). Файлы
|
(аннотации `vault.hashicorp.com/*` на Deployment `backend` и `celery`). Файлы
|
||||||
секретов в контейнере и их содержимое:
|
секретов в контейнере и их содержимое:
|
||||||
|
|
||||||
|
|||||||
@ -35,7 +35,7 @@ spec:
|
|||||||
|
|
||||||
image:
|
image:
|
||||||
name:
|
name:
|
||||||
_default: cr.yandex/crp3ccidau046kdj8g9q/backend:production_18e5ac1e
|
_default: cr.yandex/crp3ccidau046kdj8g9q/backend:production_7d0ec48b
|
||||||
pullPolicy:
|
pullPolicy:
|
||||||
_default: IfNotPresent
|
_default: IfNotPresent
|
||||||
|
|
||||||
|
|||||||
@ -35,7 +35,7 @@ spec:
|
|||||||
|
|
||||||
image:
|
image:
|
||||||
name:
|
name:
|
||||||
_default: cr.yandex/crp3ccidau046kdj8g9q/backend:production_18e5ac1e
|
_default: cr.yandex/crp3ccidau046kdj8g9q/backend:production_7d0ec48b
|
||||||
pullPolicy:
|
pullPolicy:
|
||||||
_default: IfNotPresent
|
_default: IfNotPresent
|
||||||
|
|
||||||
|
|||||||
@ -35,7 +35,7 @@ spec:
|
|||||||
|
|
||||||
image:
|
image:
|
||||||
name:
|
name:
|
||||||
_default: cr.yandex/crp3ccidau046kdj8g9q/sarex-frontend-dev:contour_5.37.0
|
_default: cr.yandex/crp3ccidau046kdj8g9q/sarex-frontend-dev:contour_5.22.3
|
||||||
pullPolicy:
|
pullPolicy:
|
||||||
_default: IfNotPresent
|
_default: IfNotPresent
|
||||||
|
|
||||||
|
|||||||
@ -8,9 +8,6 @@ spec:
|
|||||||
values:
|
values:
|
||||||
services:
|
services:
|
||||||
backend:
|
backend:
|
||||||
deployment:
|
|
||||||
replicaCount:
|
|
||||||
_default: 2
|
|
||||||
envs:
|
envs:
|
||||||
- name: ALLOWED_HOSTS
|
- name: ALLOWED_HOSTS
|
||||||
value:
|
value:
|
||||||
@ -132,6 +129,10 @@ spec:
|
|||||||
- name: ZITADEL_HOST
|
- name: ZITADEL_HOST
|
||||||
value:
|
value:
|
||||||
_default: https://sarex-login.uralmine.com
|
_default: https://sarex-login.uralmine.com
|
||||||
|
# Включено вместе с message-hub: он консьюмер топика message-hub-stage
|
||||||
|
# (SETTINGS_TOPICS в apps/message-hub/d8-ugmk-prod/message-hub.yaml),
|
||||||
|
# а писать в этот топик должен django. Vault-шаблон django-kafka
|
||||||
|
# и KAFKA_SSL_CAFILE уже есть в base — здесь только флаг.
|
||||||
- name: SERVER_KAFKA_ENABLED
|
- name: SERVER_KAFKA_ENABLED
|
||||||
value:
|
value:
|
||||||
_default: "True"
|
_default: "True"
|
||||||
|
|||||||
@ -1,60 +0,0 @@
|
|||||||
apiVersion: helm.toolkit.fluxcd.io/v2
|
|
||||||
kind: HelmRelease
|
|
||||||
metadata:
|
|
||||||
name: backend
|
|
||||||
namespace: django
|
|
||||||
spec:
|
|
||||||
values:
|
|
||||||
services:
|
|
||||||
backend:
|
|
||||||
podAnnotations:
|
|
||||||
_default:
|
|
||||||
vault.hashicorp.com/agent-inject-template-django-s3: '{{- with secret
|
|
||||||
"secrets/data/minio/apps/django" }}
|
|
||||||
|
|
||||||
AWS_S3_ENDPOINT_URL=http://${MINIO_ENDPOINT}
|
|
||||||
|
|
||||||
S3_HOST=http://${MINIO_ENDPOINT}
|
|
||||||
|
|
||||||
S3_BUCKET={{ index .Data.data "bucket" }}
|
|
||||||
|
|
||||||
S3_LOGIN={{ index .Data.data "access_key_id" }}
|
|
||||||
|
|
||||||
S3_PASSWORD={{ index .Data.data "secret_access_key" }}
|
|
||||||
|
|
||||||
AWS_S3_ACCESS_KEY_ID={{ index .Data.data "access_key_id" }}
|
|
||||||
|
|
||||||
AWS_S3_SECRET_ACCESS_KEY={{ index .Data.data "secret_access_key" }}
|
|
||||||
|
|
||||||
AWS_STORAGE_BUCKET_NAME={{ index .Data.data "bucket" }}
|
|
||||||
|
|
||||||
{{- end }}'
|
|
||||||
vault.hashicorp.com/agent-inject-secret-django-common: secrets/data/zitadel/setup
|
|
||||||
vault.hashicorp.com/agent-inject-template-django-common: '{{- with secret
|
|
||||||
"secrets/data/zitadel/setup" -}}
|
|
||||||
|
|
||||||
ZITADEL_ACCESS_TOKEN={{ index .Data.data "django_zitadel_access_token"
|
|
||||||
}}
|
|
||||||
|
|
||||||
{{- end -}}'
|
|
||||||
vault.hashicorp.com/agent-inject-secret-django-kafka: secrets/data/kafka/apps/iam
|
|
||||||
vault.hashicorp.com/agent-inject-template-django-kafka: '{{- with secret
|
|
||||||
"secrets/data/kafka/apps/iam" -}}
|
|
||||||
|
|
||||||
KAFKA_BOOTSTRAP_SERVERS=''["{{ with index .Data.data "auth" }}{{ index
|
|
||||||
. "bootstrap_servers" }}{{ else }}{{ index .Data.data "bootstrap_servers"
|
|
||||||
}}{{ end }}"]''
|
|
||||||
|
|
||||||
KAFKA_SECURITY_PROTOCOL=''SASL_PLAINTEXT''
|
|
||||||
|
|
||||||
KAFKA_SASL_MECHANISM=''SCRAM-SHA-512''
|
|
||||||
|
|
||||||
KAFKA_SASL_PLAIN_USERNAME=''{{ index .Data.data "username" }}''
|
|
||||||
|
|
||||||
KAFKA_SASL_PLAIN_PASSWORD=''{{ index .Data.data "password" }}''
|
|
||||||
|
|
||||||
KAFKA_SSL_CAFILE=''''
|
|
||||||
|
|
||||||
{{- end -}}'
|
|
||||||
traffic.sidecar.istio.io/excludeOutboundPorts: 8200,9092
|
|
||||||
proxy.istio.io/config: '{"holdApplicationUntilProxyStarts":true}'
|
|
||||||
@ -1,54 +0,0 @@
|
|||||||
apiVersion: helm.toolkit.fluxcd.io/v2
|
|
||||||
kind: HelmRelease
|
|
||||||
metadata:
|
|
||||||
name: celery
|
|
||||||
namespace: django
|
|
||||||
spec:
|
|
||||||
values:
|
|
||||||
services:
|
|
||||||
celery:
|
|
||||||
podAnnotations:
|
|
||||||
_default:
|
|
||||||
vault.hashicorp.com/agent-inject-template-django-s3: '{{- with secret
|
|
||||||
"secrets/data/minio/apps/django" }}
|
|
||||||
|
|
||||||
AWS_S3_ENDPOINT_URL=http://${MINIO_ENDPOINT}
|
|
||||||
|
|
||||||
S3_HOST=http://${MINIO_ENDPOINT}
|
|
||||||
|
|
||||||
S3_BUCKET={{ index .Data.data "bucket" }}
|
|
||||||
|
|
||||||
S3_LOGIN={{ index .Data.data "access_key_id" }}
|
|
||||||
|
|
||||||
S3_PASSWORD={{ index .Data.data "secret_access_key" }}
|
|
||||||
|
|
||||||
{{- end }}'
|
|
||||||
vault.hashicorp.com/agent-inject-secret-django-common: secrets/data/zitadel/setup
|
|
||||||
vault.hashicorp.com/agent-inject-template-django-common: '{{- with secret
|
|
||||||
"secrets/data/zitadel/setup" -}}
|
|
||||||
|
|
||||||
ZITADEL_ACCESS_TOKEN={{ index .Data.data "django_zitadel_access_token"
|
|
||||||
}}
|
|
||||||
|
|
||||||
{{- end -}}'
|
|
||||||
vault.hashicorp.com/agent-inject-secret-django-kafka: secrets/data/kafka/apps/iam
|
|
||||||
vault.hashicorp.com/agent-inject-template-django-kafka: '{{- with secret
|
|
||||||
"secrets/data/kafka/apps/iam" -}}
|
|
||||||
|
|
||||||
KAFKA_BOOTSTRAP_SERVERS=''["{{ with index .Data.data "auth" }}{{ index
|
|
||||||
. "bootstrap_servers" }}{{ else }}{{ index .Data.data "bootstrap_servers"
|
|
||||||
}}{{ end }}"]''
|
|
||||||
|
|
||||||
KAFKA_SECURITY_PROTOCOL=''SASL_PLAINTEXT''
|
|
||||||
|
|
||||||
KAFKA_SASL_MECHANISM=''SCRAM-SHA-512''
|
|
||||||
|
|
||||||
KAFKA_SASL_PLAIN_USERNAME=''{{ index .Data.data "username" }}''
|
|
||||||
|
|
||||||
KAFKA_SASL_PLAIN_PASSWORD=''{{ index .Data.data "password" }}''
|
|
||||||
|
|
||||||
KAFKA_SSL_CAFILE=''''
|
|
||||||
|
|
||||||
{{- end -}}'
|
|
||||||
traffic.sidecar.istio.io/excludeOutboundPorts: 8200,9092
|
|
||||||
proxy.istio.io/config: '{"holdApplicationUntilProxyStarts":true}'
|
|
||||||
@ -1,88 +0,0 @@
|
|||||||
apiVersion: helm.toolkit.fluxcd.io/v2
|
|
||||||
kind: HelmRelease
|
|
||||||
metadata:
|
|
||||||
name: export-project
|
|
||||||
namespace: django
|
|
||||||
spec:
|
|
||||||
interval: 10m
|
|
||||||
chart:
|
|
||||||
spec:
|
|
||||||
chart: universal-chart
|
|
||||||
version: 0.1.9
|
|
||||||
sourceRef:
|
|
||||||
kind: HelmRepository
|
|
||||||
name: yc-oci-charts
|
|
||||||
namespace: flux-system
|
|
||||||
interval: 10m
|
|
||||||
install:
|
|
||||||
remediation:
|
|
||||||
retries: 3
|
|
||||||
upgrade:
|
|
||||||
remediation:
|
|
||||||
retries: 3
|
|
||||||
values:
|
|
||||||
global:
|
|
||||||
env: _default
|
|
||||||
services:
|
|
||||||
backend:
|
|
||||||
enabled: true
|
|
||||||
image:
|
|
||||||
name:
|
|
||||||
_default: cr.yandex/crp3ccidau046kdj8g9q/export-project:prod_ef8aa756
|
|
||||||
pullPolicy:
|
|
||||||
_default: IfNotPresent
|
|
||||||
deployment:
|
|
||||||
enabled: true
|
|
||||||
name:
|
|
||||||
_default: export-project
|
|
||||||
replicaCount:
|
|
||||||
_default: 1
|
|
||||||
stage: 1
|
|
||||||
preprod: 3
|
|
||||||
production: 3
|
|
||||||
port:
|
|
||||||
_default: 8000
|
|
||||||
probes:
|
|
||||||
liveness:
|
|
||||||
enabled: false
|
|
||||||
readiness:
|
|
||||||
enabled: false
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
cpu:
|
|
||||||
_default: 25m
|
|
||||||
memory:
|
|
||||||
_default: 128Mi
|
|
||||||
service:
|
|
||||||
enabled: true
|
|
||||||
name:
|
|
||||||
_default: export-project-service
|
|
||||||
type:
|
|
||||||
_default: ClusterIP
|
|
||||||
port:
|
|
||||||
_default: 8000
|
|
||||||
targetPort:
|
|
||||||
_default: 8000
|
|
||||||
portName:
|
|
||||||
_default: http
|
|
||||||
imagePullSecrets:
|
|
||||||
enabled:
|
|
||||||
_default: true
|
|
||||||
name:
|
|
||||||
_default: regcred
|
|
||||||
labels:
|
|
||||||
monitoring: prometheus
|
|
||||||
envs:
|
|
||||||
- name: TIMEOUT
|
|
||||||
value:
|
|
||||||
_default: '180'
|
|
||||||
commitSha: ''
|
|
||||||
gitlabUri: ''
|
|
||||||
gitlabJobUrl: ''
|
|
||||||
owner: ''
|
|
||||||
podAnnotations:
|
|
||||||
_default:
|
|
||||||
sidecar.istio.io/proxyCPU: 25m
|
|
||||||
sidecar.istio.io/proxyMemory: 128Mi
|
|
||||||
sidecar.istio.io/proxyCPULimit: '2'
|
|
||||||
sidecar.istio.io/proxyMemoryLimit: 1Gi
|
|
||||||
@ -1,265 +0,0 @@
|
|||||||
apiVersion: helm.toolkit.fluxcd.io/v2
|
|
||||||
kind: HelmRelease
|
|
||||||
metadata:
|
|
||||||
name: backend
|
|
||||||
namespace: django
|
|
||||||
spec:
|
|
||||||
values:
|
|
||||||
services:
|
|
||||||
backend:
|
|
||||||
podAnnotations:
|
|
||||||
_default:
|
|
||||||
vault.hashicorp.com/agent-inject-secret-django-jwt-private: secrets/data/vault/apps/django/jwt_private
|
|
||||||
vault.hashicorp.com/agent-inject-secret-django-jwt-public: secrets/data/vault/common/jwt_public
|
|
||||||
vault.hashicorp.com/agent-inject-template-django-jwt-private: '{{- with
|
|
||||||
secret "secrets/data/vault/apps/django/jwt_private" -}}
|
|
||||||
|
|
||||||
{{ index .Data.data "private_key" }}
|
|
||||||
|
|
||||||
{{- end -}}'
|
|
||||||
vault.hashicorp.com/agent-inject-template-django-jwt-public: '{{- with
|
|
||||||
secret "secrets/data/vault/common/jwt_public" -}}
|
|
||||||
|
|
||||||
{{ index .Data.data "public_key" }}
|
|
||||||
|
|
||||||
{{- end -}}'
|
|
||||||
checksum/jwt-runtime: 58bae88d1d81ac414b2cac6ff81e0f441dc9a8f05a42d9d3d11bdfa97d38772b
|
|
||||||
vault.hashicorp.com/agent-inject-secret-jwt-signer-client: secrets/data/vault/apps/django/jwt_signer_client
|
|
||||||
vault.hashicorp.com/agent-inject-template-jwt-signer-client: '{{- with
|
|
||||||
secret "secrets/data/vault/apps/django/jwt_signer_client" -}}
|
|
||||||
|
|
||||||
JWT_SIGNER_CLIENT_TOKEN={{ index .Data.data "token" }}
|
|
||||||
|
|
||||||
{{- end -}}'
|
|
||||||
vault.hashicorp.com/role: django-backend
|
|
||||||
deployment:
|
|
||||||
args:
|
|
||||||
_default:
|
|
||||||
- 'set -a
|
|
||||||
|
|
||||||
[ -f /vault/secrets/django-postgresql ] && . /vault/secrets/django-postgresql
|
|
||||||
|
|
||||||
[ -f /vault/secrets/django-rabbitmq ] && . /vault/secrets/django-rabbitmq
|
|
||||||
|
|
||||||
[ -f /vault/secrets/django-s3 ] && . /vault/secrets/django-s3
|
|
||||||
|
|
||||||
[ -f /vault/secrets/django-kafka ] && . /vault/secrets/django-kafka
|
|
||||||
|
|
||||||
[ -f /vault/secrets/django-jwt-private ] && export JWT_PRIVATE_KEY="$(cat
|
|
||||||
/vault/secrets/django-jwt-private)"
|
|
||||||
|
|
||||||
[ -f /vault/secrets/django-jwt-public ] && export JWT_PUBLIC_KEY="$(cat
|
|
||||||
/vault/secrets/django-jwt-public)"
|
|
||||||
|
|
||||||
[ -f /vault/secrets/jwt-signer-client ] && . /vault/secrets/jwt-signer-client
|
|
||||||
|
|
||||||
set +a
|
|
||||||
|
|
||||||
exec /opt/sarex/entrypoint.sh
|
|
||||||
|
|
||||||
'
|
|
||||||
volumes:
|
|
||||||
_default:
|
|
||||||
- configMap:
|
|
||||||
items:
|
|
||||||
- key: production.py
|
|
||||||
path:
|
|
||||||
_default: production.py
|
|
||||||
name:
|
|
||||||
_default: django-configmap
|
|
||||||
mountPath:
|
|
||||||
_default: /jwt-config/original-production.py
|
|
||||||
name: django-configmap
|
|
||||||
readOnly:
|
|
||||||
_default: true
|
|
||||||
subPath:
|
|
||||||
_default: production.py
|
|
||||||
- configMap:
|
|
||||||
items:
|
|
||||||
- key: uwsgi.ini
|
|
||||||
path:
|
|
||||||
_default: uwsgi.ini
|
|
||||||
name:
|
|
||||||
_default: uwsgi-configmap
|
|
||||||
mountPath:
|
|
||||||
_default: /opt/sarex/uwsgi.ini
|
|
||||||
name: uwsgi-configmap
|
|
||||||
readOnly:
|
|
||||||
_default: true
|
|
||||||
subPath:
|
|
||||||
_default: uwsgi.ini
|
|
||||||
- name: jwt-runtime-production
|
|
||||||
mountPath:
|
|
||||||
_default: /opt/sarex/config/settings/production.py
|
|
||||||
subPath:
|
|
||||||
_default: production.py
|
|
||||||
readOnly:
|
|
||||||
_default: true
|
|
||||||
configMap:
|
|
||||||
name:
|
|
||||||
_default: jwt-runtime
|
|
||||||
items:
|
|
||||||
- key: production.py
|
|
||||||
path:
|
|
||||||
_default: production.py
|
|
||||||
- name: jwt-runtime-client
|
|
||||||
mountPath:
|
|
||||||
_default: /opt/sarex/config/jwt_signer_client.py
|
|
||||||
subPath:
|
|
||||||
_default: client.py
|
|
||||||
readOnly:
|
|
||||||
_default: true
|
|
||||||
configMap:
|
|
||||||
name:
|
|
||||||
_default: jwt-runtime
|
|
||||||
items:
|
|
||||||
- key: client.py
|
|
||||||
path:
|
|
||||||
_default: client.py
|
|
||||||
- name: jwt-runtime-urls
|
|
||||||
mountPath:
|
|
||||||
_default: /opt/sarex/config/jwt_signer_urls.py
|
|
||||||
subPath:
|
|
||||||
_default: urls.py
|
|
||||||
readOnly:
|
|
||||||
_default: true
|
|
||||||
configMap:
|
|
||||||
name:
|
|
||||||
_default: jwt-runtime
|
|
||||||
items:
|
|
||||||
- key: urls.py
|
|
||||||
path:
|
|
||||||
_default: urls.py
|
|
||||||
postRenderers:
|
|
||||||
- kustomize:
|
|
||||||
patches:
|
|
||||||
- target:
|
|
||||||
group: apps
|
|
||||||
version: v1
|
|
||||||
kind: Deployment
|
|
||||||
name: backend
|
|
||||||
patch: "- op: add\n path: /spec/template/spec/serviceAccountName\n value:\
|
|
||||||
\ django-backend-vault\n- op: add\n path: /spec/template/spec/containers/0/env/-\n\
|
|
||||||
\ value:\n name: JWT_SIGNER_MODE\n value: server\n"
|
|
||||||
---
|
|
||||||
apiVersion: helm.toolkit.fluxcd.io/v2
|
|
||||||
kind: HelmRelease
|
|
||||||
metadata:
|
|
||||||
name: celery
|
|
||||||
namespace: django
|
|
||||||
spec:
|
|
||||||
values:
|
|
||||||
services:
|
|
||||||
celery:
|
|
||||||
podAnnotations:
|
|
||||||
_default:
|
|
||||||
vault.hashicorp.com/agent-inject-secret-django-jwt-private: null
|
|
||||||
vault.hashicorp.com/agent-inject-secret-django-jwt-public: secrets/data/vault/common/jwt_public
|
|
||||||
vault.hashicorp.com/agent-inject-template-django-jwt-private: null
|
|
||||||
vault.hashicorp.com/agent-inject-template-django-jwt-public: '{{- with
|
|
||||||
secret "secrets/data/vault/common/jwt_public" -}}
|
|
||||||
|
|
||||||
{{ index .Data.data "public_key" }}
|
|
||||||
|
|
||||||
{{- end -}}'
|
|
||||||
checksum/jwt-runtime: 58bae88d1d81ac414b2cac6ff81e0f441dc9a8f05a42d9d3d11bdfa97d38772b
|
|
||||||
vault.hashicorp.com/agent-inject-secret-jwt-signer-client: secrets/data/vault/apps/django/jwt_signer_client
|
|
||||||
vault.hashicorp.com/agent-inject-template-jwt-signer-client: '{{- with
|
|
||||||
secret "secrets/data/vault/apps/django/jwt_signer_client" -}}
|
|
||||||
|
|
||||||
JWT_SIGNER_CLIENT_TOKEN={{ index .Data.data "token" }}
|
|
||||||
|
|
||||||
{{- end -}}'
|
|
||||||
vault.hashicorp.com/role: django-celery
|
|
||||||
deployment:
|
|
||||||
args:
|
|
||||||
_default:
|
|
||||||
- 'set -a
|
|
||||||
|
|
||||||
[ -f /vault/secrets/django-postgresql ] && . /vault/secrets/django-postgresql
|
|
||||||
|
|
||||||
[ -f /vault/secrets/django-rabbitmq ] && . /vault/secrets/django-rabbitmq
|
|
||||||
|
|
||||||
[ -f /vault/secrets/django-s3 ] && . /vault/secrets/django-s3
|
|
||||||
|
|
||||||
[ -f /vault/secrets/django-kafka ] && . /vault/secrets/django-kafka
|
|
||||||
|
|
||||||
[ -f /vault/secrets/django-jwt-public ] && export JWT_PUBLIC_KEY="$(cat
|
|
||||||
/vault/secrets/django-jwt-public)"
|
|
||||||
|
|
||||||
[ -f /vault/secrets/jwt-signer-client ] && . /vault/secrets/jwt-signer-client
|
|
||||||
|
|
||||||
set +a
|
|
||||||
|
|
||||||
exec celery -A config worker -B -l info -E -Q default -n default_worker.%h
|
|
||||||
--concurrency=2
|
|
||||||
|
|
||||||
'
|
|
||||||
volumes:
|
|
||||||
_default:
|
|
||||||
- configMap:
|
|
||||||
items:
|
|
||||||
- key: production.py
|
|
||||||
path:
|
|
||||||
_default: production.py
|
|
||||||
name:
|
|
||||||
_default: django-configmap
|
|
||||||
mountPath:
|
|
||||||
_default: /jwt-config/original-production.py
|
|
||||||
name: django-configmap
|
|
||||||
readOnly:
|
|
||||||
_default: true
|
|
||||||
subPath:
|
|
||||||
_default: production.py
|
|
||||||
- name: jwt-runtime-production
|
|
||||||
mountPath:
|
|
||||||
_default: /opt/sarex/config/settings/production.py
|
|
||||||
subPath:
|
|
||||||
_default: production.py
|
|
||||||
readOnly:
|
|
||||||
_default: true
|
|
||||||
configMap:
|
|
||||||
name:
|
|
||||||
_default: jwt-runtime
|
|
||||||
items:
|
|
||||||
- key: production.py
|
|
||||||
path:
|
|
||||||
_default: production.py
|
|
||||||
- name: jwt-runtime-client
|
|
||||||
mountPath:
|
|
||||||
_default: /opt/sarex/config/jwt_signer_client.py
|
|
||||||
subPath:
|
|
||||||
_default: client.py
|
|
||||||
readOnly:
|
|
||||||
_default: true
|
|
||||||
configMap:
|
|
||||||
name:
|
|
||||||
_default: jwt-runtime
|
|
||||||
items:
|
|
||||||
- key: client.py
|
|
||||||
path:
|
|
||||||
_default: client.py
|
|
||||||
postRenderers:
|
|
||||||
- kustomize:
|
|
||||||
patches:
|
|
||||||
- target:
|
|
||||||
group: apps
|
|
||||||
version: v1
|
|
||||||
kind: Deployment
|
|
||||||
name: celery
|
|
||||||
patch: "- op: add\n path: /spec/template/spec/volumes/-\n value:\n name:\
|
|
||||||
\ jwt-runtime-patch\n configMap:\n name: jwt-runtime\n- op: add\n\
|
|
||||||
\ path: /spec/template/spec/initContainers\n value:\n - name: jwt-delegation-code\n\
|
|
||||||
\ image: cr.yandex/crp3ccidau046kdj8g9q/backend:production_18e5ac1e\n\
|
|
||||||
\ command:\n - python\n - /jwt-source/patch.py\n volumeMounts:\n\
|
|
||||||
\ - name: jwt-runtime-patch\n mountPath: /jwt-source\n readOnly:\
|
|
||||||
\ true\n - name: jwt-patched\n mountPath: /jwt-patched\n resources:\n\
|
|
||||||
\ requests:\n cpu: 25m\n memory: 64Mi\n- op: add\n path:\
|
|
||||||
\ /spec/template/spec/volumes/-\n value:\n name: jwt-patched\n emptyDir:\
|
|
||||||
\ {}\n- op: add\n path: /spec/template/spec/containers/0/volumeMounts/-\n\
|
|
||||||
\ value:\n name: jwt-patched\n mountPath: /opt/sarex/sarex/base/tasks.py\n\
|
|
||||||
\ subPath: tasks.py\n readOnly: true\n- op: add\n path: /spec/template/spec/containers/0/volumeMounts/-\n\
|
|
||||||
\ value:\n name: jwt-patched\n mountPath: /opt/sarex/sarex/services/mixin.py\n\
|
|
||||||
\ subPath: mixin.py\n readOnly: true\n- op: add\n path: /spec/template/spec/containers/0/env/-\n\
|
|
||||||
\ value:\n name: JWT_SIGNER_URL\n value: http://backend-svc.django.svc.cluster.local:80/internal/jwt/access-token/\n\
|
|
||||||
- op: add\n path: /spec/template/spec/serviceAccountName\n value: django-celery-vault\n"
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: ServiceAccount
|
|
||||||
metadata:
|
|
||||||
name: django-backend-vault
|
|
||||||
namespace: django
|
|
||||||
---
|
|
||||||
apiVersion: v1
|
|
||||||
kind: ServiceAccount
|
|
||||||
metadata:
|
|
||||||
name: django-celery-vault
|
|
||||||
namespace: django
|
|
||||||
@ -1,31 +0,0 @@
|
|||||||
import json
|
|
||||||
import os
|
|
||||||
import time
|
|
||||||
from urllib.error import HTTPError, URLError
|
|
||||||
from urllib.request import Request, urlopen
|
|
||||||
|
|
||||||
|
|
||||||
def issue_access_token(user_id):
|
|
||||||
endpoint = os.environ["JWT_SIGNER_URL"]
|
|
||||||
credential = os.environ["JWT_SIGNER_CLIENT_TOKEN"]
|
|
||||||
request = Request(
|
|
||||||
endpoint,
|
|
||||||
data=json.dumps({"user_id": int(user_id)}).encode(),
|
|
||||||
headers={"Authorization": "Bearer " + credential, "Content-Type": "application/json"},
|
|
||||||
method="POST",
|
|
||||||
)
|
|
||||||
for attempt in range(3):
|
|
||||||
try:
|
|
||||||
with urlopen(request, timeout=5) as response:
|
|
||||||
payload = json.load(response)
|
|
||||||
token = payload.get("access")
|
|
||||||
if not isinstance(token, str) or not token:
|
|
||||||
raise RuntimeError("JWT signer returned an invalid response")
|
|
||||||
return token
|
|
||||||
except HTTPError as error:
|
|
||||||
if error.code < 500 or attempt == 2:
|
|
||||||
raise RuntimeError("JWT signer rejected the request: HTTP %d" % error.code) from None
|
|
||||||
except URLError:
|
|
||||||
if attempt == 2:
|
|
||||||
raise RuntimeError("JWT signer is unavailable") from None
|
|
||||||
time.sleep(attempt + 1)
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
from pathlib import Path
|
|
||||||
|
|
||||||
cases = [
|
|
||||||
("/opt/sarex/sarex/base/tasks.py", "tasks.py", "str(TokenObtainPairSerializer.get_token(user).access_token)", 2),
|
|
||||||
("/opt/sarex/sarex/services/mixin.py", "mixin.py", "str(CustomRefreshToken.for_user(user).access_token)", 1),
|
|
||||||
]
|
|
||||||
for source, destination, expression, expected in cases:
|
|
||||||
original = Path(source).read_text()
|
|
||||||
if original.count(expression) != expected:
|
|
||||||
raise RuntimeError("JWT delegation patch does not match the application image: " + source)
|
|
||||||
modified = "from config.jwt_signer_client import issue_access_token\n" + original.replace(
|
|
||||||
expression, "issue_access_token(user.id)"
|
|
||||||
)
|
|
||||||
compile(modified, source, "exec")
|
|
||||||
Path("/jwt-patched", destination).write_text(modified)
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
import os as _jwt_os
|
|
||||||
|
|
||||||
_jwt_has_private = bool(_jwt_os.environ.get("JWT_PRIVATE_KEY"))
|
|
||||||
if not _jwt_has_private:
|
|
||||||
_jwt_os.environ["JWT_PRIVATE_KEY"] = ""
|
|
||||||
with open("/jwt-config/original-production.py") as _jwt_source:
|
|
||||||
exec(compile(_jwt_source.read(), "/jwt-config/original-production.py", "exec"), globals())
|
|
||||||
if not _jwt_has_private:
|
|
||||||
_jwt_os.environ.pop("JWT_PRIVATE_KEY", None)
|
|
||||||
SIMPLE_JWT["SIGNING_KEY"] = ""
|
|
||||||
if _jwt_os.environ.get("JWT_SIGNER_MODE") == "server":
|
|
||||||
ROOT_URLCONF = "config.jwt_signer_urls"
|
|
||||||
DEBUG = False
|
|
||||||
del _jwt_has_private, _jwt_source
|
|
||||||
@ -1,64 +0,0 @@
|
|||||||
import hmac
|
|
||||||
import json
|
|
||||||
import os
|
|
||||||
|
|
||||||
from django.contrib.auth import get_user_model
|
|
||||||
from django.http import JsonResponse
|
|
||||||
from django.urls import path
|
|
||||||
from django.views.decorators.csrf import csrf_exempt
|
|
||||||
from django.views.decorators.debug import sensitive_variables
|
|
||||||
|
|
||||||
from config import urls as original_urls
|
|
||||||
from sarex.core.serializers.token import CustomTokenSerializer
|
|
||||||
|
|
||||||
|
|
||||||
@csrf_exempt
|
|
||||||
@sensitive_variables("credential", "supplied", "token")
|
|
||||||
def issue_access_token(request):
|
|
||||||
if request.method != "POST":
|
|
||||||
return JsonResponse({"detail": "Method not allowed"}, status=405)
|
|
||||||
credential = os.environ.get("JWT_SIGNER_CLIENT_TOKEN", "")
|
|
||||||
supplied = request.headers.get("Authorization", "")
|
|
||||||
if not credential or not hmac.compare_digest(supplied.encode(), ("Bearer " + credential).encode()):
|
|
||||||
return JsonResponse({"detail": "Unauthorized"}, status=401)
|
|
||||||
if len(request.body) > 1024:
|
|
||||||
return JsonResponse({"detail": "Invalid request"}, status=400)
|
|
||||||
try:
|
|
||||||
value = json.loads(request.body)
|
|
||||||
user_id = value["user_id"]
|
|
||||||
if isinstance(user_id, bool) or not isinstance(user_id, int) or not 0 < user_id <= 9223372036854775807:
|
|
||||||
raise ValueError()
|
|
||||||
except (ValueError, TypeError, KeyError):
|
|
||||||
return JsonResponse({"detail": "Invalid request"}, status=400)
|
|
||||||
user = get_user_model().objects.filter(pk=user_id, is_active=True).first()
|
|
||||||
if user is None:
|
|
||||||
return JsonResponse({"detail": "User not found"}, status=404)
|
|
||||||
token = str(CustomTokenSerializer.get_token(user).access_token)
|
|
||||||
return JsonResponse({"access": token}, headers={"Cache-Control": "no-store"})
|
|
||||||
|
|
||||||
|
|
||||||
@sensitive_variables("credential", "token")
|
|
||||||
def issue_legacy_access_token(request, pk):
|
|
||||||
credential = os.environ.get("JWT_SIGNER_CLIENT_TOKEN", "")
|
|
||||||
if not credential or not hmac.compare_digest(
|
|
||||||
request.headers.get("Authorization", "").encode(), ("Bearer " + credential).encode()
|
|
||||||
):
|
|
||||||
return JsonResponse({"detail": "Unauthorized"}, status=401)
|
|
||||||
if request.method != "GET":
|
|
||||||
return JsonResponse({"detail": "Method not allowed"}, status=405)
|
|
||||||
if not 0 < pk <= 9223372036854775807:
|
|
||||||
return JsonResponse({"detail": "Invalid request"}, status=400)
|
|
||||||
user = get_user_model().objects.filter(pk=pk, is_active=True).first()
|
|
||||||
if user is None:
|
|
||||||
return JsonResponse({"detail": "User not found"}, status=404)
|
|
||||||
token = str(CustomTokenSerializer.get_token(user).access_token)
|
|
||||||
return JsonResponse(token, safe=False, headers={"Cache-Control": "no-store"})
|
|
||||||
|
|
||||||
|
|
||||||
urlpatterns = [
|
|
||||||
path("internal/jwt/access-token/", issue_access_token),
|
|
||||||
path("internal/client/token/<int:pk>/", issue_legacy_access_token),
|
|
||||||
] + original_urls.urlpatterns
|
|
||||||
for name in ("handler400", "handler403", "handler404", "handler500"):
|
|
||||||
if hasattr(original_urls, name):
|
|
||||||
globals()[name] = getattr(original_urls, name)
|
|
||||||
@ -1,102 +0,0 @@
|
|||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
|
||||||
kind: Kustomization
|
|
||||||
resources:
|
|
||||||
- ../base
|
|
||||||
- jwt-serviceaccount.yaml
|
|
||||||
- export-project.yaml
|
|
||||||
patches:
|
|
||||||
- path: jwt-access.yaml
|
|
||||||
- path: backend.yaml
|
|
||||||
- path: celery.yaml
|
|
||||||
- path: s3-proxy.yaml
|
|
||||||
- path: zitadel-configmap.yaml
|
|
||||||
- patch: |
|
|
||||||
$patch: delete
|
|
||||||
apiVersion: helm.toolkit.fluxcd.io/v2
|
|
||||||
kind: HelmRelease
|
|
||||||
metadata:
|
|
||||||
name: srx-admin-frontend
|
|
||||||
namespace: django
|
|
||||||
- target:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: backend
|
|
||||||
patch: |
|
|
||||||
- op: add
|
|
||||||
path: /spec/values/services/backend/envs/-
|
|
||||||
value:
|
|
||||||
name: DJANGO_HOST
|
|
||||||
value:
|
|
||||||
_default: https://${HOST_PLATFORM}
|
|
||||||
configMapGenerator:
|
|
||||||
- name: jwt-runtime
|
|
||||||
namespace: django
|
|
||||||
files:
|
|
||||||
- production.py=jwt/production.py
|
|
||||||
- client.py=jwt/client.py
|
|
||||||
- urls.py=jwt/urls.py
|
|
||||||
- patch.py=jwt/patch.py
|
|
||||||
options:
|
|
||||||
disableNameSuffixHash: true
|
|
||||||
- name: django-contour-env
|
|
||||||
literals:
|
|
||||||
- SAREX_HOST=https://${HOST_PLATFORM}
|
|
||||||
- ZITADEL_HOST=https://${HOST_LOGIN}
|
|
||||||
- WORKFLOWS_HOST=http://backend-svc.processing.svc.cluster.local:80
|
|
||||||
- WORKFLOWS_BASE_HOST=http://backend-svc.django.svc.cluster.local:80
|
|
||||||
options:
|
|
||||||
disableNameSuffixHash: true
|
|
||||||
annotations:
|
|
||||||
config.kubernetes.io/local-config: "true"
|
|
||||||
replacements:
|
|
||||||
- source:
|
|
||||||
kind: ConfigMap
|
|
||||||
name: django-contour-env
|
|
||||||
fieldPath: data.SAREX_HOST
|
|
||||||
targets:
|
|
||||||
- select:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: backend
|
|
||||||
fieldPaths:
|
|
||||||
- spec.values.services.backend.envs.[name=SERVER_HOST].value._default
|
|
||||||
- spec.values.services.backend.envs.[name=SERVER_API_HOST].value._default
|
|
||||||
- select:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: celery
|
|
||||||
fieldPaths:
|
|
||||||
- spec.values.services.celery.envs.[name=SERVER_HOST].value._default
|
|
||||||
- spec.values.services.celery.envs.[name=SERVER_API_HOST].value._default
|
|
||||||
- source:
|
|
||||||
kind: ConfigMap
|
|
||||||
name: django-contour-env
|
|
||||||
fieldPath: data.ZITADEL_HOST
|
|
||||||
targets:
|
|
||||||
- select:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: backend
|
|
||||||
fieldPaths:
|
|
||||||
- spec.values.services.backend.envs.[name=ZITADEL_HOST].value._default
|
|
||||||
- select:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: celery
|
|
||||||
fieldPaths:
|
|
||||||
- spec.values.services.celery.envs.[name=ZITADEL_HOST].value._default
|
|
||||||
- source:
|
|
||||||
kind: ConfigMap
|
|
||||||
name: django-contour-env
|
|
||||||
fieldPath: data.WORKFLOWS_HOST
|
|
||||||
targets:
|
|
||||||
- select:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: celery
|
|
||||||
fieldPaths:
|
|
||||||
- spec.values.services.celery.envs.[name=WORKFLOWS_HOST].value._default
|
|
||||||
- source:
|
|
||||||
kind: ConfigMap
|
|
||||||
name: django-contour-env
|
|
||||||
fieldPath: data.WORKFLOWS_BASE_HOST
|
|
||||||
targets:
|
|
||||||
- select:
|
|
||||||
kind: HelmRelease
|
|
||||||
name: celery
|
|
||||||
fieldPaths:
|
|
||||||
- spec.values.services.celery.envs.[name=WORKFLOWS_BASE_HOST].value._default
|
|
||||||
@ -1,18 +0,0 @@
|
|||||||
apiVersion: helm.toolkit.fluxcd.io/v2
|
|
||||||
kind: HelmRelease
|
|
||||||
metadata:
|
|
||||||
name: s3-proxy
|
|
||||||
namespace: django
|
|
||||||
spec:
|
|
||||||
values:
|
|
||||||
services:
|
|
||||||
s3-proxy:
|
|
||||||
podAnnotations:
|
|
||||||
_default:
|
|
||||||
vault.hashicorp.com/agent-inject-template-s3: |
|
|
||||||
{{- with secret "secrets/data/minio/apps/django" }}
|
|
||||||
AWS_API_ENDPOINT=http://${MINIO_ENDPOINT}
|
|
||||||
AWS_S3_BUCKET={{ index .Data.data "bucket" }}
|
|
||||||
AWS_ACCESS_KEY_ID={{ index .Data.data "access_key_id" }}
|
|
||||||
AWS_SECRET_ACCESS_KEY={{ index .Data.data "secret_access_key" }}
|
|
||||||
{{- end }}
|
|
||||||
@ -1,82 +0,0 @@
|
|||||||
apiVersion: batch/v1
|
|
||||||
kind: Job
|
|
||||||
metadata:
|
|
||||||
name: django-service-user
|
|
||||||
namespace: django
|
|
||||||
annotations:
|
|
||||||
kustomize.toolkit.fluxcd.io/substitute: disabled
|
|
||||||
kustomize.toolkit.fluxcd.io/force: enabled
|
|
||||||
spec:
|
|
||||||
backoffLimit: 6
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
annotations:
|
|
||||||
sidecar.istio.io/inject: "false"
|
|
||||||
vault.hashicorp.com/agent-inject: "true"
|
|
||||||
vault.hashicorp.com/agent-pre-populate-only: "true"
|
|
||||||
vault.hashicorp.com/auth-path: auth/kubernetes
|
|
||||||
vault.hashicorp.com/role: django
|
|
||||||
vault.hashicorp.com/agent-inject-secret-django-postgresql: secrets/data/apps/django/postgres
|
|
||||||
vault.hashicorp.com/agent-inject-template-django-postgresql: |-
|
|
||||||
{{- with secret "secrets/data/apps/django/postgres" -}}
|
|
||||||
DJANGO_POSTGRES_HOST={{ index .Data.data "host" }}
|
|
||||||
DJANGO_POSTGRES_PORTS={{ index .Data.data "port" }}
|
|
||||||
DJANGO_POSTGRES_DATABASE={{ index .Data.data "database" }}
|
|
||||||
DJANGO_POSTGRES_USER={{ index .Data.data "username" }}
|
|
||||||
DJANGO_POSTGRES_PASSWORD={{ index .Data.data "password" }}
|
|
||||||
{{- end -}}
|
|
||||||
vault.hashicorp.com/agent-inject-secret-django-jwt-public: secrets/data/vault/common/jwt_public
|
|
||||||
vault.hashicorp.com/agent-inject-template-django-jwt-public: |-
|
|
||||||
{{- with secret "secrets/data/vault/common/jwt_public" -}}
|
|
||||||
{{ index .Data.data "public_key" }}
|
|
||||||
{{- end -}}
|
|
||||||
vault.hashicorp.com/agent-inject-secret-service-user: secrets/data/vault/common/django_auth
|
|
||||||
vault.hashicorp.com/agent-inject-template-service-user: |-
|
|
||||||
{{- with secret "secrets/data/vault/common/django_auth" -}}
|
|
||||||
SERVICE_USERNAME={{ index .Data.data "username" }}
|
|
||||||
SERVICE_PASSWORD={{ index .Data.data "password" }}
|
|
||||||
{{- end -}}
|
|
||||||
spec:
|
|
||||||
serviceAccountName: django-vault
|
|
||||||
restartPolicy: Never
|
|
||||||
imagePullSecrets:
|
|
||||||
- name: regcred
|
|
||||||
containers:
|
|
||||||
- name: service-user
|
|
||||||
image: cr.yandex/crp3ccidau046kdj8g9q/backend:production_7d0ec48b
|
|
||||||
imagePullPolicy: IfNotPresent
|
|
||||||
workingDir: /opt/sarex
|
|
||||||
command: ["/bin/sh", "-ec"]
|
|
||||||
args:
|
|
||||||
- |
|
|
||||||
set -a
|
|
||||||
. /vault/secrets/service-user
|
|
||||||
set +a
|
|
||||||
exec python manage.py shell -c '
|
|
||||||
import os
|
|
||||||
from django.contrib.auth import get_user_model
|
|
||||||
name = os.environ["SERVICE_USERNAME"]
|
|
||||||
user, created = get_user_model().objects.get_or_create(username=name)
|
|
||||||
user.set_password(os.environ["SERVICE_PASSWORD"])
|
|
||||||
user.is_active = True
|
|
||||||
user.is_staff = True
|
|
||||||
user.is_superuser = True
|
|
||||||
user.save()
|
|
||||||
print("service user", name, "created" if created else "updated")
|
|
||||||
'
|
|
||||||
env:
|
|
||||||
- name: DJANGO_SETTINGS_MODULE
|
|
||||||
value: config.settings.production
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
cpu: 50m
|
|
||||||
memory: 256Mi
|
|
||||||
volumeMounts:
|
|
||||||
- name: django-configmap
|
|
||||||
mountPath: /opt/sarex/config/settings/production.py
|
|
||||||
subPath: production.py
|
|
||||||
readOnly: true
|
|
||||||
volumes:
|
|
||||||
- name: django-configmap
|
|
||||||
configMap:
|
|
||||||
name: django-configmap
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: ConfigMap
|
|
||||||
metadata:
|
|
||||||
name: zitadel-configmap
|
|
||||||
namespace: django
|
|
||||||
data:
|
|
||||||
config.json: |
|
|
||||||
{
|
|
||||||
"auth_type": "zitadel",
|
|
||||||
"zitadel": {
|
|
||||||
"client_id": "${ZITADEL_CLIENT_ID}",
|
|
||||||
"host": "https://${HOST_LOGIN}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
9
apps/django/sarex-contour/kustomization.yaml
Normal file
9
apps/django/sarex-contour/kustomization.yaml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
resources:
|
||||||
|
- ../base
|
||||||
|
patches:
|
||||||
|
- path: nginx-configmap.yaml
|
||||||
|
target:
|
||||||
|
kind: ConfigMap
|
||||||
|
name: nginx-configmap
|
||||||
160
apps/django/sarex-contour/nginx-configmap.yaml
Normal file
160
apps/django/sarex-contour/nginx-configmap.yaml
Normal file
@ -0,0 +1,160 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: nginx-configmap
|
||||||
|
namespace: django
|
||||||
|
data:
|
||||||
|
nginx.conf: |
|
||||||
|
worker_processes auto;
|
||||||
|
|
||||||
|
pid /var/run/nginx.pid;
|
||||||
|
|
||||||
|
events {
|
||||||
|
use epoll;
|
||||||
|
worker_connections 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
|
||||||
|
# Basic Settings
|
||||||
|
large_client_header_buffers 8 128k;
|
||||||
|
sendfile on;
|
||||||
|
tcp_nopush on;
|
||||||
|
tcp_nodelay on;
|
||||||
|
keepalive_timeout 300;
|
||||||
|
types_hash_max_size 2048;
|
||||||
|
client_max_body_size 5000M;
|
||||||
|
client_header_buffer_size 5M;
|
||||||
|
include /etc/nginx/mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
|
||||||
|
# Logging Settings
|
||||||
|
access_log /var/log/nginx/access.log;
|
||||||
|
error_log /var/log/nginx/error.log;
|
||||||
|
|
||||||
|
# GZIP Settings
|
||||||
|
gzip on;
|
||||||
|
gzip_vary on;
|
||||||
|
gzip_proxied any;
|
||||||
|
gzip_comp_level 6;
|
||||||
|
gzip_buffers 16 8k;
|
||||||
|
gzip_http_version 1.1;
|
||||||
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
||||||
|
|
||||||
|
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||||
|
'$status $body_bytes_sent "$http_referer" '
|
||||||
|
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
listen [::]:80;
|
||||||
|
root /opt/react_client/;
|
||||||
|
|
||||||
|
add_header 'Access-Control-Allow-Origin' '*' always;
|
||||||
|
add_header 'Access-Control-Allow-Methods' '*' always;
|
||||||
|
add_header 'Access-Control-Allow-Headers' '*' always;
|
||||||
|
|
||||||
|
location = /static/index.bundle.js {
|
||||||
|
add_header Cache-Control 'no-store no-cache, must-revalidate, proxy-revalidate, max-age=0';
|
||||||
|
if_modified_since off;
|
||||||
|
expires off;
|
||||||
|
}
|
||||||
|
|
||||||
|
# location ~^/api/pm/ {
|
||||||
|
# proxy_http_version 1.1;
|
||||||
|
# proxy_set_header Connection "";
|
||||||
|
# proxy_set_header Host $host;
|
||||||
|
# proxy_pass http://backend-svc.pm.svc.cluster.local:8000;
|
||||||
|
# }
|
||||||
|
|
||||||
|
# location ~^/api/v1/documents/ {
|
||||||
|
# proxy_http_version 1.1;
|
||||||
|
# proxy_set_header Host $host;
|
||||||
|
# proxy_pass http://backend-filestream-svc.documentations.svc.cluster.local:80;
|
||||||
|
# }
|
||||||
|
|
||||||
|
location ~^/(api|admin)/ {
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Connection "";
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_pass http://backend-svc.django.svc.cluster.local:80;
|
||||||
|
}
|
||||||
|
|
||||||
|
location = /static/pdf-runtime/assets/mupdf-wasm.wasm {
|
||||||
|
alias /opt/react_client/static/pdf-runtime/assets/mupdf-wasm.wasm;
|
||||||
|
add_header Content-Type application/wasm always;
|
||||||
|
add_header Cache-Control "public, max-age=31536000, immutable" always;
|
||||||
|
add_header Access-Control-Allow-Origin "*" always;
|
||||||
|
add_header Access-Control-Allow-Methods "GET, OPTIONS" always;
|
||||||
|
add_header Access-Control-Allow-Headers "DNT,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization" always;
|
||||||
|
}
|
||||||
|
|
||||||
|
location = /workspaces-v2/worker/static/viewer-pdf/mupdf-wasm.js {
|
||||||
|
alias /opt/react_client/static/viewer-pdf/mupdf-wasm.js;
|
||||||
|
add_header Content-Type application/javascript always;
|
||||||
|
add_header Cache-Control "public, max-age=31536000, immutable" always;
|
||||||
|
add_header Access-Control-Allow-Origin "*" always;
|
||||||
|
add_header Access-Control-Allow-Methods "GET, OPTIONS" always;
|
||||||
|
add_header Access-Control-Allow-Headers "DNT,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization" always;
|
||||||
|
}
|
||||||
|
|
||||||
|
location = /workspaces-v2/worker/mupdf.worker-3.3.9.js {
|
||||||
|
alias /opt/react_client/static/pdf-runtime/mupdf.worker-3.3.9.js;
|
||||||
|
add_header Content-Type application/javascript always;
|
||||||
|
add_header Cache-Control "public, max-age=31536000, immutable" always;
|
||||||
|
add_header Access-Control-Allow-Origin "*" always;
|
||||||
|
add_header Access-Control-Allow-Methods "GET, OPTIONS" always;
|
||||||
|
add_header Access-Control-Allow-Headers "DNT,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization" always;
|
||||||
|
}
|
||||||
|
|
||||||
|
location = /workspaces-v2/worker/static/viewer-pdf/mupdf.js {
|
||||||
|
alias /opt/react_client/static/viewer-pdf/mupdf.js;
|
||||||
|
add_header Content-Type application/javascript always;
|
||||||
|
add_header Cache-Control "public, max-age=31536000, immutable" always;
|
||||||
|
add_header Access-Control-Allow-Origin "*" always;
|
||||||
|
add_header Access-Control-Allow-Methods "GET, OPTIONS" always;
|
||||||
|
add_header Access-Control-Allow-Headers "DNT,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization" always;
|
||||||
|
}
|
||||||
|
|
||||||
|
location = /workspaces-v2/worker/static/viewer-pdf/mupdf-wasm.wasm {
|
||||||
|
add_header Content-Type application/wasm always;
|
||||||
|
alias /opt/react_client/static/viewer-pdf/mupdf-wasm.wasm;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~^/workspaces-v2/(.+).js {
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Connection "";
|
||||||
|
rewrite /workspaces-v2/(.+) /$1 break;
|
||||||
|
proxy_pass http://frontend-svc.workspaces.svc.cluster.local:80;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~^/workspaces-v2/(.+)\.wasm$ {
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Connection "";
|
||||||
|
rewrite ^/workspaces-v2/(.+) /$1 break;
|
||||||
|
proxy_pass http://frontend-svc.workspaces.svc.cluster.local:80;
|
||||||
|
}
|
||||||
|
|
||||||
|
location @index {
|
||||||
|
add_header Cache-Control 'no-cache, must-revalidate, proxy-revalidate, max-age=0';
|
||||||
|
if_modified_since off;
|
||||||
|
expires off;
|
||||||
|
try_files /static/index.html =404;
|
||||||
|
}
|
||||||
|
|
||||||
|
# location ~^/workflows/(.+).js {
|
||||||
|
# proxy_http_version 1.1;
|
||||||
|
# proxy_set_header Connection "";
|
||||||
|
# rewrite /workflows/(.+) /$1 break;
|
||||||
|
# proxy_pass http://frontend-svc.processing.svc.cluster.local:80;
|
||||||
|
# }
|
||||||
|
|
||||||
|
location /service-worker.js {
|
||||||
|
try_files /static/$uri @index;
|
||||||
|
}
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri @index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,60 +0,0 @@
|
|||||||
apiVersion: helm.toolkit.fluxcd.io/v2
|
|
||||||
kind: HelmRelease
|
|
||||||
metadata:
|
|
||||||
name: backend
|
|
||||||
namespace: django
|
|
||||||
spec:
|
|
||||||
values:
|
|
||||||
services:
|
|
||||||
backend:
|
|
||||||
podAnnotations:
|
|
||||||
_default:
|
|
||||||
vault.hashicorp.com/agent-inject-template-django-s3: '{{- with secret
|
|
||||||
"secrets/data/minio/apps/django" }}
|
|
||||||
|
|
||||||
AWS_S3_ENDPOINT_URL=http://${MINIO_ENDPOINT}
|
|
||||||
|
|
||||||
S3_HOST=http://${MINIO_ENDPOINT}
|
|
||||||
|
|
||||||
S3_BUCKET={{ index .Data.data "bucket" }}
|
|
||||||
|
|
||||||
S3_LOGIN={{ index .Data.data "access_key_id" }}
|
|
||||||
|
|
||||||
S3_PASSWORD={{ index .Data.data "secret_access_key" }}
|
|
||||||
|
|
||||||
AWS_S3_ACCESS_KEY_ID={{ index .Data.data "access_key_id" }}
|
|
||||||
|
|
||||||
AWS_S3_SECRET_ACCESS_KEY={{ index .Data.data "secret_access_key" }}
|
|
||||||
|
|
||||||
AWS_STORAGE_BUCKET_NAME={{ index .Data.data "bucket" }}
|
|
||||||
|
|
||||||
{{- end }}'
|
|
||||||
vault.hashicorp.com/agent-inject-secret-django-common: secrets/data/zitadel/setup
|
|
||||||
vault.hashicorp.com/agent-inject-template-django-common: '{{- with secret
|
|
||||||
"secrets/data/zitadel/setup" -}}
|
|
||||||
|
|
||||||
ZITADEL_ACCESS_TOKEN={{ index .Data.data "django_zitadel_access_token"
|
|
||||||
}}
|
|
||||||
|
|
||||||
{{- end -}}'
|
|
||||||
vault.hashicorp.com/agent-inject-secret-django-kafka: secrets/data/kafka/apps/iam
|
|
||||||
vault.hashicorp.com/agent-inject-template-django-kafka: '{{- with secret
|
|
||||||
"secrets/data/kafka/apps/iam" -}}
|
|
||||||
|
|
||||||
KAFKA_BOOTSTRAP_SERVERS=''["{{ with index .Data.data "auth" }}{{ index
|
|
||||||
. "bootstrap_servers" }}{{ else }}{{ index .Data.data "bootstrap_servers"
|
|
||||||
}}{{ end }}"]''
|
|
||||||
|
|
||||||
KAFKA_SECURITY_PROTOCOL=''SASL_PLAINTEXT''
|
|
||||||
|
|
||||||
KAFKA_SASL_MECHANISM=''SCRAM-SHA-512''
|
|
||||||
|
|
||||||
KAFKA_SASL_PLAIN_USERNAME=''{{ index .Data.data "username" }}''
|
|
||||||
|
|
||||||
KAFKA_SASL_PLAIN_PASSWORD=''{{ index .Data.data "password" }}''
|
|
||||||
|
|
||||||
KAFKA_SSL_CAFILE=''''
|
|
||||||
|
|
||||||
{{- end -}}'
|
|
||||||
traffic.sidecar.istio.io/excludeOutboundPorts: 8200,9092
|
|
||||||
proxy.istio.io/config: '{"holdApplicationUntilProxyStarts":true}'
|
|
||||||
@ -1,54 +0,0 @@
|
|||||||
apiVersion: helm.toolkit.fluxcd.io/v2
|
|
||||||
kind: HelmRelease
|
|
||||||
metadata:
|
|
||||||
name: celery
|
|
||||||
namespace: django
|
|
||||||
spec:
|
|
||||||
values:
|
|
||||||
services:
|
|
||||||
celery:
|
|
||||||
podAnnotations:
|
|
||||||
_default:
|
|
||||||
vault.hashicorp.com/agent-inject-template-django-s3: '{{- with secret
|
|
||||||
"secrets/data/minio/apps/django" }}
|
|
||||||
|
|
||||||
AWS_S3_ENDPOINT_URL=http://${MINIO_ENDPOINT}
|
|
||||||
|
|
||||||
S3_HOST=http://${MINIO_ENDPOINT}
|
|
||||||
|
|
||||||
S3_BUCKET={{ index .Data.data "bucket" }}
|
|
||||||
|
|
||||||
S3_LOGIN={{ index .Data.data "access_key_id" }}
|
|
||||||
|
|
||||||
S3_PASSWORD={{ index .Data.data "secret_access_key" }}
|
|
||||||
|
|
||||||
{{- end }}'
|
|
||||||
vault.hashicorp.com/agent-inject-secret-django-common: secrets/data/zitadel/setup
|
|
||||||
vault.hashicorp.com/agent-inject-template-django-common: '{{- with secret
|
|
||||||
"secrets/data/zitadel/setup" -}}
|
|
||||||
|
|
||||||
ZITADEL_ACCESS_TOKEN={{ index .Data.data "django_zitadel_access_token"
|
|
||||||
}}
|
|
||||||
|
|
||||||
{{- end -}}'
|
|
||||||
vault.hashicorp.com/agent-inject-secret-django-kafka: secrets/data/kafka/apps/iam
|
|
||||||
vault.hashicorp.com/agent-inject-template-django-kafka: '{{- with secret
|
|
||||||
"secrets/data/kafka/apps/iam" -}}
|
|
||||||
|
|
||||||
KAFKA_BOOTSTRAP_SERVERS=''["{{ with index .Data.data "auth" }}{{ index
|
|
||||||
. "bootstrap_servers" }}{{ else }}{{ index .Data.data "bootstrap_servers"
|
|
||||||
}}{{ end }}"]''
|
|
||||||
|
|
||||||
KAFKA_SECURITY_PROTOCOL=''SASL_PLAINTEXT''
|
|
||||||
|
|
||||||
KAFKA_SASL_MECHANISM=''SCRAM-SHA-512''
|
|
||||||
|
|
||||||
KAFKA_SASL_PLAIN_USERNAME=''{{ index .Data.data "username" }}''
|
|
||||||
|
|
||||||
KAFKA_SASL_PLAIN_PASSWORD=''{{ index .Data.data "password" }}''
|
|
||||||
|
|
||||||
KAFKA_SSL_CAFILE=''''
|
|
||||||
|
|
||||||
{{- end -}}'
|
|
||||||
traffic.sidecar.istio.io/excludeOutboundPorts: 8200,9092
|
|
||||||
proxy.istio.io/config: '{"holdApplicationUntilProxyStarts":true}'
|
|
||||||
@ -1,88 +0,0 @@
|
|||||||
apiVersion: helm.toolkit.fluxcd.io/v2
|
|
||||||
kind: HelmRelease
|
|
||||||
metadata:
|
|
||||||
name: export-project
|
|
||||||
namespace: django
|
|
||||||
spec:
|
|
||||||
interval: 10m
|
|
||||||
chart:
|
|
||||||
spec:
|
|
||||||
chart: universal-chart
|
|
||||||
version: 0.1.9
|
|
||||||
sourceRef:
|
|
||||||
kind: HelmRepository
|
|
||||||
name: yc-oci-charts
|
|
||||||
namespace: flux-system
|
|
||||||
interval: 10m
|
|
||||||
install:
|
|
||||||
remediation:
|
|
||||||
retries: 3
|
|
||||||
upgrade:
|
|
||||||
remediation:
|
|
||||||
retries: 3
|
|
||||||
values:
|
|
||||||
global:
|
|
||||||
env: _default
|
|
||||||
services:
|
|
||||||
backend:
|
|
||||||
enabled: true
|
|
||||||
image:
|
|
||||||
name:
|
|
||||||
_default: cr.yandex/crp3ccidau046kdj8g9q/export-project:prod_ef8aa756
|
|
||||||
pullPolicy:
|
|
||||||
_default: IfNotPresent
|
|
||||||
deployment:
|
|
||||||
enabled: true
|
|
||||||
name:
|
|
||||||
_default: export-project
|
|
||||||
replicaCount:
|
|
||||||
_default: 1
|
|
||||||
stage: 1
|
|
||||||
preprod: 3
|
|
||||||
production: 3
|
|
||||||
port:
|
|
||||||
_default: 8000
|
|
||||||
probes:
|
|
||||||
liveness:
|
|
||||||
enabled: false
|
|
||||||
readiness:
|
|
||||||
enabled: false
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
cpu:
|
|
||||||
_default: 25m
|
|
||||||
memory:
|
|
||||||
_default: 128Mi
|
|
||||||
service:
|
|
||||||
enabled: true
|
|
||||||
name:
|
|
||||||
_default: export-project-service
|
|
||||||
type:
|
|
||||||
_default: ClusterIP
|
|
||||||
port:
|
|
||||||
_default: 8000
|
|
||||||
targetPort:
|
|
||||||
_default: 8000
|
|
||||||
portName:
|
|
||||||
_default: http
|
|
||||||
imagePullSecrets:
|
|
||||||
enabled:
|
|
||||||
_default: true
|
|
||||||
name:
|
|
||||||
_default: regcred
|
|
||||||
labels:
|
|
||||||
monitoring: prometheus
|
|
||||||
envs:
|
|
||||||
- name: TIMEOUT
|
|
||||||
value:
|
|
||||||
_default: '180'
|
|
||||||
commitSha: ''
|
|
||||||
gitlabUri: ''
|
|
||||||
gitlabJobUrl: ''
|
|
||||||
owner: ''
|
|
||||||
podAnnotations:
|
|
||||||
_default:
|
|
||||||
sidecar.istio.io/proxyCPU: 25m
|
|
||||||
sidecar.istio.io/proxyMemory: 128Mi
|
|
||||||
sidecar.istio.io/proxyCPULimit: '2'
|
|
||||||
sidecar.istio.io/proxyMemoryLimit: 1Gi
|
|
||||||
@ -1,265 +0,0 @@
|
|||||||
apiVersion: helm.toolkit.fluxcd.io/v2
|
|
||||||
kind: HelmRelease
|
|
||||||
metadata:
|
|
||||||
name: backend
|
|
||||||
namespace: django
|
|
||||||
spec:
|
|
||||||
values:
|
|
||||||
services:
|
|
||||||
backend:
|
|
||||||
podAnnotations:
|
|
||||||
_default:
|
|
||||||
vault.hashicorp.com/agent-inject-secret-django-jwt-private: secrets/data/vault/apps/django/jwt_private
|
|
||||||
vault.hashicorp.com/agent-inject-secret-django-jwt-public: secrets/data/vault/common/jwt_public
|
|
||||||
vault.hashicorp.com/agent-inject-template-django-jwt-private: '{{- with
|
|
||||||
secret "secrets/data/vault/apps/django/jwt_private" -}}
|
|
||||||
|
|
||||||
{{ index .Data.data "private_key" }}
|
|
||||||
|
|
||||||
{{- end -}}'
|
|
||||||
vault.hashicorp.com/agent-inject-template-django-jwt-public: '{{- with
|
|
||||||
secret "secrets/data/vault/common/jwt_public" -}}
|
|
||||||
|
|
||||||
{{ index .Data.data "public_key" }}
|
|
||||||
|
|
||||||
{{- end -}}'
|
|
||||||
checksum/jwt-runtime: 58bae88d1d81ac414b2cac6ff81e0f441dc9a8f05a42d9d3d11bdfa97d38772b
|
|
||||||
vault.hashicorp.com/agent-inject-secret-jwt-signer-client: secrets/data/vault/apps/django/jwt_signer_client
|
|
||||||
vault.hashicorp.com/agent-inject-template-jwt-signer-client: '{{- with
|
|
||||||
secret "secrets/data/vault/apps/django/jwt_signer_client" -}}
|
|
||||||
|
|
||||||
JWT_SIGNER_CLIENT_TOKEN={{ index .Data.data "token" }}
|
|
||||||
|
|
||||||
{{- end -}}'
|
|
||||||
vault.hashicorp.com/role: django-backend
|
|
||||||
deployment:
|
|
||||||
args:
|
|
||||||
_default:
|
|
||||||
- 'set -a
|
|
||||||
|
|
||||||
[ -f /vault/secrets/django-postgresql ] && . /vault/secrets/django-postgresql
|
|
||||||
|
|
||||||
[ -f /vault/secrets/django-rabbitmq ] && . /vault/secrets/django-rabbitmq
|
|
||||||
|
|
||||||
[ -f /vault/secrets/django-s3 ] && . /vault/secrets/django-s3
|
|
||||||
|
|
||||||
[ -f /vault/secrets/django-kafka ] && . /vault/secrets/django-kafka
|
|
||||||
|
|
||||||
[ -f /vault/secrets/django-jwt-private ] && export JWT_PRIVATE_KEY="$(cat
|
|
||||||
/vault/secrets/django-jwt-private)"
|
|
||||||
|
|
||||||
[ -f /vault/secrets/django-jwt-public ] && export JWT_PUBLIC_KEY="$(cat
|
|
||||||
/vault/secrets/django-jwt-public)"
|
|
||||||
|
|
||||||
[ -f /vault/secrets/jwt-signer-client ] && . /vault/secrets/jwt-signer-client
|
|
||||||
|
|
||||||
set +a
|
|
||||||
|
|
||||||
exec /opt/sarex/entrypoint.sh
|
|
||||||
|
|
||||||
'
|
|
||||||
volumes:
|
|
||||||
_default:
|
|
||||||
- configMap:
|
|
||||||
items:
|
|
||||||
- key: production.py
|
|
||||||
path:
|
|
||||||
_default: production.py
|
|
||||||
name:
|
|
||||||
_default: django-configmap
|
|
||||||
mountPath:
|
|
||||||
_default: /jwt-config/original-production.py
|
|
||||||
name: django-configmap
|
|
||||||
readOnly:
|
|
||||||
_default: true
|
|
||||||
subPath:
|
|
||||||
_default: production.py
|
|
||||||
- configMap:
|
|
||||||
items:
|
|
||||||
- key: uwsgi.ini
|
|
||||||
path:
|
|
||||||
_default: uwsgi.ini
|
|
||||||
name:
|
|
||||||
_default: uwsgi-configmap
|
|
||||||
mountPath:
|
|
||||||
_default: /opt/sarex/uwsgi.ini
|
|
||||||
name: uwsgi-configmap
|
|
||||||
readOnly:
|
|
||||||
_default: true
|
|
||||||
subPath:
|
|
||||||
_default: uwsgi.ini
|
|
||||||
- name: jwt-runtime-production
|
|
||||||
mountPath:
|
|
||||||
_default: /opt/sarex/config/settings/production.py
|
|
||||||
subPath:
|
|
||||||
_default: production.py
|
|
||||||
readOnly:
|
|
||||||
_default: true
|
|
||||||
configMap:
|
|
||||||
name:
|
|
||||||
_default: jwt-runtime
|
|
||||||
items:
|
|
||||||
- key: production.py
|
|
||||||
path:
|
|
||||||
_default: production.py
|
|
||||||
- name: jwt-runtime-client
|
|
||||||
mountPath:
|
|
||||||
_default: /opt/sarex/config/jwt_signer_client.py
|
|
||||||
subPath:
|
|
||||||
_default: client.py
|
|
||||||
readOnly:
|
|
||||||
_default: true
|
|
||||||
configMap:
|
|
||||||
name:
|
|
||||||
_default: jwt-runtime
|
|
||||||
items:
|
|
||||||
- key: client.py
|
|
||||||
path:
|
|
||||||
_default: client.py
|
|
||||||
- name: jwt-runtime-urls
|
|
||||||
mountPath:
|
|
||||||
_default: /opt/sarex/config/jwt_signer_urls.py
|
|
||||||
subPath:
|
|
||||||
_default: urls.py
|
|
||||||
readOnly:
|
|
||||||
_default: true
|
|
||||||
configMap:
|
|
||||||
name:
|
|
||||||
_default: jwt-runtime
|
|
||||||
items:
|
|
||||||
- key: urls.py
|
|
||||||
path:
|
|
||||||
_default: urls.py
|
|
||||||
postRenderers:
|
|
||||||
- kustomize:
|
|
||||||
patches:
|
|
||||||
- target:
|
|
||||||
group: apps
|
|
||||||
version: v1
|
|
||||||
kind: Deployment
|
|
||||||
name: backend
|
|
||||||
patch: "- op: add\n path: /spec/template/spec/serviceAccountName\n value:\
|
|
||||||
\ django-backend-vault\n- op: add\n path: /spec/template/spec/containers/0/env/-\n\
|
|
||||||
\ value:\n name: JWT_SIGNER_MODE\n value: server\n"
|
|
||||||
---
|
|
||||||
apiVersion: helm.toolkit.fluxcd.io/v2
|
|
||||||
kind: HelmRelease
|
|
||||||
metadata:
|
|
||||||
name: celery
|
|
||||||
namespace: django
|
|
||||||
spec:
|
|
||||||
values:
|
|
||||||
services:
|
|
||||||
celery:
|
|
||||||
podAnnotations:
|
|
||||||
_default:
|
|
||||||
vault.hashicorp.com/agent-inject-secret-django-jwt-private: null
|
|
||||||
vault.hashicorp.com/agent-inject-secret-django-jwt-public: secrets/data/vault/common/jwt_public
|
|
||||||
vault.hashicorp.com/agent-inject-template-django-jwt-private: null
|
|
||||||
vault.hashicorp.com/agent-inject-template-django-jwt-public: '{{- with
|
|
||||||
secret "secrets/data/vault/common/jwt_public" -}}
|
|
||||||
|
|
||||||
{{ index .Data.data "public_key" }}
|
|
||||||
|
|
||||||
{{- end -}}'
|
|
||||||
checksum/jwt-runtime: 58bae88d1d81ac414b2cac6ff81e0f441dc9a8f05a42d9d3d11bdfa97d38772b
|
|
||||||
vault.hashicorp.com/agent-inject-secret-jwt-signer-client: secrets/data/vault/apps/django/jwt_signer_client
|
|
||||||
vault.hashicorp.com/agent-inject-template-jwt-signer-client: '{{- with
|
|
||||||
secret "secrets/data/vault/apps/django/jwt_signer_client" -}}
|
|
||||||
|
|
||||||
JWT_SIGNER_CLIENT_TOKEN={{ index .Data.data "token" }}
|
|
||||||
|
|
||||||
{{- end -}}'
|
|
||||||
vault.hashicorp.com/role: django-celery
|
|
||||||
deployment:
|
|
||||||
args:
|
|
||||||
_default:
|
|
||||||
- 'set -a
|
|
||||||
|
|
||||||
[ -f /vault/secrets/django-postgresql ] && . /vault/secrets/django-postgresql
|
|
||||||
|
|
||||||
[ -f /vault/secrets/django-rabbitmq ] && . /vault/secrets/django-rabbitmq
|
|
||||||
|
|
||||||
[ -f /vault/secrets/django-s3 ] && . /vault/secrets/django-s3
|
|
||||||
|
|
||||||
[ -f /vault/secrets/django-kafka ] && . /vault/secrets/django-kafka
|
|
||||||
|
|
||||||
[ -f /vault/secrets/django-jwt-public ] && export JWT_PUBLIC_KEY="$(cat
|
|
||||||
/vault/secrets/django-jwt-public)"
|
|
||||||
|
|
||||||
[ -f /vault/secrets/jwt-signer-client ] && . /vault/secrets/jwt-signer-client
|
|
||||||
|
|
||||||
set +a
|
|
||||||
|
|
||||||
exec celery -A config worker -B -l info -E -Q default -n default_worker.%h
|
|
||||||
--concurrency=2
|
|
||||||
|
|
||||||
'
|
|
||||||
volumes:
|
|
||||||
_default:
|
|
||||||
- configMap:
|
|
||||||
items:
|
|
||||||
- key: production.py
|
|
||||||
path:
|
|
||||||
_default: production.py
|
|
||||||
name:
|
|
||||||
_default: django-configmap
|
|
||||||
mountPath:
|
|
||||||
_default: /jwt-config/original-production.py
|
|
||||||
name: django-configmap
|
|
||||||
readOnly:
|
|
||||||
_default: true
|
|
||||||
subPath:
|
|
||||||
_default: production.py
|
|
||||||
- name: jwt-runtime-production
|
|
||||||
mountPath:
|
|
||||||
_default: /opt/sarex/config/settings/production.py
|
|
||||||
subPath:
|
|
||||||
_default: production.py
|
|
||||||
readOnly:
|
|
||||||
_default: true
|
|
||||||
configMap:
|
|
||||||
name:
|
|
||||||
_default: jwt-runtime
|
|
||||||
items:
|
|
||||||
- key: production.py
|
|
||||||
path:
|
|
||||||
_default: production.py
|
|
||||||
- name: jwt-runtime-client
|
|
||||||
mountPath:
|
|
||||||
_default: /opt/sarex/config/jwt_signer_client.py
|
|
||||||
subPath:
|
|
||||||
_default: client.py
|
|
||||||
readOnly:
|
|
||||||
_default: true
|
|
||||||
configMap:
|
|
||||||
name:
|
|
||||||
_default: jwt-runtime
|
|
||||||
items:
|
|
||||||
- key: client.py
|
|
||||||
path:
|
|
||||||
_default: client.py
|
|
||||||
postRenderers:
|
|
||||||
- kustomize:
|
|
||||||
patches:
|
|
||||||
- target:
|
|
||||||
group: apps
|
|
||||||
version: v1
|
|
||||||
kind: Deployment
|
|
||||||
name: celery
|
|
||||||
patch: "- op: add\n path: /spec/template/spec/volumes/-\n value:\n name:\
|
|
||||||
\ jwt-runtime-patch\n configMap:\n name: jwt-runtime\n- op: add\n\
|
|
||||||
\ path: /spec/template/spec/initContainers\n value:\n - name: jwt-delegation-code\n\
|
|
||||||
\ image: cr.yandex/crp3ccidau046kdj8g9q/backend:production_18e5ac1e\n\
|
|
||||||
\ command:\n - python\n - /jwt-source/patch.py\n volumeMounts:\n\
|
|
||||||
\ - name: jwt-runtime-patch\n mountPath: /jwt-source\n readOnly:\
|
|
||||||
\ true\n - name: jwt-patched\n mountPath: /jwt-patched\n resources:\n\
|
|
||||||
\ requests:\n cpu: 25m\n memory: 64Mi\n- op: add\n path:\
|
|
||||||
\ /spec/template/spec/volumes/-\n value:\n name: jwt-patched\n emptyDir:\
|
|
||||||
\ {}\n- op: add\n path: /spec/template/spec/containers/0/volumeMounts/-\n\
|
|
||||||
\ value:\n name: jwt-patched\n mountPath: /opt/sarex/sarex/base/tasks.py\n\
|
|
||||||
\ subPath: tasks.py\n readOnly: true\n- op: add\n path: /spec/template/spec/containers/0/volumeMounts/-\n\
|
|
||||||
\ value:\n name: jwt-patched\n mountPath: /opt/sarex/sarex/services/mixin.py\n\
|
|
||||||
\ subPath: mixin.py\n readOnly: true\n- op: add\n path: /spec/template/spec/containers/0/env/-\n\
|
|
||||||
\ value:\n name: JWT_SIGNER_URL\n value: http://backend-svc.django.svc.cluster.local:80/internal/jwt/access-token/\n\
|
|
||||||
- op: add\n path: /spec/template/spec/serviceAccountName\n value: django-celery-vault\n"
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: ServiceAccount
|
|
||||||
metadata:
|
|
||||||
name: django-backend-vault
|
|
||||||
namespace: django
|
|
||||||
---
|
|
||||||
apiVersion: v1
|
|
||||||
kind: ServiceAccount
|
|
||||||
metadata:
|
|
||||||
name: django-celery-vault
|
|
||||||
namespace: django
|
|
||||||
@ -1,31 +0,0 @@
|
|||||||
import json
|
|
||||||
import os
|
|
||||||
import time
|
|
||||||
from urllib.error import HTTPError, URLError
|
|
||||||
from urllib.request import Request, urlopen
|
|
||||||
|
|
||||||
|
|
||||||
def issue_access_token(user_id):
|
|
||||||
endpoint = os.environ["JWT_SIGNER_URL"]
|
|
||||||
credential = os.environ["JWT_SIGNER_CLIENT_TOKEN"]
|
|
||||||
request = Request(
|
|
||||||
endpoint,
|
|
||||||
data=json.dumps({"user_id": int(user_id)}).encode(),
|
|
||||||
headers={"Authorization": "Bearer " + credential, "Content-Type": "application/json"},
|
|
||||||
method="POST",
|
|
||||||
)
|
|
||||||
for attempt in range(3):
|
|
||||||
try:
|
|
||||||
with urlopen(request, timeout=5) as response:
|
|
||||||
payload = json.load(response)
|
|
||||||
token = payload.get("access")
|
|
||||||
if not isinstance(token, str) or not token:
|
|
||||||
raise RuntimeError("JWT signer returned an invalid response")
|
|
||||||
return token
|
|
||||||
except HTTPError as error:
|
|
||||||
if error.code < 500 or attempt == 2:
|
|
||||||
raise RuntimeError("JWT signer rejected the request: HTTP %d" % error.code) from None
|
|
||||||
except URLError:
|
|
||||||
if attempt == 2:
|
|
||||||
raise RuntimeError("JWT signer is unavailable") from None
|
|
||||||
time.sleep(attempt + 1)
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user