@@ -66,17 +66,23 @@ WORKDIR="$2"
66
66
IOP_FILE=" $2 " /iop.yaml
67
67
SAIL_IOP_FILE=" $( basename " ${IOP_FILE% .yaml} " ) -sail.yaml"
68
68
69
- ISTIO_VERSION=" ${ISTIO_VERSION:- v1.24-latest} "
69
+ CONVERTER_BRANCH=" ${CONVERTER_BRANCH:- main} "
70
+
71
+ # get istio version from versions.yaml
72
+ VERSION_FILE=" https://raw.githubusercontent.com/istio-ecosystem/sail-operator/$CONVERTER_BRANCH /pkg/istioversion/versions.yaml"
73
+ if [ -z " ${ISTIO_VERSION:- } " ]; then
74
+ ISTIO_VERSION=" $( curl -s " $VERSION_FILE " | grep -E ' name: v[0-9]+\.[0-9]+' | sed -E ' s/.*(v[0-9]+\.[0-9]+).*/\1/' | sort -Vr | head -n1) -latest"
75
+ fi
76
+
70
77
NAMESPACE=" ${NAMESPACE:- istio-system} "
71
78
ISTIOCNI_NAMESPACE=" ${ISTIOCNI_NAMESPACE:- istio-cni} "
72
79
73
80
ISTIOCNI=" ${PROW} /config/sail-operator/istio-cni.yaml"
74
81
INGRESS_GATEWAY_VALUES=" ${PROW} /config/sail-operator/ingress-gateway-values.yaml"
75
82
EGRESS_GATEWAY_VALUES=" ${PROW} /config/sail-operator/egress-gateway-values.yaml"
76
83
77
- CONVERTER_BRANCH=" ${CONVERTER_BRANCH:- main} "
78
84
CONVERTER_ADDRESS=" https://raw.githubusercontent.com/istio-ecosystem/sail-operator/$CONVERTER_BRANCH /tools/configuration-converter.sh"
79
- CONVERTER_SCRIPT=$( basename $CONVERTER_ADDRESS )
85
+ CONVERTER_SCRIPT=$( basename " $CONVERTER_ADDRESS " )
80
86
81
87
function download_execute_converter(){
82
88
cd " ${PROW} "
@@ -109,7 +115,7 @@ function install_istio(){
109
115
}
110
116
111
117
SECRET_NAME=" istio-ca-secret"
112
- WEBHOOK_FILE=" $PROW /config/validatingwebhook.yaml"
118
+ WEBHOOK_FILE=" $PROW /config/sail-operator/ validatingwebhook.yaml"
113
119
114
120
function patch_config() {
115
121
# adds some control plane values that are mandatory and not available in iop.yaml
@@ -124,7 +130,22 @@ function patch_config() {
124
130
fi
125
131
126
132
# Workaround until https://github.com/istio-ecosystem/sail-operator/issues/749 is fixed
127
- CA_BUNDLE=$( kubectl get secret " $SECRET_NAME " -n " $NAMESPACE " -o yaml | grep " ca-cert" | awk ' {print $2}' )
133
+ CA_BUNDLE=$( kubectl get secret " $SECRET_NAME " -n " $NAMESPACE " -o yaml 2> /dev/null | grep " ca-cert" | awk ' {print $2}' )
134
+
135
+ # If not found, sleep for 5 seconds and retry once
136
+ if [ -z " $CA_BUNDLE " ]; then
137
+ echo " Secret not found. Sleeping for 5 seconds before retrying..."
138
+ sleep 5
139
+
140
+ # Retry once
141
+ CA_BUNDLE=$( kubectl get secret " $SECRET_NAME " -n " $NAMESPACE " -o yaml 2> /dev/null | grep " ca-cert" | awk ' {print $2}' )
142
+
143
+ if [ -z " $CA_BUNDLE " ]; then
144
+ echo " Secret still not found after retry. Exiting."
145
+ exit 1
146
+ fi
147
+ fi
148
+
128
149
sed -i " s|<base64-encoded-CA-cert>|$CA_BUNDLE |g" " $WEBHOOK_FILE "
129
150
kubectl apply -f " $WEBHOOK_FILE "
130
151
sed -i " s|$CA_BUNDLE |<base64-encoded-CA-cert>|g" " $WEBHOOK_FILE "
@@ -139,7 +160,6 @@ function install_gateways(){
139
160
oc -n " $NAMESPACE " wait --for=condition=Available deployment/istio-ingressgateway --timeout=60s || { echo " Failed to start istio-ingressgateway" ; oc get pods -n " $NAMESPACE " -o wide; oc describe pod $( oc get pods -n istio-system --no-headers | awk " $3 ==\" ErrImagePull\" {print $1 }" | head -n 1) -n istio-system; exit 1; }
140
161
oc -n " $NAMESPACE " wait --for=condition=Available deployment/istio-egressgateway --timeout=60s || { echo " Failed to start istio-egressgateway" ; kubectl get istios; oc get pods -n " $NAMESPACE " -o wide; exit 1; }
141
162
echo " Gateways created."
142
-
143
163
}
144
164
145
165
function cleanup_istio(){
0 commit comments