Skip to content

Commit 8e7acd2

Browse files
committed
(docs) update catalogd docs to include new metas endpoint
Closes #1782 Signed-off-by: Anik Bhattacharjee <[email protected]>
1 parent 63472e0 commit 8e7acd2

File tree

3 files changed

+54
-54
lines changed

3 files changed

+54
-54
lines changed

Diff for: docs/api-reference/catalogd-webserver.md

+22-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
# Catalogd web server
22

33
[Catalogd](https://github.com/operator-framework/operator-controller/tree/main/catalogd), the OLM v1 component for making catalog contents available on cluster, includes
4-
a web server that serves catalog contents to clients via an HTTP(S) endpoint.
4+
a web server that serves catalog contents to clients via HTTP(S) endpoints.
5+
6+
The endpoints to retrieve information about installable clusterextentions can be composed from the `.status.urls.base` of a `ClusterCatalog` resource with the selected access API path.
7+
8+
Currently, there are two API endpoints:
9+
10+
1. `api/v1/all` endpoint that provides access to the FBC metadata in entirety.
511

6-
The endpoint to retrieve this information can be composed from the `.status.urls.base` of a `ClusterCatalog` resource with the selected access API path.
712
As an example, to access the full FBC via the v1 API endpoint (indicated by path `api/v1/all`) where `.status.urls.base` is
813

914
```yaml
@@ -13,6 +18,21 @@ As an example, to access the full FBC via the v1 API endpoint (indicated by path
1318
1419
the URL to access the service would be `https://catalogd-service.olmv1-system.svc/catalogs/operatorhubio/api/v1/all`
1520

21+
2. `api/v1/metas` endpoint that allows clients to retrieve filtered portions of the FBC.
22+
23+
The metas endpoint accepts parameters which are one of the sub-types of the `Meta` [definition](https://github.com/operator-framework/operator-registry/blob/e15668c933c03e229b6c80025fdadb040ab834e0/alpha/declcfg/declcfg.go#L111-L114), following the pattern `/api/v1/metas?<parameter>[&<parameter>...]`.
24+
25+
As an example, to access only the [package schema](https://olm.operatorframework.io/docs/reference/file-based-catalogs/#olmpackage-1) blobs of the FBC via the `api/v1/metas` endpoint where `.status.urls.base` is
26+
27+
```yaml
28+
urls:
29+
base: https://catalogd-service.olmv1-system.svc/catalogs/operatorhubio
30+
```
31+
32+
the URL to access the service would be `https://catalogd-service.olmv1-system.svc/catalogs/operatorhubio/api/v1/metas?schema=olm.package`
33+
34+
For more examples of valid queries that can be made to the `api/v1/metas` service endpoint, please see [Catalog Queries](../howto/catalog-queries.md).
35+
1636
!!! note
1737

1838
The values of the `.status.urls` field in a `ClusterCatalog` resource are arbitrary string values and can change at any time.

Diff for: docs/howto/catalog-queries.md

+13-28
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ Then you can query the catalog by using `curl` commands and the `jq` CLI tool to
1212
By default, Catalogd is installed with TLS enabled for the catalog webserver.
1313
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.
1414

15+
!!! note
16+
While using the `/api/v1/metas` endpoint shown in the below examples, it is important to note that the metas endpoint accepts parameters which are one of the sub-types of the `Meta` [definition](https://github.com/operator-framework/operator-registry/blob/e15668c933c03e229b6c80025fdadb040ab834e0/alpha/declcfg/declcfg.go#L111-L114), following the pattern `/api/v1/metas?<parameter>[&<parameter>...]`. e.g. `schema=<schema_name>&package=<package_name>`, `schema=<schema_name>&name=<name>`, and `package=<package_name>&name=<name>` are all valid parameter combinations. However `schema=<schema_name>&version=<version_string>` is not a valid parameter combination, since version is not a first class FBC meta field.
17+
1518
You also need to port forward the catalog server service:
1619

1720
``` terminal
@@ -20,17 +23,11 @@ kubectl -n olmv1-system port-forward svc/catalogd-service 8443:443
2023

2124
Now you can use the `curl` command with `jq` to query catalogs that are installed on your cluster.
2225

23-
``` terminal title="Query syntax"
24-
curl -k https://localhost:8443/catalogs/operatorhubio/api/v1/all | <query>
25-
```
26-
`<query>`
27-
: One of the `jq` queries from this document
28-
2926
## Package queries
3027

3128
* Available packages in a catalog:
3229
``` terminal
33-
jq -s '.[] | select( .schema == "olm.package")'
30+
curl -k 'https://localhost:8443/catalogs/operatorhubio/api/v1/metas?schema=olm.package'
3431
```
3532
3633
* Packages that support `AllNamespaces` install mode and do not use webhooks:
@@ -40,44 +37,35 @@ curl -k https://localhost:8443/catalogs/operatorhubio/api/v1/all | <query>
4037
4138
* Package metadata:
4239
``` terminal
43-
jq -s '.[] | select( .schema == "olm.package") | select( .name == "<package_name>")'
40+
curl -k 'https://localhost:8443/catalogs/operatorhubio/api/v1/metas?schema=olm.package&name=<package_name>'
4441
```
4542
4643
`<package_name>`
4744
: Name of the package from the catalog you are querying.
4845
49-
* Catalog blobs in a package:
46+
* Blobs that belong to a package (that are not schema=olm.package):
5047
``` terminal
51-
jq -s '.[] | select( .package == "<package_name>")'
48+
curl -k 'https://localhost:8443/catalogs/operatorhubio/api/v1/metas?package=<package_name>'
5249
```
5350
5451
`<package_name>`
5552
: Name of the package from the catalog you are querying.
5653
54+
Note: the `olm.package` schema blob does not have the `package` field set. In other words, to get all the blobs that belong to a package, along with the olm.package blob for that package, a combination of both of the above queries need to be used.
55+
5756
## Channel queries
5857
5958
* Channels in a package:
6059
``` terminal
61-
jq -s '.[] | select( .schema == "olm.channel" ) | select( .package == "<package_name>") | .name'
60+
curl -k 'https://localhost:8443/catalogs/operatorhubio/api/v1/metas?schema=olm.channel&package=<package_name>'
6261
```
6362
6463
`<package_name>`
6564
: Name of the package from the catalog you are querying.
6665
6766
* Versions in a channel:
6867
``` 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>")'
68+
curl -k 'https://localhost:8443/catalogs/operatorhubio/api/v1/metas?schema=olm.channel&package=zoperator&name=alpha' | jq -s '.[] | .entries | .[] | .name'
8169
```
8270
8371
`<package_name>`
@@ -90,19 +78,16 @@ curl -k https://localhost:8443/catalogs/operatorhubio/api/v1/all | <query>
9078
9179
* Bundles in a package:
9280
``` terminal
93-
jq -s '.[] | select( .schema == "olm.bundle" ) | select( .package == "<package_name>") | .name'
81+
curl -k 'https://localhost:8443/catalogs/operatorhubio/api/v1/metas?schema=olm.bundle&package=<package_name>'
9482
```
9583
9684
`<package_name>`
9785
: Name of the package from the catalog you are querying.
9886
9987
* Bundle dependencies and available APIs:
10088
``` terminal
101-
jq -s '.[] | select( .schema == "olm.bundle" ) | select ( .name == "<bundle_name>") | select( .package == "<package_name>")'
89+
curl -k 'https://localhost:8443/catalogs/operatorhubio/api/v1/metas?schema=olm.bundle&name=<bundle_name>' | jq -s '.[] | .properties[] | select(.type=="olm.gvk")'
10290
```
10391
104-
`<package_name>`
105-
: Name of the package from the catalog you are querying.
106-
10792
`<bundle_name>`
10893
: Name of the bundle for a given package.

Diff for: docs/tutorials/explore-available-content.md

+19-24
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Then you can query the catalog by using `curl` commands and the `jq` CLI tool to
2727
2828
2. Return a list of all the extensions in a catalog via the v1 API endpoint:
2929
``` terminal
30-
curl -k https://localhost:8443/catalogs/operatorhubio/api/v1/all | jq -s '.[] | select(.schema == "olm.package") | .name'
30+
curl -k https://localhost:8443/catalogs/operatorhubio/api/v1/metas?schema=olm.package' | jq -s '.[] | .name'
3131
```
3232
3333
??? success
@@ -94,41 +94,36 @@ Then you can query the catalog by using `curl` commands and the `jq` CLI tool to
9494
!!! important
9595
Currently, OLM 1.0 does not support the installation of extensions that use webhooks or that target a single or specified set of namespaces.
9696
97-
3. Return list of packages that support `AllNamespaces` install mode and do not use webhooks:
97+
3. Return list of packages where the channel head version use `olm.csv.metadata` format, support `AllNamespaces` install mode and do not use webhooks:
9898
9999
``` terminal
100-
curl -k https://localhost:8443/catalogs/operatorhubio/api/v1/all | jq -cs '[.[] | select(.schema == "olm.bundle" and (.properties[] | select(.type == "olm.csv.metadata").value.installModes[] | select(.type == "AllNamespaces" and .supported == true)) and .spec.webhookdefinitions == null) | .package] | unique[]'
100+
curl -k https://localhost:8443/catalogs/operatorhubio/api/v1/metas?schema=olm.bundle | jq -cs '[.[] | select(.properties[] | select(.type == "olm.csv.metadata").value.installModes[] | select(.type == "AllNamespaces" and .supported == true) and .spec.webhookdefinitions == null) | .package] | unique[]'
101101
```
102102
103103
??? success
104104
``` text title="Example output"
105-
{"package":"ack-acm-controller","version":"0.0.12"}
106-
{"package":"ack-acmpca-controller","version":"0.0.5"}
107-
{"package":"ack-apigatewayv2-controller","version":"1.0.7"}
108-
{"package":"ack-applicationautoscaling-controller","version":"1.0.11"}
109-
{"package":"ack-cloudfront-controller","version":"0.0.9"}
110-
{"package":"ack-cloudtrail-controller","version":"1.0.8"}
111-
{"package":"ack-cloudwatch-controller","version":"0.0.3"}
112-
{"package":"ack-cloudwatchlogs-controller","version":"0.0.4"}
113-
{"package":"ack-dynamodb-controller","version":"1.2.9"}
114-
{"package":"ack-ec2-controller","version":"1.2.4"}
115-
{"package":"ack-ecr-controller","version":"1.0.12"}
116-
{"package":"ack-ecs-controller","version":"0.0.4"}
117-
{"package":"ack-efs-controller","version":"0.0.5"}
118-
{"package":"ack-eks-controller","version":"1.3.3"}
119-
{"package":"ack-elasticache-controller","version":"0.0.29"}
120-
{"package":"ack-emrcontainers-controller","version":"1.0.8"}
121-
{"package":"ack-eventbridge-controller","version":"1.0.6"}
122-
{"package":"ack-iam-controller","version":"1.3.6"}
123-
{"package":"ack-kafka-controller","version":"0.0.4"}
124-
{"package":"ack-keyspaces-controller","version":"0.0.11"}
105+
"ack-acm-controller"
106+
"ack-acmpca-controller"
107+
"ack-apigateway-controller"
108+
"ack-apigatewayv2-controller"
109+
"ack-applicationautoscaling-controller"
110+
"ack-athena-controller"
111+
"ack-cloudfront-controller"
112+
"ack-cloudtrail-controller"
113+
"ack-cloudwatch-controller"
114+
"ack-cloudwatchlogs-controller"
115+
"ack-documentdb-controller"
116+
"ack-dynamodb-controller"
117+
"ack-ec2-controller"
118+
"ack-ecr-controller"
119+
"ack-ecs-controller"
125120
...
126121
```
127122
128123
4. Inspect the contents of an extension's metadata:
129124
130125
``` terminal
131-
curl -k https://localhost:8443/catalogs/operatorhubio/api/v1/all | jq -s '.[] | select( .schema == "olm.package") | select( .name == "<package_name>")'
126+
curl -k https://localhost:8443/catalogs/operatorhubio/api/v1/metas?schema=olm.package&name=<package_name>
132127
```
133128
134129
`package_name`

0 commit comments

Comments
 (0)