|
| 1 | +# Use Single Layer OCI Artifacts for blobs |
| 2 | + |
| 3 | +* Deciders: @frewilhelm @ikhandamirov |
| 4 | + |
| 5 | +## Background |
| 6 | + |
| 7 | +Initially, it was planned to use a Custom Resource `Artifact` type to make blobs available between other controllers |
| 8 | +as well as publishing the result to be consumed by anything that handles that `Artifact` type. |
| 9 | +This `Artifact` type was [defined][artifact-definition] to point to a URL and hold a human-readable identifier |
| 10 | +`Revision` of a blob stored in a http-server inside the controller. |
| 11 | + |
| 12 | +The `Artifact` idea was part of a bigger [RFC][fluxcd-rfc] for `FluxCD` which was unfortunately rejected. |
| 13 | +Therefore, the Custom Resource `Artifact` is not needed anymore. Additionally, the team decided to not use a plain |
| 14 | +http-server but an internal OCI registry to store and publish its blobs that are produced by the OCM controllers as |
| 15 | +single layer OCI artifacts. |
| 16 | + |
| 17 | +There are several options on how to proceed with the replacement and implementation that are discussed below. |
| 18 | + |
| 19 | +## Artifact |
| 20 | +An artifact in the current context describes a resource that holds an identity to a blob and a pointer where to find |
| 21 | +the blob (currently an URL). It that sense, a producer can create an artifact and store these information and a consumer |
| 22 | +can search for artifacts with the specific identity to find out its location. |
| 23 | + |
| 24 | +In the current implementation the artifact is defined in the [openfluxcd/artifact repository][artifact-definition]. |
| 25 | + |
| 26 | +The ocm-controller `v1` implementation defined a `snapshot` type that serves similar purposes. |
| 27 | +Its definition can be found in [open-component-model/ocm-controller][snapshot-definition]. |
| 28 | + |
| 29 | + |
| 30 | +### Option 1: Use implementation from ocm-controllers v1 |
| 31 | + |
| 32 | +From [ocm-controller v1 Architecture][ocm-controller-v1-architecture]: |
| 33 | +_snapshots are immutable, Flux-compatible, single layer OCI images containing a single OCM resource. |
| 34 | +Snapshots are stored in an in-cluster registry and in addition to making component resources accessible for |
| 35 | +transformation, they also can be used as a caching mechanism to reduce unnecessary calls to the source OCM registry._ |
| 36 | + |
| 37 | +Pros: |
| 38 | +- ... |
| 39 | + |
| 40 | +Cons: |
| 41 | +- ... |
| 42 | + |
| 43 | + |
| 44 | +### Option 2: Create Custom Resource `Artifact` (or the like) to point to the respective blob in the OCI registry |
| 45 | +... |
| 46 | + |
| 47 | +### Option 3: Remove Artifact concept (use status of other CRs instead) |
| 48 | +Instead of using an intermediate resource, like `Artifact` or `Snapshot`, we could update the status from the source |
| 49 | +resource with the location where to find its result. |
| 50 | + |
| 51 | +For example, the `component` type status could hold the URL/tag to the blob holding the Component Descriptors that are |
| 52 | +provided by the `component-controller`. |
| 53 | + |
| 54 | +Pros: |
| 55 | +- ... |
| 56 | + |
| 57 | +Cons: |
| 58 | +- ... |
| 59 | + |
| 60 | + |
| 61 | +## (Internal) OCI Registry |
| 62 | +... |
| 63 | + |
| 64 | +### Option 1: Use implementation from ocm-controllers v1 |
| 65 | +... |
| 66 | + |
| 67 | +### Option 2: Implement the deployment of an internal OCI registry |
| 68 | +... |
| 69 | + |
| 70 | +### Option 3: Use OCI registry that FluxCD will use in the future |
| 71 | +... |
| 72 | + |
| 73 | + |
| 74 | +### Option ... |
| 75 | + |
| 76 | +## Links |
| 77 | +- Epic [#75](https://github.com/open-component-model/ocm-k8s-toolkit/issues/75) |
| 78 | +- Issue [#90](https://github.com/open-component-model/ocm-k8s-toolkit/issues/90) |
| 79 | + |
| 80 | + |
| 81 | +[artifact-definition]: https://github.com/openfluxcd/artifact/blob/d9db932260eb5f847737bcae3589b653398780ae/api/v1alpha1/artifact_types.go#L30 |
| 82 | +[fluxcd-rfc]: https://github.com/fluxcd/flux2/discussions/5058 |
| 83 | +[snapshot-definition]: https://github.com/open-component-model/ocm-controller/blob/8588071a05532abd28916931963f88b16622e44d/api/v1alpha1/snapshot_types.go#L22 |
| 84 | +[ocm-controller-v1-architecture]: https://github.com/open-component-model/ocm-controller/blob/8588071a05532abd28916931963f88b16622e44d/docs/architecture.md |
0 commit comments