Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update OLM version and install script to v0.24.0
Signed-off-by: Daniel Fan <[email protected]>
  • Loading branch information
Daniel-Fan committed May 11, 2023
commit 6febe70f97beebe4513fe50d67eeb2176bb06248
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ kind-start: kind
echo "KIND Cluster already exists" && exit 0 || \
echo "Creating KIND Cluster" && \
${KIND} create cluster --name ${KIND_CLUSTER_NAME} --config=./common/config/kind-config.yaml && \
common/scripts/install-olm.sh 0.16.1
common/scripts/install-olm.sh v0.24.0


kind-delete:
Expand Down
36 changes: 27 additions & 9 deletions common/scripts/install-olm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,49 @@

set -e

if [[ ${#@} -ne 1 ]]; then
echo "Usage: $0 version"
default_base_url=https://github.com/operator-framework/operator-lifecycle-manager/releases/download

if [[ ${#@} -lt 1 || ${#@} -gt 2 ]]; then
echo "Usage: $0 version [base_url]"
echo "* version: the github release version"
echo "* base_url: the github base URL (Default: $default_base_url)"
exit 1
fi

if kubectl get deployment olm-operator -n openshift-operator-lifecycle-manager > /dev/null 2>&1; then
echo "OLM is already installed in a different configuration. This is common if you are not running a vanilla Kubernetes cluster. Exiting..."
exit 1
fi

release=$1
url=https://github.com/operator-framework/operator-lifecycle-manager/releases/download/${release}
release="$1"
base_url="${2:-${default_base_url}}"
url="${base_url}/${release}"
namespace=olm

kubectl apply -f ${url}/crds.yaml
kubectl apply -f ${url}/olm.yaml
if kubectl get deployment olm-operator -n ${namespace} > /dev/null 2>&1; then
echo "OLM is already installed in ${namespace} namespace. Exiting..."
exit 1
fi

kubectl create -f "${url}/crds.yaml"
kubectl wait --for=condition=Established -f "${url}/crds.yaml"
kubectl create -f "${url}/olm.yaml"

# wait for deployments to be ready
kubectl rollout status -w deployment/olm-operator --namespace="${namespace}"
kubectl rollout status -w deployment/catalog-operator --namespace="${namespace}"

retries=50
until [[ $retries == 0 || $new_csv_phase == "Succeeded" ]]; do
retries=30
until [[ $retries == 0 ]]; do
new_csv_phase=$(kubectl get csv -n "${namespace}" packageserver -o jsonpath='{.status.phase}' 2>/dev/null || echo "Waiting for CSV to appear")
if [[ $new_csv_phase != "$csv_phase" ]]; then
csv_phase=$new_csv_phase
echo "Package server phase: $csv_phase"
fi
sleep 1
if [[ "$new_csv_phase" == "Succeeded" ]]; then
break
fi
sleep 10
retries=$((retries - 1))
done

Expand Down