Chapter 6. opm CLI 6.1. Installing the opm CLI 6.1.1. About the opm CLI 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. Additional resources See Operator Framework packaging format for more information about the bundle format. To create a bundle image using the Operator SDK, see Working with bundle images . 6.1.2. Installing the opm CLI 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: USD tar xvf <file> For Windows, unzip the archive with a ZIP program. Place the file anywhere in your PATH . For Linux or macOS: Check your PATH : USD echo USDPATH Move the file. For example: USD sudo mv ./opm /usr/local/bin/ For Windows: Check your PATH : C:\> path Move the file: C:\> move opm.exe <directory> Verification After you install the opm CLI, verify that it is available: USD opm version Example output Version: version.Version{OpmVersion:"v1.18.0", GitCommit:"32eb2591437e394bdc58a58371c5cd1e6fe5e63f", BuildDate:"2021-09-21T10:41:00Z", GoOs:"linux", GoArch:"amd64"} 6.1.3. Additional resources See Managing custom catalogs for opm procedures including creating, updating, and pruning catalogs. 6.2. opm CLI reference The opm command-line interface (CLI) is a tool for creating and maintaining Operator catalogs. opm CLI syntax USD opm <command> [<subcommand>] [<argument>] [<flags>] Table 6.1. Global flags Flag Description --skip-tls Skip TLS certificate verification for container image registries while pulling bundles or indexes. Important 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 Generate Operator index container images from pre-existing Operator bundles. Command syntax USD opm index <subcommand> [<flags>] Table 6.2. index subcommands Subcommand Description add Add Operator bundles to an index. export Export an Operator from an index in the appregistry format. prune Prune an index of all but specified packages. prune-stranded Prune an index of stranded bundles, which are bundles that are not associated with a particular image. rm Delete an entire Operator from an index. 6.2.1.1. add Add Operator bundles to an index. Command syntax USD opm index add [<flags>] Table 6.3. index add flags Flag Description -i , --binary-image Container image for on-image opm command -u , --build-tool (string) Tool to build container images: podman (the default value) or docker . Overrides part of the --container-tool flag. -b , --bundles (strings) Comma-separated list of bundles to add. -c , --container-tool (string) Tool to interact with container images, such as for saving and building: docker or podman . -f , --from-index (string) index to add to. --generate If enabled, only creates the Dockerfile and saves it to local disk. --mode (string) Graph update mode that defines how channel graphs are updated: replaces (the default value), semver , or semver-skippatch . -d , --out-dockerfile (string) Optional: If generating the Dockerfile, specify a file name. --permissive Allow registry load errors. -p , --pull-tool (string) Tool to pull container images: none (the default value), docker , or podman . Overrides part of the --container-tool flag. -t , --tag (string) Custom tag for container image being built. 6.2.1.2. export Export an Operator from an index in the appregistry format. Command syntax USD opm index export [<flags>] Table 6.4. index export flags Flag Description -i , --index (string) Index to get the packages from. -f , --download-folder (string) Directory where the downloaded Operator bundles are stored. The default directory is downloaded . -c , --container-tool (string) Tool to interact with container images, such as for saving and building: docker or podman . -h , --help Help for the export command. -p , --package (string) Comma-separated list of packages to export. 6.2.1.3. prune Prune an index of all but specified packages. Command syntax USD opm index prune [<flags>] Table 6.5. index prune flags Flag Description -i , --binary-image Container image for on-image opm command -c , --container-tool (string) Tool to interact with container images, such as for saving and building: docker or podman . -f , --from-index (string) Index to prune. --generate If enabled, only creates the Dockerfile and saves it to local disk. -d , --out-dockerfile (string) Optional: If generating the Dockerfile, specify a file name. -p , --packages (strings) Comma-separated list of packages to keep. --permissive Allow registry load errors. -t , --tag (string) Custom tag for container image being built. 6.2.1.4. prune-stranded Prune an index of stranded bundles, which are bundles that are not associated with a particular image. Command syntax USD opm index prune-stranded [<flags>] Table 6.6. index prune-stranded flags Flag Description -i , --binary-image Container image for on-image opm command -c , --container-tool (string) Tool to interact with container images, such as for saving and building: docker or podman . -f , --from-index (string) Index to prune. --generate If enabled, only creates the Dockerfile and saves it to local disk. -d , --out-dockerfile (string) Optional: If generating the Dockerfile, specify a file name. --permissive Allow registry load errors. -t , --tag (string) Custom tag for container image being built. 6.2.1.5. rm Delete an entire Operator from an index. Command syntax USD opm index rm [<flags>] Table 6.7. index rm flags Flag Description -i , --binary-image Container image for on-image opm command -u , --build-tool (string) Tool to build container images: podman (the default value) or docker . Overrides part of the --container-tool flag. -c , --container-tool (string) Tool to interact with container images, such as for saving and building: docker or podman . -f , --from-index (string) index to delete from. --generate If enabled, only creates the Dockerfile and saves it to local disk. -o , --operators (strings) Comma-separated list of Operators to delete. -d , --out-dockerfile (string) Optional: If generating the Dockerfile, specify a file name. --permissive Allow registry load errors. -p , --pull-tool (string) Tool to pull container images: none (the default value), docker , or podman . Overrides part of the --container-tool flag. -t , --tag (string) Custom tag for container image being built. 6.2.2. init Generate an olm.package declarative config blob. Command syntax USD opm init <package_name> [<flags>] Table 6.8. init flags Flag Description -c , --default-channel (string) The channel that subscriptions will default to if unspecified. -d , --description (string) Path to the Operator's README.md or other documentation. -i , --icon (string) Path to package's icon. -o , --output (string) Output format: json (the default value) or yaml . 6.2.3. render Generate a declarative config blob from the provided index images, bundle images, and SQLite database files. Command syntax USD opm render <index_image | bundle_image | sqlite_file> [<flags>] Table 6.9. render flags Flag Description -o , --output (string) Output format: json (the default value) or yaml . 6.2.4. validate Validate the declarative config JSON file(s) in a given directory. Command syntax USD opm validate <directory> [<flags>] 6.2.5. serve Serve declarative configs via a GRPC server. Note 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 USD opm serve <source_path> [<flags>] Table 6.10. serve flags Flag Description --debug Enable debug logging. -p , --port (string) Port number to serve on. Default: 50051 . -t , --termination-log (string) Path to a container termination log file. Default: /dev/termination-log .

Commands:
tar xvf <file>
echo USDPATH
sudo mv ./opm /usr/local/bin/
C:\> path
C:\> move opm.exe <directory>
opm version
Version: version.Version{OpmVersion:"v1.18.0", GitCommit:"32eb2591437e394bdc58a58371c5cd1e6fe5e63f", BuildDate:"2021-09-21T10:41:00Z", GoOs:"linux", GoArch:"amd64"}
opm <command> [<subcommand>] [<argument>] [<flags>]
opm index <subcommand> [<flags>]
opm index add [<flags>]
opm index export [<flags>]
opm index prune [<flags>]
opm index prune-stranded [<flags>]
opm index rm [<flags>]
opm init <package_name> [<flags>]
opm render <index_image | bundle_image | sqlite_file> [<flags>]
opm validate <directory> [<flags>]
opm serve <source_path> [<flags>]