Skip to content

Instantly share code, notes, and snippets.

@ralvares
Created December 21, 2020 12:24
Show Gist options
  • Select an option

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

Select an option

Save ralvares/aa9297f65edc7c1cd009b9b8394f9b32 to your computer and use it in GitHub Desktop.
# CentOS 8 - Install Latest Podman
sudo dnf -y module disable container-tools
sudo dnf -y install 'dnf-command(copr)'
sudo dnf -y copr enable rhcontainerbot/container-selinux
sudo curl -L -o /etc/yum.repos.d/devel:kubic:libcontainers:stable.repo https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/CentOS_8/devel:kubic:libcontainers:stable.repo
sudo dnf -y install podman
####
RHEL8.x/CENTOS8.x
podman version 1.8+
opm requires GLIBC-2.28 not available on RHEL7/CENTOS7
podman login registry.redhat.io
podman login registry.example.com:5000
For oc client version 4.6 - would have problems with certificates without SANs:
x509: certificate relies on legacy Common Name field, use SANs or temporarily enable Common Name matching with GODEBUG=x509ignoreCN=0
export GODEBUG=x509ignoreCN=0
registry=registry.example.com:5000
catalog_version=v4.6.4_1
ocp_version=v4.6
oc image extract registry.redhat.io/openshift4/ose-operator-registry:v4.6 -a /root/bundle-pullsecret.txt --path /usr/bin/opm:. --confirm
chmod +x ./opm
sudo mv ./opm /usr/local/bin/
## Disable All the Default Sources
oc patch OperatorHub cluster --type json -p '[{"op": "add", "path": "/spec/disableAllDefaultSources", "value": true}]'
### redhat-operators
opm index prune -f registry.redhat.io/redhat/redhat-operator-index:${ocp_version} \
-p advanced-cluster-management,quay-operator,local-storage-operator,codeready-workspaces,compliance-operator,elasticsearch-operator,cluster-logging \
-t ${registry}/olm/redhat-operator-index:${catalog_version}
podman push ${registry}/olm/redhat-operator-index:${catalog_version}
oc adm catalog mirror \
${registry}/olm/redhat-operator-index:${ocp_version} \
${registry} \
-a /root/bundle-pullsecret.txt --filter-by-os=/*
oc delete CatalogSource redhat-operator-catalog -n openshift-marketplace
cat <<EOF > redhat-operator-catalog.yaml
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
name: redhat-operator-catalog
namespace: openshift-marketplace
spec:
displayName: Redhat Operator Catalog
sourceType: grpc
image: ${registry}/olm/redhat-operator-index:${catalog_version}
publisher: Red Hat
EOF
oc apply -f redhat-operator-catalog.yaml
oc apply -f redhat-operator-index-manifests/imageContentSourcePolicy.yaml
### redhat-marketplace
opm index prune -f registry.redhat.io/redhat/redhat-marketplace-index:${ocp_version} \
-p cert-manager-operator-rhmp \
-t ${registry}/olm/redhat-marketplace-index:${catalog_version}
podman push ${registry}/olm/redhat-marketplace-index:${catalog_version}
oc adm catalog mirror \
${registry}/olm/redhat-marketplace-index:${ocp_version} \
${registry} \
-a /root/bundle-pullsecret.txt --filter-by-os=/*
oc delete CatalogSource redhat-marketplace-catalog -n openshift-marketplace
cat <<EOF > redhat-marketplace-catalog.yaml
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
name: redhat-marketplace-catalog
namespace: openshift-marketplace
spec:
displayName: Redhat Marketplace Catalog
sourceType: grpc
image: ${registry}/olm/redhat-marketplace-index:${catalog_version}
publisher: Red Hat
EOF
oc apply -f redhat-marketplace-catalog.yaml
oc apply -f redhat-marketplace-index-manifests/imageContentSourcePolicy.yaml
### redhat-certified-operators
opm index prune -f registry.redhat.io/redhat/certified-operator-index:${ocp_version} \
-p cert-manager-operator \
-t ${registry}/olm/certified-operator-index:${catalog_version}
podman push ${registry}/olm/certified-operator-index:${catalog_version}
oc adm catalog mirror \
${registry}/olm/certified-operator-index:${ocp_version} \
${registry} \
-a /root/bundle-pullsecret.txt --filter-by-os=/*
oc delete CatalogSource redhat-certified-catalog -n openshift-marketplace
cat <<EOF > redhat-certified-catalog.yaml
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
name: redhat-certified-catalog
namespace: openshift-marketplace
spec:
displayName: Redhat Certified Catalog
sourceType: grpc
image: ${registry}/olm/certified-operator-index:${catalog_version}
publisher: Red Hat
EOF
oc apply -f redhat-certified-catalog.yaml
oc apply -f certified-operator-index-manifests/imageContentSourcePolicy.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment