You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/design/opm-tooling.md
+34Lines changed: 34 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -93,6 +93,40 @@ We are aware of the fact that, in many cases, users will want to make other chan
93
93
94
94
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.
95
95
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
+
96
130
#### rm
97
131
98
132
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