How to add OpenJDK 21 image on the Sample drop-down List in Openshift 4?
Environment
- Red Hat build of OpenJDK
- Red hat OpenShift Container Platform (OCP)
- 4.x
Issue
- How to add OpenJDK 21 image on the Sample Drop-down List?
- How to add an image to the Java Sample drop-down list?
Resolution
Follow the procedure below - regardless of the namespace the example is being created the procedure below should be done on the openshift namespace, because the Java imagestream is under that namespace and it is fed directly there.
-
Import an image and set an ImageStreamTag:
$ oc project openshift $ oc import-image ubi8/openjdk-21:1.20-3.1724181172 --from=registry.access.redhat.com/ubi8/openjdk-21:1.20-3.1724181172 --confirm $ oc tag openjdk-21:1.20-3.1724181172 openjdk-21:latest
-
Edit the Java
ImageStream
on theopenshift
namespace, as below, by adding a new tag with the custom name. Example:- name: openjdk-21 <-- Display name annotations: description: Build and run Java applications using Maven. iconClass: icon-rh-openjdk openshift.io/display-name: Java (OpenJDK21) sampleContextDir: undertow-servlet sampleRepo: 'https://github.com/jboss-openshift/openshift-quickstarts' <---- Index Repo supports: java tags: 'builder,java,openjdk' version: latest from: kind: ImageStreamTag name: 'openjdk-21:latest'
There is no need for any reloading whatsoever, the image will load almost automatically on the drop-down menu.
The name user sets above at the tag above, will be the name displayed on the drop-down item menu on the sampleRepo
chosen. The example above will result in the following item:
Root Cause
The Sample Operator will load the Java ImageStream and verify which ones correspond to each Sample Repository, which is the index of the images.
The Java Sample application uses https://github.com/jboss-openshift/openshift-quickstarts
so the tag must have that set as sampleRepo
.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments