Remove in-cluster data processing; serve pre-built OSRM data from PVC

The init containers downloaded the OSM extract and ran
osrm-extract/partition/customize on every pod start. extract peaks ~4GB+
RAM, which OOM-kills on the 4GB nodes whenever the pod restarts (it only
survived 306 days by never restarting). Removed both init containers.

Routing data (map.osrm.*) is now built OUTSIDE the cluster and loaded
onto the PVC directly. Bumped chart to 0.2.0.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Mathias Beaulieu-Duncan 2026-06-03 17:11:04 -04:00
parent c908d5f120
commit 8576172bb4
3 changed files with 8 additions and 41 deletions

View File

@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
version: 0.2.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to

View File

@ -30,23 +30,9 @@ spec:
serviceAccountName: {{ include "helm-osrm-backend.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- if .Values.initContainer.enabled }}
initContainers:
- name: osrm-download
image: busybox
command: [ "sh", "-c" ]
args:
- wget -O /data/{{ .Values.initContainer.fileName }} {{ .Values.initContainer.url }};
volumeMounts:
- name: osrm-data
mountPath: {{ .Values.volume.mountPath }}
- name: osrm-init
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
command: {{ .Values.initContainer.command | toYaml | nindent 10 }}
volumeMounts:
- name: osrm-data
mountPath: {{ .Values.volume.mountPath }}
{{- end }}
# NOTE: No init containers. OSRM routing data (map.osrm.*) is built OUTSIDE the
# cluster (osrm-extract/partition/customize) and loaded onto the PVC directly.
# In-cluster extraction was removed: it peaks ~4GB+ RAM and OOM-kills on restart.
containers:
- name: {{ .Chart.Name }}
securityContext:

View File

@ -32,29 +32,10 @@ volume:
resources: {}
initContainer:
enabled: true
# url of the dataset you want to
url: "https://download.geofabrik.de/north-america/canada/quebec-latest.osm.pbf"
# don't forget to update the FILE_NAME in the script below
# AND in the command bellow
fileName: "map.osm.pbf"
command:
- "/bin/sh"
- "-c"
- |
set -e;
FILE_NAME=map.osm.pbf;
FILE_BASE=$(echo "$FILE_NAME" | sed 's/.osm.pbf//');
echo "Running osrm-extract...";
osrm-extract -p /opt/car.lua "/data/$FILE_NAME" || { echo "osrm-extract failed"; exit 1; }
echo "Running osrm-partition...";
osrm-partition "/data/$FILE_BASE.osrm" || { echo "osrm-partition failed"; exit 1; }
echo "Running osrm-customize...";
osrm-customize "/data/$FILE_BASE.osrm" || { echo "osrm-customize failed"; exit 1; }
# Routing data (map.osrm.*) is built OUTSIDE the cluster and loaded onto the PVC.
# In-cluster extraction was removed (osrm-extract peaks ~4GB+ and OOM-kills on restart).
# To refresh the map: build locally with osrm-backend (extract -> partition -> customize),
# then copy map.osrm.* onto the volume (e.g. via a helper pod + kubectl cp).
command:
- "osrm-routed"