Skip to content

Commit 49871ce

Browse files
committed
enhanced comments and variable names
1 parent 6676070 commit 49871ce

File tree

3 files changed

+22
-14
lines changed

3 files changed

+22
-14
lines changed

prow/integ-suite-ocp.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ SKIP_TESTS="${2:-""}"
2929
TEST_SUITE="${1:-"pilot"}"
3030
SKIP_SETUP="${SKIP_SETUP:-"false"}"
3131
INSTALL_METALLB="${INSTALL_METALLB:-"false"}"
32+
CONTROL_PLANE_SOURCE="${CONTROL_PLANE_SOURCE:-"istio"}"
3233
# Important: SKIP_TEST_RUN is a workaround until downstream tests can be executed by using this script.
3334
# To execute the tests in downstream, set SKIP_TEST_RUN to true
3435
# Jira: https://issues.redhat.com/browse/OSSM-8029
@@ -136,7 +137,7 @@ base_cmd=("go" "test" "-p" "1" "-v" "-count=1" "-tags=integ" "-vet=off" "-timeou
136137
"--istio.test.openshift")
137138

138139
# Append sail operator setup script to base command
139-
if [ "${OPERATOR_TYPE:-}" == "sail" ]; then
140+
if [ "${CONTROL_PLANE_SOURCE}" == "sail" ]; then
140141
SAIL_SETUP_SCRIPT="${WD}/setup/sail-operator-setup.sh"
141142
base_cmd+=("--istio.test.kube.deploy=false")
142143
base_cmd+=("--istio.test.kube.controlPlaneInstaller=${SAIL_SETUP_SCRIPT}")

prow/setup/sail-operator-setup.sh

+20-13
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
# install and another is with cleanup. On install script is used to convert istio in-cluster operator config to sail operator config and install istiod, istio-cni and gateways.
1919
# On cleanup istiod, istio-cni, istio-ingressgateway and istio-engressgateway are cleaned
2020
# The output log of this script is printed under working directory set by: --istio.test.work_dir/sail-operator-setup.log
21+
# Upstream WoW to call this script is documented in here: https://github.com/openshift-service-mesh/istio/tree/master/tests/integration#running-tests-on-custom-deployment
2122

2223
exec > >(tee -a "$2"/sail-operator-setup.log) 2>&1
2324
# Exit immediately for non zero status
@@ -26,6 +27,8 @@ set -e
2627
set -u
2728
# Print commands
2829
set -x
30+
# fail if any command in the pipeline fails
31+
set -o pipefail
2932

3033
function usage() {
3134
echo "Usage: $0 <install|cleanup> <input_yaml>"
@@ -53,31 +56,32 @@ PROW="$(dirname "$WD")"
5356
ROOT="$(dirname "$PROW")"
5457

5558
WORKDIR="$2"
59+
# iop.yaml is the static file name for istiod config created by upstream integration test runtime
5660
IOP_FILE="$2"/iop.yaml
5761
SAIL_IOP_FILE="$(basename "${IOP_FILE%.yaml}")-sail.yaml"
5862

59-
ISTIO_VERSION="${ISTIO_VERSION:-v1.24.1}"
63+
ISTIO_VERSION="${ISTIO_VERSION:-latest}"
6064
INGRESS_GATEWAY_SVC_NAMESPACE="${INGRESS_GATEWAY_SVC_NAMESPACE:-istio-system}"
6165
ISTIOCNI_NAMESPACE="${ISTIOCNI_NAMESPACE:-istio-cni}"
6266

63-
ISTIOCNI="${PROW}/config/sail-operator/istioCNI-cr.yaml"
67+
ISTIOCNI="${PROW}/config/sail-operator/istio-cni.yaml"
6468
INGRESS_GATEWAY_VALUES="${PROW}/config/sail-operator/ingress-gateway-values.yaml"
6569
EGRESS_GATEWAY_VALUES="${PROW}/config/sail-operator/egress-gateway-values.yaml"
6670

6771
CONVERTER_ADDRESS="https://raw.githubusercontent.com/istio-ecosystem/sail-operator/main/tools/configuration-converter.sh"
6872
CONVERTER_SCRIPT=$(basename $CONVERTER_ADDRESS)
6973

7074
function download_execute_converter(){
71-
cd ${PROW}
75+
cd "${PROW}"
7276
curl -fsSL "$CONVERTER_ADDRESS" -o "$CONVERTER_SCRIPT" || { echo "Failed to download converter script"; exit 1; }
73-
chmod +x $CONVERTER_SCRIPT
74-
bash $CONVERTER_SCRIPT "$IOP_FILE" -v "$ISTIO_VERSION" -n $INGRESS_GATEWAY_SVC_NAMESPACE
75-
rm $CONVERTER_SCRIPT
77+
chmod +x "$CONVERTER_SCRIPT"
78+
bash "$CONVERTER_SCRIPT" "$IOP_FILE" -v "$ISTIO_VERSION" -n "$INGRESS_GATEWAY_SVC_NAMESPACE" || { echo "Failed to execute converter script"; exit 1; }
79+
rm "$CONVERTER_SCRIPT"
7680
}
7781

7882
function install_istio_cni(){
7983
oc create namespace "${ISTIOCNI_NAMESPACE}" || true
80-
TMP_ISTIOCNI=$WORKDIR/istioCNI.yaml
84+
TMP_ISTIOCNI=$WORKDIR/istio-cni.yaml
8185
cp "$ISTIOCNI" "$TMP_ISTIOCNI"
8286
yq -i ".spec.namespace=\"$ISTIOCNI_NAMESPACE\"" "$TMP_ISTIOCNI"
8387
yq -i ".spec.version=\"$ISTIO_VERSION\"" "$TMP_ISTIOCNI"
@@ -91,24 +95,27 @@ function install_istiod(){
9195
yq -i eval ".apiVersion = \"sailoperator.io/$SAIL_API_VERSION\"" "$WORKDIR/$SAIL_IOP_FILE"
9296
fi
9397
oc apply -f "$WORKDIR/$SAIL_IOP_FILE"
98+
oc wait --for=condition=Available=True deployment/istiod --timeout=30s
9499
echo "istiod created."
95100
}
96101

97102
# Install ingress and egress gateways
98103
function install_gateways(){
99-
helm template -n $INGRESS_GATEWAY_SVC_NAMESPACE istio-ingressgateway ${ROOT}/manifests/charts/gateway --values $INGRESS_GATEWAY_VALUES > ${WORKDIR}/istio-ingressgateway.yaml
100-
oc apply -f ${WORKDIR}/istio-ingressgateway.yaml
101-
helm template -n $INGRESS_GATEWAY_SVC_NAMESPACE istio-egressgateway ${ROOT}/manifests/charts/gateway --values $EGRESS_GATEWAY_VALUES > ${WORKDIR}/istio-egressgateway.yaml
102-
oc apply -f ${WORKDIR}/istio-egressgateway.yaml
104+
helm template -n "$INGRESS_GATEWAY_SVC_NAMESPACE" istio-ingressgateway "${ROOT}"/manifests/charts/gateway --values "$INGRESS_GATEWAY_VALUES" > "${WORKDIR}"/istio-ingressgateway.yaml
105+
oc apply -f "${WORKDIR}"/istio-ingressgateway.yaml
106+
helm template -n "$INGRESS_GATEWAY_SVC_NAMESPACE" istio-egressgateway "${ROOT}"/manifests/charts/gateway --values "$EGRESS_GATEWAY_VALUES" > "${WORKDIR}"/istio-egressgateway.yaml
107+
oc apply -f "${WORKDIR}"/istio-egressgateway.yaml
108+
oc wait --for=condition=Available=True deployment/istio-ingressgateway --timeout=30s
109+
oc wait --for=condition=Available=True deployment/istio-egressgateway --timeout=30s
103110
echo "Gateways created."
104111

105112
}
106113

107114
function cleanup_istio(){
108115
oc delete istio/default
109116
oc delete istioCNI/default
110-
oc delete all --selector app=istio-egressgateway -n $INGRESS_GATEWAY_SVC_NAMESPACE
111-
oc delete all --selector app=istio-ingressgateway -n $INGRESS_GATEWAY_SVC_NAMESPACE
117+
oc delete all --selector app=istio-egressgateway -n "$INGRESS_GATEWAY_SVC_NAMESPACE"
118+
oc delete all --selector app=istio-ingressgateway -n "$INGRESS_GATEWAY_SVC_NAMESPACE"
112119
echo "Cleanup completed."
113120
}
114121

0 commit comments

Comments
 (0)