From 8576172bb472013e031a49db7576a5e8f6d11a58 Mon Sep 17 00:00:00 2001 From: Mathias Beaulieu-Duncan Date: Wed, 3 Jun 2026 17:11:04 -0400 Subject: [PATCH] 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) --- Chart.yaml | 2 +- templates/deployment.yaml | 20 +++----------------- values.yaml | 27 ++++----------------------- 3 files changed, 8 insertions(+), 41 deletions(-) diff --git a/Chart.yaml b/Chart.yaml index 8b24fb5..3bd5648 100644 --- a/Chart.yaml +++ b/Chart.yaml @@ -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 diff --git a/templates/deployment.yaml b/templates/deployment.yaml index fb13664..7ed5203 100644 --- a/templates/deployment.yaml +++ b/templates/deployment.yaml @@ -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: diff --git a/values.yaml b/values.yaml index 48bb8ff..ffb0d24 100644 --- a/values.yaml +++ b/values.yaml @@ -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"