How dars1k23/swiftml-k8s works
swiftml-k8s compiles a validated YAML model specification into a Docker image and Kubernetes Deployment/Service, then runs a FastAPI inference service. The primary workflow is configuration → compilation → image build and cluster deployment → health checks or batched predictions. The README documents the end-to-end deployment and framework handoff; runtime details below are based on the sampled source, so unsampled template behavior is represented only where documented or directly referenced.
Main entry points: main.py Compiler entrypoint · compiler.py Artifact compiler · server_core.py Inference API · mlkube.yaml Model YAML
Components 17
Configuration and compilation
- Model YAML
mlkube.yaml - Compiler entrypoint
main.py - Config validation
config.py - Artifact compiler
compiler.py - Dockerfile template
templates/Dockerfile.tmpl - Kubernetes template
templates/deployment.tmpl
Image and Kubernetes deployment
- Generated Dockerfile
templates/Dockerfile.tmpl - Generated manifests
templates/deployment.tmpl
Inference runtime
- Inference API
server_core.py - Model initialization
server_core.py - Framework loaders
server_core.py - Model artifact
- Prediction handler
server_core.py - Health endpoint
server_core.py
External systems
- Docker engine
- Kubernetes cluster
Other components
- Model author
Connections 20
- Model author → Model YAML: defines model
README.md - Model YAML → Compiler entrypoint: reads config
main.py - Compiler entrypoint → Config validation: validates
main.py - Compiler entrypoint → Artifact compiler: creates compiler
main.py - Artifact compiler → Dockerfile template: formats Dockerfile
compiler.py - Artifact compiler → Kubernetes template: formats manifests
compiler.py - Artifact compiler → Config validation: uses config type
compiler.py - Compiler entrypoint → Generated Dockerfile: writes output
main.py - Compiler entrypoint → Docker engine: builds image
main.py - Compiler entrypoint → Generated manifests: writes output
main.py - Compiler entrypoint → Kubernetes cluster: applies manifests
main.py - Generated manifests → Kubernetes cluster: deploys service
README.md - Generated Dockerfile → Model initialization: sets framework ENV
README.md - Model initialization → Framework loaders: selects loader
server_core.py - Framework loaders → Model artifact: loads model
server_core.py - Model author → Inference API: sends requests
README.md - Inference API → Prediction handler: routes predict
server_core.py - Prediction handler → Model artifact: calls predict
server_core.py - Inference API → Health endpoint: routes health
server_core.py - Model initialization → Inference API: initializes at startup
server_core.py