-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Helm Chart OpenShift Route Handling (#238)
* add route domain setup to values Signed-off-by: Jordan Dubrick <[email protected]> * expand template to include route handling Signed-off-by: Jordan Dubrick <[email protected]> * update deployment and route for fqdn setting Signed-off-by: Jordan Dubrick <[email protected]> * add helper script for openshift install Signed-off-by: Jordan Dubrick <[email protected]> * update documentation Signed-off-by: Jordan Dubrick <[email protected]> * add functionality for customizable name and path Signed-off-by: Jordan Dubrick <[email protected]> * update readme Signed-off-by: Jordan Dubrick <[email protected]> --------- Signed-off-by: Jordan Dubrick <[email protected]>
- Loading branch information
Showing
7 changed files
with
169 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 |