| 다음 판 | 이전 판 |
| openstack_16.1_offline_registry_구성 [2021/07/12 13:14] – 만듦 koov | openstack_16.1_offline_registry_구성 [2023/05/08 06:06] (현재) – [Shell Script] koov |
|---|
| </code> | </code> |
| </WRAP> | </WRAP> |
| | |
| | ===== Shell Script ===== |
| | |
| | 위와같은 방법으로 로컬 레지스트리 구성 후 컨테이너 이미지를 자동으로 땡겨와서 로컬 레지스트리에 탑재 하는 스크립트 이다. |
| | 이 스크립트는 스토리지 엔진 컨테이너까지 포함시키므로 필요시 수정하여 사용하면 된다. |
| | |
| | <WRAP prewrap> |
| | <code bash container_image_sync.sh> |
| | #!/bin/bash |
| | USERNAME="USERNAME" |
| | PASSWORD="PASSWORD" |
| | REGISTRY="registry.redhat.io" |
| | REGISTRY_STORAGE="registry.connect.redhat.com" |
| | NAMESPACE="rhosp-rhel8" |
| | TAG="16.2" |
| | LOCAL="registry:5000" |
| | NAMEPREFIX="openstack-" |
| | MODE=$1 |
| | |
| | if [[ -z "${MODE}" ]]; then |
| | echo "Usage: $0 <all|openstack|ceph|storage>"; |
| | exit; |
| | fi |
| | |
| | # login |
| | podman login --username ${USERNAME} --password ${PASSWORD} ${REGISTRY} |
| | |
| | # openstack image |
| | if [[ "${MODE}" == "openstack" || "${MODE}" == "all" ]]; then |
| | echo -e "\e[1;32m### Openstack container image\e[0m"; |
| | LIST=`podman search --limit 1000 "${REGISTRY}/${NAMESPACE}" | awk '{ print $2 }' | grep ${NAMEPREFIX} | grep -v beta | grep -v preview | sed "s/${REGISTRY}\///g" | grep -v NAME` |
| | |
| | ### 이미지 pull |
| | for i in ${LIST[@]}; do echo -e "\e[1;32m${i}\e[0m"; podman pull ${REGISTRY}/${i}:${TAG} ; done |
| | ### 이미지 로컬 레지스트리로 tag |
| | for i in ${LIST[@]}; do echo -e "\e[1;32m${i}\e[0m"; podman tag ${REGISTRY}/${i}:${TAG} ${LOCAL}/${i}:${TAG} ; done |
| | ### 이미지 로컬 레지스트리로 push |
| | for i in ${LIST[@]}; do echo -e "\e[1;32m${i}\e[0m"; podman push ${LOCAL}/${i}:${TAG} --remove-signatures; done |
| | fi |
| | |
| | ### ceph image |
| | if [[ "${MODE}" == "ceph" || "${MODE}" == "all" ]]; then |
| | echo -e "\e[1;32m### Ceph Storage container image\e[0m"; |
| | podman pull ${REGISTRY}/openshift4/ose-prometheus-alertmanager:v4.6 |
| | podman pull ${REGISTRY}/rhceph/rhceph-4-dashboard-rhel8:4 |
| | podman pull ${REGISTRY}/rhceph/rhceph-4-rhel8 |
| | podman pull ${REGISTRY}/openshift4/ose-prometheus-node-exporter:v4.6 |
| | podman pull ${REGISTRY}/openshift4/ose-prometheus:v4.6 |
| | |
| | podman tag ${REGISTRY}/openshift4/ose-prometheus-alertmanager:v4.6 ${LOCAL}/openshift4/ose-prometheus-alertmanager:v4.6 |
| | podman tag ${REGISTRY}/rhceph/rhceph-4-dashboard-rhel8:4 ${LOCAL}/rhceph/rhceph-4-dashboard-rhel8:4 |
| | podman tag ${REGISTRY}/rhceph/rhceph-4-rhel8 ${LOCAL}/rhceph/rhceph-4-rhel8 |
| | podman tag ${REGISTRY}/openshift4/ose-prometheus-node-exporter:v4.6 ${LOCAL}/openshift4/ose-prometheus-node-exporter:v4.6 |
| | podman tag ${REGISTRY}/openshift4/ose-prometheus:v4.6 ${LOCAL}/openshift4/ose-prometheus:v4.6 |
| | |
| | podman push ${LOCAL}/openshift4/ose-prometheus-alertmanager:v4.6 --remove-signatures |
| | podman push ${LOCAL}/rhceph/rhceph-4-dashboard-rhel8:4 --remove-signatures |
| | podman push ${LOCAL}/rhceph/rhceph-4-rhel8 --remove-signatures |
| | podman push ${LOCAL}/openshift4/ose-prometheus-node-exporter:v4.6 --remove-signatures |
| | podman push ${LOCAL}/openshift4/ose-prometheus:v4.6 --remove-signatures |
| | fi |
| | |
| | ### purestorage image |
| | if [[ "${MODE}" == "storage" || "${MODE}" == "all" ]]; then |
| | echo -e "\e[1;32m### Openstack Storage container image\e[0m"; |
| | # login |
| | podman login --username ${USERNAME} --password ${PASSWORD} ${REGISTRY_STORAGE} |
| | |
| | #podman pull registry.connect.redhat.com/purestorage/openstack-cinder-volume-pure-rhosp-16-2:latest |
| | #podman tag registry.connect.redhat.com/purestorage/openstack-cinder-volume-pure-rhosp-16-2:latest ${LOCAL}/purestorage/openstack-cinder-volume-pure-rhosp-16-2:latest |
| | podman pull ${REGISTRY_STORAGE}/purestorage/openstack-cinder-volume-pure-rhosp-16-2:latest |
| | podman tag ${REGISTRY_STORAGE}/purestorage/openstack-cinder-volume-pure-rhosp-16-2:latest ${LOCAL}/purestorage/openstack-cinder-volume-pure-rhosp-16-2:latest |
| | podman push ${LOCAL}/purestorage/openstack-cinder-volume-pure-rhosp-16-2:latest --remove-signatures |
| | fi |
| | |
| | </code> |
| | </WRAP> |
| | |
| |
| ===== 참조링크 ===== | ===== 참조링크 ===== |