During the installation of Direktiv on Red Hat Enterprise Linux the following error occurs:
error: error parsing template {{ index .data \"host\" }}, template: output:1: unexpected "\\" in operand
error: error parsing template {{ index .data \"port\" }}, template: output:1: unexpected "\\" in operand
error: error parsing template {{ index .data \"user\" }}, template: output:1: unexpected "\\" in operand
error: error parsing template {{ index .data \"password\" }}, template: output:1: unexpected "\\" in operand
error: error parsing template {{ index .data \"dbname\" }}, template: output:1: unexpected "\\" in operandThis is due to a difference between the Ubuntu and Red Hat shell escape variables. The fix is very easy. The following 2 files need to be modified:
- ~/install/04_keycloak/install.sh
- ~/install/06_direktiv/install.sh
The content of the files should look like this.
~/install/04_keycloak/install.sh:
#!/bin/sh
while ! kubectl get secrets -n postgres direktivdb-pguser-keycloak
do
echo "postgres not ready, waiting..."
sleep 5
done
if [ ! -n "${DIREKTIV_HOST+1}" ]; then
echo "DIREKTIV_HOST not set to hostname to use"
exit 1
fi
tee env.yaml <<EOF
extraEnvVars:
- name: KC_HOSTNAME_PATH
value: "/auth/"
- name: KC_HOSTNAME_STRICT
value: "false"
- name: KC_HOSTNAME_ADMIN_URL
value: "https://${DIREKTIV_HOST}/auth"
- name: KC_HOSTNAME_URL
value: "https://${DIREKTIV_HOST}/auth"
- name: KEYCLOAK_EXTRA_ARGS
value: "-Dkeycloak.import=/tmp/config/direktiv.json"
- name: KEYCLOAK_PRODUCTION
value: "true"
- name: KC_LOG_LEVEL
value: "DEBUG"
EOF
tee db.yaml <<EOF
externalDatabase:
host: `kubectl get secrets -n postgres direktivdb-pguser-keycloak -o go-template='{{ index .data "host" }}' | base64 -d`
port: `kubectl get secrets -n postgres direktivdb-pguser-keycloak -o go-template='{{ index .data "port" }}' | base64 -d`
user: `kubectl get secrets -n postgres direktivdb-pguser-keycloak -o go-template='{{ index .data "user" }}' | base64 -d`
password: "`kubectl get secrets -n postgres direktivdb-pguser-keycloak -o go-template='{{ index .data "password" }}' | base64 -d`"
database: `kubectl get secrets -n postgres direktivdb-pguser-keycloak -o go-template='{{ index .data "dbname" }}' | base64 -d`
EOF
kubectl create ns keycloak
kubectl annotate ns keycloak linkerd.io/inject=enabled
secret=`< /dev/urandom tr -dc A-Z-a-z-0-9 | head -c${1:-32};echo;`
echo $secret > kc_secret.txt
helm install --set-file tlskey=certs/server.key --set-file tlscert=certs/server.crt \
--set host=${DIREKTIV_HOST} --set clientsecret=${secret} -n keycloak keycloak-dep keycloak-dep || exit 1
helm install -f db.yaml -f env.yaml -f keycloak.yaml -n keycloak --version 13.1.0 keycloak bitnami/keycloak || exit 1~/install/06_direktiv/install.sh:
#!/bin/sh
while ! kubectl get secrets -n postgres direktivdb-pguser-direktiv
do
echo "postgres not ready, waiting..."
sleep 5
done
if [ ! -n "${DIREKTIV_HOST+1}" ]; then
echo "DIREKTIV_HOST not set to hostname to use"
exit 1
fi
install=direktiv-dev.yaml
if [ ! -n "${DIREKTIV_DEV+1}" ]; then
install=direktiv.yaml
fi
tee hostname.yaml <<EOF
ingress:
host: ${DIREKTIV_HOST}
EOF
adminToken="password"
if [ ! -n "${DIREKTIV_TOKEN+1}" ]; then
adminToken=`< /dev/urandom tr -dc A-Z-a-z-0-9 | head -c${1:-32};echo;`
fi
kubectl annotate ns default linkerd.io/inject=enabled
echo ${adminToken} > adminToken.txt
kcsecret=$(head -n 1 ../04_keycloak/kc_secret.txt)
helm install --set host=${DIREKTIV_HOST} --set secret=${kcsecret} --set adminsecret=${adminToken} direktiv-dep direktiv-dep
tee db.yaml <<EOF
database:
host: `kubectl get secrets -n postgres direktivdb-pguser-direktiv -o go-template='{{ index .data "host" }}' | base64 -d`
port: `kubectl get secrets -n postgres direktivdb-pguser-direktiv -o go-template='{{ index .data "port" }}' | base64 -d`
user: `kubectl get secrets -n postgres direktivdb-pguser-direktiv -o go-template='{{ index .data "user" }}' | base64 -d`
password: "`kubectl get secrets -n postgres direktivdb-pguser-direktiv -o go-template='{{ index .data "password" }}' | base64 -d`"
database: `kubectl get secrets -n postgres direktivdb-pguser-direktiv -o go-template='{{ index .data "dbname" }}' | base64 -d`
EOF
helm install -f hostname.yaml -f db.yaml --set ingress.enabled=false --set ingress-nginx.install=false -f ${install} direktiv direktiv/direktiv
kubectl delete ns contour-external || trueWas this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article