Managing plain bundles in OLM 1.0 (Technology Preview)

In Operator Lifecycle Manager (OLM) 1.0, a plain bundle is a static collection of arbitrary Kubernetes manifests in YAML format. The experimental olm.bundle.mediatype property of the olm.bundle schema object differentiates a plain bundle (plain+v0) from a regular (registry+v1) bundle.

OLM 1.0 is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.

For more information about the support scope of Red Hat Technology Preview features, see Technology Preview Features Support Scope.

As a cluster administrator, you can build and publish a file-based catalog that includes a plain bundle image by completing the following procedures:

  1. Build a plain bundle image.

  2. Create a file-based catalog.

  3. Add the plain bundle image to your file-based catalog.

  4. Build your catalog as an image.

  5. Publish your catalog image.

Additional resources

Prerequisites

  • Access to an OKD cluster using an account with cluster-admin permissions

    For OKD 4.14, documented procedures for OLM 1.0 are CLI-based only. Alternatively, administrators can create and view related objects in the web console by using normal methods, such as the Import YAML and Search pages. However, the existing OperatorHub and Installed Operators pages do not yet display OLM 1.0 components.

  • The TechPreviewNoUpgrades feature set enabled on the cluster

    Enabling the TechPreviewNoUpgrade feature set cannot be undone and prevents minor version updates. These feature sets are not recommended on production clusters.

  • The OpenShift CLI (oc) installed on your workstation

  • The opm CLI installed on your workstation

  • Docker or Podman installed on your workstation

  • Push access to a container registry, such as Quay

  • Kubernetes manifests for your bundle in a flat directory at the root of your project similar to the following structure:

    Example directory structure

    1. manifests
    2. ├── namespace.yaml
    3. ├── service_account.yaml
    4. ├── cluster_role.yaml
    5. ├── cluster_role_binding.yaml
    6. └── deployment.yaml

Additional resources

Building a plain bundle image from an image source

The Operator Controller currently supports installing plain bundles created only from a plain bundle image.

Procedure

  1. At the root of your project, create a Dockerfile that can build a bundle image:

    Example plainbundle.Dockerfile

    1. FROM scratch (1)
    2. ADD manifests /manifests
    1Use the FROM scratch directive to make the size of the image smaller. No other files or directories are required in the bundle image.
  2. Build an Open Container Initiative (OCI)-compliant image by using your preferred build tool, similar to the following example:

    1. $ podman build -f plainbundle.Dockerfile -t \
    2. quay.io/<organization_name>/<repository_name>:<image_tag> . (1)
    1Use an image tag that references a repository where you have push access privileges.
  3. Push the image to your remote registry by running the following command:

    1. $ podman push quay.io/<organization_name>/<repository_name>:<image_tag>

Creating a file-based catalog

If you do not have a file-based catalog, you must perform the following steps to initialize the catalog.

Procedure

  1. Create a directory for the catalog by running the following command:

    1. $ mkdir <catalog_dir>
  2. Generate a Dockerfile that can build a catalog image by running the opm generate dockerfile command in the same directory level as the previous step:

    1. $ opm generate dockerfile <catalog_dir>

    The generated Dockerfile must be in the same parent directory as the catalog directory that you created in the previous step:

    Example directory structure
    1. .
    2. ├── <catalog_dir>
    3. └── <catalog_dir>.Dockerfile
  3. Populate the catalog with the package definition for your extension by running the opm init command:

    1. $ opm init <extension_name> \
    2. --output json \
    3. > <catalog_dir>/index.json

    This command generates an olm.package declarative config blob in the specified catalog configuration file.

Adding a plain bundle to a file-based catalog

The opm render command does not support adding plain bundles to catalogs. You must manually add plain bundles to your file-based catalog, as shown in the following procedure.

Procedure

  1. Verify that the index.json or index.yaml file for your catalog is similar to the following example:

    Example <catalog_dir>/index.json file

    1. {
    2. {
    3. "schema": "olm.package",
    4. "name": "<extension_name>",
    5. "defaultChannel": ""
    6. }
    7. }
  2. To create an olm.bundle blob, edit your index.json or index.yaml file, similar to the following example:

    Example <catalog_dir>/index.json file with olm.bundle blob

    1. {
    2. "schema": "olm.bundle",
    3. "name": "<extension_name>.v<version>",
    4. "package": "<extension_name>",
    5. "image": "quay.io/<organization_name>/<repository_name>:<image_tag>",
    6. "properties": [
    7. {
    8. "type": "olm.package",
    9. "value": {
    10. "packageName": "<extension_name>",
    11. "version": "<bundle_version>"
    12. }
    13. },
    14. {
    15. "type": "olm.bundle.mediatype",
    16. "value": "plain+v0"
    17. }
    18. ]
    19. }
  3. To create an olm.channel blob, edit your index.json or index.yaml file, similar to the following example:

    Example <catalog_dir>/index.json file with olm.channel blob

    1. {
    2. "schema": "olm.channel",
    3. "name": "<desired_channel_name>",
    4. "package": "<extension_name>",
    5. "entries": [
    6. {
    7. "name": "<extension_name>.v<version>"
    8. }
    9. ]
    10. }

Verification

  1. Open your index.json or index.yaml file and ensure it is similar to the following example:

    Example <catalog_dir>/index.json file

    1. {
    2. "schema": "olm.package",
    3. "name": "example-extension",
    4. "defaultChannel": "preview"
    5. }
    6. {
    7. "schema": "olm.bundle",
    8. "name": "example-extension.v0.0.1",
    9. "package": "example-extension",
    10. "image": "quay.io/example-org/example-extension-bundle:v0.0.1",
    11. "properties": [
    12. {
    13. "type": "olm.package",
    14. "value": {
    15. "packageName": "example-extension",
    16. "version": "0.0.1"
    17. }
    18. },
    19. {
    20. "type": "olm.bundle.mediatype",
    21. "value": "plain+v0"
    22. }
    23. ]
    24. }
    25. {
    26. "schema": "olm.channel",
    27. "name": "preview",
    28. "package": "example-extension",
    29. "entries": [
    30. {
    31. "name": "example-extension.v0.0.1"
    32. }
    33. ]
    34. }
  2. Validate your catalog by running the following command:

    1. $ opm validate <catalog_dir>

Building and publishing a file-based catalog

Procedure

  1. Build your file-based catalog as an image by running the following command:

    1. $ podman build -f <catalog_dir>.Dockerfile -t \
    2. quay.io/<organization_name>/<repository_name>:<image_tag> .
  2. Push your catalog image by running the following command:

    1. $ podman push quay.io/<organization_name>/<repository_name>:<image_tag>