Skip to content

Commit 9dce767

Browse files
committed
Update README with warning about projects, convert DeploymentConfig to Deployment
1 parent 94033a7 commit 9dce767

File tree

2 files changed

+23
-24
lines changed

2 files changed

+23
-24
lines changed

templates/jlink/README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ you need:
77
2. UBI9 OpenJDK ImageStreams that include `jlink-dev` changes (see below)
88
3. The template [jlinked-app.yaml](jlinked-app.yaml).
99

10+
DISCLAIMER: This template requires OpenShift to be able to resolve ImageStreams, as such it can only be used in projects where the openshift.io/run-level label set to 0 or 1. This means it cannot be used with default, kube-public, kube-system, openshift, openshift-infra, openshift-node, and other system-created projects.
11+
1012
## Stage 0: UBI9 OpenJDK ImageStreams with jlink-dev changes
1113

1214
Until the `jlink-dev` work is merged, prior to trying out the template, we must first
@@ -18,23 +20,28 @@ prepare UBI9 OpenJDK ImageStreams with `jlink-dev` support.
1820

1921
cekit --descriptor ubi9-openjdk-17.yaml build docker
2022

21-
2. Within your OpenShift project,
23+
2. Create an OpenShift project and namespace
24+
25+
oc new-project jlink-dev
26+
oc create namespace jlink
27+
28+
3. Within your OpenShift project,
2229

2330
oc create imagestream openjdk-17-jlink-tech-preview
2431

25-
3. You may need to configure your container engine to not TLS-verify the OpenShift
32+
4. You may need to configure your container engine to not TLS-verify the OpenShift
2633
registry. For Docker, add the following to `/etc/docker/daemon.json` and restart
2734
the daemon:
2835

2936
{
3037
"insecure-registries": [ "default-route-openshift-image-registry.apps-crc.testing" ]
3138
}
3239

33-
4. Log into the OpenShift registry, e.g.
40+
5. Log into the OpenShift registry, e.g.
3441

3542
REGISTRY_AUTH_PREFERENCE=docker oc registry login
3643

37-
5. tag and push the dev image into it. The OpenShift console gives you the
44+
6. tag and push the dev image into it. The OpenShift console gives you the
3845
exact URI for your instance
3946

4047
docker tag openjdk-tech-preview/openjdk-17-jlink-rhel9:1.18 default-route-openshift-image-registry.apps-crc.testing/jlink1/openjdk-17-jlink-tech-preview:1.18
@@ -52,7 +59,7 @@ Process it to create the needed objects. You can list the parameters using
5259

5360
Some suitable test values for the parameters are
5461

55-
* JDK_VERSION: 17
62+
* JDK_VERSION: 21
5663
* APP_URI: https://github.com/jboss-container-images/openjdk-test-applications
5764
* REF: master
5865
* CONTEXT_DIR: quarkus-quickstarts/getting-started-3.9.2-uberjar

templates/jlink/jlinked-app.yaml

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ metadata:
1010
parameters:
1111
- description: JDK version to produce a jmods image and imagestream for
1212
name: JDK_VERSION
13-
value: "11"
13+
value: "21"
1414
required: true
1515
- description: OpenJDK builder image version tag
1616
name: BUILDER_IMAGE_TAG
@@ -182,7 +182,8 @@ objects:
182182
app.kubernetes.io/part-of: ${APPNAME}
183183
spec:
184184
lookupPolicy:
185-
local: false
185+
# Must be true for the Deployment to resolve the ImageStream
186+
local: true
186187
##############################################################################
187188
# stage-3: BuildConfig
188189
- apiVersion: build.openshift.io/v1
@@ -248,24 +249,26 @@ objects:
248249
# DeploymentConfig and Route object specs
249250
# DeploymentConfigs are discouraged, however the documentation sugggests to still
250251
# use them if features are missing from Deployments, which in our case they are.
251-
- apiVersion: apps.openshift.io/v1
252-
kind: DeploymentConfig
252+
- apiVersion: apps/v1
253+
kind: Deployment
253254
metadata:
254255
name: ${APPNAME}-jlinked-app-deployment
255-
annotations:
256-
template.alpha.openshift.io/wait-for-ready: "true"
257256
labels:
258257
app: ${APPNAME}
259258
app.kubernetes.io/part-of: ${APPNAME}
260259
spec:
261260
replicas: 1
262261
selector:
263-
app: ${APPNAME}
262+
matchLabels:
263+
app: ${APPNAME}
264264
template:
265265
metadata:
266266
labels:
267267
app: ${APPNAME}
268268
app.kubernetes.io/part-of: ${APPNAME}
269+
annotations:
270+
# Allows Deployments to use ImageStreams
271+
alpha.image.policy.openshift.io/resolve-names: '*'
269272
spec:
270273
containers:
271274
- name: ${APPNAME}-jlinked-app-container
@@ -274,18 +277,7 @@ objects:
274277
- containerPort: ${{TARGET_PORT}}
275278
protocol: TCP
276279
strategy:
277-
type: Rolling
278-
triggers:
279-
- type: ImageChange
280-
imageChangeParams:
281-
automatic: true
282-
containerNames:
283-
- ${APPNAME}-jlinked-app-container
284-
from:
285-
kind: ImageStreamTag
286-
name: '${APPNAME}-lightweight-image:latest'
287-
namespace: default
288-
- type: ConfigChange
280+
type: RollingUpdate
289281
- apiVersion: v1
290282
kind: Service
291283
metadata:

0 commit comments

Comments
 (0)