An ImageStream is an OpenShift resource that abstracts container images and tracks image updates. It connects image production with deployments so new builds can trigger application redeployment. section 11.3.4
An OpenShift application deployment can use ImageStreams to:
- Represent both a base JDK image and the Inventory service image. section 11.3.4
- Provide ImageStreamTags as BuildConfig outputs, such as inventory-service:1.0.0-SNAPSHOT. section 11.3.4
- Notify the Deployment of image changes so a new s2i build automatically redeploys the service. section 11.3.4
Inventory service build flow
Build the JAR locally, push it to OpenShift, and let the BuildConfig create the application image. The Deployment then runs the resulting image and redeploys when its ImageStreamTag changes. section 11.3.4
Listing 11.14 Simplified version of the generated openshift.yml
--- apiVersion: v1 kind: Service ... name: inventory-service ... --- apiVersion: image.openshift.io/v1 kind: ImageStream ... dockerImageRepository: registry.access.redhat.com/ubi8/openjdk-21 ... --- apiVersion: image.openshift.io/v1 kind: ImageStream ... name: inventory-service namespace: default spec: dockerImageRepository: quay.io/quarkus-in-action/inventory-service ...
Inspect generated ImageStream definitions for the JDK base image and the Inventory service image. section 11.3.4
Listing 11.15 Continuation of the simplified generated openshift.yml
---
apiVersion: build.openshift.io/v1
kind: BuildConfig
...
name: inventory-service
namespace: default
spec:
output:
to:
kind: ImageStreamTag
name: inventory-service:1.0.0-SNAPSHOT
source:
binary: {}
strategy:
sourceStrategy:
from:
kind: ImageStreamTag
name: openjdk-21:1.20
---
apiVersion: apps/v1
kind: Deployment
...
name: inventory-service
namespace: default
spec:
...
spec:
containers:
...
- name: JAVA_APP_JAR
value: /deployments/quarkus-run.jar
image: quay.io/quarkus-in-action/inventory-service:1.0.0
imagePullPolicy: Always
Inspect how BuildConfig writes an ImageStreamTag and how the Deployment consumes the service image. section 11.3.4
