Welcome to the OpenShift Labs on Instruqt repositories. This repo is the source code of labs you find at https://play.instruqt.com/openshift
Please refer to the Instruqt Documentation to understand how it works.
The first thing to do is to download the Instruqt CLI
If don't have an account on Instruqt, create a new account: https://play.instruqt.com/login
Login with the CLI:
instruqt auth login
This will open a browser where you can login, then your CLI session is authenticated.
You can create a new track in general with this command:
Create an empty track:
instruqt track create --title "First track"
Use commands below to create a new track starting from a template OpenShift track
This creates an example track using CRC 4.9 VM with root
user and authenticated by default with system:admin
as in this example:
instruqt track create --from openshift/openshift-example-track --title "My First OpenShift Track"
This creates an example track using CRC 4.9 VM and a sidecar Fedora container using root
user where to install packages/dependencies.
The container can be connected to the CRC VM with the oc CLI as in this example:
instruqt track create --from openshift/openshift-example-track-with-fedora-sidecar --title "My First OpenShift Track with Fedora Sidecar"
You can download an existing track:
instruqt track pull openshift/operatorframework-k8s-api-fundamentals
You can push the change to your track in this way:
instruqt track push
You can check the logs from your track in this way:
instruqt track logs
If Web Console access is required, replace Katacoda dynamic URLs with this snippet that will let user access to OpenShift from the web console by printing the HTTPS URL. The hypertext is highlighted so it's easy to access then by just clicking on it:
Access the OpenShift Web Console to login from the Web UI:
```
oc get routes console -n openshift-console -o jsonpath='{"https://"}{.spec.host}{"\n"}'
```
Copy the URL from the output of the above command and open it in your browser.
We'll deploy our app as the `developer` user. Use the following credentials:
* Username:
```
developer
```
* Password:
```
developer
```
Replace Katacoda's dynamic URLs for routes with this snippet:
Get the URL from command line, from *Terminal 1* run this command to get the app's Route:
```
oc get route <route-name> -n <namespace> -o jsonpath='{"http://"}{.spec.host}{"/taster"}{"\n"}'
```
Copy the URL and open it in your browser, or click it from here.
Replace all text mentioning to "Click to open a file" with this snippet, just point the users to the Visual Editor tab containing a VSCode web editor:
From the **Visual Editor** Tab, create a new file in this path: `fruit-taster/src/main/java/org/acme/Fruit.java`.
Then add this code:
```java
...
```
```go
```
Instruqt doesn't have the click and execute feature, any code block is copy and paste.
Convert any block like this:
oc get pods
In this way:
oc get pods
sometimes in the code you can find < >
for <>
or "e;
for "
, please substitute it if you find it.
If you find this sequence
`
``
<br>
Replace with this regexp:
s/`\n\s+```\n\s+<br>//g
There's no relative path concept from assets like in Katacoda's index.json, so you need to download them from internet from the setup-crc
or setup-container
script and store in the expected path.
As a convention, we store files into track's script
dir and images into track's assets
dir:
├── assets
│ ├── images
│ │ └── ansible-op-flow.png
│ ├── podset_controller.go
│ └── podset_types.go
├── config.yml
├── scripts
│ ├── my_script.sh
├── step1
├── step2
├── step3
│ └── setup-container
├── step4
│ └── setup-container
├── step5
├── step6
│ └── setup-container
├── step7
├── track_scripts
│ ├── setup-container
│ └── setup-crc
└── track.yml
E.g. from setup-crc
:
#!/bin/bash
curl -s https://raw.githubusercontent.com/openshift-instruqt/instruqt/master/operatorframework/go-operator-podset/assets/podset_types.go -o /tmp/podset_types.go
We are currently using nested virtualization with a CRC 4.9 inside a RHEL 8 VM.
The setting to have this image is from the config.yml
file:
version: "2"
virtualmachines:
- name: crc
image: openshift-instruqt/crc-4-10-latest
machine_type: n1-highmem-4
allow_external_ingress:
- http
- https
- high-ports
We can also have a sidecar container that can connect to the CRC VM with oc CLI in this way:
version: "2"
containers:
- name: container
image: fedora
shell: /bin/bash
virtualmachines:
- name: crc
image: openshift-instruqt/crc-4-10-latest
machine_type: n1-highmem-4
allow_external_ingress:
- http
- https
- high-ports
The connection is made inside the setup scripts like this one. Please refer to Instruqt doc to understand track's lifecycle scripts.
- First level: Pathways->Topics
- Second level: Courses->Tracks
- Third level: Steps->Challenges/Assignments
We used git submodules to clone this repo and then we used this script
git submodule update --init
python kataklisma.py
For each generated directory representing the pathway->topic, inside subfolders with tracks:
instruqt track validate && instruqt track push
Bulk validate
for d in `ls -d */ | grep -v learn-katacoda`; do
echo $d;
cd $d;
for dd in `ls -d */`; do
echo $dd;
cd $dd;
instruqt track validate;
cd ..;
done;
cd ..;
done
Bulk validate and push
for d in `ls -d */ | grep -v learn-katacoda`; do
cd $d;
echo $d;
for dd in `ls -d */`; do
echo $dd;
cd $dd;
instruqt track validate && instruqt track push --force;
cd ..;
done;
cd ..;
done