Skip to content

Commit

Permalink
updating example tracks for openshift-4-17
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanj committed Oct 24, 2024
1 parent 4df41a6 commit da82a22
Show file tree
Hide file tree
Showing 12 changed files with 76 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ tabs:
hostname: crc
- title: Web Console
type: website
url: https://console-openshift-console.crc-lgph7-master-0.crc.${_SANDBOX_ID}.instruqt.io
url: https://console-openshift-console.crc.${_SANDBOX_ID}.instruqt.io
new_window: true
difficulty: basic
timelimit: 300
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ tabs:
hostname: crc
- title: Web Console
type: website
url: https://console-openshift-console.crc-lgph7-master-0.crc.${_SANDBOX_ID}.instruqt.io
url: https://console-openshift-console.crc.${_SANDBOX_ID}.instruqt.io
new_window: true
difficulty: basic
timelimit: 300
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ tabs:
hostname: crc
- title: Web Console
type: website
url: https://console-openshift-console.crc-lgph7-master-0.crc.${_SANDBOX_ID}.instruqt.io
url: https://console-openshift-console.crc.${_SANDBOX_ID}.instruqt.io
new_window: true
- title: Visual Editor
type: code
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ tabs:
hostname: crc
- title: Web Console
type: website
url: https://console-openshift-console.crc-lgph7-master-0.crc.${_SANDBOX_ID}.instruqt.io
url: https://console-openshift-console.crc.${_SANDBOX_ID}.instruqt.io
- title: Visual Editor
type: code
hostname: container
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ containers:
shell: /bin/bash
virtualmachines:
- name: crc
image: rhd-devx-instruqt/openshift-4-11-7-lgph7
image: rhd-devx-instruqt/openshift-4-17-0
machine_type: n1-highmem-4
allow_external_ingress:
- http
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,36 @@ echo "export HOME=/root" > /tmp/.bashrc
cat /root/.bashrc >> /tmp/.bashrc
mv /tmp/.bashrc /root/.bashrc

ENS4IP=$(ip -4 -o addr show ens4 | awk '{print $4}' | cut -d "/" -f 1)

# set hostname
#INSTRUQT_HOSTNAME=$(curl -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/instance/attributes/hostname)

# Don't do this below causes issues later on, i believe.
# hostnamectl set-hostname $HOSTNAME

eval $(curl -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/instance/attributes/startup-script | grep INSTRUQT_PARTICIPANT_ID)

# dnsmasq config for crc-dnsmasq.service
cat << EOF > /var/srv/dnsmasq.conf
user=root
port= 53
bind-interfaces
# start openshift
systemctl start ovs-configuration.service
BREXIP=$(ip -4 -o addr show br-ex | awk '{print $4}' | cut -d "/" -f 1)

cat << EOF > /etc/resolv.conf
search c.rhd-devx-instruqt.internal google.internal
nameserver $BREXIP
nameserver 169.254.169.254
EOF

systemctl reload NetworkManager

cat << EOF > /etc/dnsmasq.d/crc-dnsmasq.conf
listen-address=$BREXIP
expand-hosts
log-queries
local=/crc.testing/
domain=crc.testing
address=/apps-crc.testing/$ENS4IP
address=/api.crc.testing/$ENS4IP
address=/api-int.crc.testing/$ENS4IP
address=/$HOSTNAME.crc.testing/192.168.126.11
address=/apps-crc.testing/$BREXIP
address=/api.crc.testing/$BREXIP
address=/api-int.crc.testing/$BREXIP
address=/crc.crc.testing/192.168.126.11
EOF

sed -i '/^search.*/a nameserver 10.88.0.8' /etc/resolv.conf

# start openshift
systemctl start crc-dnsmasq.service
systemctl start dnsmasq.service
systemctl start kubelet

# INGRESS
Expand Down Expand Up @@ -113,12 +114,17 @@ do
echo "AVAILABLE"
done


# SSL Setup
curl -s -o /etc/ssl/certs/sandbox.crt -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/attributes/ssl-certificate"
curl -s -o /etc/ssl/certs/sandbox.key -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/attributes/ssl-certificate-key"
oc --namespace openshift-ingress create secret tls custom-certs-default --cert=/etc/ssl/certs/sandbox.crt --key=/etc/ssl/certs/sandbox.key
rm /etc/ssl/certs/sandbox.key
#oc patch --type=merge --namespace openshift-ingress-operator ingresscontrollers/default --patch '{"spec":{"defaultCertificate":{"name":"custom-certs-default"}}}'

# INGRESS

# check if ingresses.config.openshift.io cluster is present
oc patch -p '{"spec": {"domain": "'$HOSTNAME'.crc.'$INSTRUQT_PARTICIPANT_ID'.instruqt.io"}}' ingresses.config.openshift.io cluster --type=merge
oc patch -p '{"spec": {"domain": "'$HOSTNAME'.'$INSTRUQT_PARTICIPANT_ID'.instruqt.io"}}' ingresses.config.openshift.io cluster --type=merge

# Wait 30 seconds for the old pod to be terminated
sleep 30
Expand All @@ -133,7 +139,9 @@ metadata:
namespace: openshift-ingress-operator
spec:
replicas: 1
domain: $HOSTNAME.crc.$INSTRUQT_PARTICIPANT_ID.instruqt.io
domain: $HOSTNAME.$INSTRUQT_PARTICIPANT_ID.instruqt.io
defaultCertificate:
name: custom-certs-default
EOF

oc rollout status deploy/oauth-openshift -n openshift-authentication
Expand All @@ -144,11 +152,11 @@ oc rollout status deploy/apiserver -n openshift-apiserver
until oc get routes -A 2>/dev/null 1>&2; do echo "Changing routes, waiting for cluster operators..."; sleep 5; done


oc patch -p '{"spec": {"host": "console-openshift-console.'$HOSTNAME'.crc.'$INSTRUQT_PARTICIPANT_ID'.instruqt.io"}}' route console -n openshift-console --type=merge
oc patch -p '{"spec": {"host": "console-openshift-console.'$HOSTNAME'.'$INSTRUQT_PARTICIPANT_ID'.instruqt.io"}}' route console -n openshift-console --type=merge

oc patch -p '{"spec": {"host": "downloads-openshift-console.'$HOSTNAME'.crc.'$INSTRUQT_PARTICIPANT_ID'.instruqt.io"}}' route downloads -n openshift-console --type=merge
oc patch -p '{"spec": {"host": "downloads-openshift-console.'$HOSTNAME'.'$INSTRUQT_PARTICIPANT_ID'.instruqt.io"}}' route downloads -n openshift-console --type=merge

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
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


#wait until cluster operators are "available"
Expand Down Expand Up @@ -232,7 +240,7 @@ do
sleep 5
done

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" ]
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" ]
do
echo "Waiting for web console - unavailable via curl"
sleep 5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ tabs:
hostname: crc
- title: Web Console
type: website
url: https://console-openshift-console.crc-lgph7-master-0.crc.${_SANDBOX_ID}.instruqt.io
url: https://console-openshift-console.crc.${_SANDBOX_ID}.instruqt.io
new_window: true
difficulty: basic
timelimit: 300
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ tabs:
hostname: crc
- title: Web Console
type: website
url: https://console-openshift-console.crc-lgph7-master-0.crc.${_SANDBOX_ID}.instruqt.io
url: https://console-openshift-console.crc.${_SANDBOX_ID}.instruqt.io
new_window: true
difficulty: basic
timelimit: 300
Expand Down
2 changes: 1 addition & 1 deletion examples/openshift-example-track/03-scaling/assignment.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ tabs:
hostname: crc
- title: Web Console
type: website
url: https://console-openshift-console.crc-lgph7-master-0.crc.${_SANDBOX_ID}.instruqt.io
url: https://console-openshift-console.crc.${_SANDBOX_ID}.instruqt.io
new_window: true
difficulty: basic
timelimit: 300
Expand Down
2 changes: 1 addition & 1 deletion examples/openshift-example-track/04-routes/assignment.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ tabs:
hostname: crc
- title: Web Console
type: website
url: https://console-openshift-console.crc-lgph7-master-0.crc.${_SANDBOX_ID}.instruqt.io
url: https://console-openshift-console.crc.${_SANDBOX_ID}.instruqt.io
new_window: true
difficulty: basic
timelimit: 300
Expand Down
2 changes: 1 addition & 1 deletion examples/openshift-example-track/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3"
virtualmachines:
- name: crc
image: rhd-devx-instruqt/openshift-4-11-7-lgph7
image: rhd-devx-instruqt/openshift-4-17-0
machine_type: n1-highmem-4
allow_external_ingress:
- http
Expand Down
58 changes: 33 additions & 25 deletions examples/openshift-example-track/track_scripts/setup-crc
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,36 @@ echo "export HOME=/root" > /tmp/.bashrc
cat /root/.bashrc >> /tmp/.bashrc
mv /tmp/.bashrc /root/.bashrc

ENS4IP=$(ip -4 -o addr show ens4 | awk '{print $4}' | cut -d "/" -f 1)

# set hostname
#INSTRUQT_HOSTNAME=$(curl -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/instance/attributes/hostname)

# Don't do this below causes issues later on, i believe.
# hostnamectl set-hostname $HOSTNAME

eval $(curl -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/instance/attributes/startup-script | grep INSTRUQT_PARTICIPANT_ID)

# dnsmasq config for crc-dnsmasq.service
cat << EOF > /var/srv/dnsmasq.conf
user=root
port= 53
bind-interfaces
# start openshift
systemctl start ovs-configuration.service
BREXIP=$(ip -4 -o addr show br-ex | awk '{print $4}' | cut -d "/" -f 1)

cat << EOF > /etc/resolv.conf
search c.rhd-devx-instruqt.internal google.internal
nameserver $BREXIP
nameserver 169.254.169.254
EOF

systemctl reload NetworkManager

cat << EOF > /etc/dnsmasq.d/crc-dnsmasq.conf
listen-address=$BREXIP
expand-hosts
log-queries
local=/crc.testing/
domain=crc.testing
address=/apps-crc.testing/$ENS4IP
address=/api.crc.testing/$ENS4IP
address=/api-int.crc.testing/$ENS4IP
address=/$HOSTNAME.crc.testing/192.168.126.11
address=/apps-crc.testing/$BREXIP
address=/api.crc.testing/$BREXIP
address=/api-int.crc.testing/$BREXIP
address=/crc.crc.testing/192.168.126.11
EOF

sed -i '/^search.*/a nameserver 10.88.0.8' /etc/resolv.conf

# start openshift
systemctl start crc-dnsmasq.service
systemctl start dnsmasq.service
systemctl start kubelet

# INGRESS
Expand Down Expand Up @@ -113,12 +114,17 @@ do
echo "AVAILABLE"
done


# SSL Setup
curl -s -o /etc/ssl/certs/sandbox.crt -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/attributes/ssl-certificate"
curl -s -o /etc/ssl/certs/sandbox.key -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/attributes/ssl-certificate-key"
oc --namespace openshift-ingress create secret tls custom-certs-default --cert=/etc/ssl/certs/sandbox.crt --key=/etc/ssl/certs/sandbox.key
rm /etc/ssl/certs/sandbox.key
#oc patch --type=merge --namespace openshift-ingress-operator ingresscontrollers/default --patch '{"spec":{"defaultCertificate":{"name":"custom-certs-default"}}}'

# INGRESS

# check if ingresses.config.openshift.io cluster is present
oc patch -p '{"spec": {"domain": "'$HOSTNAME'.crc.'$INSTRUQT_PARTICIPANT_ID'.instruqt.io"}}' ingresses.config.openshift.io cluster --type=merge
oc patch -p '{"spec": {"domain": "'$HOSTNAME'.'$INSTRUQT_PARTICIPANT_ID'.instruqt.io"}}' ingresses.config.openshift.io cluster --type=merge

# Wait 30 seconds for the old pod to be terminated
sleep 30
Expand All @@ -133,7 +139,9 @@ metadata:
namespace: openshift-ingress-operator
spec:
replicas: 1
domain: $HOSTNAME.crc.$INSTRUQT_PARTICIPANT_ID.instruqt.io
domain: $HOSTNAME.$INSTRUQT_PARTICIPANT_ID.instruqt.io
defaultCertificate:
name: custom-certs-default
EOF

oc rollout status deploy/oauth-openshift -n openshift-authentication
Expand All @@ -144,11 +152,11 @@ oc rollout status deploy/apiserver -n openshift-apiserver
until oc get routes -A 2>/dev/null 1>&2; do echo "Changing routes, waiting for cluster operators..."; sleep 5; done


oc patch -p '{"spec": {"host": "console-openshift-console.'$HOSTNAME'.crc.'$INSTRUQT_PARTICIPANT_ID'.instruqt.io"}}' route console -n openshift-console --type=merge
oc patch -p '{"spec": {"host": "console-openshift-console.'$HOSTNAME'.'$INSTRUQT_PARTICIPANT_ID'.instruqt.io"}}' route console -n openshift-console --type=merge

oc patch -p '{"spec": {"host": "downloads-openshift-console.'$HOSTNAME'.crc.'$INSTRUQT_PARTICIPANT_ID'.instruqt.io"}}' route downloads -n openshift-console --type=merge
oc patch -p '{"spec": {"host": "downloads-openshift-console.'$HOSTNAME'.'$INSTRUQT_PARTICIPANT_ID'.instruqt.io"}}' route downloads -n openshift-console --type=merge

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
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


#wait until cluster operators are "available"
Expand Down Expand Up @@ -232,7 +240,7 @@ do
sleep 5
done

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" ]
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" ]
do
echo "Waiting for web console - unavailable via curl"
sleep 5
Expand Down

0 comments on commit da82a22

Please sign in to comment.