opm CLI reference

The opm command-line interface (CLI) is a tool for creating and maintaining Operator catalogs.

opm CLI syntax

  1. $ opm <command> [<subcommand>] [<argument>] [<flags>]
Table 1. Global flags
FlagDescription

—skip-tls

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 OKD 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 OKD, refer to the Deprecated and removed features section of the OKD release notes.

init

Generate an olm.package declarative config blob.

Command syntax

  1. $ opm init <package_name> [<flags>]
Table 2. init flags
FlagDescription

-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.

render

Generate a declarative config blob from the provided index images, bundle images, and SQLite database files.

Command syntax

  1. $ opm render <index_image | bundle_image | sqlite_file> [<flags>]
Table 3. render flags
FlagDescription

-o, —output (string)

Output format: json (the default value) or yaml.

validate

Validate the declarative config JSON file(s) in a given directory.

Command syntax

  1. $ opm validate <directory> [<flags>]

serve

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

  1. $ opm serve <source_path> [<flags>]
Table 4. serve flags
FlagDescription

—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.

index

Generate Operator index for SQLite database format container images from pre-existing Operator bundles.

As of OKD 4.11, the default Red Hat-provided Operator catalog releases in the file-based catalog format. The default Red Hat-provided Operator catalogs for OKD 4.6 through 4.10 released in the deprecated SQLite database format.

The opm subcommands, flags, and functionality related to the SQLite database format are also deprecated and will be removed in a future release. The features are still supported and must be used for catalogs that use the deprecated SQLite database format.

Many of the opm subcommands and flags for working with the SQLite database format, such as opm index prune, do not work with the file-based catalog format. For more information about working with file-based catalogs, see “Additional resources”.

Command syntax

  1. $ opm index <subcommand> [<flags>]
Table 5. index subcommands
SubcommandDescription

add

Add Operator bundles to an index.

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.

add

Add Operator bundles to an index.

Command syntax

  1. $ opm index add [<flags>]
Table 6. index add flags
FlagDescription

-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)

Previous 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.

prune

Prune an index of all but specified packages.

Command syntax

  1. $ opm index prune [<flags>]
Table 7. index prune flags
FlagDescription

-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.

prune-stranded

Prune an index of stranded bundles, which are bundles that are not associated with a particular image.

Command syntax

  1. $ opm index prune-stranded [<flags>]
Table 8. index prune-stranded flags
FlagDescription

-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.

rm

Delete an entire Operator from an index.

Command syntax

  1. $ opm index rm [<flags>]
Table 9. index rm flags
FlagDescription

-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)

Previous 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.

-p, —packages (strings)

Comma-separated list of packages to keep.

—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.

Additional resources