Skip to content

Latest commit

 

History

History
106 lines (77 loc) · 2.87 KB

README.md

File metadata and controls

106 lines (77 loc) · 2.87 KB

Creating Offline Operator Marketplace

To create an offline marketplace in OCP 4, if you have access to an OpenShift cluster, the easiest way to create a manifest image is to follow the official documentation using oc adm.

To manually build the manifest image:

  1. Download all operators you require, for example:
./get-operator.sh redhat-operators elasticsearch-operator
./get-operator.sh redhat-operators kiali-ossm
./get-operator.sh redhat-operators jaeger-product
./get-operator.sh redhat-operators servicemeshoperator

Check the Sources section on how to get a list of all the operators (the 4.2 documentation version).

  1. Create a manifest directory:
mkdir manifests ; for f in *.tar.gz; do tar -C manifests/ -xvf $f ; done && rm -rf *tar.gz
  1. Create the marketplace container:
export REGISTRY="YOUR_REGISTRY_URL"

podman build --no-cache -f Dockerfile \
    -t ${REGISTRY}/mirrored-operator-catalog

podman push ${REGISTRY}/mirrored-operator-catalog

Once you have a manifest image:

  1. Disable external sources for your OCP:
oc patch OperatorHub cluster --type json \
    -p '[{"op": "add", "path": "/spec/disableAllDefaultSources", "value": true}]'
  1. Deploy catalog source using your image:
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
  name: OSSM-catalog
  namespace: openshift-marketplace
spec:
  sourceType: grpc
  image: YOUR_REGISTRY/mirrored-operator-catalog
  displayName: My Operator Catalog
  publisher: grpc
  1. Verify that operators are available:
oc get packagemanifest -n openshift-marketplace

Verifying the content of a manifest image

To verify what a manifest image includes:

  1. Download the latest grpcurl.

  2. Execute the container locally:

podman run -p 50051:50051 -it $IMAGE_URL
  1. Query the contents with grpcurl:
grpcurl -plaintext localhost:50051 api.Registry/ListPackages

{
  "name": "elasticsearch-operator"
}
{
  "name": "jaeger-product"
}
{
  "name": "kiali-ossm"
}
{
  "name": "servicemeshoperator"
}

Sources

Notes

  • The Dockerfile uses version v4.4.0; keep this version in sync with your OpenShift version
  • The get-operator.sh script requires jq, curl, and an environment able to download from quay.io