2022-04-08 08:22:01 +00:00
|
|
|
#! /bin/bash
|
2024-02-14 18:41:50 +00:00
|
|
|
set -euo pipefail
|
2022-04-08 08:22:01 +00:00
|
|
|
|
|
|
|
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|
|
|
|
2023-09-19 17:46:37 +00:00
|
|
|
INSTALL_NAMESPACE=${1:-default}
|
|
|
|
|
2024-02-14 18:41:50 +00:00
|
|
|
echo "$(date +"%T") Delete the default catalog if it exists"
|
2022-04-08 08:22:01 +00:00
|
|
|
sh -c "kubectl delete catalogsources operatorhubio-catalog -n olm | true"
|
|
|
|
|
2022-04-12 09:19:24 +00:00
|
|
|
kubectl apply -f $SCRIPT_DIR/../olm/testing-resources/catalog.yaml
|
|
|
|
|
|
|
|
# Wait for the catalog to be healthy
|
|
|
|
max_retries=200
|
|
|
|
c=0
|
|
|
|
while [[ $(kubectl get catalogsources test-catalog -o jsonpath="{.status.connectionState.lastObservedState}") != "READY" ]]
|
|
|
|
do
|
2024-02-14 18:41:50 +00:00
|
|
|
echo "$(date +"%T") Waiting for the test-catalog to be ready"
|
2022-04-12 09:19:24 +00:00
|
|
|
((c++)) && ((c==max_retries)) && exit -1
|
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
|
2024-02-14 18:41:50 +00:00
|
|
|
echo "$(date +"%T") The test-catalog is ready"
|
2023-09-19 17:46:37 +00:00
|
|
|
kubectl apply -f $SCRIPT_DIR/../olm/testing-resources/operatorgroup.yaml -n $INSTALL_NAMESPACE
|
|
|
|
kubectl apply -f $SCRIPT_DIR/../olm/testing-resources/subscription.yaml -n $INSTALL_NAMESPACE
|