|
1 |
| -# OpenShift-JLink PoC |
| 1 | +# OpenShift Jlink integration (Tech Preview) |
2 | 2 |
|
3 |
| -Try it out: |
| 3 | +To try it out, |
| 4 | +you need: |
4 | 5 |
|
5 |
| -## Stage 1: create ubi9 jlink imagestream and push a ubi9 image with jmods installed to it. |
| 6 | +1. Access to an OpenShift instance, such as [OpenShift Local](https://developers.redhat.com/products/openshift-local/overview) |
| 7 | +2. UBI9 OpenJDK ImageStreams that include `jlink-dev` changes (see below) |
| 8 | +3. The template [jlinked-app.yaml](jlinked-app.yaml). |
6 | 9 |
|
7 |
| -You need: |
| 10 | +## Stage 0: UBI9 OpenJDK ImageStreams with jlink-dev changes |
8 | 11 |
|
9 |
| -1. Access to an OpenShift instance, such as crc |
10 |
| -2. UBI9 OpenJDK ImageStreams. You can load them from this repository with |
| 12 | +Until the `jlink-dev` work is merged, prior to trying out the template, we must first |
| 13 | +prepare UBI9 OpenJDK ImageStreams with `jlink-dev` support. |
11 | 14 |
|
12 |
| - oc create -f templates/ubi9-community-image-streams.json |
| 15 | +1. Build a suitable OpenJDK container image from [this |
| 16 | + repository](https://github.com/jboss-container-images/openjdk), |
| 17 | + branch `jlink-dev`. e.g. |
13 | 18 |
|
14 |
| -Steps to produce the imagestream and image: |
| 19 | + cekit --descriptor ubi9-openjdk-17.yaml build docker |
15 | 20 |
|
16 |
| -1. install the template |
| 21 | +2. Within your OpenShift project, |
17 | 22 |
|
18 |
| - oc create -f templates/jlink/jlink-builder/jlink-builder-template.yaml |
| 23 | + oc create imagestream ubi9-openjdk-17 |
19 | 24 |
|
20 |
| -This will create a Template called jlink-builder-template, you should see |
| 25 | +3. You may need to configure your container engine to not TLS-verify the OpenShift |
| 26 | + registry. For Docker, add the following to `/etc/docker/daemon.json` and restart |
| 27 | + the daemon: |
21 | 28 |
|
22 |
| - template.template.openshift.io/jlink-builder-template created |
| 29 | + { |
| 30 | + "insecure-registries": [ "default-route-openshift-image-registry.apps-crc.testing" ] |
| 31 | + } |
23 | 32 |
|
24 |
| -and after running oc get template, it should be in the list as |
| 33 | +4. Log into the OpenShift registry, e.g. |
25 | 34 |
|
26 |
| - jlink-builder-template Template to produce an imagestream and buildconfig for a Jlink builder image 1 (all set) 2 |
| 35 | + REGISTRY_AUTH_PREFERENCE=docker oc registry login |
27 | 36 |
|
28 |
| -2. Set the parameters and create the imagestream and buildconfig from the template. |
| 37 | +5. tag and push the dev image into it. The OpenShift console gives you the |
| 38 | + exact URI for your instance |
29 | 39 |
|
30 |
| -The template for now defines a single parameter, JDK_VERSION. Setting this will set the version of the builder image used in the BuildConfig. Currently suppoted values are 11, 17, and 21. By default this will be 11. |
| 40 | + docker tag ubi9/openjdk-17:1.18 default-route-openshift-image-registry.apps-crc.testing/jlink1/ubi9-openjdk-17:1.18 |
| 41 | + docker push default-route-openshift-image-registry.apps-crc.testing/jlink1/ubi9-openjdk-17:1.18 |
31 | 42 |
|
32 |
| - oc process --parameters jlink-builder-template |
33 |
| - |
34 |
| - NAME DESCRIPTION GENERATOR VALUE |
35 |
| - JDK_VERSION JDK version to produce a jmods image for 11 |
| 43 | +## Stage 1: Load the template into OpenShift and instantiate it |
36 | 44 |
|
37 |
| -In order to set the JDK version, you will need to use the -p flag of oc process. To process the template and create the imagestreams, simply run |
| 45 | +Create an OpenShift template `templates/jlink-app-template` from the jlinked-app template file |
38 | 46 |
|
39 |
| - oc process jlink-builder-template -p JDK_VERSION=11 | oc create -f - |
40 |
| - |
41 |
| - imagestream.image.openshift.io/ubi9-openjdk-11-jlink created |
42 |
| - buildconfig.build.openshift.io/jlink-builder-jdk-11 created |
| 47 | + oc create -f templates/jlink/jlinked-app.yaml |
43 | 48 |
|
44 |
| -3. Start and observe the build |
| 49 | +Process it to create the needed objects. You can list the parameters using |
45 | 50 |
|
46 |
| -Start the build using |
| 51 | + oc process --parameters jlink-builder-template |
47 | 52 |
|
48 |
| - oc start-build jlink-builder-jdk-11 |
49 |
| - |
50 |
| - build.build.openshift.io/jlink-builder-jdk-11-1 started |
| 53 | +Some suitable test values for the parameters are |
51 | 54 |
|
52 |
| -Then observe it by using |
| 55 | + * JDK_VERSION: 17 |
| 56 | + * APP_URI: https://github.com/jboss-container-images/openjdk-test-applications |
| 57 | + * REF: master |
| 58 | + * CONTEXT_DIR: quarkus-quickstarts/getting-started-3.9.2-uberjar |
53 | 59 |
|
54 |
| - oc logs -f bc/jlink-builder-jdk-11 |
| 60 | + oc process \ |
| 61 | + -p JDK_VERSION=17 \ |
| 62 | + -p APP_URI=https://github.com/jboss-container-images/openjdk-test-applications \ |
| 63 | + -p REF=master \ |
| 64 | + -p CONTEXT_DIR=quarkus-quickstarts/getting-started-3.9.2-uberjar \ |
| 65 | + templates/jlink-app-template \ |
| 66 | + | oc create -f - |
55 | 67 |
|
56 |
| -## Stage 2: build and analyse application with OpenShift source-to-image (S2I) |
| 68 | +## Stage 2: Observe the results |
57 | 69 |
|
58 |
| -TODO |
| 70 | +See all the OpenShift objects that were created: |
| 71 | + |
| 72 | + oc get all |
| 73 | + |
| 74 | +Visit the Topology page within the D eveloper perspective, OpenShift web console, |
| 75 | +and inspect the App. |
0 commit comments