Skip to content
Snippets Groups Projects
Commit d45bc4d2 authored by Alex Ellis (OpenFaaS Ltd)'s avatar Alex Ellis (OpenFaaS Ltd)
Browse files

Fix build by using generated password

parent bd29b939
No related branches found
No related tags found
No related merge requests found
......@@ -33,3 +33,4 @@ of_kind_portforward.pid
jwt_key
jwt_key.pub
/*.pid
......@@ -7,11 +7,14 @@ contrib/create_cluster.sh || exit 0;
contrib/deploy.sh
contrib/run_function.sh
PASSWORD=$(kubectl get secret -n openfaas basic-auth -o=go-template='{{index .data "basic-auth-password"}}' | base64 --decode)
cd "$(git rev-parse --show-toplevel)"
echo ""
echo ""
echo "Local dev cluster details:"
printf '%-10s:\t %s\n' 'Web UI' 'http://localhost:8080/ui'
printf '%-10s:\t %s\n' 'User' 'admin'
printf '%-10s:\t %s\n' 'Password' "$(cat password.txt)"
printf '%-10s:\t %s\n' 'CLI Login' "faas-cli login --username admin --password $(cat password.txt)"
\ No newline at end of file
printf '%-10s:\t %s\n' 'Password' '$PASSWORD'
printf '%-10s:\t %s\n' 'CLI Login' "faas-cli login --username admin --password $PASSWORD"
\ No newline at end of file
......@@ -3,39 +3,11 @@
set -e
DEVENV=${OF_DEV_ENV:-kind}
OPERATOR=${OPERATOR:-0}
echo ""
echo "Applying namespaces"
kubectl --context "kind-$DEVENV" apply -f ./namespaces.yml
sha_cmd="sha256sum"
if [ ! -x "$(command -v $sha_cmd)" ]; then
sha_cmd="shasum -a 256"
fi
if [ -x "$(command -v $sha_cmd)" ]; then
sha_cmd="shasum"
fi
PASSWORD_EXISTS=$(kubectl get secret -n openfaas basic-auth | wc -c)
if [ $PASSWORD_EXISTS -eq 0 ]; then
PASSWORD=$(head -c 16 /dev/urandom| $sha_cmd | cut -d " " -f 1)
echo -n $PASSWORD > password.txt
kubectl --context "kind-$DEVENV" -n openfaas create secret generic basic-auth \
--from-literal=basic-auth-user=admin \
--from-literal=basic-auth-password="$PASSWORD"
else
PASSWORD=$(kubectl get secret -n openfaas basic-auth -o=go-template='{{index .data "basic-auth-password"}}' | base64 --decode)
echo -n $PASSWORD > password.txt
fi
CREATE_OPERATOR=false
if [ "${OPERATOR}" == "1" ]; then
CREATE_OPERATOR="true"
fi
echo ""
echo "Waiting for helm install to complete."
......@@ -44,16 +16,7 @@ helm upgrade \
--install \
openfaas \
./chart/openfaas \
--namespace openfaas \
--set basic_auth=true \
--set functionNamespace=openfaas-fn \
--set operator.create=$CREATE_OPERATOR
if [ "${OPERATOR}" == "1" ]; then
kubectl --context "kind-$DEVENV" patch -n openfaas deploy/gateway \
-p='[{"op": "add", "path": "/spec/template/spec/containers/1/command", "value": ["./faas-netes", "-operator=true"]} ]' --type=json
fi
--namespace openfaas
kubectl --context "kind-$DEVENV" rollout status deploy/prometheus -n openfaas
kubectl --context "kind-$DEVENV" rollout status deploy/gateway -n openfaas
......@@ -24,6 +24,11 @@ kubectl --context "kind-$DEVENV" port-forward deploy/gateway -n openfaas 8080:80
# port-forward needs some time to start
sleep 10
echo "Using existing password for OpenFaaS gateway retrieved from Kubernetes."
PASSWORD=$(kubectl get secret -n openfaas basic-auth -o=go-template='{{index .data "basic-auth-password"}}' | base64 --decode)
echo -n $PASSWORD > password.txt
export OPENFAAS_URL=http://127.0.0.1:8080
# Login into the gateway
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment