This repository has been archived on 2023-04-02. You can view files and clone it, but cannot push or open issues or pull requests.
gitops-tbrnt/ipapi/job-db-init.yaml

38 lines
1.3 KiB
YAML

apiVersion: batch/v1
kind: Job
metadata:
name: geoip-db-init
spec:
template:
metadata:
creationTimestamp: null
spec:
containers:
- command:
- sh
- -c
- |
wget -O geoip.tar.gz "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country&license_key=${API_KEY}&suffix=tar.gz" && \
tar -C /tmp -xvzf geoip.tar.gz && rm geoip.tar.gz && \
wget -O geoip.tar.gz "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&license_key=${API_KEY}&suffix=tar.gz" && \
tar -C /tmp -xvzf geoip.tar.gz && rm geoip.tar.gz && \
wget -O geoip.tar.gz "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-ASN&license_key=${API_KEY}&suffix=tar.gz" && \
tar -C /tmp -xvzf geoip.tar.gz && rm geoip.tar.gz && \
find /tmp -name '*.mmdb' -exec cp {} /data/geoip \;
image: busybox
name: geoip-db-init
env:
- name: API_KEY
valueFrom:
secretKeyRef:
name: maxmind-api-key
key: API_KEY
volumeMounts:
- name: geoip
mountPath: /data/geoip
volumes:
- name: geoip
persistentVolumeClaim:
claimName: ipapi-geodb
restartPolicy: Never