Skip to content

Commit

Permalink
chore: quarkus doc updated
Browse files Browse the repository at this point in the history
  • Loading branch information
squakez committed Oct 11, 2023
1 parent 873e0fd commit 35978dc
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 45 deletions.
2 changes: 1 addition & 1 deletion docs/modules/ROOT/pages/installation/advanced/network.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ In particular the access will be required when the operator build the builder co

Also in this case, the longer the operator runs, the lower the need to access to the base images, since they will be already cached and the higher the possibility to use incremental image from other IntegrationKits created.

NOTE: at the moment of writing, the default builder image we use is _quay.io/quarkus/ubi-quarkus-mandrel-builder-image:22.2.0.0-Final-java11_ and the default integration image is _eclipse-temurin:17_
NOTE: at the moment of writing, the default builder image we use is _quay.io/quarkus/ubi-quarkus-mandrel-builder-image:23.0-jdk-17_ and the default integration image is _eclipse-temurin:17_
4 changes: 2 additions & 2 deletions docs/modules/ROOT/pages/installation/advanced/offline.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ As we're in a disconnected environment, we assume this component to be accessibl

We cannot provide any specific guideline on how to preload images in the cluster registry (as it vary on your infrastructure). However we expect this to be part of the documentation of the cluster in a disconnected mode. At the same manner, you'll need to make sure to include the following images which will be required by Camel K during its operations:

* `quay.io/quarkus/quarkus-distroless-image:1.0`
* `quay.io/quarkus/quarkus-micro-image:2.0`
* `eclipse-temurin:17` (or any other base image you want to use)
* `quay.io/quarkus/ubi-quarkus-mandrel-builder-image:22.2.0.0-Final-java11`
* `quay.io/quarkus/ubi-quarkus-mandrel-builder-image:23.0-jdk-17`

The last one is the image used in the Camel K Runtime 2.16.0 version (the default one at the time of writing). Make sure to identify in the catalog (`.spec.runtime.metadata.quarkus.native-builder-image`) the one required in your installation.

Expand Down
30 changes: 28 additions & 2 deletions docs/modules/ROOT/pages/running/quarkus-native.adoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,33 @@
= Run Quarkus native applications

The default Camel runtime used by Camel K is Camel Quarkus (via Camel K Runtime dependency). This is a great choice for cloud development and by default we use the JVM mode which provides already enough optimization which makes Camel applications, first class Cloud Native applications.
The default Camel runtime used by Camel K is Camel Quarkus (via Camel K Runtime dependency). This is a great choice for **cloud native development** and by default we use the JVM mode which provides already enough optimization which makes Camel applications, first class cloud native applications.

Quarkus (and Camel Quarkus) offers also the possibility to perform a build ahead of time (AOT) and have even further optimization, making your Camel application a native executable with very low footprint and immediate startup. This is known as Native mode and we can configure such behavior using the xref:traits:quarkus.adoc[Quarkus trait].

See the examples provided in xref:traits:quarkus.adoc#_automatic_rollout_deployment_to_native_integration[Quarkus trait] documentation page to learn how to use the feature.
== Quarkus JVM mode

This is the default. As the default Camel K runtime is Quarkus, then, every Camel application you run in Kubernetes are already optimized with Quarkus JVM mode.

== Quarkus native

If you want to go Quarkus native, then you need to familiarize with the xref:traits:quarkus.adoc[Quarkus trait]. This trait is used to configure any aspect related to Quarkus build. The most straightforward way is to use `quarkus.build-mode=native` parameter:

[source,console]
$ kamel run quarkus.build-mode=native ...

This one will trigger a native compilation on your cluster. Mind that a native compilation require quite certain amount of memory and specific tooling (GraalVM). For this reason, any native build will be forced to execute with `pod` build strategy, meaning that a new Kubernetes Pod is scheduled to perform such operation. We calculate certain sensible values for Kubernetes resource such as memory and CPU (4Gi and 1000 millicores). However, depending on the complexity of your Camel application, then, you may require to adjust them. For this reason you may need to configure your xref:pipeline/pipeline.adoc#build-pipeline-trait[build pipeline resources].

=== Automatic Rollout Deployment to Native Integration

Compilation to native executables produces integrations that start faster and consume less memory at runtime. However the build process is resources intensive and takes a longer time than the packaging of a JVM mode application.

In order to combine the best of both worlds, it's possible to configure the Quarkus trait to run both traditional and native builds in parallel when running an integration, e.g.:

[source,console]
$ kamel run -t quarkus.build-mode=jvm -t quarkus.build-mode=native ...

The Integration pod will run as soon as the `jvm` build completes (within seconds), and a rollout deployment to the `native` image will be triggered, as soon as the `native` build completes (within minutes), with no service interruption.

== Supported Camel Components

Camel K only supports the Camel components that are available as Camel Quarkus Extensions out-of-the-box. These extensions are listed in the xref:camel-quarkus::reference/index.adoc[Camel Quarkus documentation].
17 changes: 0 additions & 17 deletions docs/modules/traits/pages/quarkus.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,3 @@ with the `native` kit having precedence over the `jvm` one once ready.
|===

// End of autogenerated code - DO NOT EDIT! (configuration)

== Supported Camel Components

Camel K only supports the Camel components that are available as Camel Quarkus Extensions out-of-the-box. These extensions are listed in the xref:camel-quarkus::reference/index.adoc[Camel Quarkus documentation].

== Examples

=== Automatic Rollout Deployment to Native Integration

While the compilation to native executables produces integrations that start faster and consume less memory at runtime, the build process is resources intensive, and takes a longer time than the packaging to traditional Java applications.

In order to combine the best of both worlds, it's possible to configure the Quarkus trait to run both traditional and native builds in parallel when running an integration, e.g.:

[source,console]
$ kamel run -t quarkus.mode=jvm -t quarkus.mode=native ...

The Integration pod will run as soon as the `hvm` build completes, and a rollout deployment to the `native` image will be triggered, as soon as the `native` build completes, with no service interruption.
3 changes: 0 additions & 3 deletions pkg/builder/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ type artifactsSelector func(ctx *builderContext) error
func nativeImageContext(ctx *builderContext) error {
return imageContext(ctx, func(ctx *builderContext) error {
runner := "camel-k-integration-" + defaults.Version + "-runner"

//ctx.BaseImage = "quay.io/quarkus/quarkus-distroless-image:1.0"
ctx.Artifacts = []v1.Artifact{
{
ID: runner,
Expand All @@ -74,7 +72,6 @@ func nativeImageContext(ctx *builderContext) error {
},
}
ctx.SelectedArtifacts = ctx.Artifacts

return nil
})
}
Expand Down
17 changes: 0 additions & 17 deletions pkg/resources/resources.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions pkg/trait/quarkus.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ import (

const (
quarkusTraitID = "quarkus"

QuarkusNativeDefaultBaseImageName = "quay.io/quarkus/quarkus-micro-image:2.0"
)

type quarkusPackageType string
Expand Down Expand Up @@ -345,10 +347,10 @@ func (t *quarkusTrait) applyWhenBuildSubmitted(e *Environment) error {
packageSteps = append(packageSteps, builder.Quarkus.LoadCamelQuarkusCatalog)

if native {
if nativePackagetType := builder.QuarkusRuntimeSupport(e.CamelCatalog.GetCamelQuarkusVersion()).NativeMavenProperty(); nativePackagetType != "" {
buildTask.Maven.Properties["quarkus.package.type"] = nativePackagetType
if nativePackageType := builder.QuarkusRuntimeSupport(e.CamelCatalog.GetCamelQuarkusVersion()).NativeMavenProperty(); nativePackageType != "" {
buildTask.Maven.Properties["quarkus.package.type"] = nativePackageType
if t.NativeBaseImage == "" {
packageTask.BaseImage = "quay.io/quarkus/quarkus-micro-image:2.0"
packageTask.BaseImage = QuarkusNativeDefaultBaseImageName
} else {
packageTask.BaseImage = t.NativeBaseImage
}
Expand Down

0 comments on commit 35978dc

Please sign in to comment.