Skip to content

Commit 60b9820

Browse files
committed
[OPENJDK-2897] Refresh jlink README
Update the template README to explain how to use it. https://issues.redhat.com/browse/OPENJDK-2897 Signed-off-by: Jonathan Dowland <[email protected]>
1 parent a903061 commit 60b9820

File tree

1 file changed

+43
-34
lines changed

1 file changed

+43
-34
lines changed

templates/jlink/README.md

Lines changed: 43 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,67 @@
1-
# OpenShift-JLink PoC
1+
# OpenShift Jlink integration (Tech Preview)
22

3-
Try it out:
3+
To try it out,
4+
you need:
45

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).
69

7-
You need:
10+
## Stage 0: UBI9 OpenJDK ImageStreams with jlink-dev changes
811

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

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

14-
Steps to produce the imagestream and image:
19+
cekit --descriptor ubi9-openjdk-17.yaml build docker
1520

16-
1. install the template
21+
2. Within your OpenShift project,
1722

18-
oc create -f templates/jlink/jlink-builder/jlink-builder-template.yaml
23+
oc create imagestream ubi9-openjdk-17
1924

20-
This will create a Template called jlink-builder-template, you should see
25+
3. Log into the OpenShift registry, e.g.
2126

22-
template.template.openshift.io/jlink-builder-template created
27+
REGISTRY_AUTH_PREFERENCE=docker oc registry login
2328

24-
and after running oc get template, it should be in the list as
29+
4. tag and push the dev image into it. The OpenShift console gives you the
30+
exact URI for your instance
2531

26-
jlink-builder-template Template to produce an imagestream and buildconfig for a Jlink builder image 1 (all set) 2
32+
docker tag ubi9/openjdk-17:1.18 default-route-openshift-image-registry.apps-crc.testing/jlink1/ubi9-openjdk-17:1.18
33+
docker push default-route-openshift-image-registry.apps-crc.testing/jlink1/ubi9-openjdk-17:1.18
2734

28-
2. Set the parameters and create the imagestream and buildconfig from the template.
35+
## Stage 1: Load the template into OpenShift and instantiate it
2936

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.
37+
Create an OpenShift template `templates/jlink-app-template` from the jlinked-app template file
3138

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
39+
oc create -f templates/jlink/jlinked-app.yaml
3640

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
41+
Process it to create the needed objects. You can list the parameters using
3842

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
43+
oc process --parameters jlink-builder-template
4344

44-
3. Start and observe the build
45+
Some suitable test values for the parameters are
4546

46-
Start the build using
47+
* JDK_VERSION: 17
48+
* APP_URI: https://github.com/jboss-container-images/openjdk-test-applications
49+
* REF: master
50+
* CONTEXT_DIR: quarkus-quickstarts/getting-started-3.9.2-uberjar
4751

48-
oc start-build jlink-builder-jdk-11
49-
50-
build.build.openshift.io/jlink-builder-jdk-11-1 started
52+
oc process \
53+
-p JDK_VERSION=17 \
54+
-p APP_URI=https://github.com/jboss-container-images/openjdk-test-applications \
55+
-p REF=master \
56+
-p CONTEXT_DIR=quarkus-quickstarts/getting-started-3.9.2-uberjar \
57+
templates/jlink-app-template \
58+
| oc create -f -
5159

52-
Then observe it by using
60+
## Stage 2: Observe the results
5361

54-
oc logs -f bc/jlink-builder-jdk-11
62+
See all the OpenShift objects that were created:
5563

56-
## Stage 2: build and analyse application with OpenShift source-to-image (S2I)
64+
oc get all
5765

58-
TODO
66+
Visit the Topology page within the D eveloper perspective, OpenShift web console,
67+
and inspect the App.

0 commit comments

Comments
 (0)