MM: restore the mirrors location cronjob

Signed-off-by: Aurélien Bompard <aurelien@bompard.org>
This commit is contained in:
Aurélien Bompard 2024-02-23 17:50:34 +01:00
parent c7e3a33aa0
commit a6cd73a473
No known key found for this signature in database
GPG key ID: 31584CFEB9BF64AD
3 changed files with 80 additions and 2 deletions

View file

@ -127,6 +127,10 @@
app: mirrormanager
template: cron-mirrorlist-cache.yml
objectname: cron-mirrorlist-cache.yml
- role: openshift/object
app: mirrormanager
template: cron-geoip.yml
objectname: cron-geoip.yml
- role: openshift/start-build
app: mirrormanager

View file

@ -0,0 +1,74 @@
---
# Download GeoIP database
apiVersion: batch/v1
kind: CronJob
metadata:
name: download-geoip-db
spec:
successfulJobsHistoryLimit: 3
failedJobsHistoryLimit: 3
concurrencyPolicy: Forbid
schedule: "48 * * * *"
startingDeadlineSeconds: 500
jobTemplate:
spec:
template:
spec:
restartPolicy: Never
containers:
- name: mirrormanager
image: image-registry.openshift-image-registry.svc:5000/mirrormanager/mirrormanager2:latest
command:
- "curl"
- "--create-dirs"
- "--output-dir"
- "/var/lib/mirrormanager/geoip"
- "-O"
- "https://infrastructure.fedoraproject.org/infra/bigfiles/geoip/GeoLite2-City.mmdb"
volumeMounts:
- name: data
mountPath: "/var/lib/mirrormanager"
volumes:
- name: data
persistentVolumeClaim:
claimName: data
securityContext:
supplementalGroups: [1001280000]
---
# Generate the mirrors location text file
apiVersion: batch/v1
kind: CronJob
metadata:
name: generate-mirrors-location
spec:
successfulJobsHistoryLimit: 3
failedJobsHistoryLimit: 3
concurrencyPolicy: Forbid
schedule: "50 20 * * *"
startingDeadlineSeconds: 500
jobTemplate:
spec:
template:
spec:
restartPolicy: Never
containers:
- name: mirrormanager
image: image-registry.openshift-image-registry.svc:5000/mirrormanager/mirrormanager2:latest
command:
- "mm2_generate-worldmap"
- "--output"
- "/var/lib/mirrormanager/map"
volumeMounts:
- name: config
mountPath: "/etc/mirrormanager"
- name: data
mountPath: "/var/lib/mirrormanager"
volumes:
- name: config
configMap:
name: config
- name: data
persistentVolumeClaim:
claimName: data
securityContext:
supplementalGroups: [1001280000]

View file

@ -1,7 +1,7 @@
#!/bin/bash
MIRRORLIST_PROXY="{% for host in groups['mirrorlist_proxies'] %} {{ host }} {% endfor %}"
MM_ROOT=/opt/app-root/src
MM_ROOT=/opt/app-root
CACHEDIR=/data
set -e
@ -10,7 +10,7 @@ set -x
rm -rf ${CACHEDIR}/old
mkdir -p ${CACHEDIR}/old
chmod g+w ${CACHEDIR}/old
cp -ar ${CACHEDIR}/*.* ${CACHEDIR}/old/
cp -arf ${CACHEDIR}/*.* ${CACHEDIR}/old/
${MM_ROOT}/bin/generate-mirrorlist-cache -o ${CACHEDIR}/mirrorlist_cache.proto