Skip to content

Commit 430e0d0

Browse files
committed
Add file-based catalog docs
1 parent ce578f4 commit 430e0d0

33 files changed

+1037
-62
lines changed

_topic_map.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,8 +656,13 @@ Topics:
656656
- Name: Basic tkn commands
657657
File: op-tkn-reference
658658
- Name: opm CLI
659-
File: opm-cli
659+
Dir: opm
660660
Distros: openshift-enterprise,openshift-origin
661+
Topics:
662+
- Name: Installing the opm CLI
663+
File: cli-opm-install
664+
- Name: opm CLI reference
665+
File: cli-opm-ref
661666
- Name: Operator SDK
662667
Dir: osdk
663668
Distros: openshift-enterprise,openshift-origin
@@ -1254,7 +1259,7 @@ Topics:
12541259
Topics:
12551260
- Name: What are Operators?
12561261
File: olm-what-operators-are
1257-
- Name: Packaging formats
1262+
- Name: Packaging format
12581263
File: olm-packaging-format
12591264
- Name: Common terms
12601265
File: olm-common-terms

cli_reference/opm-cli.adoc

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[id="cli-opm-install"]
2+
= Installing the opm CLI
3+
include::modules/common-attributes.adoc[]
4+
:context: cli-opm-install
5+
6+
toc::[]
7+
8+
include::modules/olm-about-opm.adoc[leveloffset=+1]
9+
.Additional resources
10+
11+
* See xref:../../operators/understanding/olm-packaging-format.adoc#olm-bundle-format_olm-packaging-format[Operator Framework packaging format] for more information about the bundle format.
12+
* To create a bundle image using the Operator SDK, see
13+
xref:../../operators/operator_sdk/osdk-working-bundle-images.adoc#osdk-working-bundle-images[Working with bundle images].
14+
15+
include::modules/olm-installing-opm.adoc[leveloffset=+1]
16+
17+
[id="opm-addtl-resources"]
18+
== Additional resources
19+
20+
* See xref:../../operators/admin/olm-managing-custom-catalogs.adoc#olm-managing-custom-catalogs[Managing custom catalogs] for `opm` procedures including creating, updating, and pruning catalogs.

cli_reference/opm/cli-opm-ref.adoc

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
[id="cli-opm-ref"]
2+
= opm CLI reference
3+
include::modules/common-attributes.adoc[]
4+
:context: cli-opm-ref
5+
6+
toc::[]
7+
8+
The `opm` command-line interface (CLI) is a tool for creating and maintaining Operator catalogs.
9+
10+
.`opm` CLI syntax
11+
[source,terminal]
12+
----
13+
$ opm <command> [<subcommand>] [<argument>] [<flags>]
14+
----
15+
16+
.Global flags
17+
[options="header",cols="1,3"]
18+
|===
19+
|Flag |Description
20+
21+
|`--skip-tls`
22+
|Skip TLS certificate verification for container image registries while pulling bundles or indexes.
23+
24+
|===
25+
26+
:FeatureName: The SQLite-based catalog format, including the related CLI commands,
27+
include::modules/deprecated-feature.adoc[]
28+
29+
include::modules/opm-cli-ref-index.adoc[leveloffset=+1]
30+
include::modules/opm-cli-ref-init.adoc[leveloffset=+1]
31+
include::modules/opm-cli-ref-render.adoc[leveloffset=+1]
32+
include::modules/opm-cli-ref-validate.adoc[leveloffset=+1]
33+
include::modules/opm-cli-ref-serve.adoc[leveloffset=+1]

cli_reference/osdk/cli-osdk-install.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ toc::[]
77

88
The Operator SDK provides a command-line interface (CLI) tool that Operator developers can use to build, test, and deploy an Operator. You can install the Operator SDK CLI on your workstation so that you are prepared to start authoring your own Operators.
99

10+
Operator authors with cluster administrator access to a Kubernetes-based cluster, such as {product-title}, can use the Operator SDK CLI to develop their own Operators based on Go, Ansible, or Helm. link:https://kubebuilder.io/[Kubebuilder] is embedded into the Operator SDK as the scaffolding solution for Go-based Operators, which means existing Kubebuilder projects can be used as is with the Operator SDK and continue to work.
11+
1012
See xref:../../operators/operator_sdk/osdk-about.adoc#osdk-about[Developing Operators] for full documentation on the Operator SDK.
1113

1214
[NOTE]

cli_reference/osdk/cli-osdk-ref.adoc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ The Operator SDK command-line interface (CLI) is a development kit designed to m
1313
$ operator-sdk <command> [<subcommand>] [<argument>] [<flags>]
1414
----
1515

16-
Operator authors with cluster administrator access to a Kubernetes-based cluster (such as {product-title}) can use the Operator SDK CLI to develop their own Operators based on Go, Ansible, or Helm. link:https://kubebuilder.io/[Kubebuilder] is embedded into the Operator SDK as the scaffolding solution for Go-based Operators, which means existing Kubebuilder projects can be used as is with the Operator SDK and continue to work.
17-
1816
See xref:../../operators/operator_sdk/osdk-about.adoc#osdk-about[Developing Operators] for full documentation on the Operator SDK.
1917

2018
include::modules/osdk-cli-ref-bundle.adoc[leveloffset=+1]

modules/olm-about-opm.adoc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// Module included in the following assemblies:
22
//
3-
// * operators/understanding/olm/olm-packaging-formats.adoc
4-
// * cli_reference/opm-cli.adoc
3+
// * operators/understanding/olm-packaging-format.adoc
4+
// * cli_reference/opm/cli-opm-install.adoc
55

66
[id="olm-about-opm_{context}"]
7-
= About opm
7+
= About the opm CLI
88

9-
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 bundles, called an _index_, that are similar to software repositories. The result is a container image, called an _index image_, which can be stored in a container registry and then installed on a cluster.
9+
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.
1010

11-
An index 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 {product-title}, Operator Lifecycle Manager (OLM) can use the index image as a catalog by referencing it in a `CatalogSource` object, which polls the image at regular intervals to enable frequent updates to installed Operators on the cluster.
11+
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 {product-title}, 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.

modules/olm-bundle-format-dependencies-file.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Module included in the following assemblies:
22
//
3-
// * operators/understanding/olm/olm-packaging-format.adoc
3+
// * operators/understanding/olm-packaging-format.adoc
44
// * operators/understanding/olm/olm-understanding-dependency-resolution.adoc
55

66
[id="olm-bundle-format-dependencies_{context}"]

modules/olm-bundle-format.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Module included in the following assemblies:
22
//
3-
// * operators/understanding/olm/olm-packaging-format.adoc
3+
// * operators/understanding/olm-packaging-format.adoc
44

55
[id="olm-bundle-format_{context}"]
66
= Bundle format
Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * operators/admin/olm-managing-custom-catalogs.adoc
4+
5+
ifdef::openshift-origin[]
6+
:registry-image: quay.io/openshift/origin-operator-registry:4.9.0
7+
endif::[]
8+
ifndef::openshift-origin[]
9+
:registry-image: registry.redhat.io/openshift4/ose-operator-registry:v4.9
10+
endif::[]
11+
12+
[id="olm-creating-fb-catalog-image_{context}"]
13+
= Creating a file-based catalog image
14+
15+
You can create a catalog image that uses the plain text _file-based catalog_ format (JSON or YAML), which replaces the deprecated SQLite database format. The `opm` CLI provides tooling that helps initialize a catalog in the file-based format, render new records into it, and validate that the catalog is valid.
16+
17+
.Prerequisites
18+
19+
* `opm` version 1.18.0+
20+
* `podman` version 1.9.3+
21+
* A bundle image built and pushed to a registry that supports link:https://docs.docker.com/registry/spec/manifest-v2-2/[Docker v2-2]
22+
23+
.Procedure
24+
25+
. Initialize a catalog for a file-based catalog:
26+
27+
.. Create a directory for the catalog:
28+
+
29+
[source,terminal]
30+
----
31+
$ mkdir <operator_name>-index
32+
----
33+
34+
.. Create a Dockerfile that can build a catalog image:
35+
+
36+
.Example `<operator_name>-index.Dockerfile`
37+
[source,bash,subs="attributes+"]
38+
----
39+
# The base image is expected to contain
40+
# /bin/opm (with a serve subcommand) and /bin/grpc_health_probe
41+
FROM {registry-image}
42+
43+
# Configure the entrypoint and command
44+
ENTRYPOINT ["/bin/opm"]
45+
CMD ["serve", "/configs"]
46+
47+
# Copy declarative config root into image at /configs
48+
ADD <operator_name>-index /configs
49+
50+
# Set DC-specific label for the location of the DC root directory
51+
# in the image
52+
LABEL operators.operatorframework.io.index.configs.v1=/configs
53+
----
54+
+
55+
The Dockerfile must be in the same parent directory as the catalog directory that you created in the previous step:
56+
+
57+
.Example directory structure
58+
[source,terminal]
59+
----
60+
.
61+
├── <operator_name>-index
62+
└── <operator_name>-index.Dockerfile
63+
----
64+
65+
.. Populate the catalog with your package definition:
66+
+
67+
[source,terminal]
68+
----
69+
$ opm init <operator_name> \ <.>
70+
--default-channel=preview \ <.>
71+
--description=./README.md \ <.>
72+
--icon=./operator-icon.svg \ <.>
73+
--output yaml \ <.>
74+
> <operator_name>-index/index.yaml <.>
75+
----
76+
<.> Operator, or package, name.
77+
<.> Channel that subscription will default to if unspecified.
78+
<.> Path to the Operator's `README.md` or other documentation.
79+
<.> Path to the Operator's icon.
80+
<.> Output format: JSON or YAML.
81+
<.> Path for creating the catalog configuration file.
82+
+
83+
This command generates an `olm.package` declarative config blob in the specified catalog configuration file.
84+
85+
. Add a bundle to the catalog:
86+
+
87+
[source,terminal]
88+
----
89+
$ opm render <registry>/<namespace>/<bundle_image_name>:<tag> \ <.>
90+
--output=yaml \
91+
>> <operator_name>-index/index.yaml <.>
92+
----
93+
<.> Pull spec for the bundle image.
94+
<.> Path to the catalog configuration file.
95+
+
96+
The `opm render` command generates a declarative config blob from the provided catalog images and bundle images.
97+
+
98+
[NOTE]
99+
====
100+
Channels must contain at least one bundle.
101+
====
102+
103+
. Add a channel entry for the bundle. For example, modify the following example to your specifications, and add it to your `<operator_name>-index/index.yaml` file:
104+
+
105+
.Example channel entry
106+
[source,yaml]
107+
----
108+
---
109+
schema: olm.channel
110+
package: <operator_name>
111+
name: preview
112+
entries:
113+
- name: <operator_name>.v0.1.0 <.>
114+
----
115+
<.> Ensure that you include the period (`.`) after `<operator_name>` but before the `v` in the version. Otherwise, the entry will fail to pass the `opm validate` command.
116+
117+
. Validate the file-based catalog:
118+
119+
.. Run the `opm validate` command against the catalog directory:
120+
+
121+
[source,terminal]
122+
----
123+
$ opm validate <operator_name>-index
124+
----
125+
126+
.. Check that the error code is `0`:
127+
+
128+
[source,terminal]
129+
----
130+
$ echo $?
131+
----
132+
+
133+
.Example output
134+
[source,terminal]
135+
----
136+
0
137+
----
138+
139+
. Build the catalog image:
140+
+
141+
[source,terminal]
142+
----
143+
$ podman build . \
144+
-f <operator_name>-index.Dockerfile \
145+
-t <registry>/<namespace>/<catalog_image_name>:<tag>
146+
----
147+
148+
. Push the catalog image to a registry:
149+
150+
.. If required, authenticate with your target registry:
151+
+
152+
[source,terminal]
153+
----
154+
$ podman login <registry>
155+
----
156+
157+
.. Push the catalog image:
158+
+
159+
[source,terminal]
160+
----
161+
$ podman push <registry>/<namespace>/<catalog_image_name>:<tag>
162+
----
163+
164+
:!registry-image:

0 commit comments

Comments
 (0)