Skip to content

Commit 7f7450c

Browse files
authored
Merge pull request #481 from jmtd/OPENJDK-2897-jlink-README
[OPENJDK-2897] Refresh jlink README
2 parents a903061 + 60cffc2 commit 7f7450c

File tree

1 file changed

+51
-34
lines changed

1 file changed

+51
-34
lines changed

templates/jlink/README.md

Lines changed: 51 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,75 @@
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. 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:
2128

22-
template.template.openshift.io/jlink-builder-template created
29+
{
30+
"insecure-registries": [ "default-route-openshift-image-registry.apps-crc.testing" ]
31+
}
2332

24-
and after running oc get template, it should be in the list as
33+
4. Log into the OpenShift registry, e.g.
2534

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
2736

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
2939

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
3142

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
3644

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
3846

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
4348

44-
3. Start and observe the build
49+
Process it to create the needed objects. You can list the parameters using
4550

46-
Start the build using
51+
oc process --parameters jlink-builder-template
4752

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
5154

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
5359

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

56-
## Stage 2: build and analyse application with OpenShift source-to-image (S2I)
68+
## Stage 2: Observe the results
5769

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

Comments
 (0)