|
1 | 1 | = Hints
|
2 | 2 | include::_attributes.adoc[]
|
3 | 3 |
|
4 |
| -== Hint #1 |
| 4 | +== Task 1 - The message |
5 | 5 |
|
6 |
| -.Click to reveal Hint #1 |
| 6 | +=== Hint #1 |
| 7 | + |
| 8 | +.Click to reveal |
7 | 9 | [%collapsible]
|
8 | 10 | ====
|
9 | 11 | Half of the nickname of the best friend of Merry Brandybuck will help you a lot!
|
10 | 12 | ====
|
11 | 13 |
|
12 |
| -== Hint #2 |
13 |
| -.Click to reveal Hint #1 |
| 14 | +=== Solution |
| 15 | + |
| 16 | +.Click to reveal |
| 17 | +[%collapsible] |
| 18 | +==== |
| 19 | +The nickname of the best friend of Merry Brandybuck is Pippin (sorry if you were not a Lord of the Rings fan). |
| 20 | +
|
| 21 | +So, the solution is to use the `pip` command to install the missing Python package. Two different ways to do this: |
| 22 | +
|
| 23 | +- Create a new cell in your Notebook and use the `!pip install stegano` command to install the required Python packages. |
| 24 | +- Use the `pip install stegano` command in a terminal launched inside Jupyter. |
| 25 | +==== |
| 26 | + |
| 27 | +== Task 2 - The environment |
| 28 | + |
| 29 | +Not really a hint, but before you loose too much time on digging this out, here is an info we got _from_ a friend: `quay.io/modh/odh-minimal-notebook-container@sha256:9592b9aed5248b77c7490f08004091174030035a76c3b198f9f01c8be0060074` |
| 30 | + |
| 31 | +You're welcome! |
| 32 | + |
| 33 | +=== Hint #1 |
| 34 | + |
| 35 | +.Click to reveal |
| 36 | +[%collapsible] |
| 37 | +==== |
| 38 | +Think out of the box of the out-of-the-box Workbench images! |
| 39 | +==== |
| 40 | + |
| 41 | +=== Hint #2 |
| 42 | +.Click to reveal |
| 43 | +[%collapsible] |
| 44 | +==== |
| 45 | +If only there was something in OpenShift that can **Build** a new container image **Config**... |
| 46 | +==== |
| 47 | + |
| 48 | +=== Hint #3 |
| 49 | +.Click to reveal |
| 50 | +[%collapsible] |
| 51 | +==== |
| 52 | +A basic Containerfile is enough to build a new container image. You just need to add what is missing... |
| 53 | +==== |
| 54 | + |
| 55 | +=== Solution |
| 56 | +.Click to reveal |
14 | 57 | [%collapsible]
|
15 | 58 | ====
|
16 |
| -If only I had something in OpenShift that can build a new container image... |
| 59 | +You need to create a new container image that includes the missing Python package. To do this, a simple Containerfile is enough. |
| 60 | +
|
| 61 | +Here is an example you can use: |
| 62 | +
|
| 63 | +```Dockerfile |
| 64 | +FROM quay.io/modh/odh-minimal-notebook-container@sha256:9592b9aed5248b77c7490f08004091174030035a76c3b198f9f01c8be0060074 |
| 65 | +
|
| 66 | +RUN pip install stegano |
| 67 | +``` |
| 68 | +
|
| 69 | +**Method 1** |
| 70 | +
|
| 71 | +* From the OpenShift Console, open an **OpenShift command line terminal** (click on the >_ logo at the top right of the console and start the Console). |
| 72 | +* Create the BuildConfig using the `oc new-build` command: |
| 73 | +
|
| 74 | +```bash |
| 75 | +oc new-build --name=ai-mazing-race-stegano -D $'FROM quay.io/modh/odh-minimal-notebook-container@sha256:9592b9aed5248b77c7490f08004091174030035a76c3b198f9f01c8be0060074\nRUN pip install stegano' |
| 76 | +``` |
| 77 | +
|
| 78 | +* You can watch the process of building the new container image by running the following command: |
| 79 | +
|
| 80 | +```bash |
| 81 | +oc logs -f bc/ai-mazing-race-stegano |
| 82 | +``` |
| 83 | +
|
| 84 | +**Method 2** |
| 85 | +
|
| 86 | +* From the OpenShift Console, create a new ImageStream called `ai-mazing-race-stegano`. |
| 87 | +* Create a new BuildConfig called `ai-mazing-race-stegano` and link it to the ImageStream. Here is the YAML configuration you can use: |
| 88 | +
|
| 89 | +```yaml |
| 90 | +kind: BuildConfig |
| 91 | +apiVersion: build.openshift.io/v1 |
| 92 | +metadata: |
| 93 | + name: ai-mazing-race-stegano |
| 94 | + labels: |
| 95 | + build: ai-mazing-race-stegano |
| 96 | +spec: |
| 97 | + output: |
| 98 | + to: |
| 99 | + kind: ImageStreamTag |
| 100 | + name: 'ai-mazing-race-stegano:latest' |
| 101 | + strategy: |
| 102 | + type: Docker |
| 103 | + dockerStrategy: |
| 104 | + from: |
| 105 | + kind: DockerImage |
| 106 | + name: 'odh-minimal-notebook-container@sha256:9592b9aed5248b77c7490f08004091174030035a76c3b198f9f01c8be0060074' |
| 107 | + source: |
| 108 | + type: Dockerfile |
| 109 | + dockerfile: |- |
| 110 | + FROM quay.io/modh/odh-minimal-notebook-container@sha256:9592b9aed5248b77c7490f08004091174030035a76c3b198f9f01c8be0060074 |
| 111 | + RUN pip install stegano |
| 112 | +``` |
| 113 | +* Launch the build by clicking on **Start Build** in the Actions drop-down of the new BuildConfig. |
| 114 | +
|
| 115 | +Congratulations! You have created a new container image that includes the missing Python package. Take note of its address `image-registry.openshift-image-registry.svc:5000/<your_project_name>/ai-mazing-race-stegano` |
| 116 | +
|
17 | 117 | ====
|
18 | 118 |
|
| 119 | +== Task 3 - Setting everything up |
| 120 | + |
| 121 | +If you were an OpenShift AI admin, it would be easy to import the new container image into the OpenShift AI environment. But you are not. So you need to find a way to use this new container image for the President's workbench... |
19 | 122 |
|
20 |
| -== Hint #3 |
21 |
| -.Click to reveal Hint #1 |
| 123 | +=== Hint #1 |
| 124 | +.Click to reveal |
22 | 125 | [%collapsible]
|
23 | 126 | ====
|
24 | 127 | Have you heard about the Notebook CR (Custom Resource) from OpenShift AI?
|
25 | 128 | ====
|
26 | 129 |
|
| 130 | +=== Hint #2 |
| 131 | +.Click to reveal |
| 132 | +[%collapsible] |
| 133 | +==== |
| 134 | +You can create a new Notebook CR that uses the new container image you have created. Or just "hack" an existing one... |
| 135 | +==== |
| 136 | + |
| 137 | +=== Solution |
| 138 | +.Click to reveal |
| 139 | +[%collapsible] |
| 140 | +==== |
| 141 | +Behind the scene, when you create a Workbench, a Notebook CR is created in OpenShift. But you can also directly create a new Notebook CR that uses the new container image you have created. Or here, the easiest way would simply be to slightly modify the existing Notebook CR. |
| 142 | +
|
| 143 | +Recipe: |
| 144 | +
|
| 145 | +* Stop your Workbench. |
| 146 | +* From the OpenShift Console, go to the **Home->API Explorer**. |
| 147 | +* Filter/find the **Notebook** object in the group kubeflow.org at version v1. Click on it. |
| 148 | +* Make sure you are on your project and click on the **Instances** tab. |
| 149 | +* Click on the **Name** of your Notebook (Workbench). |
| 150 | +* In the YAML tab, look for the field `image: 'image-registry.openshift-image-registry.svc:5000/redhat-ods-applications...` |
| 151 | +* Replace the value of the `image` field by the ImageStream name you created. Normally it should be: `image-registry.openshift-image-registry.svc:5000/<your_project_name>/ai-mazing-race-stegano`. |
| 152 | +* Get back to OpenShift AI. Your Workbench will show that the Notebook image it is using is **Deleted**. That's not exactly true, it's just not available in the images that OpenShift AI knows about... |
| 153 | +* Start your Workbench. It will use the new container image you have created. You can now directly run the cell! Without typing anything. Mission accomplished, the President sends his thanks! |
| 154 | +==== |
| 155 | + |
0 commit comments