Skip to content

Commit

Permalink
doc (jkube-kit/doc) : Documentation for Buildpacks integration
Browse files Browse the repository at this point in the history
+ Move `_integrations.adoc` from `kubernetes-maven-plugin` to `jkube-kit/doc`
+ Move `_jkube-build.adoc` from `kubernetes-maven-plugin` +
  `gradle-plugin` to `jkube-kit/doc`
+ Add section related to Buildpacks in integrations

Signed-off-by: Rohan Kumar <[email protected]>
  • Loading branch information
rohanKanojia committed Feb 7, 2024
1 parent d828cd2 commit ae9ac45
Show file tree
Hide file tree
Showing 35 changed files with 721 additions and 671 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Usage:
* Fix #2423: Change default VolumePermissionEnricher's initContainer image from `busybox` to `quay.io/quay/busybox`
* Fix #2444: Add support for Spring Boot application properties placeholders
* Fix #2456: Add utility class to decompress archive files
* Fix #2465: Add support for `buildpacks` build strategy with opinionated defaults (Zero config)
* Fix #2472: Support for Helm Chart.yaml appVersion field defaulting to project version
* Fix #2474: Remove Docker-related classes providing unused functionality
* Fix #2477: Support for Spring Boot 3.2.0 (and newer) layered jar format
Expand Down
161 changes: 0 additions & 161 deletions gradle-plugin/doc/src/main/asciidoc/inc/_groovy-configuration.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,77 +8,10 @@
|====
| Element | Description | Property

| *authConfig*
| Authentication information when pulling from or pushing to Docker registry. There is a dedicated section
<<authentication, Authentication>> for how to do security.
|

| <<cluster-access-configuration, *access*>>
| Group of configuration parameters to connect to Kubernetes/OpenShift cluster.
|

| *autoPull*
a| Decide how to pull missing base images or images to start:

* `on` : Automatic download any missing images (default)
* `off` : Automatic pulling is switched off
* `always` : Pull images always even when they already exist locally
* `once` : For multi-module builds images are only checked once and pulled for the whole build.

| `jkube.docker.autoPull`

ifeval::["{task-prefix}" == "oc"]
| *buildOutputKind*
| Allow to specify in which registry to push the container image at the end of the build.
If the output kind is ImageStreamTag, then the image will be pushed to the internal OpenShift registry.
If the output is of type DockerImage, then the name of the output reference will be used as a Docker push specification.
The default value is `ImageStreamTag`

| `jkube.build.buildOutput.kind`
endif::[]

| *buildRecreate*
a| If the effective build mode is `openshift` then this option decides how the OpenShift resource objects
associated with the build should be treated when they already exist:

* `buildConfig` or `bc` : Only the BuildConfig is recreated
* `imageStream` or `is` : Only the ImageStream is recreated
* `all` : Both, BuildConfig and ImageStream are recreated
* `none` : Neither BuildConfig nor ImageStream is recreated

The default is `none`. If you provide the property without value then `all` is assumed, so everything gets recreated.
| `jkube.build.recreate`

| *buildSourceDirectory*
| Default directory that contains the assembly descriptor(s) used by the plugin. The default value is `src/main/docker`.
This option is only relevant for the `{task-prefix}Build` task.
| `jkube.build.source.dir`

| *buildStrategy*
a| Defines what build strategy to choose while building container image.
Possible values are `docker` and `jib` out of which `docker` is default.

ifeval::["{task-prefix}" == "oc"]
If the effective build mode is `openshift` an additional `s2i` option is available
and selected by default.

Available strategies for OpenShift are:

* `s2i` for a https://docs.openshift.com/enterprise/latest/architecture/core_concepts/builds_and_image_streams.html#source-build[Source-to-Image build] with a binary source
* `docker` for a https://docs.openshift.com/enterprise/latest/architecture/core_concepts/builds_and_image_streams.html#docker-build[Docker build] with a binary source

endif::[]
| `jkube.build.strategy`

| *certPath*
| Path to SSL certificate when SSL is used for communicating with the Docker daemon. These certificates are normally
stored in `~/.docker/`. With this configuration the path can be set explicitly. If not set, the fallback is first
taken from the environment variable `DOCKER_CERT_PATH` and then as last resort `~/.docker/`. The keys in this are
expected with it standard names `ca.pem`, `cert.pem` and `key.pem`.
Please refer to the https://docs.docker.com/articles/https[Docker documentation] for more information about SSL
security with Docker.
| `jkube.docker.certPath`

| *createNewResources*
| Create new {cluster} resources.

Expand All @@ -97,31 +30,6 @@ Defaults to `false`.
Defaults to `true`.
| `jkube.deploy.deletePods`

| *dockerHost*
a| The URL of the Docker Daemon. If this configuration option is not given, then the optional `<machine>` configuration
section is consulted. The scheme of the URL can be either given directly as `http` or `https`
depending on whether plain HTTP communication is enabled or SSL should
be used. Alternatively the scheme could be `tcp` in which case the
protocol is determined via the IANA assigned port: 2375 for `http`
and 2376 for `https`. Finally, Unix sockets are supported by using
the scheme `unix` together with the filesystem path to the unix socket.

The discovery sequence used by the docker-maven-plugin to determine
the URL is:

. Value of *dockerHost* (`jkube.docker.host`)
. The Docker host associated with the docker-machine named in `<machine>`, i.e. the `DOCKER_HOST` from `docker-machine env`.
. The value of the environment variable `DOCKER_HOST`.
. `unix:///var/run/docker.sock` if it is a readable socket.
| `jkube.docker.host`

| *filter*
| In order to temporarily restrict the operation of plugin tasks this configuration option can be used.
Typically this will be set via the system property `jkube.image.filter` when Gradle is called. The value can be a single
image name (either its alias or full name) or it can be a comma separated list with multiple image names. Any name
which doesn't refer an image in the configuration will be ignored.
| `jkube.image.filter`

| *failOnNoKubernetesJson*
| Fail if there is no kubernetes json present.

Expand All @@ -136,17 +44,6 @@ otherwise.
| `jkube.failOnValidationError`

ifeval::["{task-prefix}" == "oc"]
|*forcePull*
|
Applicable only for OpenShift, S2I build strategy.

While creating a BuildConfig, By default, if the builder image specified in the
build configuration is available locally on the node, that image will be used.

Using forcePull will override the local image and refresh it from the registry the image stream points to.

|`jkube.build.forcePull`

| *ignoreRunningOAuthClients*
| Ignore OAuthClients which are already running. OAuthClients are shared across namespaces so we should not try to update or create/delete global oauth clients.

Expand All @@ -160,17 +57,6 @@ endif::[]
Defaults to `false`.
| `jkube.deploy.ignoreServices`

| [[image-pull-policy]] *imagePullPolicy*
a| Specify whether images should be pull when looking for base images while building or images for starting.
This property can take the following values (case insensitive):

* `IfNotPresent`: Automatic download any missing images (default)
* `Never` : Automatic pulling is switched off always
* `Always` : Pull images always even when they already exist locally.

By default a progress meter is printed out on the console, which is omitted when using Maven in batch mode (option `-B`). A very simplified progress meter is provided when using no color output (i.e. with `-Djkube.useColor=false`).
| `jkube.docker.imagePullPolicy`

| *interpolateTemplateParameters*
| Interpolate parameter values from `*template.yml` fragments in the generated resource list (`kubernetes.yml`).

Expand Down Expand Up @@ -229,49 +115,18 @@ Defaults to `5005`.
Defaults to `null`.
| `jkube.log.pod`

| *machine*
| Docker machine configuration.
|

| *maxConnections*
| Number of parallel connections are allowed to be opened to the Docker Host. For parsing log output, a connection needs
to be kept open (as well for the wait features), so don't put that number to low. Default is 100 which should be
suitable for most of the cases.
| `jkube.docker.maxConnections`

| *mergeWithDekorate*
| When resource generation is delegated to Dekorate, should JKube resources be merged with Dekorate generated ones.

Defaults to `false`.
| `jkube.mergeWithDekorate`

| *outputDirectory*
| Default output directory to be used by this plugin.
The default value is `build/docker` and is only used for the task `{task-prefix}Build`.
| `jkube.build.target.dir`

| *offline*
| Whether to try detecting Kubernetes Cluster or stay offline.

Defaults to `false`.
| `jkube.offline`

ifeval::["{task-prefix}" == "oc"]
| *openshiftPullSecret*
| The name to use for naming pullSecret to be created to pull the base image in case pulling from a private registry
which requires authentication for OpenShift.

The default value for pull registry will be picked from `jkube.docker.pull.registry`/`jkube.docker.registry`.
| `jkube.build.pullSecret`

| *openshiftPushSecret*
| The name of pushSecret to be used to push the final image in case pushing from a
protected registry which requires authentication.

| `jkube.build.pushSecret`

endif::[]

// TODO - Add when support is complete
//| *profile*
//| Profile to which contains enricher and generators configuration. See <<profiles,Profiles>> for details.
Expand All @@ -296,10 +151,6 @@ more details.
Defaults to `false`.
| `jkube.recreate`

| *registry*
| Specify globally a registry to use for pulling and pushing images. See <<registry,Registry handling>> for details.
| `jkube.docker.registry`

| *pushRetries*
| How often should a push be retried before giving up. This useful for flaky registries which tend to return 500 error codes from time to time.

Expand Down Expand Up @@ -373,14 +224,6 @@ Defaults to `false`.
| If not set resource manifests would be generated with `{task-prefix}Resource`.
| `jkube.skip.resource`

| *skipTag*
| If set to `true` this plugin won't add any tags to images that have been built with `{task-prefix}Build`.
| `jkube.skip.tag`

| *skipMachine*
| Skip using docker machine in any case
| `jkube.docker.skip.machine`

| *skipPush*
| If set to true the plugin won’t push any images that have been built.

Expand All @@ -406,10 +249,6 @@ Defaults to `false`.
Defaults to `false`.
| `jkube.useProjectClassPath`

| *verbose*
| Boolean attribute for switching on verbose output like the build steps when doing a Docker build. Default is `false`.
| `jkube.docker.verbose`

| *watchMode*
a|
How to watch for image changes.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[[task-overview-build]]
== Build And Deployment Tasks

include::_jkube-build.adoc[]
include::{kitdoc-path}/inc/build/_jkube-build.adoc[]

include::_jkube-push.adoc[]

Expand Down
2 changes: 2 additions & 0 deletions gradle-plugin/doc/src/main/asciidoc/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ include::inc/_registry.adoc[]

include::inc/_authentication.adoc[]

include::{kitdoc-path}/inc/_integrations.adoc[]

include::{kitdoc-path}/inc/mapping-config/_index.adoc[]

include::{kitdoc-path}/inc/_faq.adoc[]
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
[[integrations]]
= Integrations

ifeval::["{plugin-type}" == "maven"]
[[integrations.dekorate]]
== Dekorate

Expand Down Expand Up @@ -44,11 +45,54 @@ https://github.com/eclipse/jkube/tree/master/quickstarts/maven/spring-boot-dekor
An *experimental* feature is also provided to merge resources generated both by *{plugin}*
and Dekorate. You can activate this feature by using the following flag `-Djkube.mergeWithDekorate`
in the command-line, or setting it up as a property (`<jkube.mergeWithDekorate>true</jkube.mergeWithDekorate>`).
endif::[]

== JIB (Java Image Builder)
*{plugin}* also provides user an option to build container images without having access to any docker daemon.
You just need to set `jkube.build.strategy` property to `jib`. It will delegate the build process to
https://github.com/GoogleContainerTools/jib[JIB]. It creates a tarball inside your target directory which can be loaded
into any docker daemon afterwards. You may also push the image to your specified registry using push goal with feature flag enabled.

ifeval::["{plugin-type}" == "maven"]
You can find more details at https://github.com/eclipse/jkube/tree/master/quickstarts/maven/spring-boot-with-jib[Spring Boot JIB Quickstart].
endif::[]
ifeval::["{plugin-type}" == "maven"]
You can find more details at https://github.com/eclipse/jkube/tree/master/quickstarts/gradle/spring-boot-with-jib-assembly/[Spring Boot JIB With Assembly Quickstart].
endif::[]

[[integrations.buildpacks]]
== Buildpacks

*{plugin}* provides user to leverage on https://buildpacks.io/[Cloud Native Buildpacks] for building container images.
You just need to set `jkube.build.strategy` property to `buildpacks`.

[IMPORTANT]
====
Access to a Docker daemon is required in order to use Buildpacks as mentioned in https://buildpacks.io/docs/app-developer-guide/#prerequisites[Buildpack Prerequisites].
====

ifeval::["{plugin-type}" == "maven"]
[source,shell,indent=2,subs="verbatim,quotes,attributes"]
----
mvn {goal-prefix}:build -Djkube.build.strategy=buildpacks
----
endif::[]
ifeval::["{plugin-type}" == "gradle"]
[source,shell,indent=2,subs="verbatim,quotes,attributes"]
----
gradle {task-prefix}Build -Djkube.build.strategy=buildpacks
----
endif::[]

{plugin} will download https://buildpacks.io/docs/tools/pack/[Pack CLI] to user's `$HOME/.jkube` folder and start the
`pack build` process. If somehow https://buildpacks.io/docs/tools/pack/[Pack CLI] download fails, {plugin} tries to search for any local installed https://buildpacks.io/docs/tools/pack/[Pack CLI].

=== Buildpack Builder Image
By default {plugin} would try to use https://buildpacks.io/docs/concepts/components/builder/[builder image] specified in https://buildpacks.io/docs/tools/pack/cli/pack_config/[Pack Config] for building container image using https://buildpacks.io/docs/tools/pack/[Pack CLI].

For example, if user has this image set in `$HOME/.pack/config.toml`:
[source,toml,indent=2,subs="verbatim,quotes,attributes"]
----
default-builder-image = "testuser/buildpacks-quarkus-builder:latest"
----
{plugin} would use `testuser/buildpacks-quarkus-builder:latest` as Buildpacks builder image. If no image is configured, then `paketobuildpacks/builder:base` is used as default builder image.
37 changes: 8 additions & 29 deletions jkube-kit/doc/src/main/asciidoc/inc/build/_assembly.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -74,44 +74,23 @@ For example, the image `jboss/wildfly` use a "jboss" user under which all comman
In the event you do not need to include any artifacts with the image, you may safely omit this element from the configuration.

[[build-assembly-layer]]
ifeval::["{plugin-type}" == "maven"]
=== Assembly - Inline/Layer
endif::[]
ifeval::["{plugin-type}" == "gradle"]
==== Assembly - Inline/Layer
endif::[]


Inlined assembly description with a format very similar to
https://maven.apache.org/plugins/maven-assembly-plugin/assembly.html[Maven Assembly Plugin].

.Partial configuration example of an inline/layer element
ifeval::["{plugin-type}" == "gradle"]
[source,groovy,subs="attributes+"]
----
assembly {
targetDir = "/deployments"
layers = [{
fileSets = [{
directory = file("${project.rootDir}/build/dependencies")
outputDirectory = "static"
}]
}]
}
----
include::gradle/_assembly_layers_filesets.adoc[]
endif::[]
ifeval::["{plugin-type}" == "maven"]
[source,xml,indent=0,subs="verbatim,quotes,attributes"]
----
<assembly>
<!-- ... -->
<layers>
<layer>
<id>static-files</id>
<fileSets>
<fileSet>
<directory>src/static</directory>
<outputDirectory>static</outputDirectory>
</fileSet>
</fileSets>
</layer>
</layers>
</assembly>
----
include::maven/_assembly_layers_filesets.adoc[]
endif::[]


Expand Down
Loading

0 comments on commit ae9ac45

Please sign in to comment.