From 2b7716dd4e2c215d137953fecc3d6ac72c4b2053 Mon Sep 17 00:00:00 2001 From: Nyan404 Date: Tue, 25 Aug 2026 15:28:42 +0300 Subject: [PATCH] fix: wait for available PostgreSQL deployment --- .gitlab-ci.yml | 3 ++- docs/GITLAB_CI_CD.md | 2 +- structure_and_data.md | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5db9d8a..1e20070 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -97,7 +97,8 @@ deploy: sed -E "s#image: reg.nyan404.ru/cwshed-clone/belki:[^[:space:]]+#image: $DOCKER_IMAGE_REPOSITORY:$CI_COMMIT_SHORT_SHA#g" deploy/k8s/production.yaml | kubectl apply -f - - > sed -E "s#image: reg.nyan404.ru/cwshed:[^[:space:]]+#image: $GATEWAY_IMAGE_REPOSITORY:$CI_COMMIT_SHORT_SHA#g" deploy/k8s/gateway.yaml | kubectl apply -f - - - kubectl -n "$KUBE_NAMESPACE" wait --for=condition=Ready pod -l app.kubernetes.io/name=belki-postgres --timeout=180s + # Pod labels include historical ReplicaSets; wait for the Deployment's usable database replica instead. + - kubectl -n "$KUBE_NAMESPACE" wait --for=condition=Available deployment/belki-postgres --timeout=180s - kubectl -n "$KUBE_NAMESPACE" rollout status deployment/belki-web --timeout=180s - kubectl -n "$KUBE_NAMESPACE" rollout status deployment/belki-bot --timeout=180s - kubectl -n "$KUBE_NAMESPACE" rollout status deployment/cwshed --timeout=180s diff --git a/docs/GITLAB_CI_CD.md b/docs/GITLAB_CI_CD.md index d289a96..39d7089 100644 --- a/docs/GITLAB_CI_CD.md +++ b/docs/GITLAB_CI_CD.md @@ -42,6 +42,6 @@ kubectl -n belki apply -f deploy/k8s/production.yaml kubectl -n belki rollout status deployment/belki-web --timeout=180s ``` -The deploy job checks the PostgreSQL pod with `kubectl wait --for=condition=Ready` instead of `rollout status`: the database template is not updated by an application image deployment, and a stale Deployment progress condition must not hide a healthy database or fail an otherwise successful release. +The deploy job checks `deployment/belki-postgres` with `kubectl wait --for=condition=Available` instead of selecting Pods or using `rollout status`: the database template is not updated by an application image deployment. Pod-label selection can include a stale ReplicaSet, while the Deployment availability condition expresses the required outcome — one usable database replica. MetalLB адрес шлюза — `10.12.0.204`; он раздаёт старый CatWar-сайт и проксирует `/belki`, `/admin` и `/api/*` на Belki web `10.12.0.212`. diff --git a/structure_and_data.md b/structure_and_data.md index adda3f6..233fe04 100644 --- a/structure_and_data.md +++ b/structure_and_data.md @@ -98,6 +98,7 @@ - 2026-08-25: free-form coaching input additionally normalizes Russian written month names and common abbreviations (for example, `24 августа` and `1-го сент`) into the existing `ДД.ММ` date field. - 2026-08-25: `/api/admin/auth` now permits five password attempts per source in a rolling 15-minute window and clears that local budget after a successful sign-in. Edge rate limiting and TLS remain required deployment controls. - 2026-08-25: server-memory admin sessions now expire after 12 hours and are capped at 100 active tokens; the browser cookie carries the same maximum age. +- 2026-08-25: the deploy job waits for `deployment/belki-postgres` to become `Available`, rather than waiting for every Pod with the shared PostgreSQL label. Historical ReplicaSet Pods can remain during cleanup and must not fail a release after the current database replica is ready. - 2026-08-25: removed unreferenced root-level legacy BBCode copies `belki.md`, `belki2.md`, and `belkifix.md`; the first two were byte-identical and the third differed only by a closing BBCode tag. They were neither served nor referenced by the calculator, bot, or documentation. # Обновление 2026-08-16: несколько котят