Sterling B2B Integration

 View Only

IBM Sterling B2B Integrator Certified Container deployment: Configure custom Init Containers

By Nikesh Midha posted Fri February 02, 2024 12:12 AM

  

IBM Sterling B2B Integrator Certified Container deployment: Configure custom Init Containers

IBM Sterling B2B Integrator and IBM Sterling File Gateway Certified Container helm charts provide an option to configure additional init containers for application pods. Init containers are specialized container that run before application containers in a pod. They can contain custom data sets, utilities or setup scripts not present in the application image. For more information on init containers, you can refer Kubernetes documentation.

The custom init containers can be used to run any pre-startup checks, execute any setup scripts or share custom data with the application pod. It can be put to use effectively to mount custom data sets like war files to be deployed on HTTP server adapter or scripts to be executed by a local CLA2 server or any data to be referenced by custom services and so on. Please note, the option to mount data from init container to the application pod through a shared volume will be available from v6.2.0.1 onwards.

Building a custom Init Container

A custom init container image can be built either from scratch or by extending the default init container image.

A custom init container image can be built with the required resource artifacts or packages and configured as the init container in .Values.resourcesInit section. The custom image can also be built by extending the default resources init image available out of the box.

The following is a sample Dockerfile to build an image for packaging custom data sets:

FROM registry.access.redhat.com/ubi8/ubi-minimal:9.3

#Adding custom war files

COPY ./war/*.war /custom/wars

#Adding CLA2 script

COPY ./cla2/*.* /custom/cla2

#Add any other required custom artifacts to the same location

ENTRYPOINT [“sh”, “-c”, “cp -rfv /custom/* /init/custom”]

  1. The Dockerfile must be placed along with the required custom data set in a common source location (/path/to/build), and the following command must be used to build the image:

cd /path/to/build

docker build . -t <name:tag>  # for ex b2bi-custom-init:1.0

     2. Push the image to the private image registry accessible to the OpenShift or Kubernetes cluster using the following command:

docker tag  b2bi-init:1.0 <private registry url>/b2bi-custom-init:1.0

docker push <private registry url>/b2bi-custom-init:1.0

Configuring a custom Init Container

The newly built image can now be configured as an extra init container for the application containers asi, ac or api. The custom data can be shared by mounting a shared volume between the init container and the application pod. This can be done by setting shareVolume to true. If shareVolume is enabled, a local mount path with the custom data files/folders can be specified along with the app mount path location in the application pod. While configuring the path for custom war files in HTTP server adapter or scripts in CLA2 adapter in the application, the app mount path, viz. /ibm/custom, should be specified as the base path.

asi: 

  ## Additional init containers, e. g. for providing custom scripts

  extraInitContainers:

    - name: custom-init

      image: "<private-registry-url>/b2bi-custom-init:1.0"

      imagePullPolicy: IfNotPresent

      command:

      shareVolume: true

      localMountPath: /init/custom

      appMountPath: /ibm/custom


#Highlights
#Highlights-home
#Featured-area-3
#Featured-area-3-home
#ibmtechxchange-ai
#sustainability-highlights-home
0 comments
33 views

Permalink