From b28a5dcbbf00a3fc41db09408a9560709a6a350f Mon Sep 17 00:00:00 2001 From: David Tesar Date: Mon, 17 Sep 2018 10:50:27 -0700 Subject: [PATCH] Update tripviewer helm chart (#212) * fix spacing * Add in bingAPIkey to helm * make BING_API_KEY optional --- provision-team/build_deploy_tripviewer.sh | 21 +++++++++++++++------ provision-team/setup.sh | 13 +++++++++---- tripviewer/Dockerfile | 2 +- tripviewer/helm/templates/deployment.yaml | 5 +++-- 4 files changed, 28 insertions(+), 13 deletions(-) diff --git a/provision-team/build_deploy_tripviewer.sh b/provision-team/build_deploy_tripviewer.sh index 103c987c..478d6931 100755 --- a/provision-team/build_deploy_tripviewer.sh +++ b/provision-team/build_deploy_tripviewer.sh @@ -6,20 +6,24 @@ IFS=$'\n\t' # -o: prevents errors in a pipeline from being masked # IFS new value is less likely to cause confusing bugs when looping arrays or arguments (e.g. $@) -usage() { echo "Usage: build_deploy_tripviewer.sh -m -d " 1>&2; exit 1; } +usage() { echo "Usage: build_deploy_tripviewer.sh -m -d -j " 1>&2; exit 1; } declare teamName="" declare dnsURL="" +declare bingAPIkey="" # Initialize parameters specified from command line -while getopts ":m:d:" arg; do +while getopts ":d:j:m:" arg; do case "${arg}" in - m) - teamName=${OPTARG} - ;; d) dnsURL=${OPTARG} ;; + j) + bingAPIkey=${OPTARG} + ;; + m) + teamName=${OPTARG} + ;; esac done shift $((OPTIND-1)) @@ -47,6 +51,7 @@ declare registryName="${teamName}acr" #DEBUG echo $resourceGroupName echo $dnsURL +echo $bingAPIkey echo $teamName echo -e '\n' @@ -79,4 +84,8 @@ echo -e "\nhelm install ... from: " $installPath BASE_URI='http://'$dnsURL echo "Base URI: $BASE_URI" -helm install $installPath --name web --set repository.image=$TAG,ingress.rules.endpoint.host=$dnsURL +if [[ "${bingAPIkey}" == "" ]]; then + helm install $installPath --name web --set repository.image=$TAG,ingress.rules.endpoint.host=$dnsURL +else + helm install $installPath --name web --set repository.image=$TAG,ingress.rules.endpoint.host=$dnsURL,viewer.mapkey=$bingAPIkey +fi \ No newline at end of file diff --git a/provision-team/setup.sh b/provision-team/setup.sh index d16513a2..fe0918d8 100755 --- a/provision-team/setup.sh +++ b/provision-team/setup.sh @@ -3,7 +3,7 @@ # set -euo pipefail IFS=$'\n\t' -usage() { echo "Usage: setup.sh -i -l -n -e -r -c -q -u -p " 1>&2; exit 1; } +usage() { echo "Usage: setup.sh -i -l -n -e -r -c -q -u -p -j " 1>&2; exit 1; } echo "$@" declare subscriptionId="" @@ -17,9 +17,10 @@ declare recipientEmail="" declare chatConnectionString="" declare chatMessageQueue="" declare provisioningVMIpaddress="" +declare bingAPIkey="" # Initialize parameters specified from command line -while getopts ":c:i:l:n:e:q:r:u:p:" arg; do +while getopts ":c:i:l:n:e:q:r:u:p:j:" arg; do case "${arg}" in c) chatConnectionString=${OPTARG} @@ -48,6 +49,9 @@ while getopts ":c:i:l:n:e:q:r:u:p:" arg; do p) azurePassword=${OPTARG} ;; + j) + bingAPIkey=${OPTARG} + ;; esac done shift $((OPTIND-1)) @@ -166,6 +170,7 @@ echo "recipientEmail = "${recipientEmail} echo "chatConnectionString = "${chatConnectionString} echo "chatMessageQueue = "${chatMessageQueue} echo "zipPassword" = "${zipPassword}" +echo "bingAPIkey" = "${bingAPIkey}" echo "==========================================" #login to azure using your credentials @@ -268,8 +273,8 @@ bash ./build_deploy_trip.sh -s ./test_fetch_build -b Release -r $resourceGroupTe echo "12-Build and deploy User-Profile API to AKS (# bash ./build_deploy_user-profile.sh -s ./test_fetch_build -b Release -r $resourceGroupTeam -t 'api-userprofile' -d $dnsURL -n ${teamName}${teamNumber} -g $registryName)" bash ./build_deploy_user-java.sh -s ./test_fetch_build -b Release -r $resourceGroupTeam -t 'api-user-java' -d $dnsURL -n ${teamName}${teamNumber} -g $registryName -echo "13-Build and deploy Tripviewer website to AKS (# bash ./build_deploy_tripviewer.sh -m ${teamName}${teamNumber} -d $dnsURL)" -bash ./build_deploy_tripviewer.sh -m ${teamName}${teamNumber} -d $dnsURL +echo "13-Build and deploy Tripviewer website to AKS (# bash ./build_deploy_tripviewer.sh -m ${teamName}${teamNumber} -d $dnsURL -j $bingAPIkey)" +bash ./build_deploy_tripviewer.sh -m ${teamName}${teamNumber} -d $dnsURL -j $bingAPIkey echo "14-Build and deploy the simulator (# bash Usage: build_deploy_simulator.sh -n ${teamName}${teamNumber} -q 18000 -d $dnsURL -t )" bash ./build_deploy_simulator.sh -n ${teamName}${teamNumber} -q '18000' -d $dnsURL diff --git a/tripviewer/Dockerfile b/tripviewer/Dockerfile index 0b7369f3..eecb803f 100644 --- a/tripviewer/Dockerfile +++ b/tripviewer/Dockerfile @@ -4,7 +4,7 @@ COPY . . RUN dotnet publish "web/TripViewer.csproj" -c Release -o /publish FROM microsoft/dotnet:2.1-aspnetcore-runtime -ENV TEAM_API_ENDPOINT="http://akstraefikopenhackvld9.westus.cloudapp.azure.com" +ENV TEAM_API_ENDPOINT="http://akstraefikchangeme.westus.cloudapp.azure.com",BING_MAPS_KEY="changeme" WORKDIR /app COPY --from=build /publish . ENTRYPOINT ["dotnet", "TripViewer.dll"] \ No newline at end of file diff --git a/tripviewer/helm/templates/deployment.yaml b/tripviewer/helm/templates/deployment.yaml index ad097dff..c942802c 100644 --- a/tripviewer/helm/templates/deployment.yaml +++ b/tripviewer/helm/templates/deployment.yaml @@ -25,5 +25,6 @@ spec: env: - name: TEAM_API_ENDPOINT value: "http://{{ .Values.ingress.rules.endpoint.host }}" - - name: BING_MAPS_KEY - value: "{{ .Values.viewer.mapkey}}" + - name: BING_MAPS_KEY + value: "{{ .Values.viewer.mapkey}}" +