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:
- 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).
- Create a manifest directory:
mkdir manifests ; for f in *.tar.gz; do tar -C manifests/ -xvf $f ; done && rm -rf *tar.gz
- 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:
- Disable external sources for your OCP:
oc patch OperatorHub cluster --type json \
-p '[{"op": "add", "path": "/spec/disableAllDefaultSources", "value": true}]'
- 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
- Verify that operators are available:
oc get packagemanifest -n openshift-marketplace
To verify what a manifest image includes:
-
Download the latest grpcurl.
-
Execute the container locally:
podman run -p 50051:50051 -it $IMAGE_URL
- Query the contents with
grpcurl
:
grpcurl -plaintext localhost:50051 api.Registry/ListPackages
{
"name": "elasticsearch-operator"
}
{
"name": "jaeger-product"
}
{
"name": "kiali-ossm"
}
{
"name": "servicemeshoperator"
}
- https://github.com/ppetko/disconnected-install-service-mesh
- https://docs.openshift.com/container-platform/4.2/operators/olm-restricted-networks.html
- https://docs.openshift.com/container-platform/4.4/operators/olm-restricted-networks.html
- https://docs.openshift.com/container-platform/4.6/operators/admin/olm-managing-custom-catalogs.html#olm-testing-operator-catalog-image_olm-managing-custom-catalogs
- The
Dockerfile
uses versionv4.4.0
; keep this version in sync with your OpenShift version - The
get-operator.sh
script requiresjq
,curl
, and an environment able to download from quay.io