feat(k8s): Add daily registry sync cronjob for base images
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
53
k8s/registry-sync-cronjob.yaml
Normal file
53
k8s/registry-sync-cronjob.yaml
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
# Daily job to sync base images from Docker Hub to local registry
|
||||||
|
# Runs at 3 AM daily to refresh the cache before rate limits reset
|
||||||
|
apiVersion: batch/v1
|
||||||
|
kind: CronJob
|
||||||
|
metadata:
|
||||||
|
name: registry-sync
|
||||||
|
namespace: woodpecker
|
||||||
|
spec:
|
||||||
|
schedule: "0 3 * * *" # 3 AM daily
|
||||||
|
successfulJobsHistoryLimit: 3
|
||||||
|
failedJobsHistoryLimit: 3
|
||||||
|
jobTemplate:
|
||||||
|
spec:
|
||||||
|
template:
|
||||||
|
spec:
|
||||||
|
restartPolicy: OnFailure
|
||||||
|
containers:
|
||||||
|
- name: sync
|
||||||
|
image: gcr.io/go-containerregistry/crane:latest
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- |
|
||||||
|
set -e
|
||||||
|
echo "=== Registry Sync: $(date) ==="
|
||||||
|
|
||||||
|
REGISTRY="10.100.9.70:5000"
|
||||||
|
|
||||||
|
# Base images to cache
|
||||||
|
IMAGES="
|
||||||
|
library/node:20-slim
|
||||||
|
library/node:22-slim
|
||||||
|
library/node:22
|
||||||
|
library/node:22-alpine
|
||||||
|
library/node:20-alpine
|
||||||
|
library/alpine:latest
|
||||||
|
library/nginx:alpine
|
||||||
|
bitnami/kubectl:latest
|
||||||
|
"
|
||||||
|
|
||||||
|
for img in $IMAGES; do
|
||||||
|
echo "Syncing docker.io/$img -> $REGISTRY/$img"
|
||||||
|
crane copy "docker.io/$img" "$REGISTRY/$img" --insecure || echo "WARN: Failed $img"
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "=== Sync complete ==="
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
memory: "256Mi"
|
||||||
|
cpu: "200m"
|
||||||
|
requests:
|
||||||
|
memory: "128Mi"
|
||||||
|
cpu: "100m"
|
||||||
Reference in New Issue
Block a user