777926487b
initial QEMU slice, backed by imported contracts for majors 6–9. - Implement durable handlers for access/auth, cluster, LXC, storage, HA, firewall, Ceph, SDN, ACME, notifications, pools, mapping, and node ops - Serve an interactive Web UI with catalog browsing, demo seed controls, and OpenAPI/help surfaces - Bundle PVE 6.4-15, 7.4-16, and 8.4.5 contract revisions alongside 9.2.3 - Support in-memory runtime contract Apply (POST /ui/api/contract/apply) so /version and /api2 routes follow the selected major until restart - Expand seed profiles (including demo-cluster), migrations 007–008, TLS gateway config, Compose/Makefile tooling, and compatibility evidence - Tighten .gitignore for macOS, hidden directories (.*/), and local secrets
38 lines
1014 B
Python
38 lines
1014 B
Python
"""Kubernetes-compatible health endpoints."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Annotated
|
|
|
|
from fastapi import APIRouter, Depends, Response, status
|
|
from pydantic import BaseModel
|
|
|
|
from app.db.pool import Database
|
|
from app.dependencies import get_database
|
|
|
|
router = APIRouter(prefix="/health", tags=["Simulator"])
|
|
|
|
|
|
class HealthResponse(BaseModel):
|
|
status: str
|
|
|
|
|
|
@router.get("/live", response_model=HealthResponse)
|
|
async def live() -> HealthResponse:
|
|
"""Report process liveness without checking dependencies."""
|
|
|
|
return HealthResponse(status="ok")
|
|
|
|
|
|
@router.get("/ready", response_model=HealthResponse)
|
|
async def ready(
|
|
response: Response,
|
|
database: Annotated[Database, Depends(get_database)],
|
|
) -> HealthResponse:
|
|
"""Report whether the required database dependency is usable."""
|
|
|
|
if await database.is_ready():
|
|
return HealthResponse(status="ok")
|
|
response.status_code = status.HTTP_503_SERVICE_UNAVAILABLE
|
|
return HealthResponse(status="unavailable")
|