Verified Commit 638f6cd6 authored by Dmytro Bogatov's avatar Dmytro Bogatov 💕

Add script to upgrade specific service.

parent 98d46c3f
......@@ -147,33 +147,38 @@ mkdir -p services
cp sources/namespace.yaml services/
for service in "${!SERVICES[@]}"
do
generate-service $service ${SERVICES[${service}]}
done
if [ -n "$1" ]
then
generate-service $1 ${SERVICES[${1}]}
else
for service in "${!SERVICES[@]}"
do
generate-service $service ${SERVICES[${service}]}
done
for placeholder in "${!PLACEHOLDERS[@]}"
do
generate-service $placeholder registry.dbogatov.org/dbogatov/nginx-placeholders/${PLACEHOLDERS[${placeholder}]}:latest
done
for placeholder in "${!PLACEHOLDERS[@]}"
do
generate-service $placeholder registry.dbogatov.org/dbogatov/nginx-placeholders/${PLACEHOLDERS[${placeholder}]}:latest
done
### Dashboard OAuth
### Dashboard OAuth
echo "Dashboard auth configs..."
echo "Dashboard auth configs..."
rm -rf dashboard/
mkdir -p dashboard/dashboard-auth
cp sources/dashboard-auth/*.yaml dashboard/dashboard-auth/
rm -rf dashboard/
mkdir -p dashboard/dashboard-auth
cp sources/dashboard-auth/*.yaml dashboard/dashboard-auth/
COOKIE_SECRET=$(python -c 'import os,base64; print base64.b64encode(os.urandom(16))')
COOKIE_SECRET=$(python -c 'import os,base64; print base64.b64encode(os.urandom(16))')
sed -i -e "s#__OAUTH2_PROXY_COOKIE_SECRET__#$COOKIE_SECRET#g" dashboard/dashboard-auth/oauth2-proxy.yaml
sed -i -e "s#__OAUTH2_PROXY_CLIENT_SECRET__#$OAUTH2_PROXY_CLIENT_SECRET#g" dashboard/dashboard-auth/oauth2-proxy.yaml
sed -i -e "s#__OAUTH2_PROXY_COOKIE_SECRET__#$COOKIE_SECRET#g" dashboard/dashboard-auth/oauth2-proxy.yaml
sed -i -e "s#__OAUTH2_PROXY_CLIENT_SECRET__#$OAUTH2_PROXY_CLIENT_SECRET#g" dashboard/dashboard-auth/oauth2-proxy.yaml
DASHBOARD_TOKEN=$(kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk '{print $1}') | grep token: )
DASHBOARD_TOKEN="${DASHBOARD_TOKEN:7:${#DASHBOARD_TOKEN}}"
DASHBOARD_TOKEN=$(kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk '{print $1}') | grep token: )
DASHBOARD_TOKEN="${DASHBOARD_TOKEN:7:${#DASHBOARD_TOKEN}}"
sed -i -e "s#__DASHBOARD_TOKEN__#$DASHBOARD_TOKEN#g" dashboard/dashboard-auth/ingreses.yaml
sed -i -e "s#Bearer #Bearer #g" dashboard/dashboard-auth/ingreses.yaml
sed -i -e "s#__DASHBOARD_TOKEN__#$DASHBOARD_TOKEN#g" dashboard/dashboard-auth/ingreses.yaml
sed -i -e "s#Bearer #Bearer #g" dashboard/dashboard-auth/ingreses.yaml
fi
echo "Done!"
#!/usr/bin/env bash
set -e
shopt -s globstar
# Ensure that the CWD is set to script's location
cd "${0%/*}"
CWD=$(pwd)
usage() { echo "Usage: $0 [-s <string>]" 1>&2; exit 1; }
SERVICE=""
while getopts "s:" o; do
case "${o}" in
s)
SERVICE=${OPTARG}
;;
*)
usage
;;
esac
done
shift $((OPTIND-1))
source ./build-services.sh $SERVICE
kubectl apply -R -f ./services/$SERVICE
echo "Done!"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment