Skip to content

Commit 035e2ef

Browse files
authored
Add olm install wait and pin OLM version to prevent regression (#77)
* Adding delay after creating OLM delay to 5s bump operator-sdk version Fail if operator installation has not succeeded * Fix OLM version * PR review Javier
1 parent f83f610 commit 035e2ef

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

scripts/deploy-operator.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,15 @@ fi
2929
# Deploy the operator bundle
3030
operator-sdk run bundle $OPERATOR_BUNDLE_IMAGE_FULL_NAME -n $TNF_EXAMPLE_CNF_NAMESPACE $ADD_SECRET
3131

32-
# Important: this line is required to enable csv short names with minikube
32+
# Important: this line (output of command is now captured) is required to enable csv short names with minikube
3333
# If short name "csv" is used, the call will fail the first time
3434
# With long name the first time it will work and subsequent time it will work with long or short names
35-
oc get clusterserviceversions.operators.coreos.com -n $TNF_EXAMPLE_CNF_NAMESPACE
35+
CSV_MATCH=$(oc get clusterserviceversions.operators.coreos.com -n $TNF_EXAMPLE_CNF_NAMESPACE -ogo-template='{{ range .items}}{{.metadata.name}}{{end}}' 2>/dev/null | grep "nginx-operator.v0.0.1")
36+
if [ "$CSV_MATCH" = "nginx-operator.v0.0.1" ];
37+
then
38+
echo "CSV successfully deployed"
39+
else
40+
echo "ERROR: CSV not deployed. Operator deployment failed -- interrupting tests"
41+
exit 1
42+
fi
43+

scripts/install-olm.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
#!/usr/bin/env bash
2-
set -x
2+
3+
# Initialization
4+
SCRIPT_DIR=$(dirname "$0")
5+
source $SCRIPT_DIR/init-env.sh
36

47
# Install OLM
58
operator-sdk olm uninstall
6-
operator-sdk olm install
9+
operator-sdk olm install --version=v0.18.3
10+
# Wait for all OLM pods to be ready
11+
kubectl wait --for=condition=ready pod --all=true -nolm --timeout=$TNF_DEPLOYMENT_TIMEOUT
12+
sleep 5s

scripts/install-operator-sdk.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ else
1616
export OS="$(uname | awk '{print tolower($0)}')"
1717

1818
## Download executable
19-
export OPERATOR_SDK_DL_URL=https://github.com/operator-framework/operator-sdk/releases/download/v1.11.0
19+
export OPERATOR_SDK_DL_URL=https://github.com/operator-framework/operator-sdk/releases/download/v1.15.0
2020
curl -LO ${OPERATOR_SDK_DL_URL}/operator-sdk_${OS}_${ARCH}
2121

2222
## Download the auth key

0 commit comments

Comments
 (0)