-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpull
executable file
·34 lines (30 loc) · 887 Bytes
/
pull
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
. /opt/precache/common
pull_timeout="${pull_timeout:-6000}"
function mirror_images {
PULL_SECRET='/var/lib/kubelet/config.json'
for line in $(sort -u /tmp/images.txt) ; do
img="${line%\"}"
img="${img#\"}"
podman image exists $img
if [[ $? == 0 ]]; then
log_debug "Skipping existing image $img"
continue
fi
success=0
iterations=10
until [[ $success -eq 1 ]] || [[ $iterations -eq 0 ]]
do
timeout $pull_timeout podman pull $img --authfile='/var/lib/kubelet/config.json'
if [[ $? == 0 ]]; then
success=1
fi
iterations=$((iterations - 1))
done
if [[ $success == 0 ]]; then
log_debug "failed to pull ${img}"
fi
done
log_debug "Image pre-cache done"
}
mirror_images