Skip to content
This repository has been archived by the owner on Mar 24, 2022. It is now read-only.

Use internal db for PAS 2.3 #46

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions src/omg-cli/config/terraform_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"fmt"
"io/ioutil"
"path/filepath"
"strconv"
)

type TerraformConfigSchema struct {
Expand All @@ -34,14 +33,9 @@ type TerraformConfigSchema struct {

OpsManagerServiceAccountKey string

ExternalSqlIp string `json:"sql_db_ip"`
ExternalSqlPort int
OpsManagerSqlDbName string `json:"opsman_sql_db_name"`
OpsManagerSqlUsername string `json:"opsman_sql_username"`
OpsManagerSqlPassword string `json:"opsman_sql_password"`
ERTSqlDbName string `json:"ert_sql_db_name"`
ERTSqlUsername string `json:"ert_sql_username"`
ERTSqlPassword string `json:"ert_sql_password"`

MgmtSubnetName string `json:"management_subnet_name"`
MgmtSubnetGateway string `json:"management_subnet_gateway"`
Expand Down Expand Up @@ -135,14 +129,6 @@ func fromTerraform(filename string) (*Config, error) {
hydratedCfg.OpsManager.SkipSSLVerification = true
}

if val := flattened["sql_db_port"]; val != "" {
parsed, err := strconv.ParseInt(val, 10, 0)
if err != nil {
return nil, err
}
hydratedCfg.ExternalSqlPort = int(parsed)
}

hydratedCfg.OpsManagerServiceAccountKey = decode(flattened["ops_manager_service_account_key_base64"])
hydratedCfg.ServiceBrokerServiceAccountKey = decode(flattened["service_broker_service_account_key_base64"])
hydratedCfg.StackdriverNozzleServiceAccountKey = decode(flattened["stackdriver_service_account_key_base64"])
Expand Down
78 changes: 12 additions & 66 deletions src/omg-cli/omg/tiles/ert/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,42 +41,16 @@ type Properties struct {
// UAA
ServiceProviderCredentials tiles.OldCertificateValue `json:".uaa.service_provider_key_credentials"`

UaaDbChoice tiles.Value `json:".properties.uaa_database"`
UaaDbIp tiles.Value `json:".properties.uaa_database.external.host"`
UaaDbPort tiles.IntegerValue `json:".properties.uaa_database.external.port"`
UaaDbUsername tiles.Value `json:".properties.uaa_database.external.uaa_username"`
UaaDbPassword tiles.SecretValue `json:".properties.uaa_database.external.uaa_password"`
UaaDbChoice tiles.Value `json:".properties.uaa_database"`

// Databases
ErtDbChoice tiles.Value `json:".properties.system_database"`
ErtDbIp tiles.Value `json:".properties.system_database.external.host"`
ErtDbPort tiles.IntegerValue `json:".properties.system_database.external.port"`

ErtDbAppUsageUsername tiles.Value `json:".properties.system_database.external.app_usage_service_username"`
ErtDbAppUsagePassword tiles.SecretValue `json:".properties.system_database.external.app_usage_service_password"`
ErtDbAutoscaleUsername tiles.Value `json:".properties.system_database.external.autoscale_username"`
ErtDbAutoscalePassword tiles.SecretValue `json:".properties.system_database.external.autoscale_password"`
ErtDbCloudControllerUsername tiles.Value `json:".properties.system_database.external.ccdb_username"`
ErtDbCloudControllerPassword tiles.SecretValue `json:".properties.system_database.external.ccdb_password"`
ErtDbDiegoUsername tiles.Value `json:".properties.system_database.external.diego_username"`
ErtDbDiegoPassword tiles.SecretValue `json:".properties.system_database.external.diego_password"`
ErtDbLocketUsername tiles.Value `json:".properties.system_database.external.locket_username"`
ErtDbLocketPassword tiles.SecretValue `json:".properties.system_database.external.locket_password"`
ErtDbNetworkPolicyServerUsername tiles.Value `json:".properties.system_database.external.networkpolicyserver_username"`
ErtDbNetworkPolicyServerPassword tiles.SecretValue `json:".properties.system_database.external.networkpolicyserver_password"`
ErtDbNfsUsername tiles.Value `json:".properties.system_database.external.nfsvolume_username"`
ErtDbNfsPassword tiles.SecretValue `json:".properties.system_database.external.nfsvolume_password"`
ErtDbNotificationsUsername tiles.Value `json:".properties.system_database.external.notifications_username"`
ErtDbNotificationsPassword tiles.SecretValue `json:".properties.system_database.external.notifications_password"`
ErtDbAccountUsername tiles.Value `json:".properties.system_database.external.account_username"`
ErtDbAccountPassword tiles.SecretValue `json:".properties.system_database.external.account_password"`
ErtDbRoutingUsername tiles.Value `json:".properties.system_database.external.routing_username"`
ErtDbRoutingPassword tiles.SecretValue `json:".properties.system_database.external.routing_password"`
ErtDbSilkUsername tiles.Value `json:".properties.system_database.external.silk_username"`
ErtDbSilkPassword tiles.SecretValue `json:".properties.system_database.external.silk_password"`
ErtDbChoice tiles.Value `json:".properties.system_database"`

// MySQL
MySqlMonitorRecipientEmail tiles.Value `json:".mysql_monitor.recipient_email"`

// Credhub
CredhubDbChoice tiles.Value `json:".properties.credhub_database"`
}

type LargeFootprintResources struct {
Expand Down Expand Up @@ -155,37 +129,9 @@ func (*Tile) Configure(envConfig *config.EnvConfig, cfg *config.Config, om *ops_
SecurityAcknowledgement: tiles.Value{"X"},
ServiceProviderCredentials: tiles.OldCertificateValue{tiles.Certificate{cfg.SslCertificate, cfg.SslPrivateKey}},

UaaDbChoice: tiles.Value{"external"},
UaaDbIp: tiles.Value{cfg.ExternalSqlIp},
UaaDbPort: tiles.IntegerValue{cfg.ExternalSqlPort},
UaaDbUsername: tiles.Value{cfg.ERTSqlUsername},
UaaDbPassword: tiles.SecretValue{tiles.Secret{cfg.ERTSqlPassword}},

ErtDbChoice: tiles.Value{"external"},
ErtDbIp: tiles.Value{cfg.ExternalSqlIp},
ErtDbPort: tiles.IntegerValue{cfg.ExternalSqlPort},
ErtDbAppUsageUsername: tiles.Value{cfg.ERTSqlUsername},
ErtDbAppUsagePassword: tiles.SecretValue{tiles.Secret{cfg.ERTSqlPassword}},
ErtDbAutoscaleUsername: tiles.Value{cfg.ERTSqlUsername},
ErtDbAutoscalePassword: tiles.SecretValue{tiles.Secret{cfg.ERTSqlPassword}},
ErtDbCloudControllerUsername: tiles.Value{cfg.ERTSqlUsername},
ErtDbCloudControllerPassword: tiles.SecretValue{tiles.Secret{cfg.ERTSqlPassword}},
ErtDbDiegoUsername: tiles.Value{cfg.ERTSqlUsername},
ErtDbDiegoPassword: tiles.SecretValue{tiles.Secret{cfg.ERTSqlPassword}},
ErtDbLocketUsername: tiles.Value{cfg.ERTSqlUsername},
ErtDbLocketPassword: tiles.SecretValue{tiles.Secret{cfg.ERTSqlPassword}},
ErtDbNetworkPolicyServerUsername: tiles.Value{cfg.ERTSqlUsername},
ErtDbNetworkPolicyServerPassword: tiles.SecretValue{tiles.Secret{cfg.ERTSqlPassword}},
ErtDbNfsUsername: tiles.Value{cfg.ERTSqlUsername},
ErtDbNfsPassword: tiles.SecretValue{tiles.Secret{cfg.ERTSqlPassword}},
ErtDbNotificationsUsername: tiles.Value{cfg.ERTSqlUsername},
ErtDbNotificationsPassword: tiles.SecretValue{tiles.Secret{cfg.ERTSqlPassword}},
ErtDbAccountUsername: tiles.Value{cfg.ERTSqlUsername},
ErtDbAccountPassword: tiles.SecretValue{tiles.Secret{cfg.ERTSqlPassword}},
ErtDbRoutingUsername: tiles.Value{cfg.ERTSqlUsername},
ErtDbRoutingPassword: tiles.SecretValue{tiles.Secret{cfg.ERTSqlPassword}},
ErtDbSilkUsername: tiles.Value{cfg.ERTSqlUsername},
ErtDbSilkPassword: tiles.SecretValue{tiles.Secret{cfg.ERTSqlPassword}},
UaaDbChoice: tiles.Value{"internal_mysql"},
ErtDbChoice: tiles.Value{"internal_pxc"},
CredhubDbChoice: tiles.Value{"internal_mysql"},

MySqlMonitorRecipientEmail: tiles.Value{"admin@example.org"},
}
Expand Down Expand Up @@ -216,7 +162,7 @@ func (*Tile) Configure(envConfig *config.EnvConfig, cfg *config.Config, om *ops_
InternetConnected: false,
},
HaProxy: tiles.Resource{Instances: &zero},
MysqlMonitor: tiles.Resource{Instances: &zero},
MysqlMonitor: tiles.Resource{Instances: &one},
}
// Healthwatch pushes quite a few apps, make sure we have enough compute
if envConfig.IncludeHealthwatch {
Expand All @@ -241,9 +187,9 @@ func (*Tile) Configure(envConfig *config.EnvConfig, cfg *config.Config, om *ops_
InternetConnected: false,
},
HaProxy: tiles.Resource{Instances: &zero},
MysqlProxy: tiles.Resource{Instances: &zero},
Mysql: tiles.Resource{Instances: &zero},
MysqlMonitor: tiles.Resource{Instances: &zero},
MysqlProxy: tiles.Resource{Instances: &one},
Mysql: tiles.Resource{Instances: &one},
MysqlMonitor: tiles.Resource{Instances: &one},
}
resourcesBytes, err = json.Marshal(&resources)
}
Expand Down
103 changes: 0 additions & 103 deletions src/omg-tf/external_database/ert_database.tf

This file was deleted.

2 changes: 1 addition & 1 deletion src/omg-tf/external_database/opsman_database.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
resource "google_sql_database" "opsman" {
name = "${var.env_name}"
instance = "${google_sql_database_instance.master.name}"
depends_on = ["google_sql_database.nfsvolume"]
depends_on = []

count = "${var.count}"
}
17 changes: 0 additions & 17 deletions src/omg-tf/external_database/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ output "sql_db_port" {
value = "3306"
}

output "sql_db_ip" {
value = "${google_sql_database_instance.master.0.ip_address.0.ip_address}"
}

output "opsman_sql_db_name" {
value = "${google_sql_database.opsman.0.name}"
}
Expand All @@ -18,16 +14,3 @@ output "opsman_sql_password" {
sensitive = true
value = "${random_id.opsman_db_password.0.b64}"
}

output "ert_sql_username" {
value = "${random_id.ert_db_username.0.b64}"
}

output "ert_sql_password" {
sensitive = true
value = "${random_id.ert_db_password.0.b64}"
}

output "ip" {
value = "${google_sql_database_instance.master.0.ip_address.0.ip_address}"
}
17 changes: 0 additions & 17 deletions src/omg-tf/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,6 @@ output "network_name" {
value = "${google_compute_network.pcf-network.name}"
}

output "sql_db_ip" {
value = "${module.external_database.ip}"
}

output "sql_db_port" {
value = "${module.external_database.sql_db_port}"
}

output "management_subnet_gateway" {
value = "${google_compute_subnetwork.management-subnet.gateway_address}"
}
Expand Down Expand Up @@ -154,15 +146,6 @@ output "director_blobstore_bucket" {
value = "${google_storage_bucket.director.name}"
}

output "ert_sql_username" {
value = "${module.external_database.ert_sql_username}"
}

output "ert_sql_password" {
value = "${module.external_database.ert_sql_password}"
sensitive = true
}

output "opsman_sql_username" {
value = "${module.external_database.opsman_sql_username}"
}
Expand Down