@@ -51,7 +51,7 @@ sg_id="$(openstack security group create -f value -c id mirror-${CLUSTER_NAME}-$
51
51
--description " Mirror security group for $CLUSTER_NAME " ) "
52
52
>&2 echo " Created mirror security group for ${CLUSTER_NAME} : ${sg_id} "
53
53
openstack security group rule create --ingress --protocol tcp --dst-port 22 --description " ${CLUSTER_NAME} SSH" " $sg_id " > /dev/null
54
- openstack security group rule create --ingress --protocol tcp --ethertype IPv6 --remote-ip " ::/0" --dst-port 5000 --description " ${CLUSTER_NAME} mirror registry" " $sg_id " > /dev/null
54
+ openstack security group rule create --ingress --protocol tcp --ethertype IPv6 --remote-ip " ::/0" --dst-port 8443 --description " ${CLUSTER_NAME} mirror registry" " $sg_id " > /dev/null
55
55
>&2 echo " Created necessary security group rules in ${sg_id} "
56
56
57
57
server_params=" --network $CONTROL_PLANE_NETWORK --image $BASTION_IMAGE --flavor $BASTION_FLAVOR \
@@ -99,10 +99,13 @@ if ! retry 60 5 ssh_via_proxy "uname -a"; then
99
99
openstack console log show ${server_id}
100
100
exit 1
101
101
fi
102
+ MIRROR_REGISTRY_CREDENTIALS=$( < " /var/run/vault/mirror-registry/registry_creds" )
103
+ USER=" foo"
104
+ PASSWORD=" foo"
105
+ # USER="$(echo $MIRROR_REGISTRY_CREDENTIALS | cut -d':' -f1 )"
106
+ # PASSWORD="$(echo $MIRROR_REGISTRY_CREDENTIALS | cut -d':' -f2 )"
102
107
103
108
MIRROR_REGISTRY_DNS_NAME=" mirror-registry.${CLUSTER_NAME} .${BASE_DOMAIN} "
104
- MIRROR_REGISTRY_CREDENTIALS=$( < " /var/run/vault/mirror-registry/registry_creds" )
105
- scp_via_proxy " /var/run/vault/mirror-registry/registry_creds_encrypted_htpasswd" $BASTION_USER @$mirror_ipv4 :/tmp/htpasswd
106
109
107
110
echo " Deploying the mirror registry"
108
111
>&2 cat << EOF > $WORK_DIR /deploy_mirror.sh
@@ -111,30 +114,27 @@ set -e
111
114
sudo mkfs.xfs /dev/vdc
112
115
sudo mkdir -p /opt/registry/{auth,certs,data}
113
116
sudo mount /dev/vdc /opt/registry/data
114
- sudo openssl req -newkey rsa:4096 -nodes -sha256 -keyout /opt/registry/certs/domain.key -x509 -days 1 -subj "/CN=mirror-$CLUSTER_NAME -${CONFIG_TYPE} " -addext "subjectAltName=DNS:$MIRROR_REGISTRY_DNS_NAME ,DNS:mirror-$CLUSTER_NAME -${CONFIG_TYPE} " -out /opt/registry/certs/domain.crt
115
- sudo cp /opt/registry/certs/domain.crt /etc/pki/ca-trust/source/anchors/domain.crt
116
- sudo mv /tmp/htpasswd /opt/registry/auth/htpasswd
117
+ openssl req -newkey rsa:4096 -nodes -sha256 -keyout domain.key -x509 -days 1 -subj "/CN=mirror-$CLUSTER_NAME -${CONFIG_TYPE} " -addext "subjectAltName=DNS:$MIRROR_REGISTRY_DNS_NAME ,DNS:mirror-$CLUSTER_NAME -${CONFIG_TYPE} " -out domain.crt
118
+ sudo cp domain.crt /opt/registry/certs/domain.crt
119
+ sudo cp domain.key /opt/registry/certs/domain.key
120
+ sudo cp /opt/registry/certs/domain.crt /etc/pki/ca-trust/source/anchors/domain.crt
117
121
sudo update-ca-trust
118
122
sudo dnf install -y podman
119
- sudo podman create --name registry -p 5000:5000 --net host \
120
- -e "REGISTRY_AUTH=htpasswd" \
121
- -e "REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd" \
122
- -e "REGISTRY_AUTH_HTPASSWD_REALM='Registry Realm'" \
123
- -v /opt/registry/auth:/auth:Z \
124
- -v /opt/registry/certs:/certs:Z \
125
- -v /opt/registry/data:/var/lib/registry:z \
126
- -e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/domain.crt \
127
- -e REGISTRY_HTTP_TLS_KEY=/certs/domain.key \
128
- quay.io/libpod/registry:2.8.2
129
- sudo podman start registry
130
- curl -u "$MIRROR_REGISTRY_CREDENTIALS " --connect-timeout 5 --max-time 10 --retry 5 --retry-delay 0 --retry-max-time 40 https://mirror-$CLUSTER_NAME -${CONFIG_TYPE} :5000/v2/_catalog
123
+ curl -L -o mirror-registry.tar.gz https://mirror.openshift.com/pub/cgw/mirror-registry/latest/mirror-registry-amd64.tar.gz --retry 12
124
+ tar -xzvf mirror-registry.tar.gz
125
+ echo "Running the mirror registry"
126
+ ./mirror-registry install --sslCert domain.crt --sslKey domain.key --quayHostname mirror-$CLUSTER_NAME -${CONFIG_TYPE} --initPassword ${PASSWORD} --initUser ${USER} -v
127
+ echo "Finished the mirror registry"
128
+ podman login -u ${USER} -p ${PASSWORD} https://mirror-$CLUSTER_NAME -${CONFIG_TYPE} :8443"
131
129
EOF
132
130
133
131
scp_via_proxy $WORK_DIR /deploy_mirror.sh $BASTION_USER @$mirror_ipv4 :/tmp
134
132
ssh_via_proxy " chmod +x /tmp/deploy_mirror.sh"
135
133
ssh_via_proxy " bash -c /tmp/deploy_mirror.sh"
136
134
137
- echo " ${MIRROR_REGISTRY_DNS_NAME} :5000" > " ${SHARED_DIR} /mirror_registry_url"
135
+ echo " Finished running mirror"
136
+
137
+ echo " ${MIRROR_REGISTRY_DNS_NAME} :8443" > " ${SHARED_DIR} /mirror_registry_url"
138
138
scp_via_proxy $BASTION_USER @$mirror_ipv4 :/opt/registry/certs/domain.crt ${SHARED_DIR} /additional_trust_bundle
139
139
echo $mirror_ipv4 > " ${SHARED_DIR} /MIRROR_SSH_IP"
140
140
echo $mirror_ipv6 > " ${SHARED_DIR} /MIRROR_REGISTRY_IP"
0 commit comments