From 6c6087273ba83610114165ce67c1ce836059d395 Mon Sep 17 00:00:00 2001 From: Eric Jizba Date: Thu, 15 Jun 2017 16:48:11 -0700 Subject: [PATCH] Update Spinnaker templates to use Halyard 1. Simplify the config by using Halyard 2. Deploy spinnaker _to_ the k8s cluster rather than the VM 3. Deprecate the 201 template --- README.md | 5 +- quickstart_template/101-spinnaker.sh | 77 ++++++ quickstart_template/201-spinnaker-acr-k8s.sh | 232 ------------------ .../301-jenkins-acr-spinnaker-k8s.sh | 129 +++++++++- .../301-jenkins-aptly-spinnaker-vmss.sh | 54 +++- .../add_k8s_pipeline/add_k8s_pipeline.sh | 15 +- spinnaker/await_restart_service/README.md | 21 -- .../await_restart_service.sh | 109 -------- spinnaker/configure_k8s/README.md | 23 -- spinnaker/configure_k8s/configure_k8s.sh | 141 ----------- spinnaker/configure_vmss/README.md | 30 --- spinnaker/configure_vmss/configure_vmss.sh | 187 -------------- .../copy_kube_config/copy_kube_config.sh | 10 +- .../README.md | 7 +- spinnaker/install_halyard/install_halyard.sh | 57 +++++ .../install_spinnaker/install_spinnaker.sh | 96 -------- 16 files changed, 327 insertions(+), 866 deletions(-) create mode 100644 quickstart_template/101-spinnaker.sh delete mode 100644 quickstart_template/201-spinnaker-acr-k8s.sh delete mode 100644 spinnaker/await_restart_service/README.md delete mode 100644 spinnaker/await_restart_service/await_restart_service.sh delete mode 100644 spinnaker/configure_k8s/README.md delete mode 100644 spinnaker/configure_k8s/configure_k8s.sh delete mode 100644 spinnaker/configure_vmss/README.md delete mode 100644 spinnaker/configure_vmss/configure_vmss.sh rename spinnaker/{install_spinnaker => install_halyard}/README.md (57%) create mode 100644 spinnaker/install_halyard/install_halyard.sh delete mode 100644 spinnaker/install_spinnaker/install_spinnaker.sh diff --git a/README.md b/README.md index 5b631b0..e121224 100644 --- a/README.md +++ b/README.md @@ -22,11 +22,8 @@ This repository contains utility scripts to run/configure DevOp systems in Azure 1. Deploy to a development environment 1. Wait for manual judgement 1. Deploy to a production environment - * [await_restart_service.sh](spinnaker/await_restart_service/): Restarts a Spinnaker service and waits for the service to be open for requests. - * [configure_k8s.sh](spinnaker/configure_k8s/): Automatically configure a spinnaker instance to target a Kubernetes cluster and Azure Container Registry. - * [configure_vmss.sh](spinnaker/configure_vmss/): Automatically configure a Spinnaker instance to target VM Scale Sets and a Jenkins instance hosting an Aptly repository. * [copy_kube_config.sh](spinnaker/copy_kube_config/): Programatically copies a kubeconfig file from an Azure Container Service Kubernetes cluster to a Spinnaker machine. - * [install_spinnaker.sh](spinnaker/install_spinnaker/): Install Spinnaker and automatically configure it to use Azure Storage (azs) as its persistent storage. + * [install_halyard.sh](spinnaker/install_halyard/): Install Halyard and automatically configure Spinnaker to use Azure Storage (azs) as its persistent storage. ## Questions/Comments? azdevopspub@microsoft.com diff --git a/quickstart_template/101-spinnaker.sh b/quickstart_template/101-spinnaker.sh new file mode 100644 index 0000000..c9a5c1b --- /dev/null +++ b/quickstart_template/101-spinnaker.sh @@ -0,0 +1,77 @@ +#!/bin/bash + +function print_usage() { + cat <&2 + print_usage + exit -1 + fi +} + +function run_util_script() { + local script_path="$1" + shift + curl --silent "${artifacts_location}${script_path}${artifacts_location_sas_token}" | sudo bash -s -- "$@" + local return_value=$? + if [ $return_value -ne 0 ]; then + >&2 echo "Failed while executing script '$script_path'." + exit $return_value + fi +} + +while [[ $# > 0 ]] +do + key="$1" + shift + case $key in + --storage_account_name|-san) + storage_account_name="$1";; + --storage_account_key|-sak) + storage_account_key="$1";; + --username|-u) + username="$1";; + --artifacts_location|-al) + artifacts_location="$1";; + --sas_token|-st) + artifacts_location_sas_token="$1";; + --help|-help|-h) + print_usage + exit 13;; + *) + echo "ERROR: Unknown argument '$key' to script '$0'" 1>&2 + exit -1 + esac + shift +done + +throw_if_empty storage_account_name $storage_account_name +throw_if_empty storage_account_key $storage_account_key +throw_if_empty username $username + +run_util_script "spinnaker/install_halyard/install_halyard.sh" -san "$storage_account_name" -sak "$storage_account_key" -u "$username" + +sudo hal deploy apply + +# Wait for Spinnaker services to be up before returning +timeout=180 +echo "while !(nc -z localhost 8084) || !(nc -z localhost 9000); do sleep 1; done" | timeout $timeout bash +return_value=$? +if [ $return_value -ne 0 ]; then + >&2 echo "Failed to connect to Spinnaker within '$timeout' seconds." + exit $return_value +fi \ No newline at end of file diff --git a/quickstart_template/201-spinnaker-acr-k8s.sh b/quickstart_template/201-spinnaker-acr-k8s.sh deleted file mode 100644 index 9d35c23..0000000 --- a/quickstart_template/201-spinnaker-acr-k8s.sh +++ /dev/null @@ -1,232 +0,0 @@ -#!/bin/bash - -function print_usage() { - cat <&2 - print_usage - exit -1 - fi -} - -function run_util_script() { - local script_path="$1" - shift - curl --silent "${artifacts_location}${script_path}${artifacts_location_sas_token}" | sudo bash -s -- "$@" - local return_value=$? - if [ $return_value -ne 0 ]; then - >&2 echo "Failed while executing script '$script_path'." - exit $return_value - fi -} - -#Set defaults -include_kubernetes_pipeline="0" -pipeline_registry="index.docker.io" -pipeline_repository="lwander/spin-kub-demo" -pipeline_port="8000" -artifacts_location="https://raw.githubusercontent.com/Azure/azure-devops-utils/master/" -front50_port=8080 - -while [[ $# > 0 ]] -do - key="$1" - shift - case $key in - --app_id|-ai) - app_id="$1" - shift - ;; - --app_key|-ak) - app_key="$1" - shift - ;; - --subscription_id|-si) - subscription_id="$1" - shift - ;; - --tenant_id|-ti) - tenant_id="$1" - shift - ;; - --user_name|-un) - user_name="$1" - shift - ;; - --resource_group|-rg) - resource_group="$1" - shift - ;; - --master_fqdn|-mf) - master_fqdn="$1" - shift - ;; - --storage_account_name|-san) - storage_account_name="$1" - shift - ;; - --storage_account_key|-sak) - storage_account_key="$1" - shift - ;; - --azure_container_registry|-acr) - azure_container_registry="$1" - shift - ;; - --include_kubernetes_pipeline|-ikp) - include_kubernetes_pipeline="$1" - shift - ;; - --pipeline_registry|-prg) - pipeline_registry="$1" - shift - ;; - --pipeline_repository|-prp) - pipeline_repository="$1" - shift - ;; - --pipeline_port|-pp) - pipeline_port="$1" - shift - ;; - --front50_port|-fp) - front50_port="$1" - shift - ;; - --artifacts_location|-al) - artifacts_location="$1" - shift - ;; - --sas_token|-st) - artifacts_location_sas_token="$1" - shift - ;; - --help|-help|-h) - print_usage - exit 13 - ;; - *) - echo "ERROR: Unknown argument '$key' to script '$0'" 1>&2 - exit -1 - esac -done - -throw_if_empty --app_id $app_id -throw_if_empty --app_key $app_key -throw_if_empty --subscription_id $subscription_id -throw_if_empty --tenant_id $tenant_id -throw_if_empty --user_name $user_name -throw_if_empty --resource_group $resource_group -throw_if_empty --master_fqdn $master_fqdn -throw_if_empty --storage_account_name $storage_account_name -throw_if_empty --storage_account_key $storage_account_key -throw_if_empty --azure_container_registry $azure_container_registry -throw_if_empty --front50_port $front50_port - -spinnaker_kube_config_file="/home/spinnaker/.kube/config" -kubectl_file="/usr/local/bin/kubectl" -docker_hub_registry="index.docker.io" - -# Configure Spinnaker to use Azure Storage -run_util_script "spinnaker/install_spinnaker/install_spinnaker.sh" -san "$storage_account_name" -sak "$storage_account_key" -al "$artifacts_location" -st "$artifacts_location_sas_token" - -# Front50 conflicts with the default Jenkins port, so allow for using a different port -if [ "$front50_port" != "8080" ]; then - sudo sed -i "s|front50:|front50:\n port: $front50_port|" /opt/spinnaker/config/spinnaker-local.yml - sudo service spinnaker restart # We have to restart all services so that they know how to communicate to front50 -fi - -# Install Azure cli -if !(command -v az >/dev/null); then - sudo apt-get update && sudo apt-get install -y libssl-dev libffi-dev python-dev - echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/azure-cli/ wheezy main" | sudo tee /etc/apt/sources.list.d/azure-cli.list - sudo apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893 - sudo apt-get install -y apt-transport-https - sudo apt-get -y update && sudo apt-get install -y azure-cli -fi - -# Login to azure cli using service principal -az login --service-principal -u "$app_id" -p "$app_key" --tenant "$tenant_id" -az account set --subscription "$subscription_id" - -# Copy kube config to this VM -run_util_script "spinnaker/copy_kube_config/copy_kube_config.sh" -un "$user_name" -rg "$resource_group" -mf "$master_fqdn" - -# If targeting docker, we have to explicitly add the repository to the config. For private registries, -# there's no need because Spinnaker can dynamically retrieve the entire catalog of a registry. -if [ "$pipeline_registry" == "$docker_hub_registry" ]; then - docker_repository="$pipeline_repository" -else - docker_repository="" -fi - -# Configure Spinnaker to target kubernetes -run_util_script "spinnaker/configure_k8s/configure_k8s.sh" -rg "$azure_container_registry" -ai "$app_id" -ak "$app_key" -rp "$docker_repository" -al "$artifacts_location" -st "$artifacts_location_sas_token" - -# Install and setup Kubernetes cli for admin user -if !(command -v kubectl >/dev/null); then - sudo curl -L -s -o $kubectl_file https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl - sudo chmod +x $kubectl_file - mkdir -p /home/${user_name}/.kube - sudo cp $spinnaker_kube_config_file /home/${user_name}/.kube/config -fi - -# Create pipeline if enabled -if (( $include_kubernetes_pipeline )); then - if [ "$pipeline_registry" == "$docker_hub_registry" ]; then - docker_account_name="docker-hub-registry" - else - docker_account_name="azure-container-registry" - pipeline_registry="$azure_container_registry" - - #install docker if not already installed - if !(command -v docker >/dev/null); then - sudo curl -sSL https://get.docker.com/ | sh - fi - sudo gpasswd -a $user_name docker - - # Add (virtually) empty container to ACR to properly initialize Spinnaker. This fixes two bugs: - # 1. The pipeline isn't triggered on the first push to the ACR (according to the source code, Igor "avoids publishing an event if this account has no indexed images (protects against a flushed redis)") - # 2. Some dropdowns in the UI for the pipeline display a 'loading' symbol rather than the repository we configured - temp_dir=$(mktemp -d) - touch "$temp_dir/README" - echo "This container is intentionally empty and only used as a placeholder." >"$temp_dir/README" - touch "$temp_dir/Dockerfile" - echo -e "FROM scratch\nADD . README" >"$temp_dir/Dockerfile" - # We added the user to the docker group above, but that doesn't take effect until the next login so we still need to use sudo here - sudo docker login "$azure_container_registry" -u "$app_id" -p "$app_key" - sudo docker build $temp_dir --tag "$azure_container_registry/$pipeline_repository" - sudo docker push "$azure_container_registry/$pipeline_repository" - sudo docker rmi "$azure_container_registry/$pipeline_repository" - sudo docker logout - fi - - run_util_script "spinnaker/add_k8s_pipeline/add_k8s_pipeline.sh" -an "$docker_account_name" -rg "$pipeline_registry" -rp "$pipeline_repository" -p "$pipeline_port" -al "$artifacts_location" -st "$artifacts_location_sas_token" -fi \ No newline at end of file diff --git a/quickstart_template/301-jenkins-acr-spinnaker-k8s.sh b/quickstart_template/301-jenkins-acr-spinnaker-k8s.sh index 318d49c..bf97638 100644 --- a/quickstart_template/301-jenkins-acr-spinnaker-k8s.sh +++ b/quickstart_template/301-jenkins-acr-spinnaker-k8s.sh @@ -46,6 +46,70 @@ function run_util_script() { fi } +function add_empty_image_to_acr() { + # Install docker if not already installed + if !(command -v docker >/dev/null); then + sudo curl -sSL https://get.docker.com/ | sh + fi + sudo gpasswd -a $user_name docker + + # Add (virtually) empty container to ACR to properly initialize Spinnaker. This fixes two bugs: + # 1. The pipeline isn't triggered on the first push to the ACR (according to the source code, Igor "avoids publishing an event if this account has no indexed images (protects against a flushed redis)") + # 2. Some dropdowns in the UI for the pipeline display a 'loading' symbol rather than the repository we configured + temp_dir=$(mktemp -d) + touch "$temp_dir/README" + echo "This container is intentionally empty and only used as a placeholder." >"$temp_dir/README" + touch "$temp_dir/Dockerfile" + echo -e "FROM scratch\nADD . README" >"$temp_dir/Dockerfile" + # We added the user to the docker group above, but that doesn't take effect until the next login so we still need to use sudo here + sudo docker login "$azure_container_registry" -u "$app_id" -p "$app_key" + sudo docker build $temp_dir --tag "$azure_container_registry/$docker_repository" + sudo docker push "$azure_container_registry/$docker_repository" + sudo docker rmi "$azure_container_registry/$docker_repository" + sudo docker logout +} + +function install_kubectl() { + if !(command -v kubectl >/dev/null); then + kubectl_file="/usr/local/bin/kubectl" + sudo curl -L -s -o $kubectl_file https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl + sudo chmod +x $kubectl_file + fi +} + +function install_az() { + if !(command -v az >/dev/null); then + sudo apt-get update && sudo apt-get install -y libssl-dev libffi-dev python-dev + echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/azure-cli/ wheezy main" | sudo tee /etc/apt/sources.list.d/azure-cli.list + sudo apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893 + sudo apt-get install -y apt-transport-https + sudo apt-get -y update && sudo apt-get install -y azure-cli + fi +} + +function add_bash_login() { + bash_login="/home/${user_name}/.bash_login" + touch "$bash_login" + cat < "$bash_login" +### Connect to Spinnaker ### +echo "Connecting to Spinnaker..." +hal deploy connect --no-validate &>/dev/null & + +# Wait for connection +echo "while !(nc -z localhost 8084) || !(nc -z localhost 9000); do sleep 1; done" | timeout 20 bash + +if [ $? -ne 0 ]; then + echo "Failed to connect to Spinnaker." +else + echo "Successfully connected to Spinnaker." + echo "Enter 'Ctrl-C' in your terminal to exit the connection in the background." +fi + +echo "Edit your ~/.bash_login file and remove the 'Connect to Spinnaker' section if you do not want to auto-connect on login." +### Connect to Spinnaker ### +EOF +} + #Set defaults pipeline_port="8000" artifacts_location="https://raw.githubusercontent.com/Azure/azure-devops-utils/master/" @@ -145,12 +209,63 @@ throw_if_empty --docker_repository $docker_repository throw_if_empty --pipeline_port $pipeline_port throw_if_empty --jenkins_fqdn $jenkins_fqdn -include_kubernetes_pipeline="1" -pipeline_registry="$azure_container_registry" -front50_port="8081" +add_empty_image_to_acr + +install_kubectl + +install_az + +run_util_script "spinnaker/install_halyard/install_halyard.sh" -san "$storage_account_name" -sak "$storage_account_key" -u "$user_name" + +# Copy kube config +az login --service-principal -u "$app_id" -p "$app_key" --tenant "$tenant_id" +az account set --subscription "$subscription_id" +run_util_script "spinnaker/copy_kube_config/copy_kube_config.sh" -un "$user_name" -rg "$resource_group" -mf "$master_fqdn" +az logout + +# Configure Spinnaker Docker Registry Accounts +docker_hub_account="docker-hub-registry" +hal config provider docker-registry account add $docker_hub_account \ + --address "https://index.docker.io/" \ + --repositories "library/nginx" "library/redis" "library/ubuntu" # Spinnaker can't get the entire catalog for a public registry, so we have to list a few repos +acr_account="azure-container-registry" +echo "$app_key" | hal config provider docker-registry account add $acr_account \ + --address "https://$azure_container_registry/" \ + --username "$app_id" \ + --password +hal config provider docker-registry enable + +# Configure Spinnaker Kubernetes Account +kubeconfig_path="/home/${user_name}/.kube/config" +my_kubernetes_account="my-kubernetes-account" +hal config provider kubernetes account add $my_kubernetes_account \ + --kubeconfig-file "$kubeconfig_path" \ + --context $(kubectl config current-context --kubeconfig "$kubeconfig_path") \ + --docker-registries "$docker_hub_account" "$acr_account" +hal config provider kubernetes enable + +# Deploy Spinnaker to the Kubernetes cluster +hal config deploy edit --account-name $my_kubernetes_account --type distributed +hal deploy apply + +# Automatically connect to Spinnaker when logging in to DevOps VM +add_bash_login -# Configure Spinnaker (do this first because the default InstallSpinnaker.sh script sets up front50 on port 8080 and that might fail if we did Jenkins first) -run_util_script "quickstart_template/201-spinnaker-acr-k8s.sh" -ai "$app_id" -ak "$app_key" -si "$subscription_id" -ti "$tenant_id" -un "$user_name" -rg "$resource_group" -mf "$master_fqdn" -san "$storage_account_name" -sak "$storage_account_key" -acr "$azure_container_registry" -ikp "$include_kubernetes_pipeline" -prg "$pipeline_registry" -prp "$docker_repository" -pp "$pipeline_port" -fp "$front50_port" -al "$artifacts_location" -st "$artifacts_location_sas_token" +# Add Kubernetes pipeline +run_util_script "spinnaker/add_k8s_pipeline/add_k8s_pipeline.sh" \ + -an "$acr_account" \ + -rg "$azure_container_registry" \ + -rp "$docker_repository" \ + -p "$pipeline_port" \ + -al "$artifacts_location" \ + -st "$artifacts_location_sas_token" -# Configure Jenkins -run_util_script "quickstart_template/201-jenkins-acr.sh" -u "$user_name" -g "$git_repository" -r "https://$azure_container_registry" -ru "$app_id" -rp "$app_key" -rr "$docker_repository" -jf "$jenkins_fqdn" -al "$artifacts_location" -st "$artifacts_location_sas_token" +run_util_script "quickstart_template/201-jenkins-acr.sh" -u "$user_name" \ + -g "$git_repository" \ + -r "https://$azure_container_registry" \ + -ru "$app_id" \ + -rp "$app_key" \ + -rr "$docker_repository" \ + -jf "$jenkins_fqdn" \ + -al "$artifacts_location" \ + -st "$artifacts_location_sas_token" \ No newline at end of file diff --git a/quickstart_template/301-jenkins-aptly-spinnaker-vmss.sh b/quickstart_template/301-jenkins-aptly-spinnaker-vmss.sh index 378d79a..ffddff0 100644 --- a/quickstart_template/301-jenkins-aptly-spinnaker-vmss.sh +++ b/quickstart_template/301-jenkins-aptly-spinnaker-vmss.sh @@ -111,13 +111,46 @@ throw_if_empty packer_storage_account $packer_storage_account throw_if_empty vm_fqdn $vm_fqdn throw_if_empty region $region -run_util_script "spinnaker/install_spinnaker/install_spinnaker.sh" -san "$storage_account_name" -sak "$storage_account_key" -al "$artifacts_location" -st "$artifacts_location_sas_token" +default_hal_config="/home/$jenkins_username/.hal/default" -echo "Reconfiguring front50 to use ${front50_port} so that it doesn't conflict with Jenkins..." -sudo sed -i "s|front50:|front50:\n port: $front50_port|" /opt/spinnaker/config/spinnaker-local.yml -sudo service spinnaker restart # We have to restart all services so that they know how to communicate to front50 +run_util_script "spinnaker/install_halyard/install_halyard.sh" -san "$storage_account_name" -sak "$storage_account_key" -u "$jenkins_username" -run_util_script "spinnaker/configure_vmss/configure_vmss.sh" -ai "${app_id}" -ak "${app_key}" -ti "${tenant_id}" -si "${subscription_id}" -rg "${resource_group}" -vn "${vault_name}" -psa "${packer_storage_account}" -ju "${jenkins_username}" -jp "${jenkins_password}" -vf "${vm_fqdn}" -r "$region" -al "${artifacts_location}" -st "${artifacts_location_sas_token}" +# Change front50 port so it doesn't conflict with Jenkins +front50_settings="$default_hal_config/service-settings/front50.yml" +sudo -u $jenkins_username mkdir -p $(dirname "$front50_settings") +sudo -u $jenkins_username touch "$front50_settings" +echo "port: $front50_port" > "$front50_settings" + +# Configure Azure provider for Spinnaker +echo "$app_key" | hal config provider azure account add my-azure-account \ + --client-id "$app_id" \ + --tenant-id "$tenant_id" \ + --subscription-id "$subscription_id" \ + --default-key-vault "$vault_name" \ + --default-resource-group "$resource_group" \ + --packer-resource-group "$resource_group" \ + --packer-storage-account "$packer_storage_account" \ + --app-key +hal config provider azure enable + +# Configure Rosco (these params are not supported by Halyard yet) +rosco_config="$default_hal_config/profiles/rosco-local.yml" +sudo -u $jenkins_username mkdir -p $(dirname "$rosco_config") +sudo -u $jenkins_username touch "$rosco_config" +cat < "$rosco_config" +debianRepository: http://ppa.launchpad.net/openjdk-r/ppa/ubuntu trusty main;http://$vm_fqdn:9999 trusty main +defaultCloudProviderType: azure +EOF + +# Configure Jenkins for Spinnaker +echo "$jenkins_password" | hal config ci jenkins master add Jenkins \ + --address "http://localhost:8080" \ + --username "$jenkins_username" \ + --password +hal config ci jenkins enable + +# Deploy Spinnaker to local VM +sudo hal deploy apply run_util_script "jenkins/install_jenkins.sh" -jf "${vm_fqdn}" -al "${artifacts_location}" -st "${artifacts_location_sas_token}" @@ -128,4 +161,13 @@ run_util_script "jenkins/add-aptly-build-job.sh" -al "${artifacts_location}" -st echo "Setting up initial user..." echo "jenkins.model.Jenkins.instance.securityRealm.createAccount(\"$jenkins_username\", \"$jenkins_password\")" > addUser.groovy run_util_script "jenkins/run-cli-command.sh" -cif "addUser.groovy" -c "groovy =" -rm "addUser.groovy" \ No newline at end of file +rm "addUser.groovy" + +# Wait for Spinnaker services to be up before returning +timeout=180 +echo "while !(nc -z localhost 8084) || !(nc -z localhost 9000); do sleep 1; done" | timeout $timeout bash +return_value=$? +if [ $return_value -ne 0 ]; then + >&2 echo "Failed to connect to Spinnaker within '$timeout' seconds." + exit $return_value +fi \ No newline at end of file diff --git a/spinnaker/add_k8s_pipeline/add_k8s_pipeline.sh b/spinnaker/add_k8s_pipeline/add_k8s_pipeline.sh index 6c56174..2a52acf 100644 --- a/spinnaker/add_k8s_pipeline/add_k8s_pipeline.sh +++ b/spinnaker/add_k8s_pipeline/add_k8s_pipeline.sh @@ -101,6 +101,16 @@ else exit 1 fi +# Connect to k8s cluster in the background +hal deploy connect --service-names gate & +timeout=30 +echo "while !(nc -z localhost 8084); do sleep 1; done" | timeout $timeout bash +return_value=$? +if [ $return_value -ne 0 ]; then + >&2 echo "Failed to connect to Spinnaker within '$timeout' seconds." + exit $return_value +fi + # Create application application_data=$(curl -s ${artifacts_location}spinnaker/add_k8s_pipeline/application.json${artifacts_location_sas_token}) application_data=${application_data//REPLACE_APP_NAME/$app_name} @@ -133,4 +143,7 @@ prod_load_balancer_data=${prod_load_balancer_data//REPLACE_USER_NAME/$user_name} prod_load_balancer_data=${prod_load_balancer_data//REPLACE_PORT/$port} prod_load_balancer_data=${prod_load_balancer_data//REPLACE_STACK/"prod"} prod_load_balancer_data=${prod_load_balancer_data//REPLACE_SERVICE_TYPE/"LoadBalancer"} -curl -X POST -H "Content-type: application/json" --data "$prod_load_balancer_data" http://localhost:8084/applications/${app_name}/tasks \ No newline at end of file +curl -X POST -H "Content-type: application/json" --data "$prod_load_balancer_data" http://localhost:8084/applications/${app_name}/tasks + +# Stop background connection to Spinnaker +pkill kubectl \ No newline at end of file diff --git a/spinnaker/await_restart_service/README.md b/spinnaker/await_restart_service/README.md deleted file mode 100644 index 4e34531..0000000 --- a/spinnaker/await_restart_service/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# Await Restart Spinnaker Service - -Restarts a Spinnaker service and waits for the service to be open for requests. - -## Prerequisites -This must be executed on a machine with an existing Spinnaker instance. - -## Arguments -| Name | Description | -|---|---| -| --service
-s | The Spinnaker service to restart. | -| --host
-h | (optional) The host used by the service, default to localhost. | -| --port
-p | (optional) The port used by the service, if different than the default. | -| --timeout
-t | (optional) The time to wait in seconds, defaulted to 120. | - -## Example usage -```bash -./await_restart_service.sh --service clouddriver -``` - -## Questions/Comments? azdevopspub@microsoft.com \ No newline at end of file diff --git a/spinnaker/await_restart_service/await_restart_service.sh b/spinnaker/await_restart_service/await_restart_service.sh deleted file mode 100644 index 55bc80a..0000000 --- a/spinnaker/await_restart_service/await_restart_service.sh +++ /dev/null @@ -1,109 +0,0 @@ -#!/bin/bash - -function print_usage() { - cat <&2 - print_usage - exit -1 - fi -} - -# Set defaults -host="localhost" -timeout=120 - -while [[ $# > 0 ]] -do - key="$1" - shift - case $key in - --service|-s) - service="$1" - shift - ;; - --host|-h) - host="$1" - shift - ;; - --port|-p) - port="$1" - shift - ;; - --timeout|-t) - timeout="$1" - shift - ;; - --help|-help|-h) - print_usage - exit 13 - ;; - *) - echo "ERROR: Unknown argument '$key' to script '$0'" 1>&2 - exit -1 - esac -done - -throw_if_empty --service $service - -if [ -z "$port" ]; then - case $service in - clouddriver) - port=7002 - ;; - echo) - port=8089 - ;; - deck) - port=9000 - ;; - fiat) - port=7003 - ;; - front50) - port=8080 - ;; - gate) - port=8084 - ;; - igor) - port=8088 - ;; - orca) - port=8083 - ;; - rosco) - port=8087 - ;; - *) - echo "A default port for service '$service' is not known and must be specified." - exit -1 - esac -fi - -sudo service $service restart - -count=0 -while !(nc -z $host $port); do - if [ $count -gt $timeout ]; then - echo "Could not connect to Spinnaker service '$service' at '$host:$port' in specified timeout of '$timeout' seconds." 1>&2 - exit 124 # same exit code used by 'timeout' function - else - sleep 1 - ((count++)) - fi -done \ No newline at end of file diff --git a/spinnaker/configure_k8s/README.md b/spinnaker/configure_k8s/README.md deleted file mode 100644 index f932f8f..0000000 --- a/spinnaker/configure_k8s/README.md +++ /dev/null @@ -1,23 +0,0 @@ -# Configure Spinnaker for Kubernetes - -Automatically configure a spinnaker instance to target a Kubernetes cluster and Azure Container Registry. This script will restart clouddriver and igor so that config changes take effect. The only remaining step is copy the kubeconfig file from your Kubernetes master vm to the Spinnaker VM. - -## Prerequisites -This must be executed on a machine with an existing Spinnaker instance. - -## Arguments -| Name | Description | -|---|---| -| --registry
-rg | The Azure Container Registry url, for example 'sample-microsoft.azurecr.io'. | -| --app_id
-ai | The Service Principal app id used to access your registry. | -| --app_key
-ak | The Service Principal app key used to access your registry. | -| --repository
-rp | (optional) The docker repository if targeting a repo from 'index.docker.io'. If targeting an Azure Container Registry, the repository does _not_ need to be explicitly specified. | -| --artifacts_location
-al | (optional) The url for referencing other scripts/artifacts. The default is this github repository. | -| --sas_token
-st | (optional) A sas token needed if the artifacts location is private. | - -## Example usage -```bash -./configure_k8s.sh --registry "sample-microsoft.azurecr.io" --app_id "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" --app-key "password" -``` - -## Questions/Comments? azdevopspub@microsoft.com \ No newline at end of file diff --git a/spinnaker/configure_k8s/configure_k8s.sh b/spinnaker/configure_k8s/configure_k8s.sh deleted file mode 100644 index 140dc6e..0000000 --- a/spinnaker/configure_k8s/configure_k8s.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash - -function print_usage() { - cat <&2 - print_usage - exit -1 - fi -} - -function run_util_script() { - local script_path="$1" - shift - curl --silent "${artifacts_location}${script_path}${artifacts_location_sas_token}" | sudo bash -s -- "$@" - local return_value=$? - if [ $return_value -ne 0 ]; then - >&2 echo "Failed while executing script '$script_path'." - exit $return_value - fi -} - -# Set defaults -artifacts_location="https://raw.githubusercontent.com/Azure/azure-devops-utils/master/" - -while [[ $# > 0 ]] -do - key="$1" - shift - case $key in - --registry|-rg) - registry="$1" - # Remove http prefix and trailing slash from registry if they exist - registry=${registry#"https://"} - registry=${registry#"http://"} - registry=${registry%"/"} - shift - ;; - --app_id|-ai) - app_id="$1" - shift - ;; - --app_key|-ak) - app_key="$1" - shift - ;; - --repository|-rp) - repository="$1" - shift - ;; - --artifacts_location|-al) - artifacts_location="$1" - shift - ;; - --sas_token|-st) - artifacts_location_sas_token="$1" - shift - ;; - --help|-help|-h) - print_usage - exit 13 - ;; - *) - echo "ERROR: Unknown argument '$key' to script '$0'" 1>&2 - exit -1 - esac -done - -throw_if_empty --registry $registry -throw_if_empty --app_id $app_id -throw_if_empty --app_key $app_key - -spinnaker_config_dir="/opt/spinnaker/config/" -clouddriver_config_file="${spinnaker_config_dir}clouddriver-local.yml" -igor_config_file="${spinnaker_config_dir}igor-local.yml" - -# Configure Spinnaker for Docker Hub and Azure Container Registry -sudo touch "$clouddriver_config_file" -sudo cat <"$clouddriver_config_file" -kubernetes: - enabled: true - accounts: - - name: my-kubernetes-account - dockerRegistries: - - accountName: docker-hub-registry - - accountName: azure-container-registry - -dockerRegistry: - enabled: true - accounts: - - name: docker-hub-registry - address: https://index.docker.io/ - repositories: - - REPLACE_REPOSITORY - - library/nginx - - library/redis - - library/ubuntu - - name: azure-container-registry - address: https://REPLACE_ACR_REGISTRY/ - username: REPLACE_ACR_USERNAME - password: REPLACE_ACR_PASSWORD -EOF - -sudo sed -i "s|REPLACE_ACR_REGISTRY|${registry}|" $clouddriver_config_file -sudo sed -i "s|REPLACE_ACR_USERNAME|${app_id}|" $clouddriver_config_file -sudo sed -i "s|REPLACE_ACR_PASSWORD|${app_key}|" $clouddriver_config_file - -# Replace docker repository in config if specified -if [ -n "$repository" ]; then - sudo sed -i "s|REPLACE_REPOSITORY|${repository}|" $clouddriver_config_file -else - # Otherwise delete the line - sudo sed -i "/REPLACE_REPOSITORY/d" $clouddriver_config_file -fi - -# Enable docker registry in Igor so that docker triggers work -sudo touch "$igor_config_file" -sudo cat <"$igor_config_file" -dockerRegistry: - enabled: true -EOF - -# Restart services so that config changes take effect -run_util_script "spinnaker/await_restart_service/await_restart_service.sh" --service clouddriver -run_util_script "spinnaker/await_restart_service/await_restart_service.sh" --service igor \ No newline at end of file diff --git a/spinnaker/configure_vmss/README.md b/spinnaker/configure_vmss/README.md deleted file mode 100644 index bdf8ef7..0000000 --- a/spinnaker/configure_vmss/README.md +++ /dev/null @@ -1,30 +0,0 @@ -# Configure Spinnaker for VM Scale Sets - -Automatically configure a Spinnaker instance to target VM Scale Sets and a Jenkins instance hosting an Aptly repository. This script assumes Aptly is running on the Jenkins instance and is already setup. - -## Prerequisites -This must be executed on a machine with an existing Spinnaker instance. - -## Arguments -| Name | Description | -|---|---| -| --app_id
-ai | The Service Principal app id used by Spinnaker to dynamically manage resources. | -| --app_key
-ak | The Service Principal app key used by Spinnaker to dynamically manage resources. | -| --tenant_id
-ti | Tenant id for your subscription. | -| --subscription_id
-si | Subscription id. | -| --resource_group
-rg | Resource group containing your key vault and packer storage account. | -| --vault_name
-vn | Vault used to store default Username/Password for deployed VMSS. | -| --packer_storage_account
-psa | Storage account used for baked images. | -| --jenkins_username
-ju | Username that Spinnaker will use to communicate with Jenkins. | -| --jenkins_password
-jp | Password that Spinnaker will use to communicate with Jenkins. | -| --vm_fqdn
-vf | FQDN for the jenkins VM hosting the Aptly repository. | -| --region
-r | (optional) Region for VMSS created by Spinnaker, defaulted to westus. | -| --artifacts_location
-al | (optional) The url for referencing other scripts/artifacts. The default is this github repository. | -| --sas_token
-st | (optional) A sas token needed if the artifacts location is private. | - -## Example usage -```bash -./configure_vmss.sh --app_id "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" --app_key "password" --tenant_id "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" --subscription_id "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" --resource-group "devopsgroup" --vault_name "devopsVault" --packer_storage_account "packerStorage" --jenkins_username "jenkins" --jenkins_password "password" --vm_fqdn "devops.westus.cloudapp.azure.com" -``` - -## Questions/Comments? azdevopspub@microsoft.com diff --git a/spinnaker/configure_vmss/configure_vmss.sh b/spinnaker/configure_vmss/configure_vmss.sh deleted file mode 100644 index 7783ab2..0000000 --- a/spinnaker/configure_vmss/configure_vmss.sh +++ /dev/null @@ -1,187 +0,0 @@ -#!/bin/bash - -function print_usage() { - cat <&2 - print_usage - exit -1 - fi -} - -function run_util_script() { - local script_path="$1" - shift - curl --silent "${artifacts_location}${script_path}${artifacts_location_sas_token}" | sudo bash -s -- "$@" - local return_value=$? - if [ $return_value -ne 0 ]; then - >&2 echo "Failed while executing script '$script_path'." - exit $return_value - fi -} - -# Set defaults -artifacts_location="https://raw.githubusercontent.com/Azure/azure-devops-utils/master/" -region="westus" - -while [[ $# > 0 ]] -do - key="$1" - shift - case $key in - --app_id|-ai) - app_id="$1";; - --app_key|-ak) - app_key="$1";; - --tenant_id|-ti) - tenant_id="$1";; - --subscription_id|-si) - subscription_id="$1";; - --resource_group|-rg) - resource_group="$1";; - --vault_name|-vn) - vault_name="$1";; - --packer_storage_account|-psa) - packer_storage_account="$1";; - --jenkins_username|-ju) - jenkins_username="$1";; - --jenkins_password|-jp) - jenkins_password="$1";; - --vm_fqdn|-vf) - vm_fqdn="$1";; - --region|-r) - region="$1";; - --artifacts_location|-al) - artifacts_location="$1";; - --sas_token|-st) - artifacts_location_sas_token="$1";; - --help|-help|-h) - print_usage - exit 13;; - *) - echo "ERROR: Unknown argument '$key' to script '$0'" 1>&2 - exit -1 - esac - shift -done - -throw_if_empty app_id $app_id -throw_if_empty app_key $app_key -throw_if_empty tenant_id $tenant_id -throw_if_empty subscription_id $subscription_id -throw_if_empty resource_group $resource_group -throw_if_empty vault_name $vault_name -throw_if_empty packer_storage_account $packer_storage_account -throw_if_empty jenkins_username $jenkins_username -throw_if_empty jenkins_password $jenkins_password -throw_if_empty vm_fqdn $vm_fqdn -throw_if_empty region $region - -spinnaker_config_dir="/opt/spinnaker/config/" - -# Configure cloudddriver -clouddriver_config_file="${spinnaker_config_dir}clouddriver-local.yml" -sudo touch "$clouddriver_config_file" -sudo cat <"$clouddriver_config_file" -azure: - enabled: true - accounts: - - name: my-azure-account - clientId: APP_ID - appKey: APP_KEY - tenantId: TENANT_ID - subscriptionId: SUBSCRIPTION_ID - defaultResourceGroup: RESOURCE_GROUP - defaultKeyVault: VAULT_NAME -EOF -sudo sed -i "s|APP_ID|${app_id}|" $clouddriver_config_file -sudo sed -i "s|APP_KEY|${app_key}|" $clouddriver_config_file -sudo sed -i "s|TENANT_ID|${tenant_id}|" $clouddriver_config_file -sudo sed -i "s|SUBSCRIPTION_ID|${subscription_id}|" $clouddriver_config_file -sudo sed -i "s|RESOURCE_GROUP|${resource_group}|" $clouddriver_config_file -sudo sed -i "s|VAULT_NAME|${vault_name}|" $clouddriver_config_file - -# Configure rosco -rosco_config_file="${spinnaker_config_dir}rosco-local.yml" -sudo touch "$rosco_config_file" -sudo cat <"$rosco_config_file" -debianRepository: http://ppa.launchpad.net/openjdk-r/ppa/ubuntu trusty main;http://VM_FQDN:9999 trusty main -defaultCloudProviderType: azure -azure: - enabled: true - accounts: - - name: my-azure-account - clientId: APP_ID - appKey: APP_KEY - tenantId: TENANT_ID - subscriptionId: SUBSCRIPTION_ID - objectId: - packerResourceGroup: PACKER_RESOURCE_GROUP - packerStorageAccount: PACKER_STORAGE_ACCOUNT -EOF -sudo sed -i "s|VM_FQDN|${vm_fqdn}|" $rosco_config_file -sudo sed -i "s|APP_ID|${app_id}|" $rosco_config_file -sudo sed -i "s|APP_KEY|${app_key}|" $rosco_config_file -sudo sed -i "s|TENANT_ID|${tenant_id}|" $rosco_config_file -sudo sed -i "s|SUBSCRIPTION_ID|${subscription_id}|" $rosco_config_file -sudo sed -i "s|PACKER_RESOURCE_GROUP|${resource_group}|" $rosco_config_file -sudo sed -i "s|PACKER_STORAGE_ACCOUNT|${packer_storage_account}|" $rosco_config_file - -# Configure igor -igor_config_file="${spinnaker_config_dir}igor-local.yml" -sudo touch "$igor_config_file" -sudo cat <"$igor_config_file" -jenkins: - enabled: true - masters: - - name: Jenkins - address: http://localhost:8080 - username: JENKINS_USERNAME - password: JENKINS_PASSWORD -EOF -sudo sed -i "s|JENKINS_USERNAME|${jenkins_username}|" $igor_config_file -sudo sed -i "s|JENKINS_PASSWORD|${jenkins_password}|" $igor_config_file - -# Configure gate -gate_config_file="${spinnaker_config_dir}gate-local.yml" -sudo touch "$gate_config_file" -sudo cat <"$gate_config_file" -services: - igor: - enabled: true -EOF - -# Set Azure environment variables -spinnaker_env_vars="/etc/default/spinnaker" -sudo sed -i "s|SPINNAKER_AZURE_ENABLED=false|SPINNAKER_AZURE_ENABLED=true|" $spinnaker_env_vars -sudo sed -i "s|SPINNAKER_AZURE_DEFAULT_REGION=westus|SPINNAKER_AZURE_DEFAULT_REGION=$region|" $spinnaker_env_vars -sudo /opt/spinnaker/bin/reconfigure_spinnaker.sh - -# Restart services -run_util_script "spinnaker/await_restart_service/await_restart_service.sh" --service clouddriver -run_util_script "spinnaker/await_restart_service/await_restart_service.sh" --service rosco -run_util_script "spinnaker/await_restart_service/await_restart_service.sh" --service igor -run_util_script "spinnaker/await_restart_service/await_restart_service.sh" --service gate \ No newline at end of file diff --git a/spinnaker/copy_kube_config/copy_kube_config.sh b/spinnaker/copy_kube_config/copy_kube_config.sh index 38a6451..f7fde5f 100644 --- a/spinnaker/copy_kube_config/copy_kube_config.sh +++ b/spinnaker/copy_kube_config/copy_kube_config.sh @@ -55,7 +55,7 @@ throw_if_empty --user-name $admin_user_name throw_if_empty --resource_group $resource_group throw_if_empty --master_fqdn $master_fqdn -destination_file="/home/spinnaker/.kube/config" +config_path="/home/$admin_user_name/.kube/config" # Setup temporary credentials to access kubernetes master vms temp_user_name=$(uuidgen | sed 's/-//g') @@ -70,8 +70,8 @@ master_vm_ids=$(az vm list -g "$resource_group" --query "[].id" -o tsv | grep "k az vm user update -u "$temp_user_name" --ssh-key-value "$temp_pub_key" --ids "$master_vm_ids" # Copy kube config over from master kubernetes cluster and mark readable -sudo mkdir -p $(dirname "$destination_file") -sudo sh -c "ssh -o StrictHostKeyChecking=no -i \"$temp_key_path\" $temp_user_name@$master_fqdn sudo cat /home/$admin_user_name/.kube/config > \"$destination_file\"" +sudo mkdir -p $(dirname "$config_path") +sudo sh -c "ssh -o StrictHostKeyChecking=no -i \"$temp_key_path\" $temp_user_name@$master_fqdn sudo cat \"$config_path\" > \"$config_path\"" # Remove temporary credentials on every kubernetes master vm az vm user delete -u "$temp_user_name" --ids "$master_vm_ids" @@ -80,9 +80,9 @@ az vm user delete -u "$temp_user_name" --ids "$master_vm_ids" rm $temp_key_path rm ${temp_key_path}.pub -if [ ! -s "$destination_file" ]; then +if [ ! -s "$config_path" ]; then >&2 echo "Failed to copy kubeconfig for kubernetes cluster." exit -1 fi -sudo chmod +r "$destination_file" \ No newline at end of file +sudo chmod +r "$config_path" \ No newline at end of file diff --git a/spinnaker/install_spinnaker/README.md b/spinnaker/install_halyard/README.md similarity index 57% rename from spinnaker/install_spinnaker/README.md rename to spinnaker/install_halyard/README.md index d7200ec..f1677d5 100644 --- a/spinnaker/install_spinnaker/README.md +++ b/spinnaker/install_halyard/README.md @@ -1,17 +1,16 @@ # Install Spinnaker -Install Spinnaker and automatically configure it to use Azure Storage (azs) as its persistent storage. +Install Halyard and automatically configure Spinnaker to use Azure Storage (azs) as its persistent storage. ## Prerequisites -This must be executed on a linux VM. +This must be executed on a linux VM. You must run 'hal deploy apply' to finish deployment of Spinnaker. ## Arguments | Name | Description | |---|---| | --storage_account_name
-san | The storage account name used for Spinnaker's persistent storage service (front50). | | --storage_account_key
-sak | The storage account key used for Spinnaker's persistent storage service (front50). | -| --artifacts_location
-al | (optional) The url for referencing other scripts/artifacts. The default is this github repository. | -| --sas_token
-st | (optional) A sas token needed if the artifacts location is private. | +| --username
-u | User for which to install Halyard. | ## Example usage ```bash diff --git a/spinnaker/install_halyard/install_halyard.sh b/spinnaker/install_halyard/install_halyard.sh new file mode 100644 index 0000000..7417775 --- /dev/null +++ b/spinnaker/install_halyard/install_halyard.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +function print_usage() { + cat <&2 + print_usage + exit -1 + fi +} + +while [[ $# > 0 ]] +do + key="$1" + shift + case $key in + --storage_account_name|-san) + storage_account_name="$1";; + --storage_account_key|-sak) + storage_account_key="$1";; + --username|-u) + username="$1";; + --help|-help|-h) + print_usage + exit 13;; + *) + echo "ERROR: Unknown argument '$key' to script '$0'" 1>&2 + exit -1 + esac + shift +done + +throw_if_empty storage_account_name $storage_account_name +throw_if_empty storage_account_key $storage_account_key +throw_if_empty username $username + +# Install Halyard +curl --silent "https://raw.githubusercontent.com/spinnaker/halyard/master/install/stable/InstallHalyard.sh" | sudo bash -s -- --user "$username" -y + +# Set Halyard to use the latest released/validated version of Spinnaker +hal config version edit --version $(hal version latest -q) + +# Configure Spinnaker persistent store +hal config storage azs edit --storage-account-name "$storage_account_name" --storage-account-key "$storage_account_key" +hal config storage edit --type azs \ No newline at end of file diff --git a/spinnaker/install_spinnaker/install_spinnaker.sh b/spinnaker/install_spinnaker/install_spinnaker.sh deleted file mode 100644 index 4bd2ca7..0000000 --- a/spinnaker/install_spinnaker/install_spinnaker.sh +++ /dev/null @@ -1,96 +0,0 @@ -#!/bin/bash - -function print_usage() { - cat <&2 - print_usage - exit -1 - fi -} - -function run_util_script() { - local script_path="$1" - shift - curl --silent "${artifacts_location}${script_path}${artifacts_location_sas_token}" | sudo bash -s -- "$@" - local return_value=$? - if [ $return_value -ne 0 ]; then - >&2 echo "Failed while executing script '$script_path'." - exit $return_value - fi -} - -#Set defaults -artifacts_location="https://raw.githubusercontent.com/Azure/azure-devops-utils/master/" - -while [[ $# > 0 ]] -do - key="$1" - shift - case $key in - --storage_account_name|-san) - storage_account_name="$1" - shift - ;; - --storage_account_key|-sak) - storage_account_key="$1" - shift - ;; - --artifacts_location|-al) - artifacts_location="$1" - shift - ;; - --sas_token|-st) - artifacts_location_sas_token="$1" - shift - ;; - --help|-help|-h) - print_usage - exit 13 - ;; - *) - echo "ERROR: Unknown argument '$key' to script '$0'" 1>&2 - exit -1 - esac -done - -throw_if_empty --storage_account_name $storage_account_name -throw_if_empty --storage_account_key $storage_account_key - -#Install Spinnaker -curl --silent https://raw.githubusercontent.com/spinnaker/spinnaker/master/InstallSpinnaker.sh | sudo bash -s -- --quiet --noinstall_cassandra - -# The install script sometimes fails to start spinnaker, so start it here -sudo service spinnaker start - -# Disable all storage methods for front50 except for azs -sudo /opt/spinnaker/install/change_cassandra.sh --echo=inMemory --front50=azs - -front50_config_file="/opt/spinnaker/config/front50-local.yml" -sudo touch "$front50_config_file" -sudo cat <"$front50_config_file" -spinnaker: - azs: - enabled: true - storageAccountName: REPLACE_STORAGE_ACCOUNT_NAME - storageAccountKey: REPLACE_STORAGE_ACCOUNT_KEY -EOF - -sudo sed -i "s|REPLACE_STORAGE_ACCOUNT_NAME|${storage_account_name}|" $front50_config_file -sudo sed -i "s|REPLACE_STORAGE_ACCOUNT_KEY|${storage_account_key}|" $front50_config_file - -# Restart front50 so that config changes take effect -run_util_script "spinnaker/await_restart_service/await_restart_service.sh" --service front50 \ No newline at end of file