From f5379e2ec044f537cf4b0fa0a0f862e23e312a88 Mon Sep 17 00:00:00 2001 From: Phan Le Date: Tue, 14 Jul 2020 20:22:13 -0700 Subject: [PATCH] deploy, scripts: provide list of images and script to pull and push all Longhorn component images to user provided registry This help to remove the extra dependency on different container image registry. Docker Hub now holds all Longhorn components' images. Also, users can easily pull all the necessary images to their air-gap environment Longhorn #1419 Signed-off-by: Phan Le --- deploy/longhorn-images-dev.txt | 10 +++++ deploy/longhorn-images-release.txt | 10 +++++ deploy/longhorn-images.txt | 9 ++++ scripts/load-images.sh | 67 ++++++++++++++++++++++++++++++ scripts/save-images.sh | 44 ++++++++++++++++++++ 5 files changed, 140 insertions(+) create mode 100644 deploy/longhorn-images-dev.txt create mode 100644 deploy/longhorn-images-release.txt create mode 100644 deploy/longhorn-images.txt create mode 100755 scripts/load-images.sh create mode 100755 scripts/save-images.sh diff --git a/deploy/longhorn-images-dev.txt b/deploy/longhorn-images-dev.txt new file mode 100644 index 0000000..59369f5 --- /dev/null +++ b/deploy/longhorn-images-dev.txt @@ -0,0 +1,10 @@ +longhornio/longhorn-engine:master +longhornio/longhorn-instance-manager:v1_20200514 +longhornio/longhorn-manager:master +longhornio/longhorn-manager-test:master +longhornio/longhorn-test:upgrade-test.3-3.3-3.1-1 +longhornio/longhorn-ui:master +longhornio/csi-attacher:v2.0.0 +longhornio/csi-node-driver-registrar:v1.2.0 +longhornio/csi-provisioner:v1.4.0 +longhornio/csi-resizer:v0.3.0 \ No newline at end of file diff --git a/deploy/longhorn-images-release.txt b/deploy/longhorn-images-release.txt new file mode 100644 index 0000000..7743cb2 --- /dev/null +++ b/deploy/longhorn-images-release.txt @@ -0,0 +1,10 @@ +longhornio/longhorn-engine:v1.0.1 +longhornio/longhorn-instance-manager:v1_20200514 +longhornio/longhorn-manager:v1.0.1 +longhornio/longhorn-manager-test:v1.0.1 +longhornio/longhorn-test:upgrade-test.3-3.3-3.1-1 +longhornio/longhorn-ui:v1.0.1 +quay.io/k8scsi/csi-attacher:v2.0.0 +quay.io/k8scsi/csi-node-driver-registrar:v1.2.0 +quay.io/k8scsi/csi-provisioner:v1.4.0 +quay.io/k8scsi/csi-resizer:v0.3.0 \ No newline at end of file diff --git a/deploy/longhorn-images.txt b/deploy/longhorn-images.txt new file mode 100644 index 0000000..c4cf0a8 --- /dev/null +++ b/deploy/longhorn-images.txt @@ -0,0 +1,9 @@ +longhornio/longhorn-engine:v1.0.1 +longhornio/longhorn-instance-manager:v1_20200514 +longhornio/longhorn-manager:v1.0.1 +longhornio/longhorn-manager-test:v1.0.1 +longhornio/longhorn-ui:v1.0.1 +longhornio/csi-attacher:v2.0.0 +longhornio/csi-node-driver-registrar:v1.2.0 +longhornio/csi-provisioner:v1.4.0 +longhornio/csi-resizer:v0.3.0 \ No newline at end of file diff --git a/scripts/load-images.sh b/scripts/load-images.sh new file mode 100755 index 0000000..ea659f1 --- /dev/null +++ b/scripts/load-images.sh @@ -0,0 +1,67 @@ +#!/bin/bash +list="longhorn-images.txt" +images="longhorn-images.tar.gz" + +POSITIONAL=() +while [[ $# -gt 0 ]]; do + key="$1" + case $key in + -r|--registry) + reg="$2" + shift # past argument + shift # past value + ;; + -l|--image-list) + list="$2" + shift # past argument + shift # past value + ;; + -i|--images) + images="$2" + shift # past argument + shift # past value + ;; + -h|--help) + help="true" + shift + ;; + esac +done + +usage () { + echo "USAGE: $0 [--image-list longhorn-images.txt] [--images longhorn-images.tar.gz] --registry my.registry.com:5000" + echo " [-l|--images-list path] text file with list of images. 1 per line." + echo " [-l|--images path] tar.gz generated by docker save." + echo " [-r|--registry registry:port] target private registry:port. By default, registry is Docker Hub" + echo " [-h|--help] Usage message" +} + +if [[ $help ]]; then + usage + exit 0 +fi + +if [[ -n $reg ]]; then + reg+="/" +fi + +set -e -x + +docker load --input ${images} + +for i in $(cat ${list}); do + case $i in + */*/*) + docker tag ${i} ${reg}longhornio/${i#*/*/} + docker push ${reg}longhornio/${i#*/*/} + ;; + */*) + docker tag ${i} ${reg}longhornio/${i#*/} + docker push ${reg}longhornio/${i#*/} + ;; + *) + docker tag ${i} ${reg}longhornio/${i} + docker push ${reg}longhornio/${i} + ;; + esac +done diff --git a/scripts/save-images.sh b/scripts/save-images.sh new file mode 100755 index 0000000..8094916 --- /dev/null +++ b/scripts/save-images.sh @@ -0,0 +1,44 @@ +#!/bin/bash +list="longhorn-images.txt" +images="longhorn-images.tar.gz" + +POSITIONAL=() +while [[ $# -gt 0 ]]; do + key="$1" + case $key in + -i|--images) + images="$2" + shift # past argument + shift # past value + ;; + -l|--image-list) + list="$2" + shift # past argument + shift # past value + ;; + -h|--help) + help="true" + shift + ;; + esac +done + +usage () { + echo "USAGE: $0 [--image-list longhorn-images.txt] [--images longhorn-images.tar.gz]" + echo " [-l|--images-list path] text file with list of images. 1 per line." + echo " [-l|--images path] tar.gz generated by docker save." + echo " [-h|--help] Usage message" +} + +if [[ $help ]]; then + usage + exit 0 +fi + +set -e -x + +for i in $(cat ${list}); do + docker pull ${i} +done + +docker save $(cat ${list} | tr '\n' ' ') | gzip -c > ${images}