Skip to content
This repository was archived by the owner on Aug 2, 2019. It is now read-only.

Commit a80c9d9

Browse files
committed
Sync with fixes from CI for registry/isto [OCF-199] [SRVKS-32]
1 parent 4dd0130 commit a80c9d9

File tree

3 files changed

+40
-3
lines changed

3 files changed

+40
-3
lines changed

etc/hacks/knative-serving-0.3.0.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,6 @@ spec:
165165
- knative-ingressgateway
166166
- --zipkinAddress
167167
- zipkin:9411
168-
- --statsdUdpAddress
169-
- istio-statsd-prom-bridge:9125
170168
- --proxyAdminPort
171169
- "15000"
172170
- --controlPlaneAuthPolicy

etc/scripts/install.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ wait_for_all_pods knative-build
3636
wait_for_all_pods knative-eventing
3737
wait_for_all_pods knative-serving
3838

39+
enable_interaction_with_registry
40+
3941
# skip tag resolving for internal registry
4042
# OpenShift 3 and 4 place the registry in different locations, hence
4143
# the two hostnames here

etc/scripts/installation-functions.sh

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@ function check_minikube {
5757
}
5858

5959
function check_openshift_4 {
60-
($CMD get ns openshift && $CMD version | tail -1 | grep "v1.12") >/dev/null 2>&1
60+
if $CMD api-resources >/dev/null; then
61+
$CMD api-resources | grep machineconfigs | grep machineconfiguration.openshift.io > /dev/null 2>&1
62+
else
63+
($CMD get ns openshift && $CMD version | tail -1 | grep "v1.12") >/dev/null 2>&1
64+
fi
6165
}
6266

6367
function check_operatorgroups {
@@ -242,6 +246,8 @@ function install_istio {
242246
$CMD scale -n istio-system --replicas=0 deployment/jaeger-collector
243247
$CMD scale -n istio-system --replicas=0 deployment/jaeger-query
244248
$CMD scale -n istio-system --replicas=0 statefulset/elasticsearch
249+
250+
patch_istio_for_knative
245251
fi
246252
}
247253

@@ -280,3 +286,34 @@ function install_knative {
280286
channel: alpha
281287
EOF
282288
}
289+
290+
function enable_interaction_with_registry() {
291+
if check_openshift_4; then
292+
local ns=${1:-knative-serving}
293+
local configmap_name=config-service-ca
294+
local cert_name=service-ca.crt
295+
local mount_path=/var/run/secrets/kubernetes.io/servicecerts
296+
297+
$CMD -n $ns create configmap $configmap_name
298+
$CMD -n $ns annotate configmap $configmap_name service.alpha.openshift.io/inject-cabundle="true"
299+
timeout 180 '! $CMD -n $ns get cm $configmap_name -oyaml | grep $cert_name'
300+
$CMD -n $ns set volume deployment/controller --add --name=service-ca --configmap-name=$configmap_name --mount-path=$mount_path
301+
$CMD -n $ns set env deployment/controller SSL_CERT_FILE=$mount_path/$cert_name
302+
else
303+
echo "Registry configuration only required for OCP4"
304+
fi
305+
}
306+
307+
function patch_istio_for_knative() {
308+
local sidecar_config=$($CMD get configmap -n istio-system istio-sidecar-injector -o yaml)
309+
if [[ -z "${sidecar_config}" ]]; then
310+
return 1
311+
fi
312+
echo "${sidecar_config}" | grep lifecycle
313+
if [[ $? -eq 1 ]]; then
314+
echo "Patching Istio's preStop hook for graceful shutdown"
315+
echo "${sidecar_config}" | sed 's/\(name: istio-proxy\)/\1\\n lifecycle:\\n preStop:\\n exec:\\n command: [\\"sh\\", \\"-c\\", \\"sleep 20; while [ $(netstat -plunt | grep tcp | grep -v envoy | wc -l | xargs) -ne 0 ]; do sleep 1; done\\"]/' | $CMD replace -f -
316+
$CMD delete pod -n istio-system -l istio=sidecar-injector
317+
wait_for_all_pods istio-system
318+
fi
319+
}

0 commit comments

Comments
 (0)