-
Notifications
You must be signed in to change notification settings - Fork 1.9k
OSDOCS-2361: Add olm.catalogImageTemplate docs #36199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| // Module included in the following assemblies: | ||
| // | ||
| // * operators/understanding/olm/olm-understanding-olm.adoc | ||
|
|
||
| ifdef::openshift-origin[] | ||
| :global_ns: olm | ||
| endif::[] | ||
| ifndef::openshift-origin[] | ||
| :global_ns: openshift-marketplace | ||
| endif::[] | ||
|
|
||
| [id="olm-catalogsource-image-template_{context}"] | ||
| = Image template for custom catalog sources | ||
|
|
||
| Operator compatibility with the underlying cluster can be expressed by a catalog source in various ways. One way, which is used for the default Red Hat-provided catalog sources, is to identify image tags for index images that are specifically created for a particular platform release, for example {product-title} 4.9. | ||
|
|
||
| During a cluster upgrade, the index image tag for the default Red Hat-provided catalog sources are updated automatically by the Cluster Version Operator (CVO) so that Operator Lifecycle Manager (OLM) pulls the updated version of the catalog. For example during an upgrade from {product-title} 4.8 to 4.9, the `spec.image` field in the `CatalogSource` object for the `redhat-operators` catalog is updated from: | ||
|
|
||
| [source,terminal] | ||
| ---- | ||
| registry.redhat.io/redhat/redhat-operator-index:v4.8 | ||
| ---- | ||
|
|
||
| to: | ||
|
|
||
| [source,terminal] | ||
| ---- | ||
| registry.redhat.io/redhat/redhat-operator-index:v4.9 | ||
| ---- | ||
|
|
||
| However, the CVO does not automatically update image tags for custom catalogs. To ensure users are left with a compatible and supported Operator installation after a cluster upgrade, custom catalogs should also be kept updated to reference an updated index image. | ||
|
|
||
| Starting in {product-title} 4.9, cluster administrators can add the `olm.catalogImageTemplate` annotation in the `CatalogSource` object for custom catalogs to an image reference that includes a template. The following Kubernetes version variables are supported for use in the template: | ||
|
|
||
| * `kube_major_version` | ||
| * `kube_minor_version` | ||
| * `kube_patch_version` | ||
|
|
||
| [NOTE] | ||
| ==== | ||
| You must specify the Kubernetes cluster version and not an {product-title} cluster version, as the latter is not currently available for templating. | ||
| ==== | ||
|
|
||
| Provided that you have created and pushed an index image with a tag specifying the updated Kubernetes version, setting this annotation enables the index image versions in custom catalogs to be automatically changed after a cluster upgrade. The annotation value is used to overwrite any image reference in the `spec.image` field of the `CatalogSource` object, whether or not the `spec.image` field was set. This helps avoid cluster upgrades leaving Operator installations in unsupported states or without a continued update path. | ||
|
|
||
| [IMPORTANT] | ||
| ==== | ||
| You must ensure that the index image with the updated tag, in whichever registry it is stored in, is accessible by the cluster at the time of the cluster upgrade. | ||
| ==== | ||
|
|
||
| .Example catalog source with an image template | ||
| [%collapsible] | ||
| ==== | ||
| [source,yaml,subs="attributes+"] | ||
| ---- | ||
| apiVersion: operators.coreos.com/v1alpha1 | ||
| kind: CatalogSource | ||
| metadata: | ||
| generation: 1 | ||
| name: example-catalog | ||
| namespace: openshift-marketplace | ||
| annotations: | ||
| olm.catalogImageTemplate: | ||
| "quay.io/example-org/example-catalog:v{kube_major_version}.{kube_minor_version}" | ||
| spec: | ||
| displayName: Example Catalog | ||
| image: quay.io/example-org/example-catalog:v1.22 | ||
| priority: -400 | ||
| publisher: Example Org | ||
| ---- | ||
| ==== | ||
|
|
||
| For an {product-title} 4.9 cluster, which uses Kubernetes 1.22, the `olm.catalogImageTemplate` annotation in the preceding example would resolve to the following image reference: | ||
|
|
||
| [source,terminal] | ||
| ---- | ||
| quay.io/example-org/example-catalog:v1.22 | ||
| ---- | ||
|
|
||
| For future releases of {product-title}, you could create updated index images for your custom catalogs that target the later Kubernetes version that is used by the later {product-title} version. With the `olm.catalogImageTemplate` annotation set before the upgrade, upgrading the cluster to the later {product-title} version would then automatically update the catalog's index image as well. | ||
|
|
||
| ifdef::openshift-origin[] | ||
| :!global_ns: | ||
| endif::[] | ||
| ifndef::openshift-origin[] | ||
| :!global_ns: | ||
| endif::[] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.