3.2.4. Bundle packaged integrations#

This section describes how to bundle various plugins to packaged integrations in a Docker image so that Nubus for Kubernetes can load them.

This section assumes you have knowledge about how to build Docker images. Describing the single build steps, and how to publish a Docker image to a registry is beyond the scope of this document.

Nubus for Kubernetes uses Docker images to load packaged integrations. The purpose of this Docker image is that the Kubernetes cluster starts the image as Docker container and runs the entry point script or binary as loader. The loader’s only purpose is to copy your packaged integration files to defined target locations in appropriate Kubernetes pods depending on the plugin type.

To bundle any packaged integration documented in Packaged integrations, use the steps in the following sections:

  1. Packaged integration structure

  2. Bundle Dockerfile

  3. Packaged integration loader

  4. Add plugins

3.2.4.1. Packaged integration structure#

To start with a packaged integration, you need to create the file structure.

  1. Create an empty directory, for example packaged-integration-project.

    The directory contains the files of your packaged integration, the script, and the Dockerfile.

  2. Create the subdirectory plugins for the actual plugins of your packaged integration, for example packaged-integration-project/plugins.

  3. Create the empty Dockerfile. For the content, see Bundle Dockerfile.

  4. Create the empty loader.sh file. For the content, see Packaged integration loader.

Your directory structure then looks similar to the directory structure in Listing 3.6.

Listing 3.6 Directory structure for Nubus packaged integrations#
packaged-integration-project/
├── Dockerfile
├── loader.sh
└── plugins
    ├── ldap-acls
    ├── ldap-schema
    ├── udm-handlers
    ├── udm-hooks.d
    ├── udm-modules
    ├── udm-syntax.d
    ├── umc-icons
    └── umc-modules

3.2.4.2. Bundle Dockerfile#

Create your Dockerfile. You can use any Docker image as base image. It must be able to run your loader. Keep the image as slim as possible, because it reduces download and container startup time. See the example in Listing 3.7.

Listing 3.7 Example for Dockerfile#
ARG BASE_IMAGE_TAG=3.20
ARG BASE_IMAGE=docker.io/alpine
FROM ${BASE_IMAGE}:${BASE_IMAGE_TAG}

WORKDIR /

# Copy plugins of the packaged integration to the Docker image
COPY plugins/ /plugins/
# Copy the plugin loader to the Docker image
COPY loader.sh /bin/loader

CMD ["/bin/loader"]

See also

Writing a Dockerfile | Docker Docs

for getting started with writing a Dockerfile for Docker images.

3.2.4.3. Packaged integration loader#

The packaged integration loader is a script or a binary that runs after the Docker container has started. The loader copies the plugin files of the packaged integration to the /target/ directory, a predefined directory that Nubus for Kubernetes recognizes automatically. Nubus then copies the plugins to the respective Kubernetes pods depending on the plugin type.

For an example of a loader, see the loader in the openDesk Nubus Customization.

3.2.4.4. Add plugins#

Copy your plugin to the directory matching its type. The value for PLUGIN_TYPE comes from the respective plugin type section, see Plugin types.

$ export PACKAGED_INTEGRATION_PROJECT="ABSOLUTE_PATH_TO_YOUR_PACKAGED_INTEGRATION_PROJECT"
$ export PLUGIN_FILE="custom-ldap.schema"

$ cp "$PLUGIN_FILE" "$PACKAGED_INTEGRATION_PROJECT"/plugins/"$PLUGIN_TYPE"/

3.2.4.5. Build and publish#

With the directory and file structure, the Dockerfile, the loader, and the plugins, you have everything in place and are ready to build the Docker image. Follow the Docker documentation for building the Docker image.

Example
$ export REGISTRY_HOST="FQDN and optional port of your Docker registry"
$ export IMAGE_PATH="PATH to the image on the registry with trailing slash /, if any"
$ export IMAGE_NAME="Your name for the image"
$ export IMAGE_TAG="Your version tag or latest"

$ cd "$PACKAGED_INTEGRATION_PROJECT"
$ docker build -t "$IMAGE_NAME" -f Dockerfile .

# The build process takes some time.

$ docker image push "$REGISTRY_HOST"/"$IMAGE_PATH""$IMAGE_NAME":"$IMAGE_TAG"

See also

Build, tag, and publish an image | Docker Docs

for getting starting with building and tagging a Docker image.