Skip to content

Commit 96033a0

Browse files
committed
adjust ADR to our template
1 parent d0e9de1 commit 96033a0

File tree

1 file changed

+54
-30
lines changed

1 file changed

+54
-30
lines changed

docs/adr/artifacts.md

Lines changed: 54 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ There are several options on how to proceed with the replacement and implementat
4040

4141
## Decision Drivers
4242

43-
- Reduce maintenance effort.
43+
- Reduce maintenance effort
4444
- Fit into our use-cases (especially with FluxCD)
4545

46-
## Artifact
46+
## Artifact (How to store and reference the single layer OCI artifacts)
4747

4848
An artifact in the current context describes a resource that holds an identity to a blob and a pointer where to find
4949
the blob (currently a URL). In that sense, a producer can create an artifact and store this information and a consumer
@@ -68,9 +68,7 @@ transformation, they also can be used as a caching mechanism to reduce unnecessa
6868
[`SnapshotSpec`][snapshot-spec]
6969
- Identity: OCM Identity (map[string]string) (Created by [constructIdentity()][snapshot-create-identity])
7070
- Digest: OCI Layer Digest (Based on [go-containerregistry OCI implementation][go-containerregistry-digest])
71-
- Probably to check if the blob that the `snapshot` is pointing to is already equal to a newly created blob
7271
- Tag: The version (e.g. `latest`, `v1.0.0`, ..., see [reference][snapshot-version-ref]
73-
- Purpose?
7472
- (Suspend)
7573

7674
[`SnapshotStatus`][snapshot-status]
@@ -96,11 +94,31 @@ transformation, they also can be used as a caching mechanism to reduce unnecessa
9694
[`ArtifactStatus`][artifact-status]
9795
- No fields
9896

99-
### Options
97+
### Considered Options
98+
99+
* Option 1: Omit the `artifact`/`snapshot` concept
100+
* Option 2: Use the `snapshot` implementation
101+
* Option 3: Use the `artifact` implementation
102+
* Option 4: Use `OCIRepository` implementation from `FluxCD`
103+
* Option 5: Create a new custom resource
104+
105+
### Decision Outcome
106+
107+
Chosen option: "Option 2: Use the `snapshot` implementation", because it is already implemented in the
108+
`ocm-controllers` v1 and fits our use-cases most.
109+
110+
#### Positive Consequences
100111

101-
The following sections discusses several options.
112+
- Most of the functionality is already implemented, can be copied, and adjusted/refactored to our design.
102113

103-
#### Option 1: Omit the `artifact`/`snapshot` concept (Rejected)
114+
#### Negative Consequences
115+
116+
- Requires a transformer that transforms the `snapshot` resource in something that, for example, FluxCDs
117+
`source-controller` can consume. For this, the FluxCDs `OCIRepository` resource seems predestined.
118+
119+
### Pros and Cons of the Options
120+
121+
#### Option 1: Omit the `artifact`/`snapshot` concept
104122

105123
Instead of using an intermediate Custom Resource as `artifact` or `snapshot`, one could update the status of the source
106124
resource that is creating the blob could point to the location of that blob itself.
@@ -112,7 +130,7 @@ Cons:
112130
- Since there is a "real" blob in the storage, it should have a respective entity to represent it, e.g.
113131
`artifact`/`snapshot`
114132

115-
#### Option 2: Use the `snapshot` implementation (accepted)
133+
#### Option 2: Use the `snapshot` implementation
116134

117135
Pros:
118136
- Already implemented (and probably tested).
@@ -124,7 +142,7 @@ FluxCDs `source-controller` and its CR `OCIRepository`.
124142
- Implemented in `open-component-model/ocm-controller` which will be archived, when the `ocm-controller` v2 go
125143
productive. Thus, the `snapshot` implementation must be copied in this repository.
126144

127-
#### Option 3: Use the `artifact` implementation (rejected)
145+
#### Option 3: Use the `artifact` implementation
128146

129147
Pros:
130148
- Already implemented (and a bit tested)
@@ -137,7 +155,7 @@ Cons:
137155

138156
Basically rejected because we could only use the `Artifact` type definition and not the implementation for the storage.
139157

140-
#### Option 4: Use `OCIRepository` implementation from `FluxCD` (rejected)
158+
#### Option 4: Use `OCIRepository` implementation from `FluxCD`
141159

142160
See [definition][oci-repository-type]. The type is part of the FluxCDs `source-controller`, which also
143161
provides a control-loop for that resource.
@@ -159,7 +177,7 @@ local storage (plain http server).
159177
Using `OCIRepository` as intermediate `storage`-pointer CR is not an option as the control-loop of that resource would
160178
"clone" any OCI Registry blob to its own local storage.
161179

162-
#### Option 5: Create a new custom resource (rejected)
180+
#### Option 5: Create a new custom resource
163181

164182
Pros:
165183
- Greenfield approach.
@@ -171,25 +189,32 @@ Cons:
171189
Creating a new custom resource seems like an overkill, considering that the `snapshot` implementation covers a lot of
172190
our use-cases. Thus, it seems more reasonable to go with the `snapshot` implementation and adjust/refactor that.
173191

174-
### Conclusion
175192

176-
- Option 1: Omitting a dedicated resource for the storage objects is not a good design-choice.
177-
- Option 2: The `snapshot` implementation fits our purposes and is already implemented.
178-
- Option 3: The current `artifact` implementation is not feasible as it was written for another purpose.
179-
- Option 4: The FluxCDs `OCIRepository` resource has major implications to our environment that are not beneficial.
180-
- Option 5: Creating a new custom resource feels like an overkill since it requires a new implementation.
193+
## (Internal) OCI Registry (How to setup the internal OCI registry and which one to use)
194+
...
181195

182-
Therefore, option 2 is chosen as it is reasonable to use the already implemented `snapshot` resource and adjust it to
183-
our purposes.
196+
### Considered Options
184197

185-
This approach requires a transformer to make the final resource consumable. For this, the FluxCDs `OCIRepository`
186-
resource seems predestined, since `OCIRepository` can be consumed by FluxCDs `source-controller` (most use-cases) as
187-
well as by ArgoCD.
198+
* Option 1: Let the user provide a registry that is OCI compliant
199+
* Option 2: Deploy an OCI image registry with our controllers
200+
* Option 2.1: Use implementation from ocm-controllers v1
201+
* Option 2.2: Use [`zot`](https://github.com/project-zot/zot)
188202

189-
## (Internal) OCI Registry
190-
...
203+
### Decision Outcome
204+
205+
Chosen option: "???", because...
206+
207+
#### Positive Consequences
208+
209+
*
191210

192-
### Option 1: Let the user provide a registry that is OCI compliant
211+
#### Negative Consequences
212+
213+
*
214+
215+
### Pros and Cons of the Options
216+
217+
#### Option 1: Let the user provide a registry that is OCI compliant
193218

194219
Pros:
195220
- Not our responsibility
@@ -200,9 +225,9 @@ Cons:
200225
- We do not "control" the resource and issues caused by another OCI registry could be hard to fix/support
201226
- ...
202227

203-
### Option 2: Deploy an OCI image registry with our controllers
228+
#### Option 2: Deploy an OCI image registry with our controllers
204229

205-
### Option 2.1: Use implementation from ocm-controllers v1
230+
##### Option 2.1: Use implementation from ocm-controllers v1
206231

207232
Pros:
208233
- Already implemented.
@@ -211,7 +236,7 @@ Pros:
211236
Cons:
212237
- ...
213238

214-
### Option 2.2: Use [`zot`](https://github.com/project-zot/zot)
239+
###### Option 2.2: Use [`zot`](https://github.com/project-zot/zot)
215240

216241
Pros:
217242
- Is the newest shot
@@ -222,11 +247,10 @@ Cons:
222247
- Implement from scratch (probably not true)
223248
- ...
224249

225-
## Links
250+
# Links
226251
- Epic [#75](https://github.com/open-component-model/ocm-k8s-toolkit/issues/75)
227252
- Issue [#90](https://github.com/open-component-model/ocm-k8s-toolkit/issues/90)
228253

229-
230254
[artifact-definition]: https://github.com/openfluxcd/artifact/blob/d9db932260eb5f847737bcae3589b653398780ae/api/v1alpha1/artifact_types.go#L30
231255
[fluxcd-rfc]: https://github.com/fluxcd/flux2/discussions/5058
232256
[snapshot-definition]: https://github.com/open-component-model/ocm-controller/blob/8588071a05532abd28916931963f88b16622e44d/api/v1alpha1/snapshot_types.go#L22

0 commit comments

Comments
 (0)