#!/bin/bash
set -x 

newrepo=dockerhub.kubekey.local:7443/kubesphere
oldrepo=reg.kyverno.io/kyverno

dockerimages=(
kyvernopre:v1.14.2
kyverno:v1.14.2
background-controller:v1.14.2
cleanup-controller:v1.14.2
reports-controller:v1.14.2
)

j=1
for i in ${dockerimages[@]}
do
    echo $i
    echo $j

    docker pull $oldrepo/$i
    docker tag $oldrepo/$i $newrepo/$i
#    docker rmi $i $newrepo/$i

    let j+=1
done

docker save $newrepo/kyvernopre:v1.14.2 $newrepo/kyverno:v1.14.2 $newrepo/background-controller:v1.14.2 $newrepo/cleanup-controller:v1.14.2 $newrepo/reports-controller:v1.14.2 -o kyvernoimages.tar
set +x

