Skip to content

Commit bf4f88d

Browse files
committed
Various from PR comments
Signed-off-by: Brett Tofel <[email protected]>
1 parent 8e6c13f commit bf4f88d

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

docs/design/opm-tooling.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,40 @@ We are aware of the fact that, in many cases, users will want to make other chan
9393

9494
Running this command will still generate the updated registry database, but it will store it locally and additionally write `my.Dockerfile` which can be modified as needed.
9595

96+
97+
#### Update Graph Generation
98+
99+
In an effort to make channel head selection understandable and deterministic when bulk-adding bundles to an index using `--mode=replaces` (the default), the following heuristic has been adopted: the bundles with the highest version within a package are considered the heads of the channels they belong to.
100+
101+
<ul>
102+
103+
#### Under the Hood
104+
105+
`opm` effectively decomposes bundle addition into three steps for each package:
106+
107+
1. Add bundles to the underlying data store
108+
2. Choose the channel heads and default channel
109+
3. Rebuild the update graph starting at the new heads
110+
111+
Channel head -- the "latest" operator in a channel -- selection is now informed by [semver](https://semver.org/). The heurstic is simple, the bundle with the highest version in each channel becomes the new head. The default channel is then taken from the maximum versioned bundle which defines a default channel.
112+
113+
Starting from these heads, opm then rebuilds the entire update graph using the edges defined by the `replaces` and `skips` CSV fields.
114+
115+
If a given CSV is missing a version field, all CSVs (sourced from the command's arguments) belonging package are elided from the input. Additionally, a non-zero exit code is returned from the command.
116+
CSVs without a version (and with duplicate versions) that are already part of the index are allowed so long as there is at least one CSV with a version field in the package that we can recognize as having the maximum version.
117+
When `--overwrite-latest` is set, all bundle in a package are deleted and passed in as "input", and thus are constrained by the rules set out in the first paragraph above; the exceptions set out in the second paragraph above do not apply, and violations cause the offending package to be excluded from the index.
118+
119+
#### What does this mean for a package author?
120+
121+
- the head of every channel will __always__ be the bundle in that channel with the highest version field defined
122+
- a version field __must__ be defined on a bundle expected to be channel head, unless it's the only bundle in the channel
123+
124+
#### Common Pitfalls
125+
126+
- [Pre-release](https://semver.org/#spec-item-9) versions __should not__ be used as patches to channel heads; e.g. 1.0.0-p replaces 1.0.0
127+
- pre-release versions come _before_ their release version and consequently won't be chosen as the new channel head by opm (see https://semver.org/#spec-item-11 for more on ordering)
128+
</ul>
129+
96130
#### rm
97131

98132
Like `opm registry rm`, this command will remove all versions an entire operator package from the index and results in a container image that does not include that package. It supports virtually all of the same options and flags as `opm index add` with the exception of replacing `--bundles` with `--operators`. Ex:

0 commit comments

Comments
 (0)