Skip to content

Commit 076d2ae

Browse files
committed
docs(Kubernetes): Update the documentation
Describe the newly added functionality for additional containers and named volume mounts. Signed-off-by: Oliver Heger <oliver.heger@bosch.com>
1 parent 6eced3d commit 076d2ae

1 file changed

Lines changed: 29 additions & 1 deletion

File tree

website/docs/admin-guide/infrastructure/transport/kubernetes.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ This module provides an implementation of the transport abstraction layer using
77
The Kubernetes transport abstraction layer exchanges messages via environment variables.
88
The sender creates a Kubernetes Job using the Kubernetes API, that runs the configured container image and sets the message content as environment variables.
99
The container started by the Kubernetes Job acts as the receiver and constructs the message from the environment variables.
10+
The implementation supports a number of configuration options to customize the resulting Kubernetes Job, for instance, to mount secrets or persistent volumes, or to set resource requests and limits.
1011

1112
## Configuration
1213

@@ -25,7 +26,7 @@ endpoint {
2526
backoffLimit = 5
2627
commands = "/bin/sh"
2728
args = "-c java my.pkg.MyClass"
28-
mountSecrets = "server-secrets->/mnt/secrets server-certificates->/mnt/certificates"
29+
mountSecrets = "secretVolume=server-secrets->/mnt/secrets server-certificates->/mnt/certificates"
2930
mountPvcs = "my-pvc->/mnt/data,W"
3031
mountEmptyDirs = "shared->/mnt/shared"
3132
labels = "label1=value1,label2=value2"
@@ -35,6 +36,8 @@ endpoint {
3536
cpuLimit = 500m
3637
memoryRequest = 64Mi
3738
memoryLimit = 128Mi
39+
additionalContainers = "init-container, sidecar-container"
40+
volumeMounts = "secretVolume"
3841
}
3942
}
4043
```
@@ -224,6 +227,31 @@ kubernetes.memory = 768M
224227

225228
Then the memory limit of the pod to be created will be set to 768 megabytes.
226229

230+
### `additionalContainers`
231+
232+
**Default: `empty`**
233+
234+
The Kubernetes Transport implementation supports adding additional containers to the pod created by the sender. This can be used to enable advanced use cases, for instance, to run an init container that prepares the environment for the main container, or to run a sidecar container that provides additional services to the main container.
235+
236+
Declaring additional containers is done by providing a comma-separated list of container names in the `additionalContainers` property. While the properties of the main container are configured via the properties described above, additional containers take their configuration from environment variables: For each container, a set of environment variables starting with the name of the container in upper case followed by an underscore is expected. There are then corresponding variables for each property of the container, using snake-case for the property name instead of camelCase. For instance, for a container named _sidecar_, there can be variables like `SIDECAR_IMAGE_NAME` for the `imageName` property or `SIDECAR_CPU_LIMIT` for the `cpuLimit` property. These variables are optional; for missing variables, the value from the main container is used with the following exceptions:
237+
238+
- Resource requests and limits are not copied from the main container. They should be set explicitly for each additional container if needed.
239+
- Volume mounts are undefined as well if they are not set explicitly.
240+
241+
The variable `<CONTAINER_NAME>_INIT_CONTAINER=TRUE` can be used to declare a container as init container. If this variable is not set or has a different value, the container is treated as a regular container.
242+
243+
### `volumeMounts`
244+
245+
**Default: `empty`**
246+
247+
When additional containers are declared, this property can be used to specify which of the volumes should be mounted into which container. This makes it possible for instance, to exchange data between two containers via a shared volume, or to restrict volumes with secrets to specific containers.
248+
249+
To make use of this property, as a first step, volume mounts must be assigned a name. This is simply done by adding the name of the volume mount as a prefix to the mount declaration, separated by an equals sign. Such a name can be provided for all types of volume mounts. For instance, the declaration of a secret volume mount could look like `secretVolume=secretName->/mnt/secrets`. It is then known under the name _secretVolume_.
250+
251+
As a second step, the `volumeMounts` property of the main container, or the `<CONTAINER_NAME>_VOLUME_MOUNTS` environment variable for an additional container, can reference these names to select the volume mounts to be used in the respective container. Its value is a comma-separated list of volume mount names.
252+
253+
Volume mounts without a name are automatically added to all containers.
254+
227255
> [!NOTE]
228256
> The receiver part does not need any specific configuration settings except for the transport type itself.
229257

0 commit comments

Comments
 (0)