anchor.diff:  // * operators/understanding_olm/olm-understanding-olm.adoc
   
   [id="olm-new-bundle-opm_{context}"]
  -= Developer Preview: New Operator bundle format and `opm` CLI
  += Developer Preview: New Operator Bundle Format and `opm` CLI
   
   [IMPORTANT]
   ====
  
positive.code: - link:https://github.com/operator-framework/operator-registry/blob/master/docs/design/operator-bundle.md[Operator Bundle Overview]
  - link:https://github.com/operator-framework/operator-registry/blob/master/README.md[Operator Registry README]
  
  See the project's *Releases* page for `opm` downloads:
  
  - link:https://github.com/operator-framework/operator-registry/releases[Releases]
  
negative.code: available at this time.
  ====
  
  Related to the deprecation of OperatorSource, CatalogSourceConfigs, and the
  Package Manifest Format for Operators, Operator Lifecycle Manager (OLM) will be
  introducing the new _Bundle Format_ for Operators in a future release of OKD and
  OpenShift Container Platform. To improve scalability and better enable upstream
  users hosting their own catalogs, the new Bundle Format specification simplifies
  the distribution of Operator metadata.
  
  An Operator bundle represents a single version of an Operator and can be
  scaffolded with the Operator SDK. On-disk _bundle manifests_ are containerized
  and shipped as a _bundle image_, a non-runnable container image that stores the
  Kubernetes manifests and Operator metadata. Storage and distribution of the
  bundle image is then managed using existing container tools like `podman` and
  `docker` and container registries like Quay.
  
  For example, to build an Operator bundle using the CLI:
  
  .Prerequisites
  
  * Operator SDK version 0.17.0
  * An Operator project generated using Operator SDK
  
  .Procedure
  
  . Build the bundle image using the Operator SDK:
  +
  ----
  $ operator-sdk bundle create \
      --directory <project_root>/deploy/olm-catalog/test-operator/0.1.0 \//<1>
      quay.io/<namespace>/test-operator:v0.1.0 <2>
  ----
  <1> The directory where your local manifests are located.
  <2> The image tag that you want the bundle image to have.
  
  . Push the bundle image to a registry:
  +
  ----
  $ podman push quay.io/<namespace>/test-operator:v0.1.0
  ----
  
  . Validate the bundle image in the remote registry:
  +
  ----
  $ operator-sdk bundle validate quay.io/<namespace>/test-operator:v0.1.0
  ----
  
  In addition, the new Operator Package Manager (`opm`) is introduced alongside
  the new Bundle Format. The `opm` CLI allows you to create and maintain catalogs
  of Operators from a list of bundles, called an _index_, that are equivalent to a
  "repository". The result is a container image, called an _index image_, which
  can be stored in a container registry and then installed on a cluster.
  
  An index contains a database of pointers to Operator manifest content that can
  be queried via an included API that is served when the container image is run.
  On {product-title}, OLM can use the index image as a catalog by referencing it
  in a CatalogSource, which polls the image at regular intervals to enable
  frequent updates to installed Operators on the cluster.
  
  For example, to build and distribute a catalog using the `opm` CLI:
  
  .Prerequisites
  
  * `opm` version 1.12.1
  * A bundle image built and pushed to a registry.
  
  .Procedure
  
  . Start a new index:
  +
  ----
  $ opm index add \
      --bundles quay.io/<namespace>/test-operator:v0.1.0 \//<1>
      --tag quay.io/<namespace>/test-catalog:latest <2>
  ----
  <1> The bundle image to add to the index.
  <2> The image tag that you want the index image to have.
  
  . Push the index image to a registry:
  +
  ----
  $ podman push quay.io/<namespace>/test-catalog:latest
  ----
  
  . Apply a CatalogSource to your cluster that references your new index image:
  +
  ----
  $ cat <<EOF | oc apply -f -
  
  apiVersion: operators.coreos.com/v1alpha1
  kind: CatalogSource
  metadata:
    name: test-catalog
    namespace: openshift-marketplace
  spec:
    sourceType: grpc
    image: quay.io/<namespace>/test-catalog:latest <1>
    displayName: Test Catalog
    updateStrategy:
      registryPoll: <2>
        interval: 30m
  EOF
  ----
  <1> Specify your index image.
  <2> CatalogSources can now automatically check for new versions to keep up to date.
  
  . Verify using the {product-title} web console or CLI that the catalog loaded
  successfully and packages are available. For example, using the CLI:
  +
  ----
  $ oc get pods -n openshift-marketplace
  $ oc get catalogsource -n openshift-marketplace
  $ oc get packagemanifests -n openshift-marketplace
  ----
  
  . You can now add another bundle to the existing index.
  
  .. Update the existing index:
  +
  ----
  $ opm index add \
      --bundles quay.io/<namespace>/another-operator:v1 \//<1>
      --from-index quay.io/<namespace>/test-catalog:latest <2>
      --tag quay.io/<namespace>/test-catalog:latest <3>
  ----
  <1> The additional bundle image to add to the index.
  <2> The existing index that was previously pushed.
  <3> The image tag that you want the updated index image to have.
  
  .. Push the updated index image:
  +
  ----
  $ podman push quay.io/<namespace>/test-catalog:latest
  ----
  
  .. After OLM polls the index image at its regular interval, verify that the new
  packages are successfully added:
  +
  ----
  $ oc get packagemanifests -n openshift-marketplace
  ----
  
  .Additional resources
  
  