Creating the Metadata Bundle

Before we create and push the metadata bundle image we first need to create the metadata that will reside within the container image. Operator-SDK can help you with this task.

A bundle consists of manifests (CSV and CRDs) and metadata that define an Operator at a particular version. You may have also heard of a bundle image.

An Operator Bundle is built as a scratch (non-runnable) container image that contains operator manifests and specific metadata in designated directories inside the image. Then, it can be pushed and pulled from an OCI-compliant container registry. Ultimately, an operator bundle will be used by Operator Registry and OLM to install an operator in OLM-enabled clusters.

SDK projects are scaffolded with a Makefile containing the bundle recipe by default, which wraps generate kustomize manifests, generate bundle, and other related commands. First we want to run the following command from the root of your project:

$ make bundle

This will prompt a series of questions asking you for information that will added into the generated files (specifically the CSV)

  • Display name for the operator (required):

  • Description for the operator (required):

  • Provider's name for the operator (required):

  • Any relevant URL for the provider name (optional):

  • Comma-separated list of keywords for your operator (required):

  • Comma-separated list of maintainers and their emails (e.g. 'name1:email1, name2:email2') (required):

By default make bundle will generate a CSV, copy CRDs, and generate metadata in the bundle format:

bundle/
.
├── manifests
│   ├── example.my.domain_wordpresses.yaml
│   ├── wordpress.clusterserviceversion.yaml
│   └── wordpress-metrics-reader_rbac.authorization.k8s.io_v1beta1_clusterrole.yaml
├── metadata
│   └── annotations.yaml
└── tests
    └── scorecard
        └── config.yaml

Bundle metadata in bundle/metadata/annotations.yaml contains information about a particular Operator version available in a registry. OLM uses this information to install specific Operator versions and resolve dependencies. In the bundle above you can see that within the manifests directory we have the cluster role, the CSV, and the CRD. You will also see the tests directory contains information for running the scorecard. We will get to that in a later section.

Last updated