Skip to content

Commit

Permalink
In deploy_che.sh, the keycloack route should be https when the ch…
Browse files Browse the repository at this point in the history
…e server is `https` (#6739)

In `deploy_che.sh`, the keycloack route should be `https` when the
che server is `https`

Signed-off-by: David Festal <dfestal@redhat.com>
  • Loading branch information
davidfestal authored and Roman Iuvshyn committed Oct 14, 2017
1 parent 10efacb commit cee9715
Showing 1 changed file with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,38 @@

set -e

# append_before_match allows to append content before matching line
# this is needed to append content of yaml files
# first arg is mathing string, second string to insert before match
append_before_match() {
while IFS= read -r line
do
if [[ "$line" == *"$1"* ]];then
printf '%s\n' "$2"
fi
printf '%s\n' "$line"
done < /dev/stdin
}

COMMAND_DIR=$(dirname "$0")

TLS_SETTINGS=" tls:
termination: edge
insecureEdgeTerminationPolicy: Allow"

CHE_SERVER_ROUTE_TLS=$(oc get route che -o jsonpath='{.spec.tls}' || echo "")
if [ "${CHE_SERVER_ROUTE_TLS}" != "" ]; then
oc get route/keycloak -o yaml | \
append_before_match "wildcardPolicy:" "${TLS_SETTINGS}" | \
oc replace -f -
fi

if [ "${CHE_SERVER_URL}" == "" ]; then
CHE_SERVER_ROUTE_HOST=$(oc get route che -o jsonpath='{.spec.host}' || echo "")
if [ "${CHE_SERVER_ROUTE_HOST}" == "" ]; then
echo "[CHE] **ERROR**: The Che server route should exist before configuring the Keycloak web origins"
exit 1
fi
PROTOCOL=CHE_SERVER_ROUTE_TLS=$(oc get route che -o jsonpath='{.spec.tls}' || echo "")
if [ "${CHE_SERVER_ROUTE_TLS}" == "" ]; then
CHE_SERVER_URL="http://${CHE_SERVER_ROUTE_HOST}"
else
Expand Down

0 comments on commit cee9715

Please sign in to comment.