Lab 12 submission - Advanced Kubernetes Resilience#361
Open
N1qro wants to merge 38 commits into
Open
Conversation
…eful degradation and resource analysis
Lab 1 submission - deploy, break, understand
Lab 2 submission - inspect, optimize, trace
Lab 3 submission - monitor, observe, define SLOs
Lab 4 submission - deploy, probe, helm
Lab 5 submission - CI/CD, GitOps, rollback
Lab 6 submission - alerting, responding
Fix CI manifest update push race
Lab 7 submission - Progressive Delivery
Lab 8 submission - Chaos Engineering
Lab 9 submission - Stateful Services and DB Reliability
Lab 10 submission - SRE Portfolio and Reliability Review
Lab 11 submission - Advanced Microservice Patterns
There was a problem hiding this comment.
Pull request overview
This PR delivers the Lab 12 “Advanced Kubernetes Resilience” submission by hardening the QuickTicket Kubernetes deployment (replicas, PDBs, rollout behavior), executing an online schema change workflow (expand/contract rename to scheduled_at), and documenting/validating the work with updated monitoring assets and lab writeups.
Changes:
- Increased service resilience via replica scaling, PodDisruptionBudgets, and gateway Rollout termination/readiness/topology-spread adjustments.
- Added Alembic migrations (including concurrent index work) and performed an expand-and-contract rename from
event_date→scheduled_at, including seed data updates and events-service query updates. - Updated observability artifacts (Grafana dashboard panels, Prometheus rule wiring) and added supporting runbook/handbook + CI workflow updates.
Reviewed changes
Copilot reviewed 57 out of 58 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| submissions/runbooks/quickticket-handbook.md | New operational handbook/runbook content for QuickTicket. |
| submissions/lab1.md | Lab 1 submission writeup. |
| submissions/lab2.md | Lab 2 submission writeup. |
| submissions/lab3.md | Lab 3 submission writeup. |
| submissions/lab4.md | Lab 4 submission writeup. |
| submissions/lab5.md | Lab 5 submission writeup. |
| submissions/lab6.md | Lab 6 submission writeup. |
| submissions/lab7.md | Lab 7 submission writeup. |
| submissions/lab8.md | Lab 8 submission writeup. |
| submissions/lab9.md | Lab 9 submission writeup (migrations/backup/restore work). |
| submissions/lab10.md | Lab 10 submission writeup (reliability review/load testing). |
| submissions/lab11.md | Lab 11 submission writeup (notifications + resilience patterns). |
| submissions/lab12.md | Lab 12 submission writeup (advanced K8s resilience + migrations). |
| monitoring/prometheus/rules.yml | Adds/defines SLO-related recording rules. |
| monitoring/prometheus/prometheus.yml | Prometheus scrape config (loads rules file). |
| monitoring/grafana/dashboards/golden-signals.json | Replaces placeholder panels with latency/saturation/SLO panels. |
| migrations/versions/0001_baseline_pre_existing_schema.py | Alembic baseline revision. |
| migrations/versions/0002_add_email_column_to_events.py | Alembic migration: add email column. |
| migrations/versions/0003_index_events_event_date_concurrently.py | Alembic migration: concurrent index creation/drop for event_date. |
| migrations/versions/0004_add_events_scheduled_at.py | Alembic migration: add nullable scheduled_at. |
| migrations/versions/0005_backfill_events_scheduled_at.py | Alembic migration: backfill + enforce NOT NULL on scheduled_at. |
| migrations/versions/0006_drop_events_event_date.py | Alembic migration: drop event_date (contract step). |
| migrations/env.py | Alembic environment configuration. |
| migrations/README | Alembic migrations README. |
| migrations/script.py.mako | Alembic script template. |
| locustfile.py | In-cluster Locust scenario for gateway load testing. |
| k8s/redis.yaml | Redis Deployment/Service manifest. |
| k8s/postgres.yaml | Postgres Deployment/Service with PVC-backed storage. |
| k8s/events.yaml | Events Deployment/Service manifest (2 replicas, env/probes). |
| k8s/payments.yaml | Payments Deployment/Service manifest (scaled to 2 replicas). |
| k8s/notifications.yaml | Notifications Deployment/Service manifest (scaled to 2 replicas). |
| k8s/gateway.yaml | Gateway Rollout updates (graceful shutdown, topology spread, analysis steps). |
| k8s/pdb.yaml | Adds PDBs for gateway/events/payments/notifications. |
| k8s/analysis-template.yaml | Defines canary error-rate AnalysisTemplate. |
| k8s/backup-cronjob.yaml | Adds Postgres backup CronJob manifest. |
| k8s/chart/Chart.yaml | Helm chart metadata. |
| k8s/chart/values.yaml | Helm chart values for QuickTicket components. |
| k8s/chart/templates/gateway.yaml | Helm template for gateway resources. |
| k8s/chart/templates/events.yaml | Helm template for events resources. |
| k8s/chart/templates/payments.yaml | Helm template for payments resources. |
| k8s/chart/templates/postgres.yaml | Helm template for postgres resources. |
| k8s/chart/templates/redis.yaml | Helm template for redis resources. |
| docker-compose.monitoring.yaml | Wires Prometheus rules file into docker-compose monitoring setup. |
| app/seed.sql | Updates seed schema/data to use scheduled_at instead of event_date. |
| app/gateway/main.py | Implements retry/circuit-breaker/rate-limiter logic and adds payments failure handling. |
| app/events/main.py | Switches reads/order to scheduled_at (aliased to preserve API response shape). |
| app/notifications/main.py | Adds notifications service implementation and metrics. |
| app/notifications/requirements.txt | Notifications service dependencies. |
| app/notifications/Dockerfile | Builds notifications service image (non-root user). |
| app/gateway/Dockerfile | Updates gateway Dockerfile (non-root user). |
| app/events/Dockerfile | Updates events Dockerfile (non-root user). |
| app/payments/Dockerfile | Updates payments Dockerfile (non-root user). |
| app/gateway/.dockerignore | Adds dockerignore for gateway build context. |
| app/events/.dockerignore | Adds dockerignore for events build context. |
| app/payments/.dockerignore | Adds dockerignore for payments build context. |
| alembic.ini | Adds Alembic configuration. |
| .gitignore | Adjusts ignored paths to allow committing lab artifacts/manifests. |
| .github/workflows/ci.yml | Adds CI workflow to build/push images and update manifests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+385
to
395
| except httpx.RequestError: | ||
| return JSONResponse( | ||
| status_code=503, | ||
| content={ | ||
| "error": "payments_unavailable", | ||
| "message": "Payment service is temporarily down. Your reservation is held — try again in a few minutes.", | ||
| "reservation_id": reservation_id, | ||
| }, | ||
| ) | ||
| except httpx.TimeoutException: | ||
| raise HTTPException(504, "Payment service timeout") |
Comment on lines
+8
to
12
| EXPOSE 8080 | ||
| RUN addgroup --system app && adduser --system --ingroup app app | ||
| USER app | ||
|
|
||
| EXPOSE 8080 |
Comment on lines
+8
to
12
| EXPOSE 8081 | ||
| RUN addgroup --system app && adduser --system --ingroup app app | ||
| USER app | ||
|
|
||
| EXPOSE 8081 |
Comment on lines
+8
to
12
| EXPOSE 8082 | ||
| RUN addgroup --system app && adduser --system --ingroup app app | ||
| USER app | ||
|
|
||
| EXPOSE 8082 |
Comment on lines
+19
to
+20
| image: quickticket-notifications:v1 | ||
| imagePullPolicy: Never |
Comment on lines
+24
to
+30
| def downgrade() -> None: | ||
| op.add_column( | ||
| "events", | ||
| sa.Column("event_date", sa.TIMESTAMP(timezone=True), nullable=True), | ||
| ) | ||
| op.execute("UPDATE events SET event_date = scheduled_at") | ||
| op.alter_column("events", "event_date", nullable=False) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lab 12 - Advanced Kubernetes Resilience
event_datetoscheduled_atwith three migrations and two events-service deploys.Summary
preStop, readiness, and termination-grace settingsCREATE INDEX CONCURRENTLYmigration with Alembic autocommitscheduled_atsubmissions/lab12.md