initial scaffold

This commit is contained in:
Remy Moll 2025-05-29 13:42:33 +02:00
commit 81ce915621
11 changed files with 212 additions and 0 deletions

16
README.md Normal file
View File

@ -0,0 +1,16 @@
# Overpass kubernetes service
### Overview
Deploys an overpass instance with the following features:
- single pod
- no rate limiting
- no duplicate request blocking
- no authentication
- specifiable earth file as input
- slowest temporal resolution of 1 day
### Deployment
TBD
### Usage
After applying the an overlay that deploys `<namespace>` the service will be available (cluster) internally at `overpass.<namespace>.svc.cluster.local:12345 `.

77
base/configmap.yaml Normal file
View File

@ -0,0 +1,77 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: overpass-config
data:
##### FROM https://github.com/wiktorn/Overpass-API
# takes the value of either init or clone. Defaults to clone.
# we use init because we want lower than default time resolution
OVERPASS_MODE: "init"
# attic, yes, or no. Passed as --keep-attic, --meta, or nothing to update_database and init. Defaults to no.
OVERPASS_META: "no"
# (init mode only) url to a "planet" file (e.g. https://planet.openstreetmap.org/planet/planet-latest.osm.bz2)
OVERPASS_PLANET_URL: "https://planet.openstreetmap.org/planet/planet-latest.osm.bz2"
# (clone mode only) the url to clone a copy of Overpass from. Defaults to https://dev.overpass-api.de/api_drolbr/, which uses minute diffs.
# OVERPASS_CLONE_SOURCE: ""
# url to a diff directory for updating the instance (e.g. https://planet.openstreetmap.org/replication/minute/).
# intentionally use the lower resolution
OVERPASS_DIFF_URL: "https://planet.openstreetmap.org/replication/day/"
# (init mode only) takes values of no, gz or lz4. Specifies compression mode of the Overpass database. Defaults to gz.
# keep the default here
# OVERPASS_COMPRESSION: ""
# integer, desired load from area generation. Controls the ratio of sleep to work. A value of 1 will make the system sleep 99x times longer than it works, a value of 50 will result in sleep and work in equal measure, and a value of 100 will only sleep 3 seconds between each execution. Defaults to 1.
OVERPASS_RULES_LOAD: ""
# integer, the delay between updates (seconds).
OVERPASS_UPDATE_SLEEP: ""
# cookie-jar compatible content to be used when fetching planet.osm files and updates.
# OVERPASS_COOKIE_JAR_CONTENTS: ""
# commands to be run before passing the planet.osm file to update_database, e.g. conversion from pbf to osm.bz2 using osmium.
# OVERPASS_PLANET_PREPROCESS: ""
# commands to be run before passing the diff.osc file to update_database, e.g. extracting geo specific regions
# OVERPASS_DIFF_PREPROCESS: ""
# set to yes if you want to use oauth_cookie_client to update cookies before each update. Settings are read from /secrets/oauth-settings.json. Read the documentation here.
# USE_OAUTH_COOKIE_CLIENT: ""
# number of fcgiwarp processes. Defaults to 4. Use higher values if you notice performance problems.4#
# we want to be able to handle more concurrent requests
OVERPASS_FASTCGI_PROCESSES: "8"
# set the maximum allowed number of concurrent accesses from a single IP address.
# all requests are from the same anyway backend and we don't expose the service => no rate limiting
# OVERPASS_RATE_LIMIT: ""
# set the maximum amount of time units (available time).
OVERPASS_TIME: ""
# set the maximum amount of RAM (available space) in bytes.
# in accordance with the kubernetes *enforced* limits
# about 8 GB
OVERPASS_SPACE: "8000000000"
# set the maximum timeout for queries (default: 1000s). Translates to send/recv timeout for fastcgi_wrap.
# we want requests to be fairly snappy, and we fail gracefully if they take too long
OVERPASS_MAX_TIMEOUT: "60s"
# if false initial area generation and the area updater process will be disabled. Default true.
OVERPASS_USE_AREAS: "true"
# shell commands to execute to verify that image is healthy. exit 1 in case of failures, exit 0 when container is healthy. Default healthcheck queries overpass and verifies that there is reponse returned
# left empty since we use kubernetes health checks
# OVERPASS_HEALTHCHECK: ""
# if false the container will keep running after init is complete. Otherwise container will be stopped after initialization process is complete. Default true
OVERPASS_STOP_AFTER_INIT: "false"
# if yes, duplicate queries (same query from the same IP address) will be allowed. Default no.
OVERPASS_ALLOW_DUPLICATE_QUERIES: "yes"

40
base/deployment.yaml Normal file
View File

@ -0,0 +1,40 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: overpass
spec:
selector:
matchLabels:
app: overpass
template:
metadata:
labels:
app: overpass
spec:
containers:
- name: overpass
image: overpass # the actual image name is specified in the kustomization.yaml
resources:
requests:
memory: "1Gi"
cpu: "50m"
limits:
memory: "9Gi"
# we don't expect high CPU usage even during many requests
cpu: "1"
envFrom:
- configMapRef:
name: overpass-config
ports:
- containerPort: 12345
# readinessProbe: TODO
# livenessProbe: TODO
volumeMounts:
- name: overpass-data
mountPath: /database
volumes:
- name: overpass-data
persistentVolumeClaim:
claimName: overpass-data

16
base/kustomization.yaml Normal file
View File

@ -0,0 +1,16 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- namespace.yaml
# - pvc.yaml
- deployment.yaml
- configmap.yaml
- service.yaml
- pvc.yaml
images:
- name: overpass
newName: wiktorn/overpass-api
newTag: "0.7.56.9"

4
base/namespace.yaml Normal file
View File

@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: placeholder

10
base/pvc.yaml Normal file
View File

@ -0,0 +1,10 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: overpass-data
spec:
resources:
requests:
storage: 15Gi
accessModes:
- ReadWriteMany

10
base/service.yaml Normal file
View File

@ -0,0 +1,10 @@
apiVersion: v1
kind: Service
metadata:
name: overpass
spec:
selector:
app: overpass
ports:
- port: 12345
targetPort: 12345

View File

@ -0,0 +1,8 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../base
namespace: overpass-prod

View File

@ -0,0 +1,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: overpass-config
data:
# only monaco
OVERPASS_PLANET_URL: "https://planet.openstreetmap.org/TODO"

View File

@ -0,0 +1,15 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../base
namespace: overpass-stg
metadata:
labels:
env: stg
patches:
- path: configmap.yaml
- path: pvc.yaml

9
overlays/stg/pvc.yaml Normal file
View File

@ -0,0 +1,9 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: overpass-data
spec:
storageClassName: "nfs-client"
# resources:
# requests:
# storage: 10Gi