Skip to content

Commit 19d72bd

Browse files
authored
update the formulary to reflect the new schema for basic catalog templates (#335)
Signed-off-by: Jordan Keister <[email protected]>
1 parent 126a95d commit 19d72bd

File tree

2 files changed

+201
-60
lines changed

2 files changed

+201
-60
lines changed

content/en/docs/advanced-tasks/catalog-update-formulary.md

Lines changed: 200 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,12 @@ weight: 5
88
[File-based-catalogs][file-based-catalog-spec] (FBC) and [catalog templates][templates-doc] (templates) provide operator authors with standardized schemas to express operator upgrade graphs. However, without explicit tooling users require clear examples of how to achieve routine goals. This document is an attempt to establish a formulary of common operations, specifically with the intention of making these pieces automatable. This is in no way an exhaustive list.
99

1010
## Conventions
11-
Formulae will be identified as pertaining to either FBC or [semver catalog template][semver-template-doc] (semver template). Since FBC and the [basic catalog template][basic-template-doc] (basic template) both represent the upgrade graph in the set of `olm.channel` objects, instructions for FBC will also be applicable to the `basic template`. Manipulations of `olm.bundle` attributes are limited to FBC representation only.
11+
Formulae will be identified as FBC, [basic catalog template][basic-template-doc] (basic template), or [semver catalog template][semver-template-doc] (semver template).
1212
Schema manipulations will be modeled using YAML and [yq][yq]. Wherever possible, example input will be limited to the relevant object hierarchies. Truncation is indicated by elipses (...) before and after the text.
1313

14-
1514
## Examples
1615
For brevity, all formulae will refer to the same example, for semver template and FBC. For convenience, all semver bundle image pullspecs will express versions which match the bundle version (instead of SHAs).
1716

18-
### semver template example
19-
Formulae presume the following content is saved to the file `semver.yaml`
20-
```yaml
21-
schema: olm.semver
22-
generateMajorChannels: false
23-
generateMinorChannels: true
24-
candidate:
25-
bundles:
26-
- image: quay.io/organization/testoperator:v1.0.0
27-
- image: quay.io/organization/testoperator:v1.0.1
28-
- image: quay.io/organization/testoperator:v1.1.0
29-
fast:
30-
bundles:
31-
- image: quay.io/organization/testoperator:v1.0.1
32-
- image: quay.io/organization/testoperator:v1.1.0
33-
stable:
34-
bundles:
35-
- image: quay.io/organization/testoperator:v1.0.1
36-
```
37-
38-
3917
### FBC example
4018
Formulae presume the following content is saved to the file `fbc.yaml`
4119

@@ -84,28 +62,54 @@ schema: olm.channel
8462
```
8563
8664
87-
## Formulae
88-
89-
### Adding a new bundle to an existing channel
90-
#### semver
91-
Add a new `testoperatorv1.1.1` bundle pullspec to the `Candidate` channel archetype
92-
93-
```bash
94-
yq eval '.candidate.bundles += [{"image" : "quay.io/organization/testoperator:v1.1.1"}]' semver.yaml
65+
### basic template example
66+
Formulae presume the following context is saved to the file `basic.yaml`
67+
```yaml
68+
schema: olm.template.basic
69+
entries:
70+
- schema: olm.package
71+
name: testoperator
72+
defaultChannel: stable
73+
- schema: olm.channel
74+
package: testoperator
75+
name: stable
76+
entries:
77+
- name: testoperator.v0.1.0
78+
- name: testoperator.v0.2.0
79+
replaces: testoperator.v0.1.0
80+
- schema: olm.bundle
81+
image: quay.io/organization/testoperator:v0.1.0
82+
- schema: olm.bundle
83+
image: quay.io/organization/testoperator:v0.2.0
9584
```
9685

97-
produces updated `Candidate` archetype contents:
98-
86+
### semver template example
87+
Formulae presume the following content is saved to the file `semver.yaml`
9988
```yaml
100-
...
89+
schema: olm.semver
90+
generateMajorChannels: false
91+
generateMinorChannels: true
10192
candidate:
10293
bundles:
10394
- image: quay.io/organization/testoperator:v1.0.0
10495
- image: quay.io/organization/testoperator:v1.0.1
10596
- image: quay.io/organization/testoperator:v1.1.0
106-
- image: quay.io/organization/testoperator:v1.1.1
107-
...
108-
```
97+
fast:
98+
bundles:
99+
- image: quay.io/organization/testoperator:v1.0.1
100+
- image: quay.io/organization/testoperator:v1.1.0
101+
stable:
102+
bundles:
103+
- image: quay.io/organization/testoperator:v1.0.1
104+
```
105+
106+
107+
108+
109+
110+
## Formulae
111+
112+
### Adding a new bundle to an existing channel
109113

110114
#### FBC
111115
Add a new `testoperator.v1.1.1` edge to an existing `candidate-v1.1` channel
@@ -131,7 +135,6 @@ schema: olm.channel
131135
```
132136
{{% alert title="Warning" color="warning" %}}
133137
This example illustrates how it is possible to inadvertently create multiple channel heads
134-
{{% /alert %}}
135138
`opm validate` result for this output would be:
136139

137140
```bash
@@ -140,8 +143,56 @@ FATA[0000] invalid index:
140143
└── invalid channel "candidate-v1.1":
141144
├── multiple channel heads found in graph: testoperator.v1.1.0, testoperator.v1.1.1
142145
```
146+
{{% /alert %}}
147+
148+
#### basic
149+
Add a new `testoperator.v0.2.1` bundle pullspec to the existing `stable` channel
150+
151+
```bash
152+
yq eval 'select(.schema == "olm.template.basic").entries[] |= select(.schema == "olm.channel" and .name == "stable").entries += [{"name" : "testoperator.v0.2.1", "replaces": "testoperator.v0.2.0"}]' basic.yaml
153+
```
154+
155+
produces updated `stable` channel:
156+
157+
```yaml
158+
...
159+
- schema: olm.channel
160+
package: testoperator
161+
name: stable
162+
entries:
163+
- name: testoperator.v0.1.0
164+
- name: testoperator.v0.2.0
165+
replaces: testoperator.v0.1.0
166+
- name: testoperator.v0.2.1
167+
replaces: testoperator.v0.2.0
168+
...
169+
```
170+
171+
#### semver
172+
Add a new `testoperator.v1.1.1` bundle pullspec to the `Candidate` channel archetype
173+
174+
```bash
175+
yq eval '.candidate.bundles += [{"image" : "quay.io/organization/testoperator:v1.1.1"}]' semver.yaml
176+
```
177+
178+
produces updated `Candidate` archetype contents:
179+
180+
```yaml
181+
...
182+
candidate:
183+
bundles:
184+
- image: quay.io/organization/testoperator:v1.0.0
185+
- image: quay.io/organization/testoperator:v1.0.1
186+
- image: quay.io/organization/testoperator:v1.1.0
187+
- image: quay.io/organization/testoperator:v1.1.1
188+
...
189+
```
190+
143191

144192
### Adding a new 'replaces' link between two existing bundles
193+
{{% alert title="Note" color="info" %}}
194+
This operation is not possible for the semver template, which exclusively leverages semver ordering to generate an opinonated upgrade graph.
195+
{{% /alert %}}
145196

146197
#### FBC
147198
Adding a new `testoperator.v1.1.1` bundle version edge with a replaces link to its predecessor `testoperator.v1.1.0` version which already exists in the channel.
@@ -166,8 +217,34 @@ schema: olm.channel
166217
...
167218
```
168219

220+
#### basic
221+
Adding a new `testoperator.v0.1.1` bundle version edge with a replaces link to its predecessor `testoperator.v0.1.0` version which already exists in the channel.
222+
223+
```bash
224+
yq eval 'select(.schema == "olm.template.basic").entries[] |= select(.schema == "olm.channel" and .name == "stable").entries += [{"name" : "testoperator:v0.1.1", "replaces": "testoperator:v0.1.0"}]' basic.yaml
225+
```
226+
227+
produces updated `stable` channel:
228+
229+
```yaml
230+
...
231+
- schema: olm.channel
232+
package: testoperator
233+
name: stable
234+
entries:
235+
- name: testoperator.v0.1.0
236+
- name: testoperator.v0.2.0
237+
replaces: testoperator.v0.1.0
238+
- name: testoperator:v0.1.1
239+
replaces: testoperator:v0.1.0
240+
...
241+
```
242+
169243

170244
### Removing a specific bundle version
245+
{{% alert title="Note" color="info" %}}
246+
This operation is not possible for the semver template, which exclusively leverages semver ordering to generate an opinonated upgrade graph.
247+
{{% /alert %}}
171248

172249
#### FBC
173250
Remove the upgrade edge from the example `candidate-v1.1` channel which refers to bundle version `testoperator.v1.1.0`.
@@ -190,34 +267,27 @@ schema: olm.channel
190267
Please note that removing the only edge for a channel as in this example will yield an explicitly empty array. This will produce an error in `opm validate`.
191268
{{% /alert %}}
192269

193-
### Substituting a bundle version in the upgrade graph
194-
195-
#### semver
196-
For all channels, replace instances of `quay.io/organization/testoperator:v1.1.0` with `quay.io/organization/testoperator:v1.1.0-CVE`
270+
#### basic
271+
Remove the upgrade edge from the example `stable` channel which refers to bundle version `testoperator.v0.2.0`.
197272

198273
```bash
199-
yq '(..| select(has("image") and .image == "quay.io/organization/testoperator:v1.1.0")).image = "quay.io/organization/testoperator:v1.1.0-cve"' semver.yaml
274+
yq eval 'select(.schema == "olm.template.basic").entries[] |= del(select(.schema == "olm.channel" and .name == "stable").entries[]| select(.name == "testoperator.v0.2.0"))' basic.yaml
200275
```
201-
produces updated template:
276+
277+
produces updated `stable` channel:
202278

203279
```yaml
204-
schema: olm.semver
205-
generatemajorchannels: false
206-
generateminorchannels: true
207-
candidate:
208-
bundles:
209-
- image: quay.io/organization/testoperator:v1.0.0
210-
- image: quay.io/organization/testoperator:v1.0.1
211-
- image: quay.io/organization/testoperator:v1.1.0-cve
212-
fast:
213-
bundles:
214-
- image: quay.io/organization/testoperator:v1.0.1
215-
- image: quay.io/organization/testoperator:v1.1.0-cve
216-
stable:
217-
bundles:
218-
- image: quay.io/organization/testoperator:v1.0.1
280+
...
281+
- schema: olm.channel
282+
package: testoperator
283+
name: stable
284+
entries:
285+
- name: testoperator.v0.1.0
286+
...
219287
```
220288

289+
### Substituting a bundle version in the upgrade graph
290+
221291
#### FBC
222292
For all graph edges, replaces instances of `testoperator.v1.1.0` with a different bundle version `testoperator.v1.1.0-CVE`
223293

@@ -271,7 +341,60 @@ package: testoperator
271341
schema: olm.channel
272342
```
273343

344+
#### basic
345+
For all channels, replace instances of `testoperator:v0.1.0` with `testoperator:v0.1.0-CVE`
346+
347+
```bash
348+
yq '(..| select(. == "testoperator.v0.1.0")) |="testoperator.v0.1.0-CVE"' basic.yaml
349+
```
350+
351+
produces updated channels:
352+
353+
```yaml
354+
...
355+
- schema: olm.channel
356+
package: testoperator
357+
name: stable
358+
entries:
359+
- name: testoperator.v0.1.0-CVE
360+
- name: testoperator.v0.2.0
361+
replaces: testoperator.v0.1.0-CVE
362+
...
363+
```
364+
365+
#### semver
366+
For all channels, replace instances of `quay.io/organization/testoperator:v1.1.0` with `quay.io/organization/testoperator:v1.1.0-CVE`
367+
368+
```bash
369+
yq '(..| select(has("image") and .image == "quay.io/organization/testoperator:v1.1.0")).image = "quay.io/organization/testoperator:v1.1.0-cve"' semver.yaml
370+
```
371+
produces updated template:
372+
373+
```yaml
374+
schema: olm.semver
375+
generatemajorchannels: false
376+
generateminorchannels: true
377+
candidate:
378+
bundles:
379+
- image: quay.io/organization/testoperator:v1.0.0
380+
- image: quay.io/organization/testoperator:v1.0.1
381+
- image: quay.io/organization/testoperator:v1.1.0-cve
382+
fast:
383+
bundles:
384+
- image: quay.io/organization/testoperator:v1.0.1
385+
- image: quay.io/organization/testoperator:v1.1.0-cve
386+
stable:
387+
bundles:
388+
- image: quay.io/organization/testoperator:v1.0.1
389+
```
390+
391+
392+
274393
### Introducing a new replacement relationship in the upgrade graph
394+
{{% alert title="Note" color="info" %}}
395+
This operation is not possible for the semver template, which exclusively leverages semver ordering to generate an opinonated upgrade graph.
396+
{{% /alert %}}
397+
275398
#### FBC
276399
Substitute an existing 'replaces' link target for `testoperator.v1.1.0` with a different bundle version `testoperator.v1.0.0`.
277400

@@ -292,6 +415,24 @@ schema: olm.channel
292415
...
293416
```
294417

418+
#### basic
419+
Substitute an existing 'replaces' link target for `testoperator.v0.2.0` with a different bundle version `testoperator.v0.1.5`.
420+
421+
```bash
422+
yq eval '.entries[] |= select(.schema == "olm.channel" and .name == "stable").entries |= [{"name" : "testoperator:v0.2.0", "replaces": "testoperator:v0.1.5"}]' basic.yaml
423+
```
424+
produces updated `stable` channel:
425+
426+
```yaml
427+
...
428+
- schema: olm.channel
429+
package: testoperator
430+
name: stable
431+
entries:
432+
- name: testoperator:v0.2.0
433+
replaces: testoperator:v0.1.5
434+
...
435+
```
295436

296437

297438

content/en/docs/advanced-tasks/ship-operator-supporting-multiarch.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ labels:
1616
operatorframework.io/os.<GOOS>: supported
1717
```
1818
19-
Where `<GOARCH>` and `<GOOS>` are one of the values [listed here](https://github.com/golang/go/blob/master/src/go/build/syslist.go).
19+
Where `<GOARCH>` and `<GOOS>` are one of the values [listed here](https://github.com/golang/go/blob/master/src/internal/syslist/syslist.go).
2020

2121
## Multiple Architectures
2222

0 commit comments

Comments
 (0)