-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deploys, requires genesis cf deployment to integrate with. A couple of smoke tests aren't working, but it may be a security group issue
- Loading branch information
1 parent
0ad5c3b
commit 6266d51
Showing
8 changed files
with
340 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#!/bin/bash | ||
set -u | ||
#Version check | ||
min_version="2.7.8-rc1" | ||
genesis_version="$(genesis -v 2>&1 | grep '^Genesis v' | sed -e 's/Genesis v\(.*\) (.*$/\1/')" | ||
if ! [[ "$genesis_version" =~ -dev$ ]] && ! new_enough "$genesis_version" "$min_version" ; then | ||
describe >&2 "" "#R{[ERROR]} This kit needs Genesis $min_version. Please upgrade before continuing" "" | ||
exit 1 | ||
fi | ||
set -e | ||
|
||
list() { | ||
describe "" "$(cat <<EOF | ||
The following addons are defined: | ||
#G{bind-autoscaler} Binds the Autoscaler service broker to your | ||
deployed CF. | ||
EOF | ||
)" | ||
} | ||
|
||
cf_login() { | ||
cf_deployment_env="$(exodus cf_deployment_env)" | ||
cf_deployment_type="$(exodus cf_deployment_type)" | ||
cf_exodus="${GENESIS_EXODUS_MOUNT}${cf_deployment_env}/${cf_deployment_type}" | ||
if ! cf plugins | grep -q '^cf-targets'; then | ||
describe "#Y{The cf-targets plugin does not seem to be installed}" | ||
echo "Install it first, via 'genesis do $GENESIS_ENVIRONMENT -- setup-cli'" | ||
echo "from your $cf_deployment_env environment in your CF deployment repo." | ||
exit 1 | ||
fi | ||
|
||
system_domain="$(safe get "${cf_exodus}:system_domain")" | ||
api_url=https://api.$system_domain | ||
username="$(safe get "${cf_exodus}:admin_username")" | ||
password="$(safe get "${cf_exodus}:admin_password")" | ||
|
||
#TODO enfoce ssl validation | ||
cf api "$api_url" --skip-ssl-validation | ||
cf auth "$username" "$password" | ||
cf save-target -f "$cf_deployment_env" | ||
echo ; echo | ||
cf target | ||
} | ||
|
||
|
||
bind_autoscaler() { | ||
cf_login | ||
username="$(exodus service_broker_username)" | ||
password="$(exodus service_broker_password)" | ||
domain=$(exodus service_broker_domain) | ||
url="https://$domain" | ||
cf create-service-broker autoscaler "$username" "$password" "$url" | ||
cf enable-service-access autoscaler | ||
echo "Successfully created the service broker." | ||
exit 0 | ||
} | ||
|
||
|
||
case $GENESIS_ADDON_SCRIPT in | ||
list) | ||
list | ||
exit 0 | ||
;; | ||
|
||
bind-autoscaler) | ||
bind_autoscaler | ||
exit 0 | ||
;; | ||
esac | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/bin/bash | ||
set -u | ||
#Version check | ||
min_version="2.7.0" | ||
genesis_version="$(genesis -v 2>&1 | grep '^Genesis v' | sed -e 's/Genesis v\(.*\) (.*$/\1/')" | ||
if ! [[ "$genesis_version" =~ -dev$ ]] && ! new_enough "$genesis_version" "$min_version" ; then | ||
describe >&2 "" "#R{[ERROR]} This kit needs Genesis $min_version. Please upgrade before continuing" "" | ||
exit 1 | ||
fi | ||
set -e | ||
|
||
cc_ok=yes | ||
# Cloud Config checks | ||
if [[ -n "$GENESIS_CLOUD_CONFIG" ]] ; then | ||
for t in minimal small; do | ||
cloud_config_needs vm_type "$t" | ||
done | ||
|
||
# Check if there were any errors reported from the above checks. | ||
if check_cloud_config ; then | ||
describe " cloud config [#G{OK}]" | ||
else | ||
describe " cloud config [#R{FAILED}]" | ||
cc_ok=no | ||
fi | ||
fi | ||
|
||
|
||
# Runtime config checks | ||
runtime_ok=yes | ||
|
||
# Check for BOSH DNS | ||
if [[ $(bosh rc | spruce json | jq -r '.addons[] | select(.name == "bosh-dns")') == "" ]]; then | ||
runtime_ok=no | ||
describe " #R{Errors were found} in your runtime-config:" | ||
describe " - #R{BOSH DNS is not in the runtime-config, which is required. Refer to}" | ||
describe " #R{'genesis man $GENESIS_ENVIRONMENT' for more info.}" | ||
describe "" | ||
fi | ||
|
||
# Check if there were any errors reported from runtime config checks | ||
if [[ "$runtime_ok" == "yes" ]]; then | ||
describe " runtime config [#G{OK}]" | ||
else | ||
describe " runtime config [#R{FAILED}]" | ||
fi | ||
|
||
env_ok=yes | ||
# Environment Parameter checks - none yet! | ||
|
||
if [[ "$env_ok" == "yes" ]]; then | ||
describe " environment files [#G{OK}]" | ||
else | ||
describe " environment files [#R{FAILED}]" | ||
fi | ||
|
||
if [[ "$env_ok" == "no" || "$cc_ok" == "no" || "$runtime_ok" == no ]] ; then | ||
exit 1 | ||
fi | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,39 @@ | ||
--- | ||
meta: | ||
cf: | ||
bosh: (( grab params.cf-bosh || params.bosh || genesis.env )) | ||
env: (( grab params.cf-env || genesis.env )) | ||
exodus: (( concat $GENESIS_EXODUS_MOUNT params.cf_deployment_env "/" params.cf_deployment_type )) | ||
deployment_name: (( concat params.cf_deployment_env "-" params.cf_deployment_type )) | ||
|
||
params: | ||
cf_system_domain: (( param "Please specify the CF system domain in params.cf_system_domain" )) | ||
bosh-variables: | ||
cf_client_id: app_autoscaler_client | ||
cf_client_secret: (( concat "((/" meta.cf.bosh "-bosh/" meta.cf.env "-cf/uaa_clients_app_autoscaler_client_secret))" )) | ||
system_domain: (( grab params.cf_system_domain )) | ||
skip_ssl_validation: (( grab params.skip_ssl_validation || "true" )) | ||
network: (( grab params.cf_core_network )) | ||
cf_deployment_env: (( grab genesis.env )) # assumes same name as cf env | ||
cf_deployment_type: cf # for crazy people using an "non-cf" cf deployment named something else | ||
cf_core_network: (( vault meta.cf.exodus ":core_network" )) | ||
cf_system_domain: (( vault meta.cf.exodus ":system_domain" )) | ||
|
||
bosh-variables: | ||
system_domain: (( grab params.cf_system_domain )) | ||
cf_client_id: (( vault meta.cf.exodus ":app_autoscaler_client" )) | ||
cf_client_secret: (( vault meta.cf.exodus ":app_autoscaler_secret" )) | ||
loggregator_ca: | ||
certificate: (( vault meta.cf.exodus ":loggregator_ca" )) | ||
loggregator_tls_agent: | ||
ca: (( grab bosh-variables.loggregator_ca.certificate )) | ||
certificate: (( vault meta.cf.exodus ":loggregator_tls_rlp_cert" )) | ||
private_key: (( vault meta.cf.exodus ":loggregator_tls_rlp_key" )) | ||
loggregator_tls_rlp: | ||
certificate: (( vault meta.cf.exodus ":loggregator_tls_agent_cert" )) | ||
private_key: (( vault meta.cf.exodus ":loggregator_tls_agent_key" )) | ||
|
||
skip_ssl_validation: (( grab params.skip_ssl_validation || "true" )) | ||
|
||
exodus: | ||
autoscaler_api_domain: (( concat "autoscaler." params.cf_system_domain )) | ||
autoscaler_metrics_domain: (( concat "autoscalermetrics." params.cf_system_domain )) | ||
service_broker_domain: (( concat "autoscalerservicebroker." params.cf_system_domain )) | ||
|
||
service_broker_username: autoscaler_service_broker_user | ||
service_broker_password: ((autoscaler_service_broker_password)) | ||
|
||
cf_deployment_env: (( grab params.cf_deployment_env )) | ||
cf_deployment_type: (( grab params.cf_deployment_type )) |
Oops, something went wrong.