Skip to content

Commit 39acdca

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

File tree

3 files changed

+54
-53
lines changed

3 files changed

+54
-53
lines changed

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 retrive filtered portions of the FBC.
22+
23+
The metas endpoint accepts additional parameters following the pattern `/api/v1/metas?<parameters>`, and accepts parameters that corresponds to any combination of the fields of the [FBC Meta structure](https://olm.operatorframework.io/docs/reference/file-based-catalogs/#schema) (except for `Blob`).
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.

docs/howto/catalog-queries.md

+14-28
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ 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 endpoint accepts parameters following the pattern `/api/v1/metas?<parameters>`. Valid parameter set is a any combination of the fields of the [FBC Meta Structure](https://olm.operatorframework.io/docs/reference/file-based-catalogs/#schema) (except for `Blob`).
17+
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.
18+
1519
You also need to port forward the catalog server service:
1620

1721
``` terminal
@@ -20,17 +24,11 @@ kubectl -n olmv1-system port-forward svc/catalogd-service 8443:443
2024

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

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-
2927
## Package queries
3028

3129
* Available packages in a catalog:
3230
``` terminal
33-
jq -s '.[] | select( .schema == "olm.package")'
31+
curl -k 'https://localhost:8443/catalogs/operatorhubio/api/v1/metas?schema=olm.package'
3432
```
3533
3634
* Packages that support `AllNamespaces` install mode and do not use webhooks:
@@ -40,44 +38,35 @@ curl -k https://localhost:8443/catalogs/operatorhubio/api/v1/all | <query>
4038
4139
* Package metadata:
4240
``` terminal
43-
jq -s '.[] | select( .schema == "olm.package") | select( .name == "<package_name>")'
41+
curl -k 'https://localhost:8443/catalogs/operatorhubio/api/v1/metas?schema=olm.package&name=<package_name>'
4442
```
4543
4644
`<package_name>`
4745
: Name of the package from the catalog you are querying.
4846
49-
* Catalog blobs in a package:
47+
* Blobs that belong to a package (that are not schema=olm.package):
5048
``` terminal
51-
jq -s '.[] | select( .package == "<package_name>")'
49+
curl -k 'https://localhost:8443/catalogs/operatorhubio/api/v1/metas?package=<package_name>'
5250
```
5351
5452
`<package_name>`
5553
: Name of the package from the catalog you are querying.
5654
55+
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.
56+
5757
## Channel queries
5858
5959
* Channels in a package:
6060
``` terminal
61-
jq -s '.[] | select( .schema == "olm.channel" ) | select( .package == "<package_name>") | .name'
61+
curl -k 'https://localhost:8443/catalogs/operatorhubio/api/v1/metas?schema=olm.channel&package=<package_name>'
6262
```
6363
6464
`<package_name>`
6565
: Name of the package from the catalog you are querying.
6666
6767
* Versions in a channel:
6868
``` 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>")'
69+
curl -k 'https://localhost:8443/catalogs/operatorhubio/api/v1/metas?schema=olm.channel&package=<package_name>' | jq -s '.[] | select( .name == "<channel_name>" ) | .entries | .[] | .name'
8170
```
8271
8372
`<package_name>`
@@ -90,19 +79,16 @@ curl -k https://localhost:8443/catalogs/operatorhubio/api/v1/all | <query>
9079
9180
* Bundles in a package:
9281
``` terminal
93-
jq -s '.[] | select( .schema == "olm.bundle" ) | select( .package == "<package_name>") | .name'
82+
curl -k 'https://localhost:8443/catalogs/operatorhubio/api/v1/metas?schema=olm.bundle&package=<package_name>'
9483
```
9584
9685
`<package_name>`
9786
: Name of the package from the catalog you are querying.
9887
9988
* Bundle dependencies and available APIs:
10089
``` terminal
101-
jq -s '.[] | select( .schema == "olm.bundle" ) | select ( .name == "<bundle_name>") | select( .package == "<package_name>")'
90+
curl -k 'https://localhost:8443/catalogs/operatorhubio/api/v1/metas?schema=olm.bundle&name=<bundle_name>' | jq -s '.[] | .properties | .[] | select(.type=="olm.gvk")'
10291
```
10392
104-
`<package_name>`
105-
: Name of the package from the catalog you are querying.
106-
10793
`<bundle_name>`
10894
: Name of the bundle for a given package.

docs/tutorials/explore-available-content.md

+18-23
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
@@ -97,38 +97,33 @@ Then you can query the catalog by using `curl` commands and the `jq` CLI tool to
9797
3. Return list of packages that 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)