Skip to content

Commit e5cb32b

Browse files
committed
Add OCI layer selector to API docs
Signed-off-by: Stefan Prodan <[email protected]>
1 parent 49dc309 commit e5cb32b

File tree

4 files changed

+30
-3
lines changed

4 files changed

+30
-3
lines changed

api/v1beta2/ocirepository_types.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ type OCIRepositoryRef struct {
138138
// OCILayerSelector specifies which layer should be extracted from an OCI Artifact
139139
type OCILayerSelector struct {
140140
// MediaType specifies the OCI media type of the layer
141-
// which should be extracted from the OCI Artifact.
141+
// which should be extracted from the OCI Artifact. The
142+
// first layer matching this type is selected.
142143
// +optional
143144
MediaType string `json:"mediaType,omitempty"`
144145
}

config/crd/bases/source.toolkit.fluxcd.io_ocirepositories.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ spec:
8282
properties:
8383
mediaType:
8484
description: MediaType specifies the OCI media type of the layer
85-
which should be extracted from the OCI Artifact.
85+
which should be extracted from the OCI Artifact. The first layer
86+
matching this type is selected.
8687
type: string
8788
type: object
8889
provider:

docs/api/source.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2571,7 +2571,8 @@ string
25712571
<td>
25722572
<em>(Optional)</em>
25732573
<p>MediaType specifies the OCI media type of the layer
2574-
which should be extracted from the OCI Artifact.</p>
2574+
which should be extracted from the OCI Artifact. The
2575+
first layer matching this type is selected.</p>
25752576
</td>
25762577
</tr>
25772578
</tbody>

docs/spec/v1beta2/ocirepositories.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,30 @@ spec:
368368

369369
This field takes precedence over all other fields.
370370

371+
### Layer selector
372+
373+
`spec.layerSelector` is an optional field to specify which layer should be extracted from the OCI Artifact.
374+
If not specified, the controller will extract the first layer found in the artifact.
375+
376+
To extract a layer matching a specific
377+
[OCI media type](https://github.com/opencontainers/image-spec/blob/v1.0.2/media-types.md):
378+
379+
```yaml
380+
---
381+
apiVersion: source.toolkit.fluxcd.io/v1beta2
382+
kind: OCIRepository
383+
metadata:
384+
name: <repository-name>
385+
spec:
386+
layerSelector:
387+
mediaType: "application/deployment.content.v1.tar+gzip"
388+
```
389+
390+
If the layer selector matches more than one layer, the first layer matching the specified media type will be used.
391+
Note that the selected OCI layer must be
392+
[compressed](https://github.com/opencontainers/image-spec/blob/v1.0.2/layer.md#gzip-media-types)
393+
in the `tar+gzip` format.
394+
371395
### Ignore
372396

373397
`.spec.ignore` is an optional field to specify rules in [the `.gitignore`

0 commit comments

Comments
 (0)