Building an Operator Lifecycle Manager (OLM) Operator in Konflux

If you are developing an application that aligns with the Operator Framework, and managing it with Operator Lifecycle Manager (OLM), you can build that application in Konflux. We refer to such applications as OLM Operators.

OLM Operators include the following elements:

  • Operands, which are components or resources used by the application

  • Operator, which manages Operands

  • Bundle, which describes how to deploy a version of the application’s Operands and Operator as defined by a ClusterServiceVersion (CSV) file

  • File-based catalogs, which describe how users can upgrade between different Bundle versions.

Note the difference between an "OLM Operator" and an "Operator." An OLM Operator refers to the whole application, and an Operator is one part of the OLM Operator.

The first procedure in this document explains how to use Konflux to build an OLM Operator in the most basic sense—​building its Operator and bundle images. The second procedure is optional but recommended. It explains how you can automatically update the image references in the CSV of the bundle. The third procedure describes the process for generating the file-based catalog to inform OLM how to upgrade between OLM Operator versions.

Building the Operator and the bundle

This procedure assumes that the source code for your Operator and bundle, including the Dockerfiles, are in the same git repository, per OLM convention.

Procedure
  1. In the Konflux UI, create a new application for your OLM Operator in Konflux.

  2. In your new application, add a new component for your Operator. Be sure to specify the correct path to the Operator’s Dockerfile within its git repository.

  3. Add another component for your bundle. Enter the same URL that you used for the Operator, but enter the path to the bundle’s Dockerfile.

  4. (Optional) If you are using a file-based Catalog (FBC) for your OLM Operator, you must build the FBC as another component in its own separate application in Konflux.

  5. (Optional) You may want to configure Konflux to prevent redundant rebuilds for this application. For example, you can configure Konflux to rebuild your bundle image only if a commit is made to its Dockerfile or the /bundle directory, instead of rebuilding it whenever any commit is made to your OLM Operator’s git repository.

Automating updates for image references in the CSV

In order to enable your operator to be installed in disconnected environments, it is important to include sha digest image references in the CSV’s spec.relatedImages.

Procedure
  1. In the Konflux UI, in your OLM Operator’s application, go to the Components tab and copy the URL for the Operator’s container image. The URL should include sha256:.

  2. Using your preferred text editor, in the git repo for your OLM Operator, open the CSV file for your bundle. In that file, update the image reference to the Operator to be the URL you just copied. Commit this change.

  3. In the Konflux UI, follow the instructions in this document to define the relationship between the Operator and the bundle. The Operator nudges the bundle.

  4. (Optional) For any Operands with image references in your bundle’s CSV, you can repeat this same basic process:

    1. Add the Operands as components in Konflux.

    2. Wait for the first build of those components to finish.

    3. Copy the URL to the images and paste it as a reference in the bundle’s CSV file.

    If you want to update the references in your CSV to match where the operands and operators will be pushed to, see how to maintain references before release.

Building the file-based catalog

Procedure
  1. In the Konflux UI, create a new application for your file-based catalog (FBC) in Konflux.

  2. In your new application, add a new component for your FBC. Be sure to select the file-based catalog pipeline and to specify the correct path to the catalog’s Containerfile within its git repository.