Skip to content

Commit e16e671

Browse files
committed
install operator option added
1 parent 49871ce commit e16e671

File tree

4 files changed

+51
-13
lines changed

4 files changed

+51
-13
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
apiVersion: sailoperator.io/v1alpha1
1+
apiVersion: sailoperator.io/v1
22
kind: IstioCNI
33
metadata:
44
name: default
55
spec:
6-
namespace: ${ISTIOCNI_NAESPACE}
6+
namespace: ${ISTIOCNI_NAMESPACE}
77
version: ${ISTIO_VERSION}
88
profile: openshift

prow/integ-suite-ocp.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ SKIP_TESTS="${2:-""}"
2929
TEST_SUITE="${1:-"pilot"}"
3030
SKIP_SETUP="${SKIP_SETUP:-"false"}"
3131
INSTALL_METALLB="${INSTALL_METALLB:-"false"}"
32+
OPERATOR_NAMESPACE="${OPERATOR_NAMESPACE:-"sail-operator"}"
3233
CONTROL_PLANE_SOURCE="${CONTROL_PLANE_SOURCE:-"istio"}"
34+
INSTALL_SAIL_OPERATOR="${INSTALL_SAIL_OPERATOR:-"true"}"
3335
# Important: SKIP_TEST_RUN is a workaround until downstream tests can be executed by using this script.
3436
# To execute the tests in downstream, set SKIP_TEST_RUN to true
3537
# Jira: https://issues.redhat.com/browse/OSSM-8029
@@ -97,6 +99,11 @@ else
9799
echo "Skipping the setup"
98100
fi
99101

102+
# Install Sail Operator
103+
if [ "${INSTALL_SAIL_OPERATOR}" == "true" ]; then
104+
deploy_operator
105+
fi
106+
100107
# Check if the test run should be skipped
101108
# This is a workaround until downstream tests can be executed by using this script.
102109
# Jira: https://issues.redhat.com/browse/OSSM-8029

prow/setup/ocp_setup.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ WD=$(dirname "$0")
3131
WD=$(cd "$WD"; pwd)
3232
TIMEOUT=300
3333
export NAMESPACE="${NAMESPACE:-"istio-system"}"
34+
SAIL_REPO_URL="https://github.com/istio-ecosystem/sail-operator.git"
3435

3536
function setup_internal_registry() {
3637
# Validate that the internal registry is running in the OCP Cluster, configure the variable to be used in the make target.
@@ -177,4 +178,32 @@ spec:
177178
timeout --foreground -v -s SIGHUP -k ${TIMEOUT} ${TIMEOUT} bash -c 'until oc get IPAddressPool default -n metallb-system; do sleep 5; done && echo "The IP address pool has been created."'
178179

179180
echo "MetalLB has been deployed and configured with the IP address pool."
181+
}
182+
183+
#need to change env variables since make deploy of sail-operator uses them
184+
function env_save(){
185+
INICIAL_NAMESPACE="$NAMESPACE"
186+
INICIAL_HUB="$HUB"
187+
INITIAL_TAG="$TAG"
188+
}
189+
function cleanup_sail_repo() {
190+
echo "Cleaning up..."
191+
cd .. 2>/dev/null || true
192+
rm -rf sail-operator
193+
export NAMESPACE="$INICIAL_NAMESPACE"
194+
export HUB="$INICIAL_HUB"
195+
export TAG="$INITIAL_TAG"
196+
}
197+
198+
function deploy_operator(){
199+
env_save
200+
unset HUB
201+
unset TAG
202+
unset NAMESPACE
203+
git clone --depth 1 --branch main $SAIL_REPO_URL || { echo "Failed to clone sail-operator repo"; exit 1; }
204+
cd sail-operator
205+
make deploy || { echo "sail-operator make deploy failed"; cleanup_sail_repo ; exit 1; }
206+
cleanup_sail_repo
207+
echo "Sail operator deployed"
208+
180209
}

prow/setup/sail-operator-setup.sh

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
# 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
2222

2323
exec > >(tee -a "$2"/sail-operator-setup.log) 2>&1
24+
2425
# Exit immediately for non zero status
2526
set -e
2627
# Check unset variables
@@ -60,8 +61,8 @@ WORKDIR="$2"
6061
IOP_FILE="$2"/iop.yaml
6162
SAIL_IOP_FILE="$(basename "${IOP_FILE%.yaml}")-sail.yaml"
6263

63-
ISTIO_VERSION="${ISTIO_VERSION:-latest}"
64-
INGRESS_GATEWAY_SVC_NAMESPACE="${INGRESS_GATEWAY_SVC_NAMESPACE:-istio-system}"
64+
ISTIO_VERSION="${ISTIO_VERSION:-v1.24.1}"
65+
NAMESPACE="${NAMESPACE:-istio-system}"
6566
ISTIOCNI_NAMESPACE="${ISTIOCNI_NAMESPACE:-istio-cni}"
6667

6768
ISTIOCNI="${PROW}/config/sail-operator/istio-cni.yaml"
@@ -75,7 +76,7 @@ function download_execute_converter(){
7576
cd "${PROW}"
7677
curl -fsSL "$CONVERTER_ADDRESS" -o "$CONVERTER_SCRIPT" || { echo "Failed to download converter script"; exit 1; }
7778
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+
bash "$CONVERTER_SCRIPT" "$IOP_FILE" -v "$ISTIO_VERSION" -n "$NAMESPACE" || { echo "Failed to execute converter script"; exit 1; }
7980
rm "$CONVERTER_SCRIPT"
8081
}
8182

@@ -94,28 +95,29 @@ function install_istiod(){
9495
if [ "${SAIL_API_VERSION:-}" != "" ]; then
9596
yq -i eval ".apiVersion = \"sailoperator.io/$SAIL_API_VERSION\"" "$WORKDIR/$SAIL_IOP_FILE"
9697
fi
97-
oc apply -f "$WORKDIR/$SAIL_IOP_FILE"
98-
oc wait --for=condition=Available=True deployment/istiod --timeout=30s
98+
oc apply -f "$WORKDIR/$SAIL_IOP_FILE" || { echo "Failed to install istiod"; exit 1; }
99+
oc -n "$NAMESPACE" wait --for=condition=Available deployment/istiod --timeout=120s || { echo "Failed to start istiod"; exit 1; }
100+
99101
echo "istiod created."
100102
}
101103

102104
# Install ingress and egress gateways
103105
function install_gateways(){
104-
helm template -n "$INGRESS_GATEWAY_SVC_NAMESPACE" istio-ingressgateway "${ROOT}"/manifests/charts/gateway --values "$INGRESS_GATEWAY_VALUES" > "${WORKDIR}"/istio-ingressgateway.yaml
106+
helm template -n "$NAMESPACE" istio-ingressgateway "${ROOT}"/manifests/charts/gateway --values "$INGRESS_GATEWAY_VALUES" > "${WORKDIR}"/istio-ingressgateway.yaml
105107
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
108+
helm template -n "$NAMESPACE" istio-egressgateway "${ROOT}"/manifests/charts/gateway --values "$EGRESS_GATEWAY_VALUES" > "${WORKDIR}"/istio-egressgateway.yaml
107109
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
110+
oc -n "$NAMESPACE" wait --for=condition=Available deployment/istio-ingressgateway --timeout=30s || { echo "Failed to start istio-ingressgateway"; exit 1; }
111+
oc -n "$NAMESPACE" wait --for=condition=Available deployment/istio-egressgateway --timeout=30s || { echo "Failed to start istio-egressgateway"; exit 1; }
110112
echo "Gateways created."
111113

112114
}
113115

114116
function cleanup_istio(){
115117
oc delete istio/default
116118
oc delete istioCNI/default
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"
119+
oc delete all --selector app=istio-egressgateway -n "$NAMESPACE"
120+
oc delete all --selector app=istio-ingressgateway -n "$NAMESPACE"
119121
echo "Cleanup completed."
120122
}
121123

0 commit comments

Comments
 (0)