image:
  repository: ghcr.io/project-osrm/osrm-backend
  pullPolicy: IfNotPresent

replicaCount: 1

autoscaling:
  enabled: false
  minReplicas: 1
  maxReplicas: 100
  targetCPUUtilizationPercentage: 80
  # targetMemoryUtilizationPercentage: 80

serviceAccount:
  create: true
  automount: true
  annotations: {}
  name: ""

service:
  type: ClusterIP
  port: 5000

volume:
  mountPath: /data
  # this will be probably different for you
  storageClass: linode-block-storage
  accessMode: ReadWriteOnce
  # adjust the size you need depending on the dataset you need
  size: 20Gi
  existingClaim: ""

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; }

command:
  - "osrm-routed"
  - "--algorithm"
  - "mld"
  - /data/map.osrm

# httpGet doesn't support status code 400 and there is no health check call on the osrm api
# I rather avoid making a real call which will use compute everytime the probes triggers
livenessProbe:
  exec:
    command:
      - sh
      - -c
      - 'cat /proc/net/tcp | grep -i ":1388"'

readinessProbe:
  exec:
    command:
      - sh
      - -c
      - 'cat /proc/net/tcp | grep -i ":1388"'

# important for init containers to give it times to download and extract the data
tolerations:
  - key: "node.kubernetes.io/not-ready"
    operator: "Exists"
    effect: "NoExecute"
    tolerationSeconds: 3600  # 60 minutes

  - key: "node.kubernetes.io/unreachable"
    operator: "Exists"
    effect: "NoExecute"
    tolerationSeconds: 3600  # 60 minutes