This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.Ce contenu n'est pas disponible dans la langue sélectionnée.
Chapter 6. opm CLI
6.1. Installing the opm CLI Copier lienLien copié sur presse-papiers!
6.1.1. About the opm CLI Copier lienLien copié sur presse-papiers!
The opm
CLI tool is provided by the Operator Framework for use with the Operator bundle format. This tool allows you to create and maintain catalogs of Operators from a list of Operator bundles that are similar to software repositories. The result is a container image which can be stored in a container registry and then installed on a cluster.
A catalog contains a database of pointers to Operator manifest content that can be queried through an included API that is served when the container image is run. On OpenShift Container Platform, Operator Lifecycle Manager (OLM) can reference the image in a catalog source, defined by a CatalogSource
object, which polls the image at regular intervals to enable frequent updates to installed Operators on the cluster.
6.1.2. Installing the opm CLI Copier lienLien copié sur presse-papiers!
You can install the opm
CLI tool on your Linux, macOS, or Windows workstation.
Prerequisites
For Linux, you must provide the following packages. RHEL 8 meets these requirements:
-
podman
version 1.9.3+ (version 2.0+ recommended) -
glibc
version 2.28+
-
Procedure
- Navigate to the OpenShift mirror site and download the latest version of the tarball that matches your operating system.
Unpack the archive.
For Linux or macOS:
tar xvf <file>
$ tar xvf <file>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - For Windows, unzip the archive with a ZIP program.
Place the file anywhere in your
PATH
.For Linux or macOS:
Check your
PATH
:echo $PATH
$ echo $PATH
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Move the file. For example:
sudo mv ./opm /usr/local/bin/
$ sudo mv ./opm /usr/local/bin/
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
For Windows:
Check your
PATH
:path
C:\> path
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Move the file:
move opm.exe <directory>
C:\> move opm.exe <directory>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
After you install the
opm
CLI, verify that it is available:opm version
$ opm version
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Version: version.Version{OpmVersion:"v1.18.0", GitCommit:"32eb2591437e394bdc58a58371c5cd1e6fe5e63f", BuildDate:"2021-09-21T10:41:00Z", GoOs:"linux", GoArch:"amd64"}
Version: version.Version{OpmVersion:"v1.18.0", GitCommit:"32eb2591437e394bdc58a58371c5cd1e6fe5e63f", BuildDate:"2021-09-21T10:41:00Z", GoOs:"linux", GoArch:"amd64"}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
6.2. opm CLI reference Copier lienLien copié sur presse-papiers!
The opm
command-line interface (CLI) is a tool for creating and maintaining Operator catalogs.
opm
CLI syntax
opm <command> [<subcommand>] [<argument>] [<flags>]
$ opm <command> [<subcommand>] [<argument>] [<flags>]
Flag | Description |
---|---|
| Skip TLS certificate verification for container image registries while pulling bundles or indexes. |
The SQLite-based catalog format, including the related CLI commands, is a deprecated feature. Deprecated functionality is still included in OpenShift Container Platform and continues to be supported; however, it will be removed in a future release of this product and is not recommended for new deployments.
For the most recent list of major functionality that has been deprecated or removed within OpenShift Container Platform, refer to the Deprecated and removed features section of the OpenShift Container Platform release notes.
6.2.1. index Copier lienLien copié sur presse-papiers!
Generate Operator index container images from pre-existing Operator bundles.
Command syntax
opm index <subcommand> [<flags>]
$ opm index <subcommand> [<flags>]
Subcommand | Description |
---|---|
| Add Operator bundles to an index. |
|
Export an Operator from an index in the |
| Prune an index of all but specified packages. |
| Prune an index of stranded bundles, which are bundles that are not associated with a particular image. |
| Delete an entire Operator from an index. |
6.2.1.1. add Copier lienLien copié sur presse-papiers!
Add Operator bundles to an index.
Command syntax
opm index add [<flags>]
$ opm index add [<flags>]
Flag | Description |
---|---|
|
Container image for on-image |
|
Tool to build container images: |
| Comma-separated list of bundles to add. |
|
Tool to interact with container images, such as for saving and building: |
| Previous index to add to. |
| If enabled, only creates the Dockerfile and saves it to local disk. |
|
Graph update mode that defines how channel graphs are updated: |
| Optional: If generating the Dockerfile, specify a file name. |
| Allow registry load errors. |
|
Tool to pull container images: |
| Custom tag for container image being built. |
6.2.1.2. export Copier lienLien copié sur presse-papiers!
Export an Operator from an index in the appregistry
format.
Command syntax
opm index export [<flags>]
$ opm index export [<flags>]
Flag | Description |
---|---|
| Index to get the packages from. |
|
Directory where the downloaded Operator bundles are stored. The default directory is |
|
Tool to interact with container images, such as for saving and building: |
|
Help for the |
| Comma-separated list of packages to export. |
6.2.1.3. prune Copier lienLien copié sur presse-papiers!
Prune an index of all but specified packages.
Command syntax
opm index prune [<flags>]
$ opm index prune [<flags>]
Flag | Description |
---|---|
|
Container image for on-image |
|
Tool to interact with container images, such as for saving and building: |
| Index to prune. |
| If enabled, only creates the Dockerfile and saves it to local disk. |
| Optional: If generating the Dockerfile, specify a file name. |
| Comma-separated list of packages to keep. |
| Allow registry load errors. |
| Custom tag for container image being built. |
6.2.1.4. prune-stranded Copier lienLien copié sur presse-papiers!
Prune an index of stranded bundles, which are bundles that are not associated with a particular image.
Command syntax
opm index prune-stranded [<flags>]
$ opm index prune-stranded [<flags>]
Flag | Description |
---|---|
|
Container image for on-image |
|
Tool to interact with container images, such as for saving and building: |
| Index to prune. |
| If enabled, only creates the Dockerfile and saves it to local disk. |
| Optional: If generating the Dockerfile, specify a file name. |
| Allow registry load errors. |
| Custom tag for container image being built. |
6.2.1.5. rm Copier lienLien copié sur presse-papiers!
Delete an entire Operator from an index.
Command syntax
opm index rm [<flags>]
$ opm index rm [<flags>]
Flag | Description |
---|---|
|
Container image for on-image |
|
Tool to build container images: |
|
Tool to interact with container images, such as for saving and building: |
| Previous index to delete from. |
| If enabled, only creates the Dockerfile and saves it to local disk. |
| Comma-separated list of Operators to delete. |
| Optional: If generating the Dockerfile, specify a file name. |
| Allow registry load errors. |
|
Tool to pull container images: |
| Custom tag for container image being built. |
6.2.2. init Copier lienLien copié sur presse-papiers!
Generate an olm.package
declarative config blob.
Command syntax
opm init <package_name> [<flags>]
$ opm init <package_name> [<flags>]
Flag | Description |
---|---|
| The channel that subscriptions will default to if unspecified. |
|
Path to the Operator’s |
| Path to package’s icon. |
|
Output format: |
6.2.3. render Copier lienLien copié sur presse-papiers!
Generate a declarative config blob from the provided index images, bundle images, and SQLite database files.
Command syntax
opm render <index_image | bundle_image | sqlite_file> [<flags>]
$ opm render <index_image | bundle_image | sqlite_file> [<flags>]
Flag | Description |
---|---|
|
Output format: |
6.2.4. validate Copier lienLien copié sur presse-papiers!
Validate the declarative config JSON file(s) in a given directory.
Command syntax
opm validate <directory> [<flags>]
$ opm validate <directory> [<flags>]
6.2.5. serve Copier lienLien copié sur presse-papiers!
Serve declarative configs via a GRPC server.
The declarative config directory is loaded by the serve
command at startup. Changes made to the declarative config after this command starts are not reflected in the served content.
Command syntax
opm serve <source_path> [<flags>]
$ opm serve <source_path> [<flags>]
Flag | Description |
---|---|
| Enable debug logging. |
|
Port number to serve on. Default: |
|
Path to a container termination log file. Default: |