Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 4 additions & 4 deletions .github/quarkus-github-bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ triage:
- id: kubernetes
labels: [area/kubernetes]
titleBody: "kubernetes"
notify: [geoand]
notify: [geoand, metacosm]
directories:
- extensions/kubernetes/
- extensions/kubernetes-client/
Expand All @@ -354,15 +354,15 @@ triage:
- id: minikube
labels: [area/kubernetes]
titleBody: "minikube"
notify: [geoand]
notify: [geoand, metacosm]
- id: openshift
labels: [area/kubernetes]
titleBody: "openshift"
notify: [geoand]
notify: [geoand, metacosm]
- id: knative
labels: [area/kubernetes]
titleBody: "knative"
notify: [geoand]
notify: [geoand, metacosm]
- id: container-image
labels: [area/container-image]
expression: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -533,9 +533,10 @@ public boolean isSatisfiedBy(Task t) {

project.getPlugins().withId("org.jetbrains.kotlin.jvm", plugin -> {
quarkusDev.configure(task -> task.shouldPropagateJavaCompilerArgs(false));
SourceSetContainer ssc = project.getExtensions().getByType(SourceSetContainer.class);
final SourceSet generatedSourceSet = ssc.getByName(QuarkusGenerateCode.QUARKUS_GENERATED_SOURCES);
final SourceSet generatedTestSourceSet = ssc.getByName(QuarkusGenerateCode.QUARKUS_TEST_GENERATED_SOURCES);
tasks.named("compileKotlin", task -> {
final SourceSet generatedSourceSet = project.getExtensions().getByType(SourceSetContainer.class)
.getByName(QuarkusGenerateCode.QUARKUS_GENERATED_SOURCES);
addCodeGenSourceDirs(task, generatedSourceSet);
task.dependsOn(quarkusGenerateCode);
task.mustRunAfter(quarkusGenerateCodeDev);
Expand All @@ -548,18 +549,32 @@ public boolean isSatisfiedBy(Task t) {
}
});
tasks.named("compileTestKotlin", task -> {
final SourceSet generatedSourceSet = project.getExtensions().getByType(SourceSetContainer.class)
.getByName(QuarkusGenerateCode.QUARKUS_TEST_GENERATED_SOURCES);
addCodeGenSourceDirs(task, generatedSourceSet);
addCodeGenSourceDirs(task, generatedTestSourceSet);
task.dependsOn(quarkusGenerateCodeTests);
if (tasks.contains(new NamedImpl(generatedSourceSet.getCompileJavaTaskName()))) {
task.mustRunAfter(tasks.named(generatedSourceSet.getCompileJavaTaskName()));
if (tasks.contains(new NamedImpl(generatedTestSourceSet.getCompileJavaTaskName()))) {
task.mustRunAfter(tasks.named(generatedTestSourceSet.getCompileJavaTaskName()));
}
final String generatedSourcesCompileTaskName = generatedSourceSet.getCompileTaskName("kotlin");
final String generatedSourcesCompileTaskName = generatedTestSourceSet.getCompileTaskName("kotlin");
if (tasks.contains(new NamedImpl(generatedSourcesCompileTaskName))) {
task.mustRunAfter(tasks.named(generatedSourcesCompileTaskName));
}
});
// kapt stub tasks don't inherit the source dirs injected into compileKotlin, so wire them explicitly.
// TODO: perhaps we should prioritize IDE devX and proper wiring into the main SS, and invert
// the handling here: kapt should be the base case, and KSP should be the edge-case.
// See issues [1] and [2] for full context.
// * [1] https://github.com/quarkusio/quarkus/issues/29698
// * [2] https://github.com/quarkusio/quarkus/issues/50486
project.getPlugins().withId("org.jetbrains.kotlin.kapt", kaptPlugin -> {
tasks.matching(t -> t.getName().equals("kaptGenerateStubsKotlin")).configureEach(task -> {
addCodeGenSourceDirs(task, generatedSourceSet);
task.dependsOn(quarkusGenerateCode);
});
tasks.matching(t -> t.getName().equals("kaptGenerateStubsTestKotlin")).configureEach(task -> {
addCodeGenSourceDirs(task, generatedTestSourceSet);
task.dependsOn(quarkusGenerateCodeTests);
});
});
});
}

Expand Down
77 changes: 39 additions & 38 deletions docs/src/main/asciidoc/deploying-to-openshift-docker-howto.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ https://github.com/quarkusio/quarkus/tree/main/docs/src/main/asciidoc
include::_attributes.adoc[]
:diataxis-type: howto
:categories: cloud, native
:summary: This guide describes how to build and deploy a Quarkus application on {openshift} by using the Docker build strategy.
:summary: This guide describes how to build and deploy a {project-name} application on {openshift} by using the Docker build strategy.
:topics: devops,kubernetes,openshift,cloud,deployment
:extensions: io.quarkus:quarkus-openshift

As an application developer, you can deploy your applications to {openshift} by using the Docker build strategy as a deployment option.
As an application developer, you can deploy your applications to {openshift-long} by using the Docker build strategy as a deployment option.

This stategy builds the artifacts outside the {openshift} cluster, locally or in a CI environment, and provides them to the {openshift} build system together with a Dockerfile.
This strategy builds the artifacts outside the {openshift} cluster, either locally or in a CI environment, and provides them to the {openshift} build system together with a Dockerfile.
The artifacts include JAR files or a native executable.
The {openshift} cluster builds the container and provides it as an image stream.
The {openshift} cluster builds the container image and provides it as an image stream.

This functionality is provided by the `quarkus-openshift` extension.
If you want to use a custom Dockerfile, add the file to the `src/main/docker` directory or any location inside the module.
Additionally, set the path to your Dockerfile by using the `quarkus.openshift.jvm-dockerfile` property.
If you want to use a custom Dockerfile, add the file to the `src/main/docker` directory or another location inside the module.
Set the path to your Dockerfile with the `quarkus.openshift.jvm-dockerfile` property.

== Prerequisites

Expand All @@ -33,42 +33,42 @@ Additionally, set the path to your Dockerfile by using the `quarkus.openshift.jv

== Procedure

. Set the Docker build strategy in your `application.properties` configuration file:
. Set the Docker build strategy in your `application.properties` file:
+
[source, properties]
[source,properties]
----
quarkus.openshift.build-strategy=docker
----
. Optional: Set the following properties in the `application.properties` file, based on your environment:
** If you are using an untrusted certificate, enable certificate trust for the `KubernetesClient`:
. Optional: Complete one or more of the following configuration steps in the `application.properties` file:
+
* If you are using an untrusted certificate, enable certificate trust for the `KubernetesClient`:
+
[source,properties]
----
quarkus.kubernetes-client.trust-certs=true
----
** To expose the service and create an {openshift} route, set the following property:
* To expose the service and create an {openshift} route, set the following property:
+
[source,properties]
----
quarkus.openshift.route.expose=true
----
** To use a custom Dockerfile instead of the pregenerated Dockerfiles, set the path to your Dockerfile:
* To use a custom Dockerfile instead of the pre-generated Dockerfiles, set the path to your Dockerfile:
+
[source,properties,subs="attributes+,+quotes"]
[source,properties]
----
quarkus.openshift.jvm-dockerfile=<path_to_your_dockerfile>
----
+
For example, to specify a custom Dockerfile named `Dockerfile.custom-jvm`:
For example, to specify a custom Dockerfile named `Dockerfile.custom-jvm`, set the following property:
+
[source,properties]
----
quarkus.openshift.jvm-dockerfile=src/main/resources/Dockerfile.custom-jvm
----

. Package and deploy your application to the current {openshift} project:
+
[source,shell,subs="attributes+,+quotes"]
[source,shell]
----
./mvnw clean package -Dquarkus.openshift.deploy=true
----
Expand All @@ -79,28 +79,27 @@ The following verification steps use the `openshift-helloworld` example applicat

. Display the list of pods associated with your current OpenShift project:
+
[source,shell,subs="+quotes",options="nowrap"]
[source,shell,options="nowrap"]
----
oc get pods
----
+
[source,shell,subs="+quotes",options="nowrap"]
[source,text,options="nowrap"]
----
NAME READY STATUS RESTARTS AGE
openshift-helloworld-1-build 0/1 Completed 0 11m
openshift-helloworld-1-deploy 0/1 Completed 0 10m
openshift-helloworld-1-gzzrx 1/1 Running 0 10m
----

. To get the log output for your application's pod, use the `oc logs -f` command with its name.
The following example uses the `openshift-helloworld-1-gzzrx` pod name, which corresponds to the latest pod prefixed with the name of your application:
. To get the log output from your application's pod, run the `oc logs -f` command with the pod name.
The following example uses the `openshift-helloworld-1-gzzrx` pod name, which corresponds to the latest pod prefixed with the application name:
+
[source,shell,subs="+quotes",options="nowrap"]
[source,shell,options="nowrap"]
----
oc logs -f _openshift-helloworld-1-gzzrx_
oc logs -f openshift-helloworld-1-gzzrx
----
+
[source,shell,subs=attributes+]
[source,text,subs="attributes+"]
----
Starting the Java application using /opt/jboss/container/java/run/run-java.sh ...
INFO exec -a "java" java -Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager -XX:MaxRAMPercentage=50.0 -XX:+UseParallelGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -XX:+ExitOnOutOfMemoryError -cp "." -jar /deployments/quarkus-run.jar
Expand All @@ -112,45 +111,47 @@ __ ____ __ _____ ___ __ ____ ______
2024-09-17 10:23:25,281 INFO [io.quarkus] (main) Profile prod activated.
2024-09-17 10:23:25,281 INFO [io.quarkus] (main) Installed features: [cdi, kubernetes, rest, smallrye-context-propagation, vertx]
----

. Get a list of services:
. Display the list of services:
+
[source,shell,subs="+quotes",options="nowrap"]
[source,shell,options="nowrap"]
----
oc get svc
----
+
[source,shell,subs="+quotes",options="nowrap"]
[source,text,options="nowrap"]
----
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
openshift-helloworld ClusterIP 172.30.64.57 <none> 80/TCP 14m
----

. Get a URL to test your application.
To do so, ensure you have exposed an {openshift} route by setting the `quarkus.openshift.route.expose=true` property in the `application.properties` file before building the application.
To do so, ensure that you exposed an {openshift} route by setting the `quarkus.openshift.route.expose=true` property in the `application.properties` file before building the application:
+
[source,shell,subs="+quotes",options="nowrap"]
[source,shell,options="nowrap"]
----
oc get routes
----
+
[source,shell,subs="+quotes",options="nowrap"]
[source,text,options="nowrap"]
----
NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD
openshift-helloworld openshift-helloworld-username-dev.apps.sandbox-m2.ll9k.p1.openshiftapps.com openshift-helloworld http None
----
+
[NOTE]
====
Be aware that the route is now listening on port 80 and is no longer on port 8080.
Be aware that the route listens on port 80 and no longer listens on port 8080.
====
+
You can test the application demonstrated in this example with a web browser or a terminal by using `curl` and the complete URL output from `oc get routes`, that is, `\http://openshift-helloworld-username-dev.apps.sandbox-m2.ll9k.p1.openshiftapps.com`.
You can test the application in this example with a web browser or from a terminal.
Use the complete URL from `oc get routes`, for example `http://openshift-helloworld-username-dev.apps.sandbox-m2.ll9k.p1.openshiftapps.com`.
+
For example:
+
For example: `curl \http://openshift-helloworld-username-dev.apps.sandbox-m2.ll9k.p1.openshiftapps.com`.
[source,shell,options="nowrap"]
----
curl http://openshift-helloworld-username-dev.apps.sandbox-m2.ll9k.p1.openshiftapps.com
----

== References

* xref:deploying-to-openshift.adoc[Deploying {project-name} applications to {openshift}]


* xref:deploying-to-openshift.adoc[Deploying {project-name} applications to {openshift}]
16 changes: 9 additions & 7 deletions docs/src/main/asciidoc/deploying-to-openshift-native-howto.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ include::_attributes.adoc[]
:topics: devops,kubernetes,openshift,cloud,deployment
:extensions: io.quarkus:quarkus-openshift

You can deploy your native {project-name} applications to {openshift} compiled to native executables by using the Docker build strategy.
You can deploy your {project-name} applications compiled to native executables to {openshift-long} by using the Docker build strategy.

You must create a native executable for your application that targets a supported operating system and match the architecture.
You must create a native executable for your application that targets a supported operating system and matches the architecture.
This means, if you are building on Windows, you create a native Linux executable by using a container runtime, for example, Docker or Podman.

Your Quarkus project includes pregenerated Dockerfiles with instructions.
If you want to use a custom Dockerfile, add the file to the `src/main/docker` directory or any location inside the module.
Additionally, if you want to have multiple Docker files and switch between them, set the path to your preferred Dockerfile by using the `quarkus.openshift.native-dockerfile` property.

Additionally, if you want to have multiple Dockerfiles and switch between them, set the path to your preferred Dockerfile by using the `quarkus.openshift.native-dockerfile` property.

[NOTE]
====
Expand All @@ -37,7 +38,7 @@ This guide describes this strategy by using a Quarkus project with Maven as the

. Set the Docker build strategy in your `application.properties` configuration file:
+
[source, properties]
[source,properties]
----
quarkus.openshift.build-strategy=docker
----
Expand All @@ -48,6 +49,7 @@ quarkus.openshift.build-strategy=docker
quarkus.native.container-build=true
----
. Optional: Set the following properties in the `application.properties` file based on your environment:
+
** If you are using an untrusted certificate, enable certificate trust for the `KubernetesClient`:
+
[source,properties]
Expand All @@ -66,6 +68,7 @@ quarkus.openshift.route.expose=true
----
quarkus.openshift.native-dockerfile=<path_to_your_dockerfile>
----
+
For example, to specify a custom Dockerfile named `Dockerfile.custom-native`:
+
[source,properties]
Expand All @@ -74,7 +77,7 @@ quarkus.openshift.native-dockerfile=src/main/docker/Dockerfile.custom-native
----

** Specify the container engine:
*** To build a native executable with Podman:
*** To build a native executable with Podman:
+
[source,properties]
----
Expand All @@ -89,7 +92,7 @@ quarkus.native.container-runtime=docker

. Finally, build the native executable, package, and deploy your application to {openshift}:
+
[source,shell,subs="attributes+,+quotes"]
[source,shell]
----
./mvnw clean package -Pnative -Dquarkus.openshift.deploy=true
----
Expand Down Expand Up @@ -120,4 +123,3 @@ oc logs -f __<pod_name>__
== References

* xref:deploying-to-openshift.adoc[Deploying {project-name} applications to {openshift}]

Loading
Loading