-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deploy nginx-ingress operator with scripts (#516)
* Add nginx operator for testing * Scripts to add operator deployment
- Loading branch information
Showing
4 changed files
with
33 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,52 @@ | ||
#!/usr/bin/env bash | ||
# shellcheck disable=SC2016,SC2086,SC1083 | ||
|
||
# Initialization | ||
SCRIPT_DIR=$(dirname "$0") | ||
|
||
# shellcheck disable=SC1091 # Not following. | ||
source "$SCRIPT_DIR"/init-env.sh | ||
|
||
: ' | ||
#check if operator-sdk is installed and install it if needed | ||
if [[ -z "$(which operator-sdk 2>/dev/null)" ]]; then | ||
echo "operator-sdk executable cannot be found in the path. Will try to install it." | ||
"$SCRIPT_DIR"/install-operator-sdk.sh | ||
else | ||
echo "operator-sdk was found in the path, no need to install it" | ||
fi | ||
' | ||
|
||
# Installing OLM | ||
"$SCRIPT_DIR"/install-olm.sh | ||
"$SCRIPT_DIR"/delete-operator.sh | ||
|
||
# Creates a secret if a pem file exists | ||
"$SCRIPT_DIR"/create-secret.sh | ||
: ' | ||
# Creates a secret if a pem file exists | ||
"$SCRIPT_DIR"/create-secret.sh | ||
ADD_SECRET="" | ||
ADD_SECRET="" | ||
# shellcheck disable=SC2143 # Use grep -q. | ||
if [[ -n "$(oc get secret -n "$CERTSUITE_EXAMPLE_NAMESPACE" | awk '{print $1}' | grep "$SECRET_NAME")" ]]; then | ||
ADD_SECRET="--ca-secret-name $SECRET_NAME" | ||
fi | ||
# shellcheck disable=SC2143 # Use grep -q. | ||
if [[ -n "$(oc get secret -n "$CERTSUITE_EXAMPLE_NAMESPACE" | awk '{print $1}' | grep "$SECRET_NAME")" ]]; then | ||
ADD_SECRET="--ca-secret-name $SECRET_NAME" | ||
fi | ||
# Deploy the operator bundle | ||
operator-sdk run bundle "$OPERATOR_BUNDLE_IMAGE_FULL_NAME" -n "$CERTSUITE_EXAMPLE_NAMESPACE" "$ADD_SECRET" | ||
# Deploy the operator bundle | ||
operator-sdk run bundle "$OPERATOR_BUNDLE_IMAGE_FULL_NAME" -n "$CERTSUITE_EXAMPLE_NAMESPACE" "$ADD_SECRET" | ||
# Important: this line (output of command is now captured) is required to enable csv short names with non-ocp cluster | ||
# If short name "csv" is used, the call will fail the first time | ||
# With long name the first time it will work and subsequent time it will work with long or short names | ||
CSV_MATCH=$(oc get clusterserviceversions.operators.coreos.com -n "$CERTSUITE_EXAMPLE_NAMESPACE" -ogo-template='{{ range .items}}{{.metadata.name}}{{end}}' 2>/dev/null | grep "nginx-operator.v0.0.1") | ||
if [ "$CSV_MATCH" = "nginx-operator.v0.0.1" ]; then | ||
echo "CSV successfully deployed" | ||
else | ||
echo "ERROR: CSV not deployed. Operator deployment failed -- interrupting tests" | ||
exit 1 | ||
fi | ||
# Important: this line (output of command is now captured) is required to enable csv short names with non-ocp cluster | ||
# If short name "csv" is used, the call will fail the first time | ||
# With long name the first time it will work and subsequent time it will work with long or short names | ||
CSV_MATCH=$(oc get clusterserviceversions.operators.coreos.com -n "$CERTSUITE_EXAMPLE_NAMESPACE" -ogo-template='{{ range .items}}{{.metadata.name}}{{end}}' 2>/dev/null | grep "nginx-operator.v0.0.1") | ||
if [ "$CSV_MATCH" = "nginx-operator.v0.0.1" ]; then | ||
echo "CSV successfully deployed" | ||
else | ||
echo "ERROR: CSV not deployed. Operator deployment failed -- interrupting tests" | ||
exit 1 | ||
fi | ||
' | ||
|
||
# deploy single namespace operator nginx in namespace nginx-ops | ||
oc apply --filename ./test-target/operator-single-install-mode.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters