forked from devfile/registry-support
-
Notifications
You must be signed in to change notification settings - Fork 0
/
helm-openshift-install.sh
executable file
·56 lines (48 loc) · 1.79 KB
/
helm-openshift-install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
#
# Copyright Red Hat
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
if [ $# -eq 0 ]; then
echo "Usage: $0 <arguments>"
exit 1
fi
name=${INSTALL_NAME:-"devfile-registry"}
path=${CHART_PATH:-"deploy/chart/devfile-registry"}
START_TIME=$(date +%s)
TIMEOUT_SEC=25
SPINUP_SEC=60 # Helm Upgrade can have unexpected results if it is run while the cluster is initially starting
# If user set custom name postfix devfile-registry to it to sync with what was deployed
if [ "$name" != "devfile-registry" ]; then
name="${name}-devfile-registry"
fi
# Run the install without the generated Openshift Route being passed to Registry Viewer fqdn as it does not exist yet
helm install $name $path --set global.isOpenShift=true "$@"
while true; do
ROUTE=$(oc get route $name -o jsonpath='{.spec.host}' 2>/dev/null)
if [ -n "$ROUTE" ]; then
echo Domain found: "$ROUTE"
break
fi
new_time=$(date +%s)
elapsed_time=$((new_time - START_TIME))
if [ $elapsed_time -ge $TIMEOUT_SEC ]; then
echo "TIMEOUT: Domain not found."
exit 1
fi
sleep 1
done
# Allow deployment to start occuring before the upgrade
sleep $SPINUP_SEC
# Run upgrade with the new variable to set fqdn of the Registry Viewer
helm upgrade $name $path --reuse-values --set global.route.domain=$ROUTE