Adding Functionality to HCL Launch Container Agent#

To extend the containerized agents, you need to add this functionality to the HCL™ Launch container agent.

Creation Of Dockerfile For Extended Image#

Extending the agent container image can be accomplished by specifying the agent build level that you wish to enhance as your base image and then invoking the docker entrypoint provided by the base image. Here is an example Dockerfile and shell script that can be used to add Python 3.8 to the agent image:

# Base image for agent version


# Copy shell script into /tmp directory
COPY artifacts/* /tmp/

# Important: Need root access to install packages
USER root

# Install packages to extend agent functionality
RUN bash /tmp/

USER 1001

# Important: Must invoke existing docker-entrypoint script provided by base image
ENTRYPOINT [“/usr/local/bin/”]

# List of packages to install

# Agent is based on RHEL8 ubi-minimal image which uses microdnf to install packages
microdnf update -y
microdnf install -y --nodocs ${PKG_LIST}
microdnf clean all
rm -rf /var/cache/microdnf
rm -rf /var/tmp/microdnf-*

How To Identify HCL Launch Agent Base Image#

The base image that you use is based on the agent version that you wish to extend.

The supported agent versions can be located in the templates/_hcl-launch-agent-chart-config.tpl file of the agent Helm Chart. Here are some examples:

{{- define "{{ .Chart.Name }}.imageSpec" -}}
{{- if eq .Values.version "" -}}
{{- else if eq .Values.version "" -}}
{{- else if eq .Values.version "" -}}
{{- else -}}
{{- end -}}
{{- end -}}

Authenticate To HCL Container Registry Prior To Building The Image#

To pull the base image from the desired registry, you must perform a docker login prior to the running docker build command. Here is an example docker login command to use:

docker login -u <harbor-username> -p <harbor-cli-secret>

HCL container images are contained in the Harbor repositiory To gain access to this repository, please follow these instructions:

New customers:#

You must create a support ticket to get the credentials that are required to access the product binaries from the Harbor repository. For more information, refer to How to create an HCL support case.

You must use your existing Harbor repository credentials to access the product binaries.

Updating The Agent Helm Chart#

This step is only required for agent releases prior to

In order to use the extended agent image, you will need to update the _hcl-launch-agent-chart-config.tpl file to look something like this:

{{- define "{{ .Chart.Name }}.imageSpec" -}}
{{- if contains "extended" .Values.version -}}
  {{ .Values.version }}
{{- else if eq .Values.version "" -}}
{{- else if eq .Values.version "" -}}
{{- else if eq .Values.version "" -}}
{{- else -}}
{{- end -}}
{{- end -}}

Note lines 2 and 3 are added to the logic.

Specifying The New ImageSpec For Deployment#

To use the extended image, specify the imagespec in the version parameter of your values.yaml file. The tag for your image must include the word “extended” for this process to work. Here is an example values.yaml:

# Agent Version
version: "myregistry/agent:"

Update remaining parameters in values.yaml for your modified helm chart and then run the helm install command.

To verify your packages were installed successfully, you can run the kubectl exec -it <podname> -- /bin/sh command to open a command prompt into the running agent.

Parent topic: Installing an agent in a Kubernetes cluster