Skip to content

Commit 0c2bfa1

Browse files
authored
Change formatting in the "Catalog queries" doc (#1461)
This commit adds definition lists for placeholders such as `<package_name>`. The goal of adding definition lists for placeholders is to improve their visibility in the code snippets. This commit also switches existing definition lists [1] (list of queries) to unordered list. The current list of queries uses definition lists from mkdocs-material. However it relies on a tailing space after a colon to work. E.g. the whole line becomes `: ` and it is prone to errors because: 1. It is easy to overlook a space which is part of markdown. 2. Many editors remove tailing spaces at the end of lines. 3. We are adding more definition lists into this docs to explain placeholders such as `<package_name>`. With nested definition lists markdown of this document going to be very difficult to manage. [1]: https://squidfunk.github.io/mkdocs-material/reference/lists/#using-definition-lists Signed-off-by: Mikalai Radchuk <mradchuk@redhat.com>
1 parent a504d6f commit 0c2bfa1

File tree

1 file changed

+81
-46
lines changed

1 file changed

+81
-46
lines changed

docs/howto/catalog-queries.md

Lines changed: 81 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,108 @@
11
# Catalog queries
22

3+
After you [add a catalog of extensions](../tutorials/add-catalog.md) to your cluster, you must port forward your catalog as a service.
4+
Then you can query the catalog by using `curl` commands and the `jq` CLI tool to find extensions to install.
5+
6+
## Prerequisites
7+
8+
* You have added a ClusterCatalog of extensions, such as [OperatorHub.io](https://operatorhub.io), to your cluster.
9+
* You have installed the `jq` CLI tool.
10+
311
!!! note
412
By default, Catalogd is installed with TLS enabled for the catalog webserver.
513
The following examples will show this default behavior, but for simplicity's sake will ignore TLS verification in the curl commands using the `-k` flag.
614

15+
You also need to port forward the catalog server service:
16+
17+
``` terminal
18+
kubectl -n olmv1-system port-forward svc/catalogd-service 8443:443
19+
```
720

8-
You can use the `curl` command with `jq` to query catalogs that are installed on your cluster.
21+
Now you can use the `curl` command with `jq` to query catalogs that are installed on your cluster.
922

1023
``` terminal title="Query syntax"
1124
curl -k https://localhost:8443/catalogs/operatorhubio/api/v1/all | <query>
1225
```
26+
`<query>`
27+
: One of the `jq` queries from this document
1328

1429
## Package queries
1530

16-
Available packages in a catalog
17-
:
18-
``` terminal
19-
jq -s '.[] | select( .schema == "olm.package")'
20-
```
31+
* Available packages in a catalog:
32+
``` terminal
33+
jq -s '.[] | select( .schema == "olm.package")'
34+
```
2135
22-
Packages that support `AllNamespaces` install mode and do not use webhooks
36+
* Packages that support `AllNamespaces` install mode and do not use webhooks:
37+
``` terminal
38+
jq -c 'select(.schema == "olm.bundle") | {"package":.package, "version":.properties[] | select(.type == "olm.bundle.object").value.data | @base64d | fromjson | select(.kind == "ClusterServiceVersion" and (.spec.installModes[] | select(.type == "AllNamespaces" and .supported == true) != null) and .spec.webhookdefinitions == null).spec.version}'
39+
```
2340
24-
:
25-
``` terminal
26-
jq -c 'select(.schema == "olm.bundle") | {"package":.package, "version":.properties[] | select(.type == "olm.bundle.object").value.data | @base64d | fromjson | select(.kind == "ClusterServiceVersion" and (.spec.installModes[] | select(.type == "AllNamespaces" and .supported == true) != null) and .spec.webhookdefinitions == null).spec.version}'
27-
```
41+
* Package metadata:
42+
``` terminal
43+
jq -s '.[] | select( .schema == "olm.package") | select( .name == "<package_name>")'
44+
```
2845
29-
Package metadata
30-
:
31-
``` terminal
32-
jq -s '.[] | select( .schema == "olm.package") | select( .name == "<package_name>")'
33-
```
46+
`<package_name>`
47+
: Name of the package from the catalog you are querying.
3448
35-
Catalog blobs in a package
36-
:
37-
``` terminal
38-
jq -s '.[] | select( .package == "<package_name>")'
39-
```
49+
* Catalog blobs in a package:
50+
``` terminal
51+
jq -s '.[] | select( .package == "<package_name>")'
52+
```
53+
54+
`<package_name>`
55+
: Name of the package from the catalog you are querying.
4056
4157
## Channel queries
4258
43-
Channels in a package
44-
:
45-
``` terminal
46-
jq -s '.[] | select( .schema == "olm.channel" ) | select( .package == "<package_name>") | .name'
47-
```
59+
* Channels in a package:
60+
``` terminal
61+
jq -s '.[] | select( .schema == "olm.channel" ) | select( .package == "<package_name>") | .name'
62+
```
4863
49-
Versions in a channel
50-
:
51-
``` terminal
52-
jq -s '.[] | select( .package == "<package_name>" ) | select( .schema == "olm.channel" ) | select( .name == "<channel_name>" ) | .entries | .[] | .name'
53-
```
64+
`<package_name>`
65+
: Name of the package from the catalog you are querying.
5466
55-
Latest version in a channel and upgrade path
56-
:
57-
``` terminal
58-
jq -s '.[] | select( .schema == "olm.channel" ) | select ( .name == "<channel>") | select( .package == "<package_name>")'
59-
```
67+
* Versions in a channel:
68+
``` terminal
69+
jq -s '.[] | select( .package == "<package_name>" ) | select( .schema == "olm.channel" ) | select( .name == "<channel_name>" ) | .entries | .[] | .name'
70+
```
71+
72+
`<package_name>`
73+
: Name of the package from the catalog you are querying.
74+
75+
`<channel_name>`
76+
: Name of the channel for a given package.
77+
78+
* Latest version in a channel and upgrade path:
79+
``` terminal
80+
jq -s '.[] | select( .schema == "olm.channel" ) | select ( .name == "<channel_name>") | select( .package == "<package_name>")'
81+
```
82+
83+
`<package_name>`
84+
: Name of the package from the catalog you are querying.
85+
86+
`<channel_name>`
87+
: Name of the channel for a given package.
6088
6189
## Bundle queries
6290
63-
Bundles in a package
64-
:
65-
``` terminal
66-
jq -s '.[] | select( .schema == "olm.bundle" ) | select( .package == "<package_name>") | .name'
67-
```
91+
* Bundles in a package:
92+
``` terminal
93+
jq -s '.[] | select( .schema == "olm.bundle" ) | select( .package == "<package_name>") | .name'
94+
```
6895
69-
Bundle dependencies and available APIs
70-
:
71-
``` terminal
72-
jq -s '.[] | select( .schema == "olm.bundle" ) | select ( .name == "<bundle_name>") | select( .package == "<package_name>")'
73-
```
96+
`<package_name>`
97+
: Name of the package from the catalog you are querying.
98+
99+
* Bundle dependencies and available APIs:
100+
``` terminal
101+
jq -s '.[] | select( .schema == "olm.bundle" ) | select ( .name == "<bundle_name>") | select( .package == "<package_name>")'
102+
```
103+
104+
`<package_name>`
105+
: Name of the package from the catalog you are querying.
106+
107+
`<bundle_name>`
108+
: Name of the bundle for a given package.

0 commit comments

Comments
 (0)