Questo contenuto non è disponibile nella lingua selezionata.
Chapter 6. opm CLI
6.1. Installing the opm CLI Copia collegamentoCollegamento copiato negli appunti!
6.1.1. About the opm CLI Copia collegamentoCollegamento copiato negli appunti!
The
opm
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
6.1.2. Installing the opm CLI Copia collegamentoCollegamento copiato negli appunti!
You can install the
opm
Prerequisites
For Linux, you must provide the following packages. RHEL 8 meets these requirements:
-
version 1.9.3+ (version 2.0+ recommended)
podman -
version 2.28+
glibc
-
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>- For Windows, unzip the archive with a ZIP program.
Place the file anywhere in your
.PATHFor Linux or macOS:
Check your
:PATH$ echo $PATHMove the file. For example:
$ sudo mv ./opm /usr/local/bin/
For Windows:
Check your
:PATHC:\> pathMove the file:
C:\> move opm.exe <directory>
Verification
After you install the
CLI, verify that it is available:opm$ opm version
6.2. opm CLI reference Copia collegamentoCollegamento copiato negli appunti!
The
opm
opm CLI syntax
$ 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. generate Copia collegamentoCollegamento copiato negli appunti!
Generate various artifacts for declarative config indexes.
Command syntax
$ opm generate <subcommand> [<flags>]
| Subcommand | Description |
|---|---|
|
| Generate a Dockerfile for a declarative config index. |
| Flags | Description |
|---|---|
|
| Help for generate. |
6.2.1.1. dockerfile Copia collegamentoCollegamento copiato negli appunti!
Generate a Dockerfile for a declarative config index.
This command creates a Dockerfile in the same directory as the
<dcRootDir>
<dcDirName>.Dockerfile
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>]
| Flag | Description |
|---|---|
|
| Image in which to build catalog. The default value is
|
|
| Extra labels to include in the generated Dockerfile. Labels have the form
|
|
| Help for Dockerfile. |
To build with the official Red Hat image, use the
registry.redhat.io/openshift4/ose-operator-registry:v4.11
-i
6.2.2. index Copia collegamentoCollegamento copiato negli appunti!
Generate Operator index for SQLite database format container images from pre-existing Operator bundles.
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.
The
opm
Many of the
opm
opm index prune
Command syntax
$ opm index <subcommand> [<flags>]
| Subcommand | Description |
|---|---|
|
| Add Operator bundles to an index. |
|
| 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.2.1. add Copia collegamentoCollegamento copiato negli appunti!
Add Operator bundles to an index.
Command syntax
$ 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.2.2. prune Copia collegamentoCollegamento copiato negli appunti!
Prune an index of all but specified packages.
Command syntax
$ 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.2.3. prune-stranded Copia collegamentoCollegamento copiato negli appunti!
Prune an index of stranded bundles, which are bundles that are not associated with a particular image.
Command syntax
$ 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. |
|
| Comma-separated list of packages to keep. |
|
| Allow registry load errors. |
|
| Custom tag for container image being built. |
6.2.2.4. rm Copia collegamentoCollegamento copiato negli appunti!
Delete an entire Operator from an index.
Command syntax
$ 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. |
|
| Comma-separated list of packages to keep. |
|
| Allow registry load errors. |
|
| Tool to pull container images:
|
|
| Custom tag for container image being built. |
6.2.3. init Copia collegamentoCollegamento copiato negli appunti!
Generate an
olm.package
Command syntax
$ 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.4. migrate Copia collegamentoCollegamento copiato negli appunti!
Migrate a SQLite database format index image or database file to a file-based catalog.
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.
Command syntax
$ opm migrate <index_ref> <output_dir> [<flags>]
| Flag | Description |
|---|---|
|
| Output format:
|
6.2.5. render Copia collegamentoCollegamento copiato negli appunti!
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>]
| Flag | Description |
|---|---|
|
| Output format:
|
6.2.6. serve Copia collegamentoCollegamento copiato negli appunti!
Serve declarative configs via a GRPC server.
The declarative config directory is loaded by the
serve
Command syntax
$ opm serve <source_path> [<flags>]
| Flag | Description |
|---|---|
|
| Enable debug logging. |
|
| Port number to serve on. Default:
|
|
| Path to a container termination log file. Default:
|
6.2.7. validate Copia collegamentoCollegamento copiato negli appunti!
Validate the declarative config JSON file(s) in a given directory.
Command syntax
$ opm validate <directory> [<flags>]