@@ -11,35 +11,36 @@ echo "export HOME=/root" > /tmp/.bashrc
11
11
cat /root/.bashrc >> /tmp/.bashrc
12
12
mv /tmp/.bashrc /root/.bashrc
13
13
14
- ENS4IP=$( ip -4 -o addr show ens4 | awk ' {print $4}' | cut -d " /" -f 1)
15
-
16
14
# set hostname
17
15
# INSTRUQT_HOSTNAME=$(curl -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/instance/attributes/hostname)
18
16
19
- # Don't do this below causes issues later on, i believe.
20
- # hostnamectl set-hostname $HOSTNAME
21
-
22
17
eval $( curl -H " Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/instance/attributes/startup-script | grep INSTRUQT_PARTICIPANT_ID)
23
18
24
- # dnsmasq config for crc-dnsmasq.service
25
- cat << EOF > /var/srv/dnsmasq.conf
26
- user=root
27
- port= 53
28
- bind-interfaces
19
+ # start openshift
20
+ systemctl start ovs-configuration.service
21
+ BREXIP=$( ip -4 -o addr show br-ex | awk ' {print $4}' | cut -d " /" -f 1)
22
+
23
+ cat << EOF > /etc/resolv.conf
24
+ search c.rhd-devx-instruqt.internal google.internal
25
+ nameserver $BREXIP
26
+ nameserver 169.254.169.254
27
+ EOF
28
+
29
+ systemctl reload NetworkManager
30
+
31
+ cat << EOF > /etc/dnsmasq.d/crc-dnsmasq.conf
32
+ listen-address=$BREXIP
29
33
expand-hosts
30
34
log-queries
31
35
local=/crc.testing/
32
36
domain=crc.testing
33
- address=/apps-crc.testing/$ENS4IP
34
- address=/api.crc.testing/$ENS4IP
35
- address=/api-int.crc.testing/$ENS4IP
36
- address=/$HOSTNAME .crc.testing/192.168.126.11
37
+ address=/apps-crc.testing/$BREXIP
38
+ address=/api.crc.testing/$BREXIP
39
+ address=/api-int.crc.testing/$BREXIP
40
+ address=/crc .crc.testing/192.168.126.11
37
41
EOF
38
42
39
- sed -i ' /^search.*/a nameserver 10.88.0.8' /etc/resolv.conf
40
-
41
- # start openshift
42
- systemctl start crc-dnsmasq.service
43
+ systemctl start dnsmasq.service
43
44
systemctl start kubelet
44
45
45
46
# INGRESS
113
114
echo " AVAILABLE"
114
115
done
115
116
116
-
117
+ # SSL Setup
118
+ curl -s -o /etc/ssl/certs/sandbox.crt -H " Metadata-Flavor: Google" " http://metadata.google.internal/computeMetadata/v1/instance/attributes/ssl-certificate"
119
+ curl -s -o /etc/ssl/certs/sandbox.key -H " Metadata-Flavor: Google" " http://metadata.google.internal/computeMetadata/v1/instance/attributes/ssl-certificate-key"
120
+ oc --namespace openshift-ingress create secret tls custom-certs-default --cert=/etc/ssl/certs/sandbox.crt --key=/etc/ssl/certs/sandbox.key
121
+ rm /etc/ssl/certs/sandbox.key
122
+ # oc patch --type=merge --namespace openshift-ingress-operator ingresscontrollers/default --patch '{"spec":{"defaultCertificate":{"name":"custom-certs-default"}}}'
117
123
118
124
# INGRESS
119
125
120
126
# check if ingresses.config.openshift.io cluster is present
121
- oc patch -p ' {"spec": {"domain": "' $HOSTNAME ' .crc. ' $INSTRUQT_PARTICIPANT_ID ' .instruqt.io"}}' ingresses.config.openshift.io cluster --type=merge
127
+ oc patch -p ' {"spec": {"domain": "' $HOSTNAME ' .' $INSTRUQT_PARTICIPANT_ID ' .instruqt.io"}}' ingresses.config.openshift.io cluster --type=merge
122
128
123
129
# Wait 30 seconds for the old pod to be terminated
124
130
sleep 30
@@ -133,7 +139,9 @@ metadata:
133
139
namespace: openshift-ingress-operator
134
140
spec:
135
141
replicas: 1
136
- domain: $HOSTNAME .crc.$INSTRUQT_PARTICIPANT_ID .instruqt.io
142
+ domain: $HOSTNAME .$INSTRUQT_PARTICIPANT_ID .instruqt.io
143
+ defaultCertificate:
144
+ name: custom-certs-default
137
145
EOF
138
146
139
147
oc rollout status deploy/oauth-openshift -n openshift-authentication
@@ -144,11 +152,11 @@ oc rollout status deploy/apiserver -n openshift-apiserver
144
152
until oc get routes -A 2> /dev/null 1>&2 ; do echo " Changing routes, waiting for cluster operators..." ; sleep 5; done
145
153
146
154
147
- oc patch -p ' {"spec": {"host": "console-openshift-console.' $HOSTNAME ' .crc. ' $INSTRUQT_PARTICIPANT_ID ' .instruqt.io"}}' route console -n openshift-console --type=merge
155
+ oc patch -p ' {"spec": {"host": "console-openshift-console.' $HOSTNAME ' .' $INSTRUQT_PARTICIPANT_ID ' .instruqt.io"}}' route console -n openshift-console --type=merge
148
156
149
- oc patch -p ' {"spec": {"host": "downloads-openshift-console.' $HOSTNAME ' .crc. ' $INSTRUQT_PARTICIPANT_ID ' .instruqt.io"}}' route downloads -n openshift-console --type=merge
157
+ oc patch -p ' {"spec": {"host": "downloads-openshift-console.' $HOSTNAME ' .' $INSTRUQT_PARTICIPANT_ID ' .instruqt.io"}}' route downloads -n openshift-console --type=merge
150
158
151
- oc patch -p ' {"spec": {"host": "default-route-openshift-image-registry.' $HOSTNAME ' .crc. ' $INSTRUQT_PARTICIPANT_ID ' .instruqt.io"}}' route default-route -n openshift-image-registry --type=merge
159
+ oc patch -p ' {"spec": {"host": "default-route-openshift-image-registry.' $HOSTNAME ' .' $INSTRUQT_PARTICIPANT_ID ' .instruqt.io"}}' route default-route -n openshift-image-registry --type=merge
152
160
153
161
154
162
# wait until cluster operators are "available"
232
240
sleep 5
233
241
done
234
242
235
- while [ " $( curl -k -I https://console-openshift-console.$HOSTNAME .crc. $INSTRUQT_PARTICIPANT_ID .instruqt.io -o /dev/null -w ' %{http_code}\n' -s 2> /dev/null) " != " 200" ]
243
+ while [ " $( curl -k -I https://console-openshift-console.$HOSTNAME .$INSTRUQT_PARTICIPANT_ID .instruqt.io -o /dev/null -w ' %{http_code}\n' -s 2> /dev/null) " != " 200" ]
236
244
do
237
245
echo " Waiting for web console - unavailable via curl"
238
246
sleep 5
0 commit comments