1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/microshift-ops-config-embed-ostree.adoc
Andrew Taylor 7254a1b0ea updates
2024-06-14 12:59:24 +00:00

135 lines
4.1 KiB
Plaintext

//Module included in the following assemblies:
//
//* microshift_running_apps/microshift_operators/microshift-operators-olm.adoc
:_mod-docs-content-type: PROCEDURE
[id="microshift-apply-ops-ostree-disconnected-use_{context}"]
= Applying catalogs and Operators in a disconnected-deployment RHEL for Edge image
After you have created a {op-system-ostree} image for a disconnected environment and configured {microshift-short} networking settings for disconnected use, you can configure the namespace and create catalog and Operator custom resources (CR) for running your Operators.
.Prerequisites
* You have a {op-system-ostree} image.
* Networking is configured for disconnected use.
* You completed the oc-mirror plugin dry run procedure.
.Procedure
. Create a `CatalogSource` custom resource (CR), similar to the following example:
+
.Example `my-catalog-source-cr.yaml` file
[source,yaml]
----
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
name: cs-redhat-operator-index
namespace: openshift-marketplace <1>
spec:
image: registry.example.com/redhat/redhat-operator-index:v4.16
sourceType: grpc
displayName:
publisher:
updateStrategy:
registryPoll:
interval: 60m
----
<1> The global namespace. Setting the `metadata.namespace` to `openshift-marketplace` enables the catalog to run in all namespaces. Subscriptions in any namespace can reference catalogs created in the `openshift-marketplace` namespace.
+
[NOTE]
====
The default pod security admission definition for `openshift-marketplace` is `baseline`, therefore a catalog source custom resource (CR) created in that namespace does not require a `spec.grpcPodConfig.securityContextConfig` value to be set. You can set a `legacy` or `restricted` value if required for the namespace and Operators you want to use.
====
. Add the SHA of the catalog index commit to the Catalog Source (CR), similar to the following example:
+
.Example namespace `spec.image` configuration
[source,yaml]
----
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
name: cs-redhat-operator-index
namespace: openshift-marketplace
spec:
image: registry.example.com/redhat/redhat-operator-index@sha256:7a76c0880a839035eb6e896d54ebd63668bb37b82040692141ba39ab4c539bc6 <1>
sourceType: grpc
displayName:
publisher:
updateStrategy:
registryPoll:
interval: 60m
----
<1> The SHA of the image commit. Use the same SHA you added to the Image Builder blueprint.
+
[IMPORTANT]
====
You must use the SHA instead of a tag in your catalog CR or the pod fails to start.
====
. Apply the YAML file from the oc-mirror plugin dry run results directory to the cluster by running the following command:
+
[source,terminal]
----
$ oc apply -f ./oc-mirror-workspace/results-1708508014/catalogSource-cs-redhat-operator-index.yaml
----
+
.Example output
[source,terminal]
----
catalogsource.operators.coreos.com/cs-redhat-operator-index created
----
. Verify that the `CatalogSource` resources were successfully installed by running the following command:
+
[source,terminal]
----
$ oc get catalogsource --all-namespaces
----
//Example output
. Verify that the catalog source is running by using the following command:
+
[source,terminal]
----
$ oc get pods -n openshift-marketplace
----
+
.Example output
[source,terminal]
----
NAME READY STATUS RESTARTS AGE
cs-redhat-operator-index-4227b 2/2 Running 0 2m5s
----
. Create a `Subscription` CR, similar to the following example:
+
.Example `my-subscription-cr.yaml` file
[source,yaml]
----
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: amq-broker
namespace: openshift-operators
spec:
channel: 7.11.x
name: amq-broker-rhel8
source: cs-redhat-operator-index
sourceNamespace: openshift-marketplace
----
. Apply the `Subscription` CR by running the following command:
+
[source,terminal]
----
$ oc apply -f ./<my-subscription-cr.yaml> <1>
----
<1> Specify the name of your `Subscription` CR, such as `my-subscription-cr.yaml`.
+
.Example output
[source,terminal]
----
subscription.operators.coreos.com/amq-broker created
----