Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions templates/jlink/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,17 @@ Some suitable test values for the parameters are
* REF: master
* CONTEXT_DIR: quarkus-quickstarts/getting-started-3.9.2-uberjar
* APPNAME: quarkus-quickstart
* TARGET_PORT: 8080
* SERVICE_PORT: 8080

oc process \
-p JDK_VERSION=17 \
-p APP_URI=https://github.com/jboss-container-images/openjdk-test-applications \
-p REF=master \
-p CONTEXT_DIR=quarkus-quickstarts/getting-started-3.9.2-uberjar \
-p APPNAME=quarkus-quickstart \
-p TARGET_PORT=8080 \
-p SERVICE_PORT=8080 \
templates/jlink-app-template \
| oc create -f -

Expand Down
98 changes: 98 additions & 0 deletions templates/jlink/jlinked-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ metadata:
annotations:
description: Template to produce imagestreams and buildconfigs for jlinked application
name: jlink-app-template
labels:
jlink-app-name: ${APPNAME}
##############################################################################
# List of parameters required to create template
parameters:
Expand All @@ -29,6 +31,14 @@ parameters:
generate: expression
from: "[a-zA-Z0-9]{16}"
required: true
- description: Target port for the created Route
name: TARGET_PORT
value: "8080"
required: true
- description: Port for the created Service to listen on
name: SERVICE_PORT
value: "8181"
required: true
message: "... The GitHub webhook secret is ${GITHUB_WEBHOOK_SECRET} ..."
##############################################################################
# Following are the objects(imagestream and buildconfigs) for all the 3-stages
Expand All @@ -39,6 +49,8 @@ objects:
kind: ImageStream
metadata:
name: ${APPNAME}-ubi9-openjdk-${JDK_VERSION}-jlink
labels:
jlink-app-name: ${APPNAME}
spec:
lookupPolicy:
local: false
Expand All @@ -50,6 +62,7 @@ objects:
name: ${APPNAME}-jlink-builder-jdk-${JDK_VERSION}
labels:
app: ${APPNAME}-jlink-builder-jdk-${JDK_VERSION}
jlink-app-name: ${APPNAME}
spec:
source:
dockerfile: |
Expand Down Expand Up @@ -89,6 +102,8 @@ objects:
kind: ImageStream
metadata:
name: ${APPNAME}-intermediate
labels:
jlink-app-name: ${APPNAME}
spec:
lookupPolicy:
local: false
Expand All @@ -100,6 +115,7 @@ objects:
name: ${APPNAME}-jlink-s2i-jdk-${JDK_VERSION}
labels:
app: ${APPNAME}-jlink-s2i-jdk-${JDK_VERSION}
jlink-app-name: ${APPNAME}
spec:
source:
type: Git
Expand Down Expand Up @@ -139,6 +155,8 @@ objects:
kind: ImageStream
metadata:
name: ${APPNAME}-ubimicro
labels:
jlink-app-name: ${APPNAME}
spec:
lookupPolicy:
local: true
Expand Down Expand Up @@ -216,3 +234,83 @@ objects:
from:
kind: ImageStreamTag
name: ${APPNAME}-ubimicro:latest # ImageStreamTag for registry.access.redhat.com/ubi9/ubi-micro
##############################################################################
# DeploymentConfig and Route object specs
# DeploymentConfigs are discouraged, however the documentation sugggests to still
# use them if features are missing from Deployments, which in our case they are.
- apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
metadata:
name: ${APPNAME}-jlinked-app-deployment
annotations:
template.alpha.openshift.io/wait-for-ready: "true"
labels:
jlink-app-name: ${APPNAME}
spec:
replicas: 1
selector:
app: ${APPNAME}-jlinked-app
template:
metadata:
labels:
app: ${APPNAME}-jlinked-app
spec:
containers:
- name: ${APPNAME}-jlinked-app-container
image: >-
${APPNAME}-lightweight-image:latest
ports:
- containerPort: 8080
protocol: TCP
strategy:
type: Rolling
triggers:
- type: ImageChange
imageChangeParams:
automatic: true
containerNames:
- ${APPNAME}-jlinked-app-container
from:
kind: ImageStreamTag
name: '${APPNAME}-lightweight-image:latest'
namespace: default
- type: ConfigChange
- apiVersion: v1
kind: Service
metadata:
name: ${APPNAME}-jlinked-app-service
labels:
jlink-app-name: ${APPNAME}
spec:
selector:
app: ${APPNAME}-jlinked-app
ports:
- protocol: TCP
name: target-${TARGET_PORT}-tcp
port: ${{SERVICE_PORT}}
targetPort: ${{TARGET_PORT}}
- apiVersion: route.openshift.io/v1
kind: Route
metadata:
name: ${APPNAME}-jlinked-app-route
labels:
jlink-app-name: ${APPNAME}
spec:
to:
kind: Service
name: ${APPNAME}-jlinked-app-service
port:
targetPort: ${TARGET_PORT}
- apiVersion: v1
kind: Pod
metadata:
name: ${APPNAME}-jlinked-app-pod
labels:
jlink-app-name: ${APPNAME}
spec:
containers:
- image: ${APPNAME}-lightweight-image:latest
name: ${APPNAME}-jlinked-app-container
ports:
- containerPort: ${{TARGET_PORT}}
protocol: TCP
Loading