Add Kubernetes manifests for routing engines
Deployments and Services for osrm-foot (256-512MB), osrm-bicycle (256-512MB), and OTP (1-2GB). Includes PVCs for data storage and an init Job to download and pre-process Greater London OSM data.
This commit is contained in:
parent
8509a0326f
commit
7084c46f89
5 changed files with 244 additions and 0 deletions
64
k8s/osrm-init-job.yaml
Normal file
64
k8s/osrm-init-job.yaml
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: osrm-init
|
||||
spec:
|
||||
backoffLimit: 3
|
||||
template:
|
||||
spec:
|
||||
restartPolicy: OnFailure
|
||||
containers:
|
||||
- name: osrm-init
|
||||
image: ghcr.io/project-osrm/osrm-backend:latest
|
||||
command:
|
||||
- /bin/bash
|
||||
- -c
|
||||
- |
|
||||
set -euo pipefail
|
||||
OSM_FILE="greater-london-latest.osm.pbf"
|
||||
GEOFABRIK_URL="https://download.geofabrik.de/europe/great-britain/england/greater-london-latest.osm.pbf"
|
||||
|
||||
# Download OSM data if not present
|
||||
if [ ! -f "/data/${OSM_FILE}" ]; then
|
||||
echo "Downloading Greater London OSM extract..."
|
||||
apt-get update -qq && apt-get install -qq -y curl
|
||||
curl -L -o "/data/${OSM_FILE}" "${GEOFABRIK_URL}"
|
||||
fi
|
||||
|
||||
# Process foot profile
|
||||
if [ ! -f "/data/foot/greater-london-latest.osrm" ]; then
|
||||
echo "Processing foot profile..."
|
||||
mkdir -p /data/foot
|
||||
cp "/data/${OSM_FILE}" "/data/foot/${OSM_FILE}"
|
||||
osrm-extract -p /opt/foot.lua "/data/foot/${OSM_FILE}"
|
||||
osrm-partition "/data/foot/greater-london-latest.osrm"
|
||||
osrm-customize "/data/foot/greater-london-latest.osrm"
|
||||
rm -f "/data/foot/${OSM_FILE}"
|
||||
fi
|
||||
|
||||
# Process bicycle profile
|
||||
if [ ! -f "/data/bicycle/greater-london-latest.osrm" ]; then
|
||||
echo "Processing bicycle profile..."
|
||||
mkdir -p /data/bicycle
|
||||
cp "/data/${OSM_FILE}" "/data/bicycle/${OSM_FILE}"
|
||||
osrm-extract -p /opt/bicycle.lua "/data/bicycle/${OSM_FILE}"
|
||||
osrm-partition "/data/bicycle/greater-london-latest.osrm"
|
||||
osrm-customize "/data/bicycle/greater-london-latest.osrm"
|
||||
rm -f "/data/bicycle/${OSM_FILE}"
|
||||
fi
|
||||
|
||||
echo "OSRM data initialization complete!"
|
||||
volumeMounts:
|
||||
- name: osrm-data
|
||||
mountPath: /data
|
||||
resources:
|
||||
requests:
|
||||
memory: "1Gi"
|
||||
cpu: "500m"
|
||||
limits:
|
||||
memory: "2Gi"
|
||||
cpu: "2000m"
|
||||
volumes:
|
||||
- name: osrm-data
|
||||
persistentVolumeClaim:
|
||||
claimName: osrm-data-pvc
|
||||
Loading…
Add table
Add a link
Reference in a new issue