Skip to content

Commit

Permalink
Update Spinnaker templates to use Halyard
Browse files Browse the repository at this point in the history
1. Simplify the config by using Halyard
2. Deploy spinnaker _to_ the k8s cluster rather than the VM
3. Deprecate the 201 template
  • Loading branch information
ejizba committed Jun 16, 2017
1 parent d1d8606 commit 6c60872
Show file tree
Hide file tree
Showing 16 changed files with 327 additions and 866 deletions.
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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? [email protected]

Expand Down
77 changes: 77 additions & 0 deletions quickstart_template/101-spinnaker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/bin/bash

function print_usage() {
cat <<EOF
Command
$0
Arguments
--storage_account_name|-san [Required] : Storage Account name used for Spinnaker's persistent storage
--storage_account_key|-sak [Required] : Storage Account key used for Spinnaker's persistent storage
--username|-u [Required] : User for which to install Halyard
--artifacts_location|-al : Url used to reference other scripts/artifacts.
--sas_token|-st : A sas token needed if the artifacts location is private.
EOF
}

function throw_if_empty() {
local name="$1"
local value="$2"
if [ -z "$value" ]; then
echo "Parameter '$name' cannot be empty." 1>&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
232 changes: 0 additions & 232 deletions quickstart_template/201-spinnaker-acr-k8s.sh

This file was deleted.

Loading

0 comments on commit 6c60872

Please sign in to comment.