Skip to content

Commit ed46a03

Browse files
committed
docs: initial commit for "search"
This work is relevant for both CNCF (artifacts) and OCI (distribution spec) We can iterate under CNCF for this part while being compatible with OCI. Signed-off-by: Ramkumar Chinchani <[email protected]>
1 parent 9c5f79f commit ed46a03

File tree

2 files changed

+127
-1
lines changed

2 files changed

+127
-1
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ started contributing, please see our [Contributor Guide](CONTRIBUTING.md).
9797
<!-- More information about creating your scope with links to examples -->
9898
<!-- https://contribute.cncf.io/maintainers/governance/charter/ -->
9999

100-
- Define a set of query interfaces that can standardized across various software ecosystems.
100+
- Define a set of [query interfaces](docs/search/search.md) that can standardized across various software ecosystems.
101101

102102
## Communications
103103

docs/search/search.md

+126
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
---
2+
tags: cncf,wg-artifacts
3+
breaks: false
4+
---
5+
6+
# Search API
7+
8+
The [distribution spec](https://github.com/opencontainers/distribution-spec)
9+
allows for OPTIONAL [extensions](https://github.com/opencontainers/distribution-spec/blob/main/extensions/README.md) that registry operators may
10+
implement.
11+
12+
```http
13+
GET /v2/_<extension>/<component>/<module>[?<key>=<value>&...]
14+
```
15+
16+
One use case that is rising in prominence is standardized _search_ capability
17+
within registries. This capability can be organized under _cncf as follows.
18+
19+
```http
20+
GET /v2/_cncf/ext/search[?<key>=<value>&...]
21+
```
22+
23+
The prefix `/v2/_cncf` is chosen so that it is compatible with OCI and yet can independently be developed.
24+
25+
## Search vs List?
26+
27+
In this document, if not explicitly called out, it is understood that Search is
28+
a truncated List based on certain criteria.
29+
30+
## Search Use Cases
31+
32+
Search for:
33+
34+
- Repository name
35+
36+
Return a list of repositories matching _name_. If _name_ is not specified, return all repositories (similar to /v2/_catalog query)
37+
38+
```http
39+
GET /v2/_cncf/ext/search[?repository=<name>]
40+
```
41+
42+
** For all the following search queries, an additional _repository=\<repository\>_ query param can be added to further qualify the search.
43+
44+
- Image name
45+
46+
Return a list of images in a _repository_ matching _name_. If _name_ is not specified, return all images (similar to /v2/<>/tags/list query)
47+
48+
```http
49+
GET /v2/_cncf/ext/search[?repository=<repository>&image=<name>]
50+
```
51+
52+
- MediaType
53+
54+
Return a list of images matching _name_ media-type. If _name_ is not specified, return all images.
55+
56+
```http
57+
GET /v2/_cncf/ext/search[?mediaType=<name>]
58+
```
59+
60+
- ArtifactType
61+
62+
Return a list of images matching _name_ artifact-type. If _name_ is not specified, return all images.
63+
64+
```http
65+
GET /v2/_cncf/ext/search[?artifactType=<name>]
66+
```
67+
68+
- Annotation
69+
70+
Return a list of images matching _name_ annotation. If _name_ is not specified, return all images.
71+
72+
```http
73+
GET /v2/_cncf/ext/search[?annotation=<name>]
74+
```
75+
76+
- Digest
77+
78+
Return a list of images matching _hash_ digest. If _hash_ is not specified, return all images.
79+
80+
```http
81+
GET /v2/_cncf/ext/search[?digest=<hash>]
82+
```
83+
84+
- Free-form global search
85+
86+
Return a list of repositories and images matching _name_ name. If _name_ is not specified, return all repositories and images.
87+
88+
```http
89+
GET /v2/_cncf/ext/search[?global=<key>]
90+
```
91+
92+
- Artifact content search
93+
94+
Return a list of images containing a _key_ within artifact contents.
95+
96+
```http
97+
GET /v2/_cncf/ext/search[?artifactType=<application/spdx>&key=<key>]
98+
```
99+
100+
## Prefix Match
101+
102+
TBD
103+
104+
## Regex
105+
106+
TBD
107+
108+
## Pagination
109+
110+
Refer to [listing tags](https://github.com/opencontainers/distribution-spec/blob/main/spec.md#listing-tags) section.
111+
112+
## Implementation Guidelines
113+
114+
Not to prescribe an implementation but [GraphQL](https://en.wikipedia.org/wiki/GraphQL) could be a choice.
115+
TBD
116+
117+
## Scalability
118+
119+
When a registry has a very large number of repositories and images, then compiling and returning the results could be problematic.
120+
TBD
121+
122+
## References
123+
124+
[OCI Distribution Spec Extensions](./_cncf.md)
125+
126+
[CNCF WG Artifacts](https://github.com/cncf-tags/wg-artifacts)

0 commit comments

Comments
 (0)