|
| 1 | +# Operator version ranges |
| 2 | + |
| 3 | +This document explains how to specify a version range to install or update an Operator with OLM 1.0. |
| 4 | + |
| 5 | +You define a version range in an Operator's custom resource (CR) file. |
| 6 | + |
| 7 | +## Specifying a version range in the CR |
| 8 | + |
| 9 | +If you specify a version range in the Operator's CR, OLM 1.0 installs or updates the latest version of the Operator that can be resolved within the version range. |
| 10 | +The resolved version is the latest version of the Operator that satisfies the dependencies and constraints of the Operator and the environment. |
| 11 | +Operator updates within the specified range are automatically installed if they can be resolved successfully. |
| 12 | +Updates are not installed if they are outside of the specified range or if they cannot be resolved successfully. |
| 13 | + |
| 14 | +For more information about dependency and constraint resolution in OLM 1.0, see the [Deppy introduction](https://github.com/operator-framework/deppy#introductionhttps://github.com/operator-framework/deppy#introductionhttps://github.com/operator-framework/deppy#introduction) |
| 15 | + |
| 16 | +### Comparisons |
| 17 | + |
| 18 | +You define a version range by adding a comparison string to the `spec.version` field. A comparison string is composed of a list of comma or space separated values and one or more comparison operators. You can add an additional comparison string by including an OR (`||`) operator between the strings. |
| 19 | + |
| 20 | +#### Basic comparisons |
| 21 | + |
| 22 | +| Operator | Definition | |
| 23 | +|----------|------------------------------------| |
| 24 | +| `=` | equal (not aliased to an operator) | |
| 25 | +| `!=` | not equal | |
| 26 | +| `>` | greater than | |
| 27 | +| `<` | less than | |
| 28 | +| `>=` | greater than or equal to | |
| 29 | +| `<=` | less than or equal to | |
| 30 | + |
| 31 | +#### Range comparisons |
| 32 | + |
| 33 | +To specify a version range, use a range comparison similar to the following example: |
| 34 | + |
| 35 | +```yaml |
| 36 | +version: >=3.0, <3.6 |
| 37 | +``` |
| 38 | +
|
| 39 | +#### Wildcards in comparisons |
| 40 | +
|
| 41 | +You can use the `x`, `X`, and `*` characters as wildcard characters in all comparison operations. |
| 42 | +If you use a wildcard character with the `=` operator, you define a patch level comparision. |
| 43 | +This is equivalent to making a tilde range comparison. |
| 44 | + |
| 45 | +*Example comparisons with wildcard characters* |
| 46 | +| Comparison | Equivalent | |
| 47 | +|------------|---------------------| |
| 48 | +| `1.2.x` | `>= 1.2.0, < 1.3.0` | |
| 49 | +| `>= 1.2.x` | `>= 1.2.0` | |
| 50 | +| `<= 2.x` | `< 3` | |
| 51 | +| `*` | `>= 0.0.0` | |
| 52 | + |
| 53 | + |
| 54 | +#### Patch release or tilde (`~`) range comparison |
| 55 | + |
| 56 | +You can use the tilde (`~`) operator to make patch release comparisons. |
| 57 | +This is useful when you want to specify a minor version up to the next major version. |
| 58 | + |
| 59 | +*Example patch release comparisons* |
| 60 | +| Comparison | Equivalent | |
| 61 | +|------------|---------------------| |
| 62 | +| `~1.2.3` | `>= 1.2.3, < 1.3.0` | |
| 63 | +| `~1` | `>= 1, <2` | |
| 64 | +| `~2.3` | `>= 2.3, < 2.4` | |
| 65 | +| `~1.2.x` | `>= 1.2.0, < 1.3.0` | |
| 66 | +| `~1.x` | `>= 1, < 2` | |
| 67 | + |
| 68 | + |
| 69 | +#### Major release or caret (`^`) range comparisons |
| 70 | + |
| 71 | +You can use the caret (`^`) operator to make major release comparisons after a stable, `1.0.0`, version is published. |
| 72 | +If you make a major release comparison before a stable version is published, minor versions define the API stability level. |
| 73 | + |
| 74 | +*Example major release comparisons* |
| 75 | + |
| 76 | +| Comparison | Equivalent | |
| 77 | +|------------|----------------------------------------| |
| 78 | +| `^1.2.3` | `>= 1.2.3, < 2.0.0``>= 1.2.3, < 2.0.0` | |
| 79 | +| `^1.2.x` | `>= 1.2.0, < 2.0.0` | |
| 80 | +| `^2.3` | `>= 2.3, < 3` | |
| 81 | +| `^2.x` | `>= 2.0.0, < 3` | |
| 82 | +| `^0.2.3` | `>=0.2.3 <0.3.0` | |
| 83 | +| `^0.2` | `>=0.2.0 <0.3.0` | |
| 84 | +| `^0.0.3` | `>=0.0.3 <0.0.4` | |
| 85 | +| `^0.0` | `>=0.0.0 <0.1.0` | |
| 86 | +| `^0` | `>=0.0.0 <1.0.0` | |
0 commit comments