From 81ce91562114f91906aac496d4da64c3334f3a79 Mon Sep 17 00:00:00 2001 From: Remy Moll Date: Thu, 29 May 2025 13:42:33 +0200 Subject: [PATCH] initial scaffold --- README.md | 16 +++++++ base/configmap.yaml | 77 ++++++++++++++++++++++++++++++++ base/deployment.yaml | 40 +++++++++++++++++ base/kustomization.yaml | 16 +++++++ base/namespace.yaml | 4 ++ base/pvc.yaml | 10 +++++ base/service.yaml | 10 +++++ overlays/prod/kustomization.yaml | 8 ++++ overlays/stg/configmap.yaml | 7 +++ overlays/stg/kustomization.yaml | 15 +++++++ overlays/stg/pvc.yaml | 9 ++++ 11 files changed, 212 insertions(+) create mode 100644 README.md create mode 100644 base/configmap.yaml create mode 100644 base/deployment.yaml create mode 100644 base/kustomization.yaml create mode 100644 base/namespace.yaml create mode 100644 base/pvc.yaml create mode 100644 base/service.yaml create mode 100644 overlays/prod/kustomization.yaml create mode 100644 overlays/stg/configmap.yaml create mode 100644 overlays/stg/kustomization.yaml create mode 100644 overlays/stg/pvc.yaml diff --git a/README.md b/README.md new file mode 100644 index 0000000..713d30c --- /dev/null +++ b/README.md @@ -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 `` the service will be available (cluster) internally at `overpass..svc.cluster.local:12345 `. \ No newline at end of file diff --git a/base/configmap.yaml b/base/configmap.yaml new file mode 100644 index 0000000..6d88a80 --- /dev/null +++ b/base/configmap.yaml @@ -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" diff --git a/base/deployment.yaml b/base/deployment.yaml new file mode 100644 index 0000000..0f9e4e5 --- /dev/null +++ b/base/deployment.yaml @@ -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 diff --git a/base/kustomization.yaml b/base/kustomization.yaml new file mode 100644 index 0000000..7bd6909 --- /dev/null +++ b/base/kustomization.yaml @@ -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" diff --git a/base/namespace.yaml b/base/namespace.yaml new file mode 100644 index 0000000..0a074bd --- /dev/null +++ b/base/namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: placeholder diff --git a/base/pvc.yaml b/base/pvc.yaml new file mode 100644 index 0000000..12bd8b5 --- /dev/null +++ b/base/pvc.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: overpass-data +spec: + resources: + requests: + storage: 15Gi + accessModes: + - ReadWriteMany diff --git a/base/service.yaml b/base/service.yaml new file mode 100644 index 0000000..761f390 --- /dev/null +++ b/base/service.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: Service +metadata: + name: overpass +spec: + selector: + app: overpass + ports: + - port: 12345 + targetPort: 12345 diff --git a/overlays/prod/kustomization.yaml b/overlays/prod/kustomization.yaml new file mode 100644 index 0000000..1f61416 --- /dev/null +++ b/overlays/prod/kustomization.yaml @@ -0,0 +1,8 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - ../../base + +namespace: overpass-prod + diff --git a/overlays/stg/configmap.yaml b/overlays/stg/configmap.yaml new file mode 100644 index 0000000..6319162 --- /dev/null +++ b/overlays/stg/configmap.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: overpass-config +data: + # only monaco + OVERPASS_PLANET_URL: "https://planet.openstreetmap.org/TODO" diff --git a/overlays/stg/kustomization.yaml b/overlays/stg/kustomization.yaml new file mode 100644 index 0000000..4962ab1 --- /dev/null +++ b/overlays/stg/kustomization.yaml @@ -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 diff --git a/overlays/stg/pvc.yaml b/overlays/stg/pvc.yaml new file mode 100644 index 0000000..2674985 --- /dev/null +++ b/overlays/stg/pvc.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: overpass-data +spec: + storageClassName: "nfs-client" + # resources: + # requests: + # storage: 10Gi \ No newline at end of file