Skip to content

Instantly share code, notes, and snippets.

@ralvares
Created March 16, 2021 07:58
Show Gist options
  • Select an option

  • Save ralvares/585dde7af3c2cf32065ecb7cbe67f460 to your computer and use it in GitHub Desktop.

Select an option

Save ralvares/585dde7af3c2cf32065ecb7cbe67f460 to your computer and use it in GitHub Desktop.
Creating Community Custom Catalog for a Disconnected Cluster
# Community operators CatalogSource
## Download and Install opm tool
wget https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp/latest-4.7/opm-linux.tar.gz
tar xzvf opm-linux.tar.gz
mv opm /usr/local/bin
## Login to redhat registry
podman login registry.redhat.io
## Createing a Custom Catalog
opm index prune -f registry.redhat.io/redhat/community-operator-index:v4.7 \
-p argocd-operator \
-t registry.example.local/redhat/community-operator-index:v4.7
## Pushing Image to Registry
podman push registry.example.local/redhat/community-operator-index:v4.7
##Mirring contaimer Images from Custom Catalog
oc adm catalog mirror \
registry.example.local/redhat/community-operator-index:v4.7 \
registry.example.local \
-a /root/bundle-pullsecret.txt --filter-by-os=/*
## Disable All the Default Sources
oc patch OperatorHub cluster --type json -p '[{"op": "add", "path": "/spec/disableAllDefaultSources", "value": true}]'
## Delete existing Community Catalog Source ( If any )
oc delete CatalogSource redhat-community-catalog -n openshift-marketplace
## Create New Catalog Source
cat <<EOF > redhat-community-catalog.yaml
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
name: redhat-community-catalog
namespace: openshift-marketplace
spec:
displayName: Redhat Community Catalog
sourceType: grpc
image: registry.example.local/redhat/community-operator-index:v4.7
publisher: Red Hat
EOF
## Apply changes
oc apply -f redhat-community-catalog.yaml
oc apply -f redhat-community-index-manifests/imageContentSourcePolicy.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment