Add a catalog source to a cluster
To make Operators from a custom index image available for installation, create a catalog source that adds the catalog content to your cluster.
Cluster administrators
can create a CatalogSource object that references an index image. The software catalog uses catalog sources to populate the user interface.
|
|
Alternatively, you can use the web console to manage catalog sources. From the Administration → Cluster Settings → Configuration → OperatorHub page, click the Sources tab, where you can create, update, delete, disable, and enable individual sources. |
-
You built and pushed an index image to a registry.
-
You have access to the cluster as a user with the
cluster-adminrole.
-
Create a
CatalogSourceobject that references your index image.-
Modify the following to your specifications and save it as a
catalogSource.yamlfile:apiVersion: operators.coreos.com/v1alpha1 kind: CatalogSource metadata: name: my-operator-catalog namespace: openshift-marketplace annotations: olm.catalogImageTemplate: "<registry>/<namespace>/<index_image_name>:v{kube_major_version}.{kube_minor_version}.{kube_patch_version}" spec: sourceType: grpc grpcPodConfig: securityContextConfig: <security_mode> image: <registry>/<namespace>/<index_image_name>:<tag> displayName: My Operator Catalog publisher: <publisher_name> updateStrategy: registryPoll: interval: 30mwhere:
metadata.namespace-
Specifies the value for the
metadata.namespaceparameter. If you want the catalog source to be available globally to users in all namespaces, specify theopenshift-marketplacenamespace. Otherwise, you can specify a different namespace for the catalog to be scoped and available only for that namespace. metadata.annotations-
Specifies the value for the
metadata.annotationsparameter. This is optional to set theolm.catalogImageTemplateannotation to your index image name and use one or more of the Kubernetes cluster version variables as shown when constructing the template for the image tag. spec.grpcPodConfig.securityContextConfig-
Specifies the value of
legacyorrestricted. If the field is not set, the default value islegacy. In a future OpenShift Container Platform release, it is planned that the default value will berestricted.If your catalog cannot run with
restrictedpermissions, it is recommended that you manually set this field tolegacy. spec.image-
Specifies your index image. If you specify a tag after the image name, for example
:v{product-version}, the catalog source pod uses an image pull policy ofAlways, meaning the pod always pulls the image before starting the container. If you specify a digest, for example@sha256:<id>, the image pull policy isIfNotPresent, meaning the pod pulls the image only if it does not already exist on the node. spec.publisher-
Specifies your name or an organization name publishing the catalog.
spec.updateStrategy.registryPoll-
Specifies the value for the
spec.updateStrategy.registryPollparameter. The catalog sources can automatically check for new versions to keep up to date.
-
Use the file to create the
CatalogSourceobject:$ oc apply -f catalogSource.yaml
-
-
Verify the following resources are created successfully.
-
Check the pods:
$ oc get pods -n openshift-marketplaceThe following is example output:
NAME READY STATUS RESTARTS AGE my-operator-catalog-6njx6 1/1 Running 0 28s marketplace-operator-d9f549946-96sgr 1/1 Running 0 26h -
Check the catalog source:
$ oc get catalogsource -n openshift-marketplaceThe following is example output:
NAME DISPLAY TYPE PUBLISHER AGE my-operator-catalog My Operator Catalog grpc 5s -
Check the package manifest:
$ oc get packagemanifest -n openshift-marketplaceThe following is example output:
NAME CATALOG AGE jaeger-product My Operator Catalog 93sYou can now install the Operators from the Software Catalog page on your OpenShift Container Platform web console.
-