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
53
k8s/osrm-bicycle.yaml
Normal file
53
k8s/osrm-bicycle.yaml
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: osrm-bicycle
|
||||
labels:
|
||||
app: osrm-bicycle
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: osrm-bicycle
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: osrm-bicycle
|
||||
spec:
|
||||
containers:
|
||||
- name: osrm-bicycle
|
||||
image: ghcr.io/project-osrm/osrm-backend:latest
|
||||
command: ["osrm-routed", "--algorithm", "MLD", "/data/bicycle/greater-london-latest.osrm"]
|
||||
ports:
|
||||
- containerPort: 5000
|
||||
volumeMounts:
|
||||
- name: osrm-data
|
||||
mountPath: /data
|
||||
resources:
|
||||
requests:
|
||||
memory: "256Mi"
|
||||
cpu: "100m"
|
||||
limits:
|
||||
memory: "512Mi"
|
||||
cpu: "500m"
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: 5000
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 10
|
||||
volumes:
|
||||
- name: osrm-data
|
||||
persistentVolumeClaim:
|
||||
claimName: osrm-data-pvc
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: osrm-bicycle
|
||||
spec:
|
||||
selector:
|
||||
app: osrm-bicycle
|
||||
ports:
|
||||
- port: 5000
|
||||
targetPort: 5000
|
||||
53
k8s/osrm-foot.yaml
Normal file
53
k8s/osrm-foot.yaml
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: osrm-foot
|
||||
labels:
|
||||
app: osrm-foot
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: osrm-foot
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: osrm-foot
|
||||
spec:
|
||||
containers:
|
||||
- name: osrm-foot
|
||||
image: ghcr.io/project-osrm/osrm-backend:latest
|
||||
command: ["osrm-routed", "--algorithm", "MLD", "/data/foot/greater-london-latest.osrm"]
|
||||
ports:
|
||||
- containerPort: 5000
|
||||
volumeMounts:
|
||||
- name: osrm-data
|
||||
mountPath: /data
|
||||
resources:
|
||||
requests:
|
||||
memory: "256Mi"
|
||||
cpu: "100m"
|
||||
limits:
|
||||
memory: "512Mi"
|
||||
cpu: "500m"
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: 5000
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 10
|
||||
volumes:
|
||||
- name: osrm-data
|
||||
persistentVolumeClaim:
|
||||
claimName: osrm-data-pvc
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: osrm-foot
|
||||
spec:
|
||||
selector:
|
||||
app: osrm-foot
|
||||
ports:
|
||||
- port: 5000
|
||||
targetPort: 5000
|
||||
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
|
||||
53
k8s/otp.yaml
Normal file
53
k8s/otp.yaml
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: otp
|
||||
labels:
|
||||
app: otp
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: otp
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: otp
|
||||
spec:
|
||||
containers:
|
||||
- name: otp
|
||||
image: opentripplanner/opentripplanner:2.6.0
|
||||
command: ["--load", "--serve"]
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
volumeMounts:
|
||||
- name: otp-data
|
||||
mountPath: /var/opentripplanner
|
||||
resources:
|
||||
requests:
|
||||
memory: "1Gi"
|
||||
cpu: "250m"
|
||||
limits:
|
||||
memory: "2Gi"
|
||||
cpu: "1000m"
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /otp/actuators/health
|
||||
port: 8080
|
||||
initialDelaySeconds: 120
|
||||
periodSeconds: 30
|
||||
volumes:
|
||||
- name: otp-data
|
||||
persistentVolumeClaim:
|
||||
claimName: otp-data-pvc
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: otp
|
||||
spec:
|
||||
selector:
|
||||
app: otp
|
||||
ports:
|
||||
- port: 8080
|
||||
targetPort: 8080
|
||||
21
k8s/routing-pvcs.yaml
Normal file
21
k8s/routing-pvcs.yaml
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: osrm-data-pvc
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 2Gi
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: otp-data-pvc
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 2Gi
|
||||
Loading…
Add table
Add a link
Reference in a new issue