Skip to content

Instantly share code, notes, and snippets.

@danpawlik
Last active June 11, 2024 13:27
Show Gist options
  • Save danpawlik/774c0ca57aea5f9130abedd398e7c631 to your computer and use it in GitHub Desktop.
Save danpawlik/774c0ca57aea5f9130abedd398e7c631 to your computer and use it in GitHub Desktop.
Install OLM with Operatorhub.io support on MicroShift 4.14 and newer
#!/bin/bash
OPERATOR_SDK="v1.34.2"
OLM="0.27.0"
# Grant more permissions
oc patch scc restricted --type=merge -p '{"runAsUser": {"type": "RunAsAny"}}'
oc patch scc restricted-v2 --type=merge -p '{"runAsUser": {"type": "RunAsAny"}}'
# optional
oc adm policy add-scc-to-user privileged system:serviceaccount:olm:default
# download Operator SDK
curl -SL https://github.com/operator-framework/operator-sdk/releases/download/$OPERATOR_SDK/operator-sdk_linux_amd64
chmod +x operator-sdk_linux_amd64
# install OLM via OperatorSDK. Alternative way is to use script - https://github.com/operator-framework/operator-lifecycle-manager/releases/
operator-sdk_linux_amd64 olm install --version "$OLM"
oc apply -f - <<EOF
---
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
name: operatorhubio-catalog
namespace: olm
spec:
sourceType: grpc
image: quay.io/operatorhubio/catalog:latest
displayName: Community Operators
publisher: OperatorHub.io
updateStrategy:
registryPoll:
interval: 60m
EOF
# Install e.g. cert manager
kubectl create -f https://operatorhub.io/install/cert-manager.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment