#!/bin/bash
set -x 

newrepo=registry.local:9001

dockerimages=(
registry.k8s.io/kube-apiserver:v1.28.4
registry.k8s.io/kube-controller-manager:v1.28.4
registry.k8s.io/kube-scheduler:v1.28.4
registry.k8s.io/kube-proxy:v1.28.4
registry.k8s.io/pause:3.9
registry.k8s.io/etcd:3.5.9-0
registry.k8s.io/coredns/coredns:v1.10.1
quay.io/calico/cni:v3.25.0
quay.io/calico/node:v3.25.0
quay.io/calico/kube-controllers:v3.25.0
ghcr.io/k8snetworkplumbingwg/multus-cni:v3.9.3
ghcr.io/k8snetworkplumbingwg/sriov-cni:v2.7.0
ghcr.io/k8snetworkplumbingwg/sriov-network-device-plugin:v3.5.1
docker.io/starlingx/n3000-opae:stx.8.0-v1.0.2
quay.io/stackanetes/kubernetes-entrypoint:v0.3.1
k8s.gcr.io/pause:3.4.1
registry.k8s.io/ingress-nginx/controller:v1.9.3
registry.k8s.io/ingress-nginx/kube-webhook-certgen:v20231011-8b53cabe0
registry.k8s.io/defaultbackend-amd64:1.5
registry.k8s.io/ingress-nginx/opentelemetry:v20230721-3e2062ee5
docker.io/fluxcd/helm-controller:v0.35.0
docker.io/fluxcd/source-controller:v1.0.1
registry.k8s.io/sig-storage/snapshot-controller:v6.1.0
quay.io/jetstack/cert-manager-acmesolver:v1.13.1
quay.io/jetstack/cert-manager-cainjector:v1.13.1
quay.io/jetstack/cert-manager-controller:v1.13.1
quay.io/jetstack/cert-manager-webhook:v1.13.1
quay.io/jetstack/cert-manager-ctl:v1.13.1
)

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

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

    let j+=1
done

docker save registry.local:9001/registry.k8s.io/kube-apiserver:v1.28.4 registry.local:9001/registry.k8s.io/kube-controller-manager:v1.28.4 registry.local:9001/registry.k8s.io/kube-scheduler:v1.28.4 registry.local:9001/registry.k8s.io/kube-proxy:v1.28.4 registry.local:9001/registry.k8s.io/pause:3.9 registry.local:9001/registry.k8s.io/etcd:3.5.9-0  registry.local:9001/registry.k8s.io/coredns/coredns:v1.10.1 registry.local:9001/quay.io/calico/cni:v3.25.0 registry.local:9001/quay.io/calico/node:v3.25.0 registry.local:9001/quay.io/calico/kube-controllers:v3.25.0 registry.local:9001/ghcr.io/k8snetworkplumbingwg/multus-cni:v3.9.3 registry.local:9001/ghcr.io/k8snetworkplumbingwg/sriov-cni:v2.7.0 registry.local:9001/ghcr.io/k8snetworkplumbingwg/sriov-network-device-plugin:v3.5.1 registry.local:9001/docker.io/starlingx/n3000-opae:stx.8.0-v1.0.2 registry.local:9001/quay.io/stackanetes/kubernetes-entrypoint:v0.3.1 registry.local:9001/k8s.gcr.io/pause:3.4.1 registry.local:9001/registry.k8s.io/ingress-nginx/controller:v1.9.3 registry.local:9001/registry.k8s.io/ingress-nginx/kube-webhook-certgen:v20231011-8b53cabe0 registry.local:9001/registry.k8s.io/defaultbackend-amd64:1.5 registry.local:9001/registry.k8s.io/ingress-nginx/opentelemetry:v20230721-3e2062ee5 registry.local:9001/docker.io/fluxcd/helm-controller:v0.35.0 registry.local:9001/docker.io/fluxcd/source-controller:v1.0.1 registry.local:9001/registry.k8s.io/sig-storage/snapshot-controller:v6.1.0 registry.local:9001/quay.io/jetstack/cert-manager-acmesolver:v1.13.1 registry.local:9001/quay.io/jetstack/cert-manager-cainjector:v1.13.1 registry.local:9001/quay.io/jetstack/cert-manager-controller:v1.13.1 registry.local:9001/quay.io/jetstack/cert-manager-webhook:v1.13.1 registry.local:9001/quay.io/jetstack/cert-manager-ctl:v1.13.1 -o localimages1284.tar

set +x

