Movatterモバイル変換


[0]ホーム

URL:


Skip to navigationSkip to content
Red Hat Summit Red Hat SummitSupportConsoleDevelopersStart a trialContact
  1. Home
  2. Products
  3. OpenShift Container Platform
  4. 4.13
  5. CLI tools
  6. Chapter 7. opm CLI

OpenShift Container Platform

Chapter 7. opm CLI


7.1. Installing the opm CLI

7.1.1. About the opm CLI

Theopm 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 aCatalogSource object, which polls the image at regular intervals to enable frequent updates to installed Operators on the cluster.

Additional resources

7.1.2. Installing the opm CLI

You can install theopm 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

  1. Navigate to theOpenShift mirror site and download the latest version of the tarball that matches your operating system.
  2. Unpack the archive.

    • For Linux or macOS:

      $tar xvf<file>
      Copy to Clipboard
    • For Windows, unzip the archive with a ZIP program.
  3. Place the file anywhere in yourPATH.

    • For Linux or macOS:

      1. Check yourPATH:

        $echo$PATH
        Copy to Clipboard
      2. Move the file. For example:

        $sudomv ./opm /usr/local/bin/
        Copy to Clipboard
    • For Windows:

      1. Check yourPATH:

        C:\> path
        Copy to Clipboard
      2. Move the file:

        C:\> move opm.exe <directory>
        Copy to Clipboard

Verification

  • After you install theopm CLI, verify that it is available:

    $opm version
    Copy to Clipboard

7.1.3. Additional resources

7.2. opm CLI reference

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

opm CLI syntax

$opm<command>[<subcommand>][<argument>][<flags>]
Copy to Clipboard

Table 7.1. Global flags
FlagDescription

-skip-tls-verify

Skip TLS certificate verification for container image registries while pulling bundles or indexes.

--use-http

When you pull bundles, use plain HTTP for container image registries.

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 theDeprecated and removed features section of the OpenShift Container Platform release notes.

7.2.1. generate

Generate various artifacts for declarative config indexes.

Command syntax

$opm generate<subcommand>[<flags>]
Copy to Clipboard

Table 7.2. generate subcommands
SubcommandDescription

dockerfile

Generate a Dockerfile for a declarative config index.

Table 7.3. generate flags
FlagsDescription

-h,--help

Help for generate.

7.2.1.1. dockerfile

Generate a Dockerfile for a declarative config index.

Important

This command creates a Dockerfile in the same directory as the<dcRootDir> (named<dcDirName>.Dockerfile) that is used to build the index. If a Dockerfile with the same name already exists, this command fails.

When specifying extra labels, if duplicate keys exist, only the last value of each duplicate key gets added to the generated Dockerfile.

Command syntax

$opm generate dockerfile<dcRootDir>[<flags>]
Copy to Clipboard

Table 7.4. generate dockerfile flags
FlagDescription

-i,--binary-image (string)

Image in which to build catalog. The default value isquay.io/operator-framework/opm:latest.

-l,--extra-labels (string)

Extra labels to include in the generated Dockerfile. Labels have the formkey=value.

-h,--help

Help for Dockerfile.

Note

To build with the official Red Hat image, use theregistry.redhat.io/openshift4/ose-operator-registry:v4.13 value with the-i flag.

7.2.2. index

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

Important

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

Theopm 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 theopm subcommands and flags for working with the SQLite database format, such asopm 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

$opm index<subcommand>[<flags>]
Copy to Clipboard

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

7.2.2.1. add

Add Operator bundles to an index.

Command syntax

$opm indexadd[<flags>]
Copy to Clipboard

Table 7.6. index add flags
FlagDescription

-i,--binary-image

Container image for on-imageopm command

-u,--build-tool (string)

Tool to build container images:podman (the default value) ordocker. 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 orpodman.

-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, orsemver-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, orpodman. Overrides part of the--container-tool flag.

-t,--tag (string)

Custom tag for container image being built.

7.2.2.2. prune

Prune an index of all but specified packages.

Command syntax

$opm index prune[<flags>]
Copy to Clipboard

Table 7.7. index prune flags
FlagDescription

-i,--binary-image

Container image for on-imageopm command

-c,--container-tool (string)

Tool to interact with container images, such as for saving and building:docker orpodman.

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

7.2.2.3. prune-stranded

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

Command syntax

$opm index prune-stranded[<flags>]
Copy to Clipboard

Table 7.8. index prune-stranded flags
FlagDescription

-i,--binary-image

Container image for on-imageopm command

-c,--container-tool (string)

Tool to interact with container images, such as for saving and building:docker orpodman.

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

7.2.2.4. rm

Delete an entire Operator from an index.

Command syntax

$opm indexrm[<flags>]
Copy to Clipboard

Table 7.9. index rm flags
FlagDescription

-i,--binary-image

Container image for on-imageopm command

-u,--build-tool (string)

Tool to build container images:podman (the default value) ordocker. Overrides part of the--container-tool flag.

-c,--container-tool (string)

Tool to interact with container images, such as for saving and building:docker orpodman.

-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, orpodman. Overrides part of the--container-tool flag.

-t,--tag (string)

Custom tag for container image being built.

Additional resources

7.2.3. init

Generate anolm.package declarative config blob.

Command syntax

$opm init<package_name>[<flags>]
Copy to Clipboard

Table 7.10. init flags
FlagDescription

-c,--default-channel (string)

The channel that subscriptions will default to if unspecified.

-d,--description (string)

Path to the Operator’sREADME.md or other documentation.

-i,--icon (string)

Path to package’s icon.

-o,--output (string)

Output format:json (the default value) oryaml.

7.2.4. migrate

Migrate a SQLite database format index image or database file to a file-based catalog.

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 theDeprecated and removed features section of the OpenShift Container Platform release notes.

Command syntax

$opm migrate<index_ref><output_dir>[<flags>]
Copy to Clipboard

Table 7.11. migrate flags
FlagDescription

-o,--output (string)

Output format:json (the default value) oryaml.

7.2.5. render

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>]
Copy to Clipboard

Table 7.12. render flags
FlagDescription

-o,--output (string)

Output format:json (the default value) oryaml.

7.2.6. serve

Serve declarative configs via a GRPC server.

Note

The declarative config directory is loaded by theserve 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>]
Copy to Clipboard

Table 7.13. serve flags
FlagDescription

--cache-dir (string)

If this flag is set, it syncs and persists the server cache directory.

--cache-enforce-integrity

Exits with an error if the cache is not present or is invalidated. The default value istrue when the--cache-dir flag is set and the--cache-only flag isfalse. Otherwise, the default isfalse.

--cache-only

Syncs the serve cache and exits without serving.

--debug

Enables debug logging.

h,--help

Help for serve.

-p,--port (string)

The port number for the service. The default value is50051.

--pprof-addr (string)

The address of the startup profiling endpoint. The format isAddr:Port.

-t,--termination-log (string)

The path to a container termination log file. The default value is/dev/termination-log.

7.2.7. validate

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

Command syntax

$opm validate<directory>[<flags>]
Copy to Clipboard

Jump to section
Back to top
Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.Explore our recent updates.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see theRed Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Theme

© 2025 Red Hat

[8]ページ先頭

©2009-2025 Movatter.jp