Реализовать lab3 в общем Helm-релизе с Traefik, TLS и HPA

This commit is contained in:
Vladislav Agapov
2026-10-16 11:51:20 +03:00
parent a57cbcf329
commit 9494547300
88 changed files with 1922 additions and 255 deletions
+18 -9
View File
@@ -1,13 +1,13 @@
PYTHON ?= python3
BASE_URL ?= http://localhost:8080
BASE_URL ?= https://hl.agapov.space
CA_FILE ?=
ACTION_SCRIPT ?=
TLS_ARGS = $(if $(CA_FILE),--ca-file "$(CA_FILE)",)
.PHONY: help check validate test load test-persistence
.PHONY: help check validate test load test-persistence test-failover
help:
@echo "init/deploy/port-forward: Helm stand; chart-check: Helm lint; reshard SHARDS=2|3; test/test-persistence: API; coverage: Go; research: SQL; check/validate: contract"
@echo "check: offline structure; validate: full OpenAPI (requirements-dev.txt); test: running API; load: synthetic writes"
check:
$(PYTHON) scripts/check_contract.py
@@ -25,6 +25,10 @@ test-persistence:
@test -n "$(ACTION_SCRIPT)" || (echo "Set ACTION_SCRIPT to your implemented executable restart hook"; exit 2)
$(PYTHON) tests/resilience.py --mode persistence --action-script "$(ACTION_SCRIPT)" --base-url "$(BASE_URL)" $(TLS_ARGS)
test-failover:
@test -n "$(ACTION_SCRIPT)" || (echo "Set ACTION_SCRIPT to your implemented executable stop-one hook"; exit 2)
$(PYTHON) tests/resilience.py --mode failover --action-script "$(ACTION_SCRIPT)" --base-url "$(BASE_URL)" $(TLS_ARGS)
GO ?= go
.PHONY: build test-student coverage vet lint fmt research
build:
@@ -40,10 +44,10 @@ lint:
fmt:
golangci-lint fmt
research:
scripts/research.sh
scripts/experiment.sh
REGISTRY ?= asisti.registry.twcstorage.ru
IMAGE := $(REGISTRY)/mtusi2026lab2
IMAGE := $(REGISTRY)/mtusi2026lab3
IMAGE_TAG ?= dev-$(shell date -u +%Y%m%d%H%M%S)
PLATFORM ?= linux/amd64
REGISTRY_USER ?= token
@@ -67,7 +71,7 @@ chart-check:
helm lint $(CHART) -f "$(VALUES)"
helm template "$(RELEASE)" $(CHART) -n "$(NAMESPACE)" -f "$(VALUES)" > /dev/null
deploy:
helm upgrade --install "$(RELEASE)" $(CHART) $(HELM_ARGS) --create-namespace -f "$(VALUES)" $(if $(IMAGE_DIGEST),--set-string image.digest=$(IMAGE_DIGEST),) --wait --timeout 180s
helm upgrade --install "$(RELEASE)" $(CHART) $(HELM_ARGS) --create-namespace -f "$(VALUES)" $(if $(IMAGE_DIGEST),--set-string image.digest=$(IMAGE_DIGEST),) --wait --wait-for-jobs --timeout 240s
reload:
kubectl --context "$(KUBE_CONTEXT)" -n "$(NAMESPACE)" rollout restart deployment/api
kubectl --context "$(KUBE_CONTEXT)" -n "$(NAMESPACE)" rollout status deployment/api --timeout=180s
@@ -78,6 +82,11 @@ ready:
reshard:
SHARDS="$(SHARDS)" scripts/scale-shards.sh
.PHONY: test-faults
test-faults:
scripts/test-faults.sh
.PHONY: metrics-install test-idempotency load-cluster
metrics-install:
kubectl --context "$(KUBE_CONTEXT)" apply -k infra/metrics-server
kubectl --context "$(KUBE_CONTEXT)" -n "$(NAMESPACE)" rollout status deployment/metrics-server --timeout=180s
test-idempotency:
RUN="idempotency-$$(date -u +%Y%m%d%H%M%S)" LOAD_SCRIPT=idempotency.js scripts/run-load.sh
load-cluster:
scripts/run-load.sh